1
0
mirror of https://github.com/fumiama/NanoBot.git synced 2026-06-05 02:30:23 +08:00

finish intent

This commit is contained in:
源文雨
2023-10-14 13:37:45 +09:00
parent 5a088daf11
commit 9918dd8ec8
4 changed files with 66 additions and 1 deletions

View File

@@ -47,3 +47,23 @@ type WebsocketPayload struct {
S int `json:"s"`
T string `json:"t"`
}
// https://bot.q.qq.com/wiki/develop/api/gateway/intents.html
const (
IntentGuilds = 1 << 0
IntentGuildMembers = 1 << 1
IntentGuildMessages = 1 << 9
IntentGuildMessageReactions = 1 << 10
IntentDirectMessage = 1 << 12
IntentOpenForumsEvent = 1 << 18
IntentAudioOrLiveChannelMember = 1 << 19
IntentInteraction = 1 << 26
IntentMessageAudit = 1 << 27
IntentForumsEvent = 1 << 28
IntentAudioAction = 1 << 29
IntentPublicGuildMessages = 1 << 30
IntentAll = IntentGuilds | IntentGuildMembers | IntentGuildMessages | IntentGuildMessageReactions |
IntentDirectMessage | IntentOpenForumsEvent | IntentAudioOrLiveChannelMember | IntentInteraction |
IntentMessageAudit | IntentForumsEvent | IntentAudioAction | IntentPublicGuildMessages
)

View File

@@ -43,4 +43,34 @@ type Handler struct {
OnOpenForumPostDelete func(s int, bot *Bot, d *Post)
OnOpenForumReplyCreate func(s int, bot *Bot, d *Reply)
OnOpenForumReplyDelete func(s int, bot *Bot, d *Reply)
// AUDIO_OR_LIVE_CHANNEL_MEMBER (1 << 19) // 音视频/直播子频道成员进出事件
OnAudioOrLiveChannelMemberEnter func(s int, bot *Bot, d *AudioLiveChannelUsersChange)
OnAudioOrLiveChannelMemberExit func(s int, bot *Bot, d *AudioLiveChannelUsersChange)
// INTERACTION (1 << 26) 事件结构不明
// MESSAGE_AUDIT (1 << 27)
OnMessageAuditPass func(s int, bot *Bot, d *MessageAudited)
OnMessageAuditReject func(s int, bot *Bot, d *MessageAudited)
// FORUMS_EVENT (1 << 28) // 论坛事件,仅 *私域* 机器人能够设置此 intents。
OnForumThreadCreate func(s int, bot *Bot, d *Thread)
OnForumThreadUpdate func(s int, bot *Bot, d *Thread)
OnForumThreadDelete func(s int, bot *Bot, d *Thread)
OnForumPostCreate func(s int, bot *Bot, d *Post)
OnForumPostDelete func(s int, bot *Bot, d *Post)
OnForumReplyCreate func(s int, bot *Bot, d *Reply)
OnForumReplyDelete func(s int, bot *Bot, d *Reply)
OnForumPublishAuditResult func(s int, bot *Bot, d *AuditResult)
// AUDIO_ACTION (1 << 29)
OnAudioStart func(s int, bot *Bot, d *AudioAction)
OnAudioFinish func(s int, bot *Bot, d *AudioAction)
OnAudioOnMic func(s int, bot *Bot, d *AudioAction)
OnAudioOffMic func(s int, bot *Bot, d *AudioAction)
// PUBLIC_GUILD_MESSAGES (1 << 30) // 消息事件,此为公域的消息事件
OnAtMessageCreate func(s int, bot *Bot, d *Message)
OnPublicMessageDelete func(s int, bot *Bot, d *Message)
}

View File

@@ -49,3 +49,13 @@ func (bot *Bot) OpenMicInChannel(id string) error {
func (bot *Bot) CloseMicInChannel(id string) error {
return bot.DeleteOpenAPI("/channels/"+id+"/mic", "", nil)
}
// AudioLiveChannelUsersChange 音视频/直播子频道成员进出事件
//
// https://bot.q.qq.com/wiki/develop/api/gateway/audio_or_live_channel_member.html
type AudioLiveChannelUsersChange struct {
GuildID string `json:"guild_id"`
ChannelID string `json:"channel_id"`
ChannelType int `json:"channel_type"`
UserID string `json:"user_id"`
}

View File

@@ -99,7 +99,12 @@ type MessageDelete struct {
//
// https://bot.q.qq.com/wiki/develop/api/openapi/message/model.html#%E6%B6%88%E6%81%AF%E5%AE%A1%E6%A0%B8%E5%AF%B9%E8%B1%A1-messageaudited
type MessageAudited struct {
AuditID string `json:"audit_id"`
AuditID string `json:"audit_id"`
AuditTime time.Time `json:"audit_time"`
ChannelID string `json:"channel_id"`
CreateTime time.Time `json:"create_time"`
GuildID string `json:"guild_id"`
MessageID string `json:"message_id"`
}
// GetMessageFromChannel 获取子频道 channel_id 下的消息 message_id 的详情