commands

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommandCheckIsAdmin added in v0.5.2

func CommandCheckIsAdmin(ListenerName string, AdminErrorMsg string, data events.EventSendMessage, _logger logger.LoggerInterface, _api *apis.ApiBase) bool

internal use

Types

type OnCommand

type OnCommand struct {
	Command []string // 可触发事件的指令列表,与正则 Regex 互斥,优先使用此项
	Regex   string   // 可触发指令的正则表达式,与指令表 Command 互斥

	Listener           events.BotListenerSendMessage           // 指令触发时的回调函数
	RequireAT          bool                                    // 是否要求必须@机器人才能触发指令
	RequireAdmin       bool                                    // 是否要求频道主或或管理才可触发指令
	RequirePermission  func(data events.EventSendMessage) bool // 一个自定义的指令权限判断函数,返回true表示允许触发指令
	AdminErrorMsg      string                                  // 当RequireAdmin,而触发用户的权限不足时,如此项不为空,返回此消息并短路;否则不进行短路
	PermissionErrorMsg string                                  // 当RequirePermission,而触发用户的权限不足时,如此项不为空,返回此消息并短路;否则不进行短路
	IsShortCircuit     bool                                    // 如果触发指令成功是否短路不运行后续指令(将根据注册顺序排序指令的短路机制)
	// contains filtered or unexported fields
}

func (*OnCommand) CheckCommand

func (p *OnCommand) CheckCommand(data events.EventSendMessage, _logger logger.LoggerInterface, _api *apis.ApiBase) bool

内部检查当前消息是否符合触发条件

func (*OnCommand) Equals

func (p *OnCommand) Equals(_p OnCommand) bool

type Preprocessor

type Preprocessor events.BotListenerSendMessage

Jump to

Keyboard shortcuts

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