Documentation ¶
Index ¶
- Variables
- func ParseAndHandle(payload *dto.WSPayload) error
- func ParseData(message []byte, target interface{}) error
- func RegisterHandlers(handlers ...interface{}) dto.Intent
- type ATMessageEventHandler
- type AudioEventHandler
- type ChannelEventHandler
- type DirectMessageDeleteEventHandler
- type DirectMessageEventHandler
- type ErrorNotifyHandler
- type ForumAuditEventHandler
- 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 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 }
DefaultHandlers 默认的 handler 结构,管理所有支持的 handler 类型
Functions ¶
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 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 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 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 ThreadEventHandler ¶
type ThreadEventHandler func(event *dto.WSPayload, data *dto.WSThreadData) error
ThreadEventHandler 论坛主题事件 handler