Documentation ¶
Overview ¶
处理收到的信息事件
处理收到的信息事件
处理收到的信息事件
处理收到的信息事件
处理收到的信息事件
处理收到的信息事件
处理收到的信息事件
处理收到的回调事件
处理收到的帖子信息事件
处理收到的信息事件
Index ¶
- func ConvertInteractionToMessage(interaction *dto.WSInteractionData) dto.Message
- func DelayedPutInteraction(o openapi.OpenAPI, interactionID, fromuid, fromgid string)
- func GenerateAvatarURL(userID int64) (string, error)
- func GenerateAvatarURLV2(openid string) (string, error)
- func PostMessageToUrls(message map[string]interface{})
- func PrintStructWithFieldNames(v interface{})
- func SendMessage(messageText string, data interface{}, messageType string, api openapi.OpenAPI, ...) error
- func SendMessageMd(md *dto.Markdown, kb *keyboard.MessageKeyboard, data interface{}, ...) error
- func UnmarshalForumContentElements(content string) ([]dto.ForumContentElement, error)
- type GroupNoticeEvent
- type GroupRequestEvent
- type OnebotChannelMessage
- type OnebotGroupMessage
- type OnebotInteractionNotice
- type OnebotPrivateMessage
- type PrivateSender
- type Processors
- func (p *Processors) Autobind(data interface{}) error
- func (p *Processors) BroadcastMessageToAll(message map[string]interface{}) error
- func (p *Processors) HandleFrameworkCommand(messageText string, data interface{}, Type string) error
- func (p *Processors) ProcessC2CMessage(data *dto.WSC2CMessageData) error
- func (p *Processors) ProcessChannelDirectMessage(data *dto.WSDirectMessageData) error
- func (p *Processors) ProcessGroupAddBot(data *dto.GroupAddBotEvent) error
- func (p *Processors) ProcessGroupDelBot(data *dto.GroupAddBotEvent) error
- func (p *Processors) ProcessGroupMessage(data *dto.WSGroupATMessageData) error
- func (p *Processors) ProcessGuildATMessage(data *dto.WSATMessageData) error
- func (p *Processors) ProcessGuildNormalMessage(data *dto.WSMessageData) error
- func (p *Processors) ProcessInlineSearch(data *dto.WSInteractionData) error
- func (p *Processors) ProcessThreadMessage(data *dto.WSThreadData) error
- func (p *Processors) SendMessageToAllClients(message map[string]interface{}) error
- type SelfIntroduceClient
- type Sender
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertInteractionToMessage ¶
func ConvertInteractionToMessage(interaction *dto.WSInteractionData) dto.Message
ConvertInteractionToMessage 转换 Interaction 到 Message
func DelayedPutInteraction ¶
延迟执行PutInteraction
func GenerateAvatarURL ¶
GenerateAvatarURL 生成根据给定 userID 和随机 q 值组合的 QQ 头像 URL
func GenerateAvatarURLV2 ¶
GenerateAvatarURLV2 生成根据32位ID 和 Appid 组合的 新QQ 头像 URL
func SendMessage ¶
func SendMessage(messageText string, data interface{}, messageType string, api openapi.OpenAPI, apiv2 openapi.OpenAPI) error
SendMessage 发送消息根据不同的类型
func SendMessageMd ¶
func SendMessageMd(md *dto.Markdown, kb *keyboard.MessageKeyboard, data interface{}, messageType string, api openapi.OpenAPI, apiv2 openapi.OpenAPI) error
SendMessageMd 发送Md消息根据不同的类型
func UnmarshalForumContentElements ¶
func UnmarshalForumContentElements(content string) ([]dto.ForumContentElement, error)
UnmarshalForumContentElements 动态解析元素类型
Types ¶
type GroupNoticeEvent ¶
type GroupNoticeEvent struct { GroupID int64 `json:"group_id"` NoticeType string `json:"notice_type"` OperatorID int64 `json:"operator_id"` PostType string `json:"post_type"` SelfID int64 `json:"self_id"` SubType string `json:"sub_type"` Time int64 `json:"time"` UserID int64 `json:"user_id"` }
GroupNoticeEvent 表示群通知事件的数据结构
type GroupRequestEvent ¶
type GroupRequestEvent struct { Comment string `json:"comment"` Flag string `json:"flag"` GroupID int64 `json:"group_id"` PostType string `json:"post_type"` RequestType string `json:"request_type"` SelfID int64 `json:"self_id"` SubType string `json:"sub_type"` Time int64 `json:"time"` UserID int64 `json:"user_id"` }
GroupRequestEvent 表示群组请求事件的数据结构
type OnebotChannelMessage ¶
type OnebotChannelMessage struct { ChannelID string `json:"channel_id"` GuildID string `json:"guild_id"` Message interface{} `json:"message"` MessageID string `json:"message_id"` MessageType string `json:"message_type"` PostType string `json:"post_type"` SelfID int64 `json:"self_id"` SelfTinyID string `json:"self_tiny_id"` Sender Sender `json:"sender"` SubType string `json:"sub_type"` Time int64 `json:"time"` Avatar string `json:"avatar,omitempty"` UserID int64 `json:"user_id"` RawMessage string `json:"raw_message"` Echo string `json:"echo,omitempty"` RealMessageType string `json:"real_message_type,omitempty"` //当前信息的真实类型 表情表态 }
频道信息事件
type OnebotGroupMessage ¶
type OnebotGroupMessage struct { RawMessage string `json:"raw_message"` MessageID int `json:"message_id"` GroupID int64 `json:"group_id"` // Can be either string or int depending on p.Settings.CompleteFields MessageType string `json:"message_type"` PostType string `json:"post_type"` SelfID int64 `json:"self_id"` // Can be either string or int Sender Sender `json:"sender"` SubType string `json:"sub_type"` Time int64 `json:"time"` Avatar string `json:"avatar,omitempty"` Echo string `json:"echo,omitempty"` Message interface{} `json:"message"` // For array format MessageSeq int `json:"message_seq"` Font int `json:"font"` UserID int64 `json:"user_id"` RealMessageType string `json:"real_message_type,omitempty"` //当前信息的真实类型 group group_private guild guild_private RealUserID string `json:"real_user_id,omitempty"` //当前真实uid RealGroupID string `json:"real_group_id,omitempty"` //当前真实gid IsBindedGroupId bool `json:"is_binded_group_id,omitempty"` //当前群号是否是binded后的 IsBindedUserId bool `json:"is_binded_user_id,omitempty"` //当前用户号号是否是binded后的 }
群信息事件
type OnebotInteractionNotice ¶
type OnebotInteractionNotice struct { GroupID int64 `json:"group_id,omitempty"` NoticeType string `json:"notice_type,omitempty"` PostType string `json:"post_type,omitempty"` SelfID int64 `json:"self_id,omitempty"` SubType string `json:"sub_type,omitempty"` Time int64 `json:"time,omitempty"` UserID int64 `json:"user_id,omitempty"` Data *dto.WSInteractionData `json:"data,omitempty"` }
onebotv11标准扩展
type OnebotPrivateMessage ¶
type OnebotPrivateMessage struct { RawMessage string `json:"raw_message"` MessageID int `json:"message_id"` // Can be either string or int depending on logic MessageType string `json:"message_type"` PostType string `json:"post_type"` SelfID int64 `json:"self_id"` // Can be either string or int depending on logic Sender PrivateSender `json:"sender"` SubType string `json:"sub_type"` Time int64 `json:"time"` Avatar string `json:"avatar,omitempty"` Echo string `json:"echo,omitempty"` Message interface{} `json:"message"` // For array format MessageSeq int `json:"message_seq"` // Optional field Font int `json:"font"` // Optional field UserID int64 `json:"user_id"` // Can be either string or int depending on logic RealMessageType string `json:"real_message_type,omitempty"` //当前信息的真实类型 group group_private guild guild_private IsBindedUserId bool `json:"is_binded_user_id,omitempty"` //当前用户号号是否是binded后的 }
私聊信息事件
type PrivateSender ¶
type Processors ¶
type Processors struct { Api openapi.OpenAPI // API 类型 Apiv2 openapi.OpenAPI //群的API Settings *config.Settings // 使用指针 Wsclient []*wsclient.WebSocketClient // 指针的切片 WsServerClients []callapi.WebSocketServerClienter //ws server被连接的客户端 }
Processor 结构体用于处理消息
func NewProcessor ¶
func NewProcessor(api openapi.OpenAPI, apiv2 openapi.OpenAPI, settings *config.Settings, wsclient []*wsclient.WebSocketClient) *Processors
修改函数的返回类型为 *Processor
func NewProcessorV2 ¶
func NewProcessorV2(api openapi.OpenAPI, apiv2 openapi.OpenAPI, settings *config.Settings) *Processors
修改函数的返回类型为 *Processor
func (*Processors) Autobind ¶
func (p *Processors) Autobind(data interface{}) error
autobind 函数接受 interface{} 类型的数据 commit by 紫夜 2023-11-19
func (*Processors) BroadcastMessageToAll ¶
func (p *Processors) BroadcastMessageToAll(message map[string]interface{}) error
方便快捷的发信息函数
func (*Processors) HandleFrameworkCommand ¶
func (p *Processors) HandleFrameworkCommand(messageText string, data interface{}, Type string) error
func (*Processors) ProcessC2CMessage ¶
func (p *Processors) ProcessC2CMessage(data *dto.WSC2CMessageData) error
ProcessC2CMessage 处理C2C消息 群私聊
func (*Processors) ProcessChannelDirectMessage ¶
func (p *Processors) ProcessChannelDirectMessage(data *dto.WSDirectMessageData) error
ProcessChannelDirectMessage 处理频道私信消息 这里我们是被动收到
func (*Processors) ProcessGroupAddBot ¶
func (p *Processors) ProcessGroupAddBot(data *dto.GroupAddBotEvent) error
ProcessGroupAddBot 处理机器人增加
func (*Processors) ProcessGroupDelBot ¶
func (p *Processors) ProcessGroupDelBot(data *dto.GroupAddBotEvent) error
ProcessGroupDelBot 处理机器人减少
func (*Processors) ProcessGroupMessage ¶
func (p *Processors) ProcessGroupMessage(data *dto.WSGroupATMessageData) error
ProcessGroupMessage 处理群组消息
func (*Processors) ProcessGuildATMessage ¶
func (p *Processors) ProcessGuildATMessage(data *dto.WSATMessageData) error
ProcessGuildATMessage 处理消息,执行逻辑并可能使用 api 发送响应
func (*Processors) ProcessGuildNormalMessage ¶
func (p *Processors) ProcessGuildNormalMessage(data *dto.WSMessageData) error
ProcessGuildNormalMessage 处理频道常规消息
func (*Processors) ProcessInlineSearch ¶
func (p *Processors) ProcessInlineSearch(data *dto.WSInteractionData) error
ProcessInlineSearch 处理内联查询
func (*Processors) ProcessThreadMessage ¶
func (p *Processors) ProcessThreadMessage(data *dto.WSThreadData) error
ProcessInlineSearch 处理帖子事件
func (*Processors) SendMessageToAllClients ¶
func (p *Processors) SendMessageToAllClients(message map[string]interface{}) error
发信息给所有连接正向ws的客户端
type SelfIntroduceClient ¶
type SelfIntroduceClient struct { }
定义了一个符合 Client 接口的 SelfIntroduceClient 结构体
func (*SelfIntroduceClient) SendMessage ¶
func (c *SelfIntroduceClient) SendMessage(message map[string]interface{}) error
实现 Client 接口的 SendMessage 方法 假client中不执行任何操作,只是返回 nil 来符合接口要求
type Sender ¶
type Sender struct { Nickname string `json:"nickname"` TinyID string `json:"tiny_id"` UserID int64 `json:"user_id"` Role string `json:"role,omitempty"` Card string `json:"card,omitempty"` Sex string `json:"sex,omitempty"` Age int32 `json:"age,omitempty"` Area string `json:"area,omitempty"` Level string `json:"level,omitempty"` Title string `json:"title,omitempty"` }