Documentation ¶
Overview ¶
Package event 事件处理注册
Index ¶
- Variables
- func ParseAndHandle(payload *dto.WSPayload) error
- func ParseData(message []byte, target interface{}) error
- func RegisterHandler(opCode dto.OPCode, eventType dto.EventType, handler eventParseFunc)
- func RegisterHandlers(handlers ...interface{}) dto.Intent
- type ATMessageEventHandler
- type AudioEventHandler
- type C2CFriendEventHandler
- type C2CMessageEventHandler
- type ChannelEventHandler
- type DirectMessageDeleteEventHandler
- type DirectMessageEventHandler
- type EnterAIOEventHandler
- type ErrorNotifyHandler
- type ForumAuditEventHandler
- type GroupATMessageEventHandler
- type GuildEventHandler
- type GuildMemberEventHandler
- type InteractionEventHandler
- type MessageAuditEventHandler
- type MessageDeleteEventHandler
- type MessageEventHandler
- type MessageReactionEventHandler
- type PlainEventHandler
- type PostEventHandler
- type PublicMessageDeleteEventHandler
- type ReadyHandler
- type ReplyEventHandler
- type SubscribeMsgStatusEventHandler
- type ThreadEventHandler
Constants ¶
This section is empty.
Variables ¶
var DefaultHandlers struct { Ready ReadyHandler ErrorNotify ErrorNotifyHandler Plain PlainEventHandler Guild GuildEventHandler GuildMember GuildMemberEventHandler Channel ChannelEventHandler Message MessageEventHandler MessageReaction MessageReactionEventHandler ATMessage ATMessageEventHandler DirectMessage DirectMessageEventHandler MessageAudit MessageAuditEventHandler MessageDelete MessageDeleteEventHandler PublicMessageDelete PublicMessageDeleteEventHandler DirectMessageDelete DirectMessageDeleteEventHandler Audio AudioEventHandler Thread ThreadEventHandler Post PostEventHandler Reply ReplyEventHandler ForumAudit ForumAuditEventHandler Interaction InteractionEventHandler GroupATMessage GroupATMessageEventHandler C2CMessage C2CMessageEventHandler SubscribeMsgStatus SubscribeMsgStatusEventHandler C2CFriend C2CFriendEventHandler EnterAIO EnterAIOEventHandler }
DefaultHandlers 默认的 handler 结构,管理所有支持的 handler 类型
Functions ¶
func RegisterHandler ¶ added in v0.1.7
RegisterHandler 注册回调事件处理器
func RegisterHandlers ¶
RegisterHandlers 注册事件回调,并返回 intent 用于 websocket 的鉴权
Types ¶
type ATMessageEventHandler ¶
type ATMessageEventHandler func(event *dto.WSPayload, data *dto.WSATMessageData) error
ATMessageEventHandler at 机器人消息事件 handler
type AudioEventHandler ¶
type AudioEventHandler func(event *dto.WSPayload, data *dto.WSAudioData) error
AudioEventHandler 音频机器人事件 handler
type C2CFriendEventHandler ¶ added in v0.1.7
type C2CFriendEventHandler func(event *dto.WSPayload, data *dto.WSC2CFriendData) error
C2CFriendEventHandler C2C 好友事件 handler
type C2CMessageEventHandler ¶ added in v0.1.7
type C2CMessageEventHandler func(event *dto.WSPayload, data *dto.WSC2CMessageData) error
C2CMessageEventHandler 机器人消息事件 handler
type ChannelEventHandler ¶
type ChannelEventHandler func(event *dto.WSPayload, data *dto.WSChannelData) error
ChannelEventHandler 子频道事件 handler
type DirectMessageDeleteEventHandler ¶ added in v0.1.1
type DirectMessageDeleteEventHandler func(event *dto.WSPayload, data *dto.WSDirectMessageDeleteData) error
DirectMessageDeleteEventHandler 消息事件 handler
type DirectMessageEventHandler ¶
type DirectMessageEventHandler func(event *dto.WSPayload, data *dto.WSDirectMessageData) error
DirectMessageEventHandler 私信消息事件 handler
type EnterAIOEventHandler ¶ added in v0.1.7
type EnterAIOEventHandler func(event *dto.WSPayload, data *dto.WSEnterAIOData) error
EnterAIOEventHandler 进入AIO事件 handler
type ErrorNotifyHandler ¶
type ErrorNotifyHandler func(err error)
ErrorNotifyHandler 当 ws 连接发生错误的时候,会回调,方便使用方监控相关错误 比如 reconnect invalidSession 等错误,错误可以转换为 bot.Err
type ForumAuditEventHandler ¶
type ForumAuditEventHandler func(event *dto.WSPayload, data *dto.WSForumAuditData) error
ForumAuditEventHandler 论坛帖子审核事件 handler
type GroupATMessageEventHandler ¶ added in v0.1.7
type GroupATMessageEventHandler func(event *dto.WSPayload, data *dto.WSGroupATMessageData) error
GroupATMessageEventHandler 群中at机器人消息事件 handler
type GuildEventHandler ¶
type GuildEventHandler func(event *dto.WSPayload, data *dto.WSGuildData) error
GuildEventHandler 频道事件handler
type GuildMemberEventHandler ¶
type GuildMemberEventHandler func(event *dto.WSPayload, data *dto.WSGuildMemberData) error
GuildMemberEventHandler 频道成员事件 handler
type InteractionEventHandler ¶
type InteractionEventHandler func(event *dto.WSPayload, data *dto.WSInteractionData) error
InteractionEventHandler 互动事件 handler
type MessageAuditEventHandler ¶
type MessageAuditEventHandler func(event *dto.WSPayload, data *dto.WSMessageAuditData) error
MessageAuditEventHandler 消息审核事件 handler
type MessageDeleteEventHandler ¶ added in v0.1.1
type MessageDeleteEventHandler func(event *dto.WSPayload, data *dto.WSMessageDeleteData) error
MessageDeleteEventHandler 消息事件 handler
type MessageEventHandler ¶
type MessageEventHandler func(event *dto.WSPayload, data *dto.WSMessageData) error
MessageEventHandler 消息事件 handler
type MessageReactionEventHandler ¶
type MessageReactionEventHandler func(event *dto.WSPayload, data *dto.WSMessageReactionData) error
MessageReactionEventHandler 表情表态事件 handler
type PlainEventHandler ¶
PlainEventHandler 透传handler
type PostEventHandler ¶
type PostEventHandler func(event *dto.WSPayload, data *dto.WSPostData) error
PostEventHandler 论坛回帖事件 handler
type PublicMessageDeleteEventHandler ¶ added in v0.1.1
type PublicMessageDeleteEventHandler func(event *dto.WSPayload, data *dto.WSPublicMessageDeleteData) error
PublicMessageDeleteEventHandler 消息事件 handler
type ReadyHandler ¶
type ReadyHandler func(event *dto.WSPayload, data *dto.WSReadyData)
ReadyHandler 可以处理 ws 的 ready 事件
type ReplyEventHandler ¶
type ReplyEventHandler func(event *dto.WSPayload, data *dto.WSReplyData) error
ReplyEventHandler 论坛帖子回复事件 handler
type SubscribeMsgStatusEventHandler ¶ added in v0.1.7
type SubscribeMsgStatusEventHandler func(event *dto.WSPayload, data *dto.WSSubscribeMsgStatus) error
SubscribeMsgStatusEventHandler 订阅消息模板授权状态变更事件 handler
type ThreadEventHandler ¶
type ThreadEventHandler func(event *dto.WSPayload, data *dto.WSThreadData) error
ThreadEventHandler 论坛主题事件 handler