Documentation
¶
Index ¶
- Constants
- Variables
- func RegisterCoroutinePlugin(plugin CoroutinePlugin)
- func RegisterOnMessagePlugin(plugin OnMessagePlugin)
- func RegisterSchedulerPlugin(plugin SchedulerPlugin)
- type AlwaysFireEventPlugin
- type AlwaysFireNextEventPlugin
- type AlwaysNotFireNextEventPlugin
- type CoroutinePlugin
- type MessageRequest
- type MessageResponse
- type NoInitPlugin
- type NoSortPlugin
- type OnMessagePlugin
- type PluginInfo
- type SchedulerPlugin
Constants ¶
View Source
const ( //GroupMessage 群消息 GroupMessage = messageType("group") //PrivateMessage 私聊消息 PrivateMessage = messageType("private") )
Variables ¶
View Source
var Crons = cron.New()
View Source
var GlobalCoroutinePlugins []CoroutinePlugin
CoroutinePluginPlugins 全局插件 {'id','plugin'}
View Source
var GlobalOnMessagePluginIDs []string
GlobalOnMessagePluginIDs 排序后的全局插件ID
View Source
var GlobalOnMessagePlugins = make(map[string]OnMessagePlugin)
GlobalOnMessagePlugins 全局插件 {'name','plugin'}
Functions ¶
func RegisterCoroutinePlugin ¶
func RegisterCoroutinePlugin(plugin CoroutinePlugin)
func RegisterOnMessagePlugin ¶
func RegisterOnMessagePlugin(plugin OnMessagePlugin)
RegisterOnMessagePlugin 注册消息插件
func RegisterSchedulerPlugin ¶
func RegisterSchedulerPlugin(plugin SchedulerPlugin)
RegisterSchedulerPlugin 注册消息插件
Types ¶
type AlwaysFireEventPlugin ¶
type AlwaysFireEventPlugin struct {
}
AlwaysFireEventPlugin 总是触发的插件
func (AlwaysFireEventPlugin) IsFireEvent ¶
func (p AlwaysFireEventPlugin) IsFireEvent(msg *MessageRequest) bool
IsFireEvent 简单插件初始化
type AlwaysFireNextEventPlugin ¶
type AlwaysFireNextEventPlugin struct {
}
AlwaysFireNextEventPlugin 总是触发下一个插件的插件
func (AlwaysFireNextEventPlugin) IsFireNextEvent ¶
func (p AlwaysFireNextEventPlugin) IsFireNextEvent(msg *MessageRequest) bool
IsFireNextEvent IsFireNextEvent
type AlwaysNotFireNextEventPlugin ¶
type AlwaysNotFireNextEventPlugin struct {
}
AlwaysNotFireNextEventPlugin 总是不触发下一个插件的插件
func (AlwaysNotFireNextEventPlugin) IsFireNextEvent ¶
func (p AlwaysNotFireNextEventPlugin) IsFireNextEvent(msg *MessageRequest) bool
IsFireNextEvent IsFireNextEvent
type CoroutinePlugin ¶
type CoroutinePlugin interface {
//Run 要执行的方法
Run(c *bot.Bot) error
// contains filtered or unexported methods
}
CoroutinePlugin 协程插件
type MessageRequest ¶
type MessageRequest struct {
MessageType messageType
ID int32
InternalID int32
GroupCode int64
GroupName string
Sender *message.Sender
Time int32
Elements []message.IMessageElement
OriginalObject *msg.Message
QQClient *client.QQClient
}
MessageRequest 消息请求
func NewMessageRequsetFromGroupMessage ¶
func NewMessageRequsetFromGroupMessage(msg *message.GroupMessage) *MessageRequest
NewMessageRequsetFromGroupMessage NewMessageRequsetFromGroupMessage
func NewMessageRequsetFromPrivateMessage ¶
func NewMessageRequsetFromPrivateMessage(msg *message.PrivateMessage) *MessageRequest
NewMessageRequsetFromPrivateMessage NewMessageRequsetFromPrivateMessage
type MessageResponse ¶
type MessageResponse struct {
Elements []message.IMessageElement
}
MessageResponse 消息事件返回对象
type OnMessagePlugin ¶
type OnMessagePlugin interface {
//IsFireEvent 是否触发事件
IsFireEvent(msg *MessageRequest) bool
//IsFireNextEvent 是否触发后续事件
IsFireNextEvent(msg *MessageRequest) bool
//OnMessage 监听消息
OnMessageEvent(msg *MessageRequest) (*MessageResponse, error)
// contains filtered or unexported methods
}
OnMessagePlugin 监听消息插件
type PluginInfo ¶
PluginInfo 插件的信息
Click to show internal directories.
Click to hide internal directories.