Help us shape the future of Go! Take the 2026 Go Developer Survey

context

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 30, 2025 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CommandContextTypeAddAdmin    = "ADDADMIN"
	CommandContextTypeRemoveAdmin = "REMOVEADMIN"
	CommandContextTypeShowAdmin   = "SHOWADMIN"
	CommandContextTypeDeleteAll   = "DELETEALL"
	CommandContextReconnect       = "RECONNECT"
	CommandContextTypeCal         = "SHOWCAL"
	CommandContextTypeCalLocal    = "SHOWCALLOCAL"
	CommandContextTypeHelper      = "HELP"
	CommandContextTypeHitokoto    = "ONEWORD"
	CommandContextTypeMusic       = "SEARCHMUSIC"
	CommandContextTypeRoll        = "ROLL"
	CommandContextTypePing        = "PING"
	CommandContextTypeUser        = "GETUSER"
	CommandContextTypeTryPanic    = "TRYPANIC"
	CommandContextTypeRestart     = "RESTART"
	CommandContextTypeDailyRate   = "RATE"
	CommandContextTypeGPT         = "GPT"
	CommandContextTypeNews        = "NEWS"
	CommandContextTypeNotify      = "NOTI"
)

const 长命令组

@param CommandContextTypeAddAdmin

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandCommonContext

type CommandCommonContext struct {
	TargetID string
	AuthorID string
	MsgID    string
}

CommandCommonContext is a context for command.

type CommandContext

type CommandContext struct {
	Common *CommandCommonContext
	Extra  *CommandExtraContext
	Ctx    context.Context
	// contains filtered or unexported fields
}

CommandContext is a context for command.

func GetNewCommandCtx

func GetNewCommandCtx() *CommandContext

GetNewCommandCtx is a function for command.

@return *CommandContext

func (*CommandContext) ContextHandler

func (ctx *CommandContext) ContextHandler(Command string, parameters ...string)

ContextHandler is a function for command.

@receiver ctx
@param Command
@param parameters

func (*CommandContext) ErrorSenderHandler

func (ctx *CommandContext) ErrorSenderHandler(err error)

ErrorSenderHandler is a function for command.

@receiver ctx
@param err

func (*CommandContext) ErrorSenderHandlerNew

func (ctx *CommandContext) ErrorSenderHandlerNew(ctxFunc interface{}, parameters ...string)

ErrorSenderHandlerNew is a function for command.

@receiver ctx
@param err

func (*CommandContext) Init

Init is a init function for command.

@receiver ctx

func (*CommandContext) InitContext

func (ctx *CommandContext) InitContext(baseCtx context.Context) *CommandContext

InitContext 1

@receiver ctx
@param baseCtx
@return *CommandContext

func (*CommandContext) InitExtra

func (ctx *CommandContext) InitExtra(khlCtx interface{}) *CommandContext

InitExtra is a init function for command.

@receiver ctx
@param khlCtx
@return *CommandContext

func (*CommandContext) IsAdmin

func (ctx *CommandContext) IsAdmin() bool

IsAdmin is a function for command.

@receiver ctx
@return bool

type CommandContextFunc

type CommandContextFunc func(ctx context.Context, TargetID, MsgID, AuthorID string, parameters ...string) error

CommandContextFunc is a function for command.

@param TargetID
@param MsgID
@param AuthorID
@param parameters
@return error

type CommandContextWithGuildIDFunc

type CommandContextWithGuildIDFunc func(ctx context.Context, targetID, quoteID, authorID string, guildID string, args ...string) error

CommandContextWithGuildIDFunc is a function for command.

@param targetID
@param quoteID
@param authorID
@param guildID
@param args
@return error

type CommandExtraContext

type CommandExtraContext struct {
	GuildID string
}

CommandExtraContext is a context for command.

Jump to

Keyboard shortcuts

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