message

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

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

func NewCommand

func NewCommand(opts ...CommandOption) *Command

func (*Command) Execute

func (mc *Command) Execute(ctx context.Context, sess bot.Session) error

func (*Command) HasPermission

func (mc *Command) HasPermission(p int) bool

func (*Command) Usage

func (mc *Command) Usage(ctx context.Context, s bot.Session) error

type CommandMap

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

func NewCommandMap

func NewCommandMap(opts ...CommandMapOption) *CommandMap

func (*CommandMap) BuildUsage

func (cm *CommandMap) BuildUsage(command string) string

func (*CommandMap) ExecuteCommand

func (cm *CommandMap) ExecuteCommand(ctx context.Context, s bot.Session) error

func (*CommandMap) SendUsage

func (cm *CommandMap) SendUsage(ctx context.Context, s bot.Session) error

type CommandMapOption

type CommandMapOption func(*CommandMap)

func WithMapCommand

func WithMapCommand(name string, c *Command) CommandMapOption

func WithMapScope

func WithMapScope(scope bool) CommandMapOption

type CommandOption

type CommandOption func(*Command)

func WithCommandArgs

func WithCommandArgs(a int) CommandOption

func WithCommandFn

func WithCommandFn(fn func(context.Context, *Session) error) CommandOption

func WithCommandPermissions

func WithCommandPermissions(p int) CommandOption

func WithCommandUsage

func WithCommandUsage(us string) CommandOption

type Session

type Session struct {
	Msg *discord.Message

	// Entire message
	Argv []string

	// Without command trigger
	Args []string

	// Prefix that triggered the command
	Prefix string

	// DB row for the origin guild
	Guild *modelsx.GuildWithPrefixes

	Bot bot.Client
	Tx  *sql.Tx
}

func NewMessageSession

func NewMessageSession(opts ...SessionOption) *Session

func (*Session) Client

func (ms *Session) Client() bot.Client

func (*Session) Reply

func (ms *Session) Reply(ctx context.Context, msg string) error

func (*Session) Replyf

func (ms *Session) Replyf(ctx context.Context, msg string, args ...interface{}) error

type SessionOption

type SessionOption func(s *Session)

func WithSessionClient

func WithSessionClient(b bot.Client) SessionOption

func WithSessionGuild

func WithSessionGuild(g *modelsx.GuildWithPrefixes) SessionOption

func WithSessionMessage

func WithSessionMessage(m *discord.Message) SessionOption

func WithSessionTx

func WithSessionTx(tx *sql.Tx) SessionOption

Jump to

Keyboard shortcuts

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