Git Product home page Git Product logo

revolt's Introduction

Go Reference Go Report Go Version License Revolt.go Version

Revolt.go

Revolt.go is a Go package for writing bots and self-bots for Revolt.

Features

  • Event listener.
  • Easy to use.
  • Support for self bots.
  • Simple caching system.

Getting Started

Installation

  • Create a new project and initiate the go.mod file. go mod init example
  • Install the package using go get github.com/ben-forster/revolt
  • Create your main bot file. touch main.go

API Reference

Click here for the library's API reference.

Official documentation will come in the near future.

Notice

Please note that you will need Go 1.21 to use this library.

This package is still under development and while you can create a working bot, the library is not finished. You can see a development roadmap here. Please create an issue if you would like to contribute.

Ping Pong Example (Bot)

package main

import (
    "os"
    "os/signal"
    "syscall"

    "github.com/ben-forster/revolt"
)

func main() {
    // Init a new client.
    client := revolt.Client{
        Token: "bot token",
    }

    // Listen a on message event.
    client.OnMessage(func(m *revolt.Message) {
        if m.Content == "!ping" {
            sendMsg := &revolt.SendMessage{}
            sendMsg.SetContent("๐Ÿ“ Pong!")

            m.Reply(true, sendMsg)
        }
    })

    // Start the client.
    client.Start()

    // Wait for close.
    sc := make(chan os.Signal, 1)

    signal.Notify(
        sc,
        syscall.SIGINT,
        syscall.SIGTERM,
        os.Interrupt,
    )
    <-sc

    // Destroy client.
    client.Destroy()
}

Ping Pong Example (Self-Bot)

package main

import (
    "os"
    "os/signal"
    "syscall"

    "github.com/ben-forster/revolt"
)

func main() {
    // Init a new client.
    client := revolt.Client{
        SelfBot: &revolt.SelfBot{
            Id:           "session id",
            SessionToken: "session token",
            UserId:       "user id",
        },
    }

    // Listen a on message event.
    client.OnMessage(func(m *revolt.Message) {
        if m.Content == "!ping" {
            sendMsg := &revolt.SendMessage{}
            sendMsg.SetContent("๐Ÿ“ Pong!")

            m.Reply(true, sendMsg)
        }
    })

    // Start the client.
    client.Start()

    // Wait for close.
    sc := make(chan os.Signal, 1)

    signal.Notify(
        sc,
        syscall.SIGINT,
        syscall.SIGTERM,
        os.Interrupt,
    )
    <-sc

    // Destroy client.
    client.Destroy()
}

Credit

This project is a mantained and re-worked version of 5elenay's library revoltgo.

revolt's People

Contributors

ben-forster avatar itzthemeow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

revolt's Issues

An entire command framework

  • Attributes
  • Command Text parsing
  • Permission Requirements
  • Command Context
  • Manipulation Ability from the Command Context

Events - Server To Client

  • Error
  • Authenticate
  • Pong
  • Ready
  • Message Create
  • Message Update
  • Message Delete
  • Channel Create
  • Channel Update
  • Channel Delete
  • Channel Group Join
  • Channel Group Leave
  • Channel Start Typing
  • Channel Stop Typing
  • Channel Ack
  • Server Create
  • Server Update
  • Server Deleted
  • Server Member Update
  • Server Member Join
  • Server Member Leave
  • Server Role Updated
  • Server Role Deleted
  • User Updated
  • User Relationship

Onboarding

  • Check Onboarding Status
  • Complete Onboarding

Groups

  • Create Group
  • Fetch Group Members
  • Add Group Member
  • Remove Group Member

Sync

  • Fetch Settings
  • Set Settings
  • Fetch Unreads

Authentication

  • Create Account
  • Resend Verification
  • User Login
  • Bot Login
  • Send Password Reset
  • Password Reset
  • Fetch Account
  • Check Auth
  • Change Password
  • Change Email
  • Delete Session
  • Fetch Sessions
  • Logout

Relationships

  • Fetch Relationships
  • Fetch Singular Relationship
  • Send / Accept Friend Request
  • Deny / Remove Friend Request / Friend
  • Block User
  • Unblock User

Invites

  • Fetch Invites
  • Join Invite
  • Delete Invite

Emojis

  • Fetch Emojis
  • Create Emoji
  • Delete Emoji

Server Information

  • Fetch Server
  • Edit Server
  • Delete / Leave Server
  • Create Server
  • Create Channel
  • Fetch Invites
  • Mark Server As Read

Logging

  • Logger class (Use Go's built-in log library)
  • Ability to define log levels
  • Default logging
  • Option to use custom logger

Interactions

  • Add Reactions
  • Remove Reaction
  • Remove All Reactions

Messaging

  • Send Message
  • Fetch Messages
  • Fetch Singular Message
  • Edit Message
  • Delete Message
  • Search Messages
  • Acknowledge Message

Core

  • Query Node (goquery)

Bots

  • Create Bot
  • Fetch Owned Bots
  • Edit Bot
  • Delete Bot
  • Fetch Public Bot
  • Invite Public Bot

Server Members

  • Fetch Singular Member
  • Edit Member
  • Kick Member
  • Fetch Members
  • Ban User
  • Unban User
  • Fetch Bans
  • Timeout User

Server Permissions

  • Set Role Permission
  • Set Default Permission
  • Create Role
  • Edit Role
  • Delete Role

User Information

  • Fetch User
  • Edit User
  • Change Username
  • Fetch User Profile
  • Fetch Default Avatar
  • Fetch Mutual Friends

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.