bot

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 9, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogTxHash = "tx_hash"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Bot

type Bot struct {
	// contains filtered or unexported fields
}

Bot represents the object that should be used to interact with Discord

func Create

func Create(cfg *types.BotConfig, testnet *network.Client, mainnet *network.Client) (*Bot, error)

Create allows to build a new Bot instance

func (*Bot) CheckCommandLimit

func (bot *Bot) CheckCommandLimit(userID disgord.Snowflake, command string) *time.Time

CheckCommandLimit returns the date on which the given user will be able to run the command again

func (*Bot) HandleConnect

func (bot *Bot) HandleConnect(s disgord.Session, data *disgord.MessageCreate) error

HandleConnect handle a connection request. This request is done by the users when they want to connect their Desmos profile with their Discord account. The command expects one single argument which must be the JSON object returned from the "desmos sign" command.

The handling of the command will fail in the following occasions: 1. The signed value does not correspond to the username of the user sending the message 2. Any of the values are badly encoded

func (*Bot) HandleDocs

func (bot *Bot) HandleDocs(s disgord.Session, data *disgord.MessageCreate) error

HandleDocs handles the the request for docs by the user

func (*Bot) HandleHelp

func (bot *Bot) HandleHelp(s disgord.Session, data *disgord.MessageCreate) error

HandleHelp handles the the request for help by the user

func (*Bot) HandleSendTokens

func (bot *Bot) HandleSendTokens(s disgord.Session, data *disgord.MessageCreate) error

HandleSendTokens handles the sending of tokens to a user that asks them

func (*Bot) HandleVerify

func (bot *Bot) HandleVerify(s disgord.Session, data *disgord.MessageCreate) error

HandleVerify handles a verification request. This request is done by the user who already has a Desmos profile that is connected to their Discord profile. With this request they can verify everything has been completed successfully and get the role they deserve inside the Discord channel. This command has no arguments.

func (*Bot) NewCmdHandler

func (bot *Bot) NewCmdHandler(cmdName string, handler types.CmdHandler) disgord.HandlerMessageCreate

NewCmdHandler returns a new command handler for the command that has the given name

func (*Bot) React

func (bot *Bot) React(msg *disgord.Message, s disgord.Session, emoji interface{}, flags ...disgord.Flag)

React allows to react with the provided emoji to the given message

func (*Bot) RefreshRoles added in v0.3.0

func (bot *Bot) RefreshRoles()

RefreshRoles iterates over all the members and cleans their roles

func (*Bot) Reply

func (bot *Bot) Reply(msg *disgord.Message, s disgord.Session, message string)

Reply sends a Discord message as a reply to the given msg

func (*Bot) SetCommandLimitation

func (bot *Bot) SetCommandLimitation(userID disgord.Snowflake, cmd string)

SetCommandLimitation sets the limitation for the given user for the provided command

func (*Bot) Start

func (bot *Bot) Start()

Start starts the bot so that it can listen to events properly

func (*Bot) Unreact

func (bot *Bot) Unreact(msg *disgord.Message, s disgord.Session, emoji interface{}, flags ...disgord.Flag)

Unreact allows to unreact with the provided emoji to the given message

type CallData

type CallData struct {
	// Username is the plain-text Discord username of the user that wants to be verified
	Username string `json:"username"`
}

func NewCallData

func NewCallData(username string) *CallData

NewCallData returns a new CallData instance

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL