discord

package
v0.0.0-...-f4937b0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2022 License: GPL-3.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bot

type Bot struct {
	Session *discordgo.Session
	Token   string `json:"token"`
	Version string
	Router  *Mux
	Regex   *Regex
}

func CreateBot

func CreateBot(token string) *Bot

func GetInstance

func GetInstance() *Bot

func (*Bot) GetUserRolesID

func (bot *Bot) GetUserRolesID(guildid string, userid string) *[]string

func (*Bot) InitRegex

func (b *Bot) InitRegex()

func (*Bot) OnMemberJoin

func (bot *Bot) OnMemberJoin(s *discordgo.Session, m *discordgo.GuildMemberAdd)

func (*Bot) OnMemberRemove

func (bot *Bot) OnMemberRemove(s *discordgo.Session, m *discordgo.GuildMemberRemove)

func (*Bot) OnMessageCreate

func (bot *Bot) OnMessageCreate(s *discordgo.Session, mc *discordgo.MessageCreate)

func (*Bot) OnMessageDelete

func (bot *Bot) OnMessageDelete(s *discordgo.Session, md *discordgo.MessageDelete)

func (*Bot) OnMessageUpdate

func (bot *Bot) OnMessageUpdate(s *discordgo.Session, m *discordgo.MessageUpdate)

func (*Bot) OnReactionAdd

func (bot *Bot) OnReactionAdd(s *discordgo.Session, ra *discordgo.MessageReactionAdd)

func (*Bot) OnReady

func (bot *Bot) OnReady(s *discordgo.Session, r *discordgo.Ready)

func (*Bot) Start

func (bot *Bot) Start()

type HandlerFunc

HandlerFunc is the function signature required for a message route handler.

type Mux

type Mux struct {
	Routes  []*Route
	Default *Route
}

Mux is the main struct for all mux methods.

func NewRouter

func NewRouter() *Mux

New returns a new Discord message route mux

func (*Mux) InitRouter

func (r *Mux) InitRouter()

func (*Mux) Match

func (m *Mux) Match(msg string) (*Route, []string, []string)

func (*Mux) Route

func (m *Mux) Route(pattern string, handler HandlerFunc) (*Route, error)

Route allows you to register a route

type Regex

type Regex struct {
	SelfMention *regexp.Regexp
}

type Route

type Route struct {
	Pattern     string      // match pattern that should trigger this route handler
	Description string      // short description of this route
	Help        string      // detailed help string for this route
	Run         HandlerFunc // route handler function to call
}

Route holds information about a specific message route handler

Jump to

Keyboard shortcuts

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