dcroute

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2023 License: MIT Imports: 11 Imported by: 0

README

dcroute

Discord router for quick bot development

Documentation

Index

Constants

View Source
const MessageAny = "_*"
View Source
const MessageNotFound = "_?"

Variables

This section is empty.

Functions

This section is empty.

Types

type ChannelType

type ChannelType int
const (
	ChannelTypeGuildText          ChannelType = 0
	ChannelTypeDM                 ChannelType = 1
	ChannelTypeGuildVoice         ChannelType = 2
	ChannelTypeGroupDM            ChannelType = 3
	ChannelTypeGuildCategory      ChannelType = 4
	ChannelTypeGuildNews          ChannelType = 5
	ChannelTypeGuildStore         ChannelType = 6
	ChannelTypeGuildNewsThread    ChannelType = 10
	ChannelTypeGuildPublicThread  ChannelType = 11
	ChannelTypeGuildPrivateThread ChannelType = 12
	ChannelTypeGuildStageVoice    ChannelType = 13
	ChannelTypeGuildForum         ChannelType = 15
)

type Command

type Command struct {
	Description string
	GuildID     string
}

type Context

type Context struct {
	Sender    *User
	MessageID string
	ChannelID string
	GuildID   string

	MessageCreate     *discordgo.MessageCreate
	InteractionCreate *discordgo.InteractionCreate
	// contains filtered or unexported fields
}

func (*Context) CommandRespond

func (c *Context) CommandRespond(response string)

func (*Context) RemoveReaction

func (c *Context) RemoveReaction(channelID string, messageID string, reaction string) error

func (*Context) Router

func (c *Context) Router() *Router

func (*Context) SendFile

func (c *Context) SendFile(channelID string, name string, filepath string) error

func (*Context) SendMessage

func (c *Context) SendMessage(channelID string, m string) error

func (*Context) SendReaction

func (c *Context) SendReaction(channelID string, messageID string, reaction string) error

func (*Context) SendReply

func (c *Context) SendReply(channelID string, messageID string, guildID string, m string) error

type CreateChannelArgs

type CreateChannelArgs struct {
	GuildID    string
	Name       string
	Topic      string
	CategoryID string
	Type       ChannelType
}

type Group

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

func (*Group) Command

func (g *Group) Command(name string, command Command, f HandlerFunc)

func (*Group) Message

func (g *Group) Message(name string, f HandlerFunc)

func (*Group) SetErrorFunc

func (g *Group) SetErrorFunc(f HandlerFunc)

func (*Group) Use

func (g *Group) Use(f MiddlewareFunc)

type HandlerFunc

type HandlerFunc func(ctx *Context) error

type MiddlewareFunc

type MiddlewareFunc func(ctx *Context) error

type Router

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

func New

func New(token string) *Router

func (*Router) CreateChannel

func (r *Router) CreateChannel(args CreateChannelArgs) (*discordgo.Channel, error)

func (*Router) CreateEmoji

func (r *Router) CreateEmoji(guildID string, name string, path string) (*discordgo.Emoji, error)

func (*Router) Group

func (r *Router) Group() *Group

func (*Router) Session

func (r *Router) Session() *discordgo.Session

func (*Router) SetErrorFunc

func (r *Router) SetErrorFunc(f HandlerFunc)

func (*Router) SetPrefix

func (r *Router) SetPrefix(prefix string)

func (*Router) Start

func (r *Router) Start() error

func (*Router) Wait

func (r *Router) Wait()

type User

type User struct {
	Username string
	ID       string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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