plugins

package
v0.4.12 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearPlugins

func ClearPlugins()

func FetchPlugins

func FetchPlugins() map[string]*Plugin

func RegisterPlugin

func RegisterPlugin(name string, context *Plugin)

注册插件到下一个Bot实例

Types

type AbstractBot added in v0.2.0

type AbstractBot struct {
	Api            *apis.ApiBase
	Logger         logger.LoggerInterface
	WaitForCommand func(reg models.WaitForCommandRegister) (*events.EventSendMessage, error)
}

用于为插件提供基础机器人功能的抽象类

type OnCommand

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

	Listener       plugin_msg_listener
	RequireAT      bool   // 是否要求必须@机器人才能触发指令
	RequireAdmin   bool   // 是否要求频道主或或管理才可触发指令
	AdminErrorMsg  string // 当RequireAT,而触发用户的权限不足时,如此项不为空,返回此消息并短路;否则不进行短路
	IsShortCircuit bool   // 如果触发指令成功是否短路不运行后续指令(将根据注册顺序排序指令的短路机制,且插件中的短路是否影响主程序会根据bot的is_plugins_short_circuit_affect_main决定)
	// contains filtered or unexported fields
}

func (*OnCommand) CheckCommand

func (p *OnCommand) CheckCommand(data events.EventSendMessage, abstract_bot *AbstractBot) bool

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

func (*OnCommand) Equals

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

type Plugin

type Plugin struct {
	IsEnable      bool
	Preprocessors []Preprocessor
	OnCommand     []OnCommand
}

type Preprocessor

type Preprocessor plugin_msg_listener

Jump to

Keyboard shortcuts

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