core

package
v0.0.0-...-abf6750 Latest Latest
Warning

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

Go to latest
Published: May 9, 2023 License: GPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	State *state.State
	Self  *discord.User

	Commands = make(map[string]*Command)
	Modules  = []*Module{}
)

Functions

func AddModule

func AddModule(module *Module)

func AddModules

func AddModules(modules ...*Module)

func Close

func Close()

func Connect

func Connect() error

func DeployCommands

func DeployCommands() error

func InteractionEvent

func InteractionEvent(e *gateway.InteractionCreateEvent)

func NewClient

func NewClient(token string)

Types

type Argument

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

func (*Argument) Bool

func (argument *Argument) Bool() bool

func (*Argument) String

func (argument *Argument) String() string

type BasicContext

type BasicContext struct {
	*sync.Mutex

	ChannelID discord.ChannelID
	GuildID   discord.GuildID
	State     *state.State
	// contains filtered or unexported fields
}

func NewBasicContext

func NewBasicContext(channelID discord.ChannelID, guildID discord.GuildID) *BasicContext

func (*BasicContext) Embed

func (ctx *BasicContext) Embed(embed *utils.Embed)

func (*BasicContext) File

func (ctx *BasicContext) File(file sendpart.File)

func (*BasicContext) Guild

func (ctx *BasicContext) Guild() (*discord.Guild, error)

func (*BasicContext) Send

func (ctx *BasicContext) Send(args ...interface{})

type Command

type Command struct {
	Name, Description   string
	Module              *Module
	Deferred            bool
	Type                discord.CommandType
	Options             discord.CommandOptions
	Handler             func(*CommandContext)
	AutoCompleteHandler func(*AutoCompleteContext) api.AutocompleteStringChoices
}

func (*Command) RAW

func (cmd *Command) RAW() api.CreateCommandData

type CommandContext

type CommandContext struct {
	*sync.Mutex
	*gateway.InteractionCreateEvent

	Data  *discord.CommandInteraction
	State *state.State
	// contains filtered or unexported fields
}

func (*CommandContext) Argument

func (ctx *CommandContext) Argument(index int) *Argument

func (*CommandContext) Edit

func (ctx *CommandContext) Edit(args ...interface{}) (msg *discord.Message, err error)

func (*CommandContext) Embed

func (ctx *CommandContext) Embed(eb *utils.Embed) *CommandContext

func (*CommandContext) Ephemeral

func (ctx *CommandContext) Ephemeral() *CommandContext

func (*CommandContext) File

func (ctx *CommandContext) File(file sendpart.File) *CommandContext

func (*CommandContext) Guild

func (ctx *CommandContext) Guild() *discord.Guild

func (*CommandContext) Reply

func (ctx *CommandContext) Reply(args ...interface{})

func (*CommandContext) Stacktrace

func (ctx *CommandContext) Stacktrace(err error)

func (*CommandContext) VoiceState

func (ctx *CommandContext) VoiceState() *discord.VoiceState

type Event

type Event struct {
	Handler interface{}
}

type Module

type Module struct {
	Name, Emote string

	Commands []*Command
	Events   []*Event

	OnInit, OnLogin func()
}

Jump to

Keyboard shortcuts

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