Documentation ¶
Overview ¶
Package dto 维护了用于与机器人接口通信的数据结构对象。
Index ¶
- Constants
- func OPMeans(op OPCode) string
- type APIPermission
- type APIPermissionDemand
- type APIPermissionDemandIdentify
- type APIPermissionDemandToCreate
- type APIPermissions
- type ActionType
- type Announces
- type Ark
- type ArkKV
- type ArkObj
- type ArkObjKV
- type AudioAction
- type AudioControl
- type AudioStatus
- type Author
- type C2CAtachment
- type C2CAuthor
- type C2CMessage
- type C2CMessageToCreate
- type C2CMsgResp
- type C2CRichMediaMessageToCreate
- type Channel
- type ChannelAnnouncesToCreate
- type ChannelPermissions
- type ChannelPrivateType
- type ChannelRolesPermissions
- type ChannelSubType
- type ChannelType
- type ChannelValueObject
- type DeleteHistoryMsgDay
- type DirectMessage
- type DirectMessageToCreate
- type Duration
- type Embed
- type EmbedField
- type Emoji
- type EventType
- type FileInfo
- type ForumAuditResult
- type FriendAddEvent
- type FriendDelEvent
- type FriendMsgReceiveEvent
- type FriendMsgRejectEvent
- type GroupAddRobotEvent
- type GroupDelRobotEvent
- type GroupMessage
- type GroupMessageToCreate
- type GroupMsgReceiveEvent
- type GroupMsgRejectEvent
- type GroupMsgResp
- type GroupRichMediaMessageToCreate
- type Guild
- type GuildAnnouncesToCreate
- type GuildMembersPager
- type GuildPager
- type GuildRoleMembersPager
- type GuildRoles
- type HTTPIdentity
- type HTTPReady
- type HTTPSession
- type Intent
- type Interaction
- type InteractionData
- type InteractionDataType
- type InteractionType
- type LayoutType
- type Markdown
- type MarkdownParams
- type Member
- type MemberAddRoleBody
- type MemberDeleteOption
- type MemberDeleteOpts
- type Message
- type MessageArk
- type MessageAttachment
- type MessageAudit
- type MessageDelete
- type MessageEmbedThumbnail
- type MessagePagerType
- type MessageReaction
- type MessageReactionPager
- type MessageReactionUsers
- type MessageReference
- type MessageSetting
- type MessageToCreate
- type MessagesPager
- type OPCode
- type Pager
- type PinsMessage
- type Post
- type PostInfo
- type ReactionTarget
- type ReactionTargetType
- type RecommendChannel
- type Reply
- type ReplyInfo
- type RichMediaMsgResp
- type Role
- type RoleID
- type Schedule
- type ScheduleWrapper
- type SearchInputResolved
- type SearchLayout
- type SearchRecord
- type SearchRsp
- type Session
- type SessionStartLimit
- type SettingGuide
- type SettingGuideToCreate
- type ShardConfig
- type SpeakPermissionType
- type Thread
- type ThreadInfo
- type Timestamp
- type UpdateChannelPermissions
- type UpdateGuildMute
- type UpdateGuildMuteResponse
- type UpdateResult
- type UpdateRole
- type UpdateRoleFilter
- type UpdateRoleInfo
- type User
- type WSATMessageData
- type WSAudioData
- type WSC2CMessageData
- type WSChannelData
- type WSDirectMessageData
- type WSDirectMessageDeleteData
- type WSForumAuditData
- type WSFriendAddData
- type WSFriendDelData
- type WSFriendMsgRejectData
- type WSFriendMsgReveiceData
- type WSGroupATMessageData
- type WSGroupAddRobotData
- type WSGroupDelRobotData
- type WSGroupMessageData
- type WSGroupMsgReceiveData
- type WSGroupMsgRejectData
- type WSGuildData
- type WSGuildMemberData
- type WSHelloData
- type WSIdentityData
- type WSInteractionData
- type WSMessageAuditData
- type WSMessageData
- type WSMessageDeleteData
- type WSMessageReactionData
- type WSPayload
- type WSPayloadBase
- type WSPostData
- type WSPublicMessageDeleteData
- type WSReadyData
- type WSReplyData
- type WSResumeData
- type WSThreadData
- type WSUser
- type WebsocketAP
Constants ¶
const ( AudioStatusStart = iota AudioStatusPause AudioStatusResume AudioStatusStop )
音频状态
const ( ChannelTypeText ChannelType = iota ChannelTypeVoice ChannelTypeCategory ChannelTypeLive = 10000 + iota // 直播子频道 ChannelTypeApplication // 应用子频道 ChannelTypeForum // 论坛子频道 )
子频道类型定义
const ( // ReactionTargetTypeMsg 消息 ReactionTargetTypeMsg = iota // ReactionTargetTypeFeed 帖子 ReactionTargetTypeFeed // ReactionTargetTypeComment 评论 ReactionTargetTypeComment // ReactionTargetTypeReply 回复 ReactionTargetTypeReply )
const DefaultColor = 4278245297
DefaultColor 用户组默认颜色值
Variables ¶
This section is empty.
Functions ¶
Types ¶
type APIPermission ¶
type APIPermission struct { Path string `json:"path,omitempty"` // API 接口名,例如 /guilds/{guild_id}/members/{user_id} Method string `json:"method,omitempty"` // 请求方法,例如 GET Desc string `json:"desc,omitempty"` // API 接口名称,例如 获取频道信 AuthStatus int `json:"auth_status,omitempty"` // 授权状态,auth_stats 为 1 时已授权 }
APIPermission API 权限对象
type APIPermissionDemand ¶
type APIPermissionDemand struct { GuildID string `json:"guild_id,omitempty"` // 频道 ID ChannelID string `json:"channel_id,omitempty"` // 子频道 ID APIIdentify *APIPermissionDemandIdentify `json:"api_identify,omitempty"` // 权限接口唯一标识 Title string `json:"title,omitempty"` // 接口权限链接中的接口权限描述信息 Desc string `json:"desc,omitempty"` // 接口权限链接中的机器人可使用功能的描述信息 }
APIPermissionDemand 接口权限需求对象
type APIPermissionDemandIdentify ¶
type APIPermissionDemandIdentify struct { Path string `json:"path,omitempty"` // API 接口名,例如 /guilds/{guild_id}/members/{user_id} Method string `json:"method,omitempty"` // 请求方法,例如 GET }
APIPermissionDemandIdentify API 权限需求标识对象
type APIPermissionDemandToCreate ¶
type APIPermissionDemandToCreate struct { ChannelID string `json:"channel_id"` // 子频道 ID APIIdentify *APIPermissionDemandIdentify `json:"api_identify,omitempty"` // 接口权限链接中的接口权限描述信息 Desc string `json:"desc"` // 接口权限链接中的机器人可使用功能的描述信息 }
APIPermissionDemandToCreate 创建频道 API 接口权限授权链接结构体定义
type APIPermissions ¶
type APIPermissions struct {
APIList []*APIPermission `json:"apis,omitempty"` // API 权限列表
}
APIPermissions API 权限列表对象
type ActionType ¶
type ActionType uint32
ActionType 每行数据的点击行为
const ( // ActionTypeSendARK 发送 ark 消息 ActionTypeSendARK ActionType = 0 )
type Announces ¶
type Announces struct { // 频道 ID GuildID string `json:"guild_id"` // 子频道 ID ChannelID string `json:"channel_id"` // 用来创建公告的消息 ID MessageID string `json:"message_id"` // 公告类别 0:成员公告,1:欢迎公告,默认为成员公告 AnnouncesType uint32 `json:"announces_type"` // 推荐子频道详情数组 RecommendChannels []RecommendChannel `json:"recommend_channels,omitempty"` }
Announces 公告对象
type Ark ¶
type Ark struct { TemplateID int `json:"template_id,omitempty"` // ark 模版 ID KV []*ArkKV `json:"kv,omitempty"` // ArkKV 数组 }
Ark 消息模版
type ArkKV ¶
type ArkKV struct { Key string `json:"key,omitempty"` Value string `json:"value,omitempty"` Obj []*ArkObj `json:"obj,omitempty"` }
ArkKV Ark 键值对
type AudioAction ¶
type AudioAction struct { GuildID string `json:"guild_id"` ChannelID string `json:"channel_id"` URL string `json:"audio_url"` Text string `json:"text"` }
AudioAction 音频动作
type AudioControl ¶
type AudioControl struct { URL string `json:"audio_url"` Text string `json:"text"` Status AudioStatus `json:"status"` }
AudioControl 音频控制对象
type C2CAtachment ¶
type C2CMessage ¶
type C2CMessage struct { Id string `json:"id"` Author *C2CAuthor `json:"author"` Content string `json:"content"` Timestamp Timestamp `json:"timestamp"` Attachments []*C2CAtachment `json:"attachments"` }
type C2CMessageToCreate ¶
type C2CMessageToCreate struct { Content string `json:"content,omitempty"` MsgType int `json:"msg_type"` Markdown *Markdown `json:"markdown,omitempty"` Keyboard *keyboard.MessageKeyboard `json:"keyboard,omitempty"` // 消息按钮组件 Media *FileInfo `json:"media,omitempty"` Ark *Ark `json:"ark,omitempty"` Image string `json:"image,omitempty"` MessageReference *MessageReference `json:"message_reference,omitempty"` EventID string `json:"event_id,omitempty"` // 要回复的事件id, 逻辑同MsgID MsgID string `json:"msg_id,omitempty"` MsgReq uint `json:"msg_req,omitempty"` }
type C2CMsgResp ¶
type C2CRichMediaMessageToCreate ¶
type C2CRichMediaMessageToCreate struct { FileType int `json:"file_type"` Url string `json:"url"` SrvSendMsg bool `json:"srv_send_msg"` FileData []byte `json:"file_data"` }
媒体类型:1 图片,2 视频,3 语音,4 文件(暂不开放) 资源格式要求: 图片:png/jpg,视频:mp4,语音:silk,
type Channel ¶
type Channel struct { // 频道ID ID string `json:"id"` // 群ID GuildID string `json:"guild_id"` ChannelValueObject }
Channel 频道结构定义
type ChannelAnnouncesToCreate ¶
type ChannelAnnouncesToCreate struct {
MessageID string `json:"message_id"` // 用来创建公告的消息ID
}
ChannelAnnouncesToCreate 创建子频道公告结构体定义
type ChannelPermissions ¶
type ChannelPermissions struct { ChannelID string `json:"channel_id,omitempty"` UserID string `json:"user_id,omitempty"` Permissions string `json:"permissions,omitempty"` }
ChannelPermissions 子频道权限
type ChannelPrivateType ¶
type ChannelPrivateType int
ChannelPrivateType 频道可见性类型定义
const ( ChannelPrivateTypePublic ChannelPrivateType = iota // 公开频道 ChannelPrivateTypeOnlyAdmin // 群主管理员可见 ChannelPrivateTypeAdminAndMember // 群主管理员+指定成员 )
频道可见性类型定义
type ChannelRolesPermissions ¶
type ChannelRolesPermissions struct { ChannelID string `json:"channel_id,omitempty"` RoleID string `json:"role_id,omitempty"` Permissions string `json:"permissions,omitempty"` }
ChannelRolesPermissions 子频道身份组权限
type ChannelSubType ¶
type ChannelSubType int
ChannelSubType 子频道子类型定义
const ( ChannelSubTypeChat ChannelSubType = iota // 闲聊,默认子类型 ChannelSubTypeNotice // 公告 ChannelSubTypeGuide // 攻略 ChannelSubTypeTeamGame // 开黑 )
子频道子类型定义
type ChannelValueObject ¶
type ChannelValueObject struct { // 频道名称 Name string `json:"name,omitempty"` // 频道类型 Type ChannelType `json:"type,omitempty"` // 排序位置 Position int64 `json:"position,omitempty"` // 父频道的ID ParentID string `json:"parent_id,omitempty"` // 拥有者ID OwnerID string `json:"owner_id,omitempty"` // 子频道子类型 SubType ChannelSubType `json:"sub_type,omitempty"` // 子频道可见性类型 PrivateType ChannelPrivateType `json:"private_type,omitempty"` // 创建私密子频道的时候,同时带上 userID,能够将这些成员添加为私密子频道的成员 // 注意:只有创建私密子频道的时候才支持这个参数 PrivateUserIDs []string `json:"private_user_ids,omitempty"` // 发言权限 SpeakPermission SpeakPermissionType `json:"speak_permission,omitempty"` // 应用子频道的应用ID,仅应用子频道有效,定义请参考 // [文档](https://bot.q.qq.com/wiki/develop/api/openapi/channel/model.html) ApplicationID string `json:"application_id,omitempty"` // 机器人在此频道上拥有的权限, 定义请参考 // [文档](https://bot.q.qq.com/wiki/develop/api/openapi/channel_permissions/model.html#permissions) Permissions string `json:"permissions,omitempty"` // 操作人 OpUserID string `json:"op_user_id,omitempty"` }
ChannelValueObject 频道的值对象部分
type DeleteHistoryMsgDay ¶
type DeleteHistoryMsgDay = int
DeleteHistoryMsgDay 消息撤回天数
const ( NoDelete = 0 // 不删除任何消息 DeleteThreeDays DeleteHistoryMsgDay = 3 // 3天 DeleteSevenDays DeleteHistoryMsgDay = 7 // 7天 DeleteFifteenDays DeleteHistoryMsgDay = 15 // 15天 DeleteThirtyDays DeleteHistoryMsgDay = 30 // 30天 DeleteAll DeleteHistoryMsgDay = -1 // 删除所有消息 )
支持的消息撤回天数,除这些天数之外,传递其他值将不会撤回任何消息
type DirectMessage ¶
type DirectMessage struct { // 频道ID GuildID string `json:"guild_id"` // 子频道id ChannelID string `json:"channel_id"` // 私信频道创建的时间戳 CreateTime string `json:"create_time"` }
DirectMessage 私信结构定义,一个 DirectMessage 为两个用户之间的一个私信频道,简写为 DM
type DirectMessageToCreate ¶
type DirectMessageToCreate struct { // 频道ID SourceGuildID string `json:"source_guild_id"` // 用户ID RecipientID string `json:"recipient_id"` }
DirectMessageToCreate 创建私信频道的结构体定义
type Duration ¶
Duration 支持能够直接配置中解析出来 time.Duration 类型的数据 需要实现对应类型的 Unmarshaler 接口
func (*Duration) UnmarshalJSON ¶
UnmarshalJSON 实现json的解析接口
type Embed ¶
type Embed struct { Title string `json:"title,omitempty"` Description string `json:"description,omitempty"` Prompt string `json:"prompt"` // 消息弹窗内容,消息列表摘要 Thumbnail MessageEmbedThumbnail `json:"thumbnail,omitempty"` Fields []*EmbedField `json:"fields,omitempty"` }
Embed 结构
type EmbedField ¶
type EmbedField struct { Name string `json:"name,omitempty"` Value string `json:"value,omitempty"` }
EmbedField Embed字段描述
type EventType ¶
type EventType string
EventType 事件类型
const ( EventGuildCreate EventType = "GUILD_CREATE" EventGuildUpdate EventType = "GUILD_UPDATE" EventGuildDelete EventType = "GUILD_DELETE" EventChannelCreate EventType = "CHANNEL_CREATE" EventChannelUpdate EventType = "CHANNEL_UPDATE" EventChannelDelete EventType = "CHANNEL_DELETE" EventGuildMemberAdd EventType = "GUILD_MEMBER_ADD" EventGuildMemberUpdate EventType = "GUILD_MEMBER_UPDATE" EventGuildMemberRemove EventType = "GUILD_MEMBER_REMOVE" EventMessageCreate EventType = "MESSAGE_CREATE" EventMessageReactionAdd EventType = "MESSAGE_REACTION_ADD" EventMessageReactionRemove EventType = "MESSAGE_REACTION_REMOVE" EventAtMessageCreate EventType = "AT_MESSAGE_CREATE" EventPublicMessageDelete EventType = "PUBLIC_MESSAGE_DELETE" EventDirectMessageCreate EventType = "DIRECT_MESSAGE_CREATE" EventDirectMessageDelete EventType = "DIRECT_MESSAGE_DELETE" EventAudioStart EventType = "AUDIO_START" EventAudioFinish EventType = "AUDIO_FINISH" EventAudioOnMic EventType = "AUDIO_ON_MIC" EventAudioOffMic EventType = "AUDIO_OFF_MIC" EventMessageAuditPass EventType = "MESSAGE_AUDIT_PASS" EventMessageAuditReject EventType = "MESSAGE_AUDIT_REJECT" EventMessageDelete EventType = "MESSAGE_DELETE" EventForumThreadCreate EventType = "FORUM_THREAD_CREATE" EventForumThreadUpdate EventType = "FORUM_THREAD_UPDATE" EventForumThreadDelete EventType = "FORUM_THREAD_DELETE" EventForumPostCreate EventType = "FORUM_POST_CREATE" EventForumPostDelete EventType = "FORUM_POST_DELETE" EventForumReplyCreate EventType = "FORUM_REPLY_CREATE" EventForumReplyDelete EventType = "FORUM_REPLY_DELETE" EventForumAuditResult EventType = "FORUM_PUBLISH_AUDIT_RESULT" EventInteractionCreate EventType = "INTERACTION_CREATE" EventC2CMessageCreate EventType = "C2C_MESSAGE_CREATE" EventGroupATMessageCreate EventType = "GROUP_AT_MESSAGE_CREATE" EventGroupMessageCreate EventType = "GROUP_MESSAGE_CREATE" EventGroupAddRobbot EventType = "GROUP_ADD_ROBBOT" EventGroupDelRobbot EventType = "GROUP_DEL_ROBBOT" EventGroupMsgReject EventType = "GROUP_MSG_REJECT" EventGroupMsgReceive EventType = "GROUP_MSG_RECEIVE" EventFriendAdd EventType = "FRIEND_ADD" EventFriendDel EventType = "FRIEND_DEL" EventC2CMsgReject EventType = "C2C_MSG_REJECT" EventC2CMsgReceive EventType = "C2C_MSG_RECEIVE" )
事件类型
type ForumAuditResult ¶
type ForumAuditResult struct { TaskID string `json:"task_id"` GuildID string `json:"guild_id"` ChannelID string `json:"channel_id"` AuthorID string `json:"author_id"` ThreadID string `json:"thread_id"` PostID string `json:"post_id"` ReplyID string `json:"reply_id"` PublishType uint32 `json:"type"` Result uint32 `json:"result"` ErrMsg string `json:"err_msg"` DateTime string `json:"date_time"` }
ForumAuditResult 帖子审核事件主体内容
type FriendAddEvent ¶ added in v0.0.2
type FriendDelEvent ¶ added in v0.0.2
type FriendMsgReceiveEvent ¶ added in v0.0.2
type FriendMsgRejectEvent ¶ added in v0.0.2
type GroupAddRobotEvent ¶ added in v0.0.2
type GroupDelRobotEvent ¶ added in v0.0.2
type GroupMessage ¶
type GroupMessageToCreate ¶
type GroupMessageToCreate struct { Content string `json:"content,omitempty"` MsgType int `json:"msg_type"` Markdown *Markdown `json:"markdown,omitempty"` Keyboard *keyboard.MessageKeyboard `json:"keyboard,omitempty"` // 消息按钮组件 Media *FileInfo `json:"media,omitempty"` Ark *Ark `json:"ark,omitempty"` Image string `json:"image,omitempty"` MessageReference *MessageReference `json:"message_reference,omitempty"` EventID string `json:"event_id,omitempty"` // 要回复的事件id, 逻辑同MsgID MsgID string `json:"msg_id,omitempty"` MsgReq uint `json:"msg_req,omitempty"` }
消息类型: 0 是文本,1 图文混排,2 markdown, 3 ark,4 embed 7 富媒体
type GroupMsgReceiveEvent ¶ added in v0.0.2
type GroupMsgRejectEvent ¶ added in v0.0.2
type GroupMsgResp ¶
type GroupRichMediaMessageToCreate ¶
type GroupRichMediaMessageToCreate struct { FileType int `json:"file_type"` Url string `json:"url"` SrvSendMsg bool `json:"srv_send_msg"` FileData []byte `json:"file_data"` }
媒体类型:1 图片,2 视频,3 语音,4 文件(暂不开放) 资源格式要求: 图片:png/jpg,视频:mp4,语音:silk,
type Guild ¶
type Guild struct { // 频道ID(与客户端上看到的频道ID不同) ID string `json:"id"` // 频道名称 Name string `json:"name"` // 频道头像 Icon string `json:"icon"` // 拥有者ID OwnerID string `json:"owner_id"` // 是否为拥有者 IsOwner bool `json:"owner"` // 成员数量 MemberCount int `json:"member_count"` // 最大成员数目 MaxMembers int64 `json:"max_members"` // 频道描述 Desc string `json:"description"` // 当前用户加入群的时间 // 此字段只在GUILD_CREATE事件中使用 JoinedAt Timestamp `json:"joined_at"` // 频道列表 Channels []*Channel `json:"channels"` // 游戏绑定公会区服ID UnionWorldID string `json:"union_world_id"` // 游戏绑定公会/战队ID UnionOrgID string `json:"union_org_id"` // 操作人 OpUserID string `json:"op_user_id,omitempty"` }
Guild 频道结构定义
type GuildAnnouncesToCreate ¶
type GuildAnnouncesToCreate struct { ChannelID string `json:"channel_id"` // 用来创建公告的子频道 ID MessageID string `json:"message_id"` // 用来创建公告的消息 ID AnnouncesType uint32 `json:"announces_type"` // 公告类别 0:成员公告,1:欢迎公告,默认为成员公告 RecommendChannels []RecommendChannel `json:"recommend_channels"` // 推荐子频道详情列表 }
GuildAnnouncesToCreate 创建频道全局公告结构体定义
type GuildMembersPager ¶
type GuildMembersPager struct { After string `json:"after"` // 读此id之后的数据,如果是第一次请求填0,默认为0 Limit string `json:"limit"` // 分页大小,1-1000,默认是1 }
GuildMembersPager 分页器
func (*GuildMembersPager) QueryParams ¶
func (g *GuildMembersPager) QueryParams() map[string]string
QueryParams 转换为 query 参数
type GuildPager ¶
type GuildPager struct { Before string `json:"before"` // 读此id之前的数据 After string `json:"after"` // 读此id之后的数据 Limit string `json:"limit"` // 分页大小,1-100,默认是 100 }
GuildPager 分页器
func (*GuildPager) QueryParams ¶
func (g *GuildPager) QueryParams() map[string]string
QueryParams 转换为 query 参数
type GuildRoleMembersPager ¶
type GuildRoleMembersPager struct { StartIndex string `json:"start_index"` Limit string `json:"limit"` }
GuildRoleMembersPager 分页器
func (*GuildRoleMembersPager) QueryParams ¶
func (g *GuildRoleMembersPager) QueryParams() map[string]string
QueryParams 转换为 query 参数
type GuildRoles ¶
type GuildRoles struct { GuildID string `json:"guild_id"` Roles []*Role `json:"roles"` NumLimit string `json:"role_num_limit"` }
GuildRoles 频道用户组列表返回
type HTTPIdentity ¶
type HTTPIdentity struct { Intents Intent `json:"intents"` Shards [2]uint32 `json:"shards"` // array of two integers (shard_id, num_shards) Callback string `json:"callback_url"` }
HTTPIdentity 鉴权数据
type HTTPReady ¶
type HTTPReady struct { Version int `json:"version"` SessionID string `json:"session_id"` Bot struct { ID string `json:"id"` Username string `json:"username"` } `json:"bot"` Shard [2]uint32 `json:"shard"` }
HTTPReady ready,鉴权后返回
type HTTPSession ¶
type HTTPSession struct { AppID int64 `json:"app_id"` SessionID string `json:"session_id"` CallbackURL string `json:"callback_url"` Env string `json:"env"` Intents int64 `json:"intents"` LastHeartbeatTime string `json:"last_heartbeat_time"` State string `json:"state"` Shards [2]int64 `json:"shards"` }
HTTPSession session 对象
type Intent ¶
type Intent int
Intent 类型
const ( // IntentGuilds 包含 // - GUILD_CREATE // - GUILD_UPDATE // - GUILD_DELETE // - GUILD_ROLE_CREATE // - GUILD_ROLE_UPDATE // - GUILD_ROLE_DELETE // - CHANNEL_CREATE // - CHANNEL_UPDATE // - CHANNEL_DELETE // - CHANNEL_PINS_UPDATE IntentGuilds Intent = 1 << iota // IntentGuildMembers 包含 // - GUILD_MEMBER_ADD // - GUILD_MEMBER_UPDATE // - GUILD_MEMBER_REMOVE IntentGuildMembers IntentGuildBans IntentGuildEmojis IntentGuildIntegrations IntentGuildWebhooks IntentGuildInvites IntentGuildVoiceStates IntentGuildPresences IntentGuildMessages // IntentGuildMessageReactions 包含 // - MESSAGE_REACTION_ADD // - MESSAGE_REACTION_REMOVE IntentGuildMessageReactions IntentGuildMessageTyping IntentDirectMessages IntentDirectMessageReactions IntentDirectMessageTyping // IntentQQ 包含 // - C2C_MESSAGE_CREATE // - GROUP_AT_MESSAGE_CREATE IntentQQ Intent = 1 << 25 IntentInteraction Intent = 1 << 26 // 互动事件 IntentAudit Intent = 1 << 27 // 审核事件 // IntentForum 论坛事件 // - THREAD_CREATE // 当用户创建主题时 // - THREAD_UPDATE // 当用户更新主题时 // - THREAD_DELETE // 当用户删除主题时 // - POST_CREATE // 当用户创建帖子时 // - POST_DELETE // 当用户删除帖子时 // - REPLY_CREATE // 当用户回复评论时 // - REPLY_DELETE // 当用户回复评论时 // - FORUM_PUBLISH_AUDIT_RESULT // 当用户发表审核通过时 IntentForum Intent = 1 << 28 // 论坛事件 // IntentAudio // - AUDIO_START // 音频开始播放时 // - AUDIO_FINISH // 音频播放结束时 IntentAudio Intent = 1 << 29 // 音频机器人事件 IntentGuildAtMessage Intent = 1 << 30 // 只接收@消息事件 IntentNone Intent = 0 )
websocket intent 声明
type Interaction ¶
type Interaction struct { ID string `json:"id,omitempty"` // 互动行为唯一标识 ApplicationID string `json:"application_id,omitempty"` // 应用ID Type InteractionType `json:"type,omitempty"` // 互动类型 Data *InteractionData `json:"data,omitempty"` // 互动数据 GuildID string `json:"guild_id,omitempty"` // 频道 ID ChannelID string `json:"channel_id,omitempty"` // 子频道 ID GroupOpenID string `json:"group_openid,omitempty"` // 群 ID GroupMemberOpenID string `json:"group_member_openid,omitempty"` Version uint32 `json:"version,omitempty"` // 版本,默认为 1 }
Interaction 互动行为对象
type InteractionData ¶
type InteractionData struct { Name string `json:"name,omitempty"` // 标题 Type InteractionDataType `json:"type,omitempty"` // 数据类型,不同数据类型对应不同的 resolved 数据 Resolved json.RawMessage `json:"resolved,omitempty"` // 跟不同的互动类型和数据类型有关系的数据 }
InteractionData 互动数据
type InteractionDataType ¶
type InteractionDataType uint32
InteractionDataType 互动数据类型
const ( // InteractionDataTypeChatSearch 聊天框搜索 InteractionDataTypeChatSearch InteractionDataType = 9 )
type InteractionType ¶
type InteractionType uint32
InteractionType 互动类型
const ( // InteractionTypePing ping InteractionTypePing InteractionType = 1 // InteractionTypeCommand 命令 InteractionTypeCommand InteractionType = 2 )
type LayoutType ¶
type LayoutType uint32
LayoutType 布局类型
const ( // LayoutTypeImageText 左图右文 LayoutTypeImageText LayoutType = 0 )
type Markdown ¶
type Markdown struct { TemplateID int `json:"template_id,omitempty"` // 模版 id CustomTemplateId string `json:"custom_template_id,omitempty"` Params []*MarkdownParams `json:"params"` // 模版参数 Content string `json:"content"` // 原生 markdown }
Markdown markdown 消息
type MarkdownParams ¶
MarkdownParams markdown 模版参数 键值对
type Member ¶
type Member struct { GuildID string `json:"guild_id"` JoinedAt Timestamp `json:"joined_at"` Nick string `json:"nick"` User *User `json:"user"` Roles []string `json:"roles"` OpUserID string `json:"op_user_id,omitempty"` }
Member 群成员
type MemberAddRoleBody ¶
type MemberAddRoleBody struct { // 子频道对象 Channel *Channel `json:"channel"` }
MemberAddRoleBody 增加子频道管理员身份组时附加内容
type MemberDeleteOption ¶
type MemberDeleteOption func(*MemberDeleteOpts)
MemberDeleteOption 删除成员选项
func WithAddBlackList ¶
func WithAddBlackList(b bool) MemberDeleteOption
WithAddBlackList 将当前成员同时添加到频道黑名单中
func WithDeleteHistoryMsg ¶
func WithDeleteHistoryMsg(days DeleteHistoryMsgDay) MemberDeleteOption
WithDeleteHistoryMsg 删除成员时同时撤回消息
type MemberDeleteOpts ¶
type MemberDeleteOpts struct { AddBlackList bool `json:"add_blacklist"` DeleteHistoryMsgDays DeleteHistoryMsgDay `json:"delete_history_msg_days"` }
MemberDeleteOpts 删除成员额外参数
type Message ¶
type Message struct { // 消息ID ID string `json:"id"` // 子频道ID ChannelID string `json:"channel_id"` // 频道ID GuildID string `json:"guild_id"` // 内容 Content string `json:"content"` // 发送时间 Timestamp Timestamp `json:"timestamp"` // 消息编辑时间 EditedTimestamp Timestamp `json:"edited_timestamp"` // 是否@all MentionEveryone bool `json:"mention_everyone"` // 消息发送方 Author *User `json:"author"` // 消息发送方Author的member属性,只是部分属性 Member *Member `json:"member"` // 附件 Attachments []*MessageAttachment `json:"attachments"` // 结构化消息-embeds Embeds []*Embed `json:"embeds"` // 消息中的提醒信息(@)列表 Mentions []*User `json:"mentions"` // ark 消息 Ark *Ark `json:"ark"` // 私信消息 DirectMessage bool `json:"direct_message"` // 子频道 seq,用于消息间的排序,seq 在同一子频道中按从先到后的顺序递增,不同的子频道之前消息无法排序 SeqInChannel string `json:"seq_in_channel"` // 引用的消息 MessageReference *MessageReference `json:"message_reference,omitempty"` // 私信场景下,该字段用来标识从哪个频道发起的私信 SrcGuildID string `json:"src_guild_id"` }
Message 消息结构体定义
type MessageAttachment ¶
type MessageAttachment struct {
URL string `json:"url"`
}
MessageAttachment 附件定义
type MessageAudit ¶
type MessageAudit struct { // 审核 ID AuditID string `json:"audit_id"` // 消息 ID MessageID string `json:"message_id"` // 频道 ID GuildID string `json:"guild_id"` // 子频道 ID ChannelID string `json:"channel_id"` // 审核时间 AuditTime string `json:"audit_time"` // 创建时间 CreateTime string `json:"create_time"` // 子频道 seq,用于消息间的排序,seq 在同一子频道中按从先到后的顺序递增,不同的子频道之前消息无法排序 SeqInChannel string `json:"seq_in_channel"` }
MessageAudit 消息审核结构体定义
type MessageDelete ¶
type MessageDelete struct { // 消息 Message Message `json:"message"` // 操作用户 OpUser User `json:"op_user"` }
MessageDelete 消息删除结构体定义
type MessageEmbedThumbnail ¶
type MessageEmbedThumbnail struct {
URL string `json:"url"`
}
MessageEmbedThumbnail embed 消息的缩略图对象
type MessagePagerType ¶
type MessagePagerType string
MessagePagerType 消息翻页拉取方式
const ( // MPTAround 拉取消息ID上下的消息 MPTAround MessagePagerType = "around" // MPTBefore 拉取消息ID之前的消息 MPTBefore MessagePagerType = "before" // MPTAfter 拉取消息ID之后的消息 MPTAfter MessagePagerType = "after" )
type MessageReaction ¶
type MessageReaction struct { UserID string `json:"user_id"` ChannelID string `json:"channel_id"` GuildID string `json:"guild_id"` Target ReactionTarget `json:"target"` Emoji Emoji `json:"emoji"` }
MessageReaction 表情表态动作
type MessageReactionPager ¶
type MessageReactionPager struct { Cookie string `json:"cookie"` // 分页游标 Limit string `json:"limit"` // 分页大小,1-1000,默认是20 }
MessageReactionPager 分页器
func (*MessageReactionPager) QueryParams ¶
func (g *MessageReactionPager) QueryParams() map[string]string
QueryParams 转换为 query 参数
type MessageReactionUsers ¶
type MessageReactionUsers struct { Users []*User `json:"users,omitempty"` Cookie string `json:"cookie,omitempty"` IsEnd bool `json:"is_end,omitempty"` }
MessageReactionUsers 消息表情表态用户列表
type MessageReference ¶
type MessageReference struct { MessageID string `json:"message_id"` // 消息 id IgnoreGetMessageError bool `json:"ignore_get_message_error"` // 是否忽律获取消息失败错误 }
MessageReference 引用消息
type MessageSetting ¶
type MessageSetting struct { DisableCreateDm bool `json:"disable_create_dm,omitempty"` DisablePushMsg bool `json:"disable_push_msg,omitempty"` ChannelIDs []string `json:"channel_ids,omitempty"` ChannelPushMaxNum int `json:"channel_push_max_num,omitempty"` }
MessageSetting 消息频率设置信息
type MessageToCreate ¶
type MessageToCreate struct { Content string `json:"content,omitempty"` Embed *Embed `json:"embed,omitempty"` Ark *Ark `json:"ark,omitempty"` Image string `json:"image,omitempty"` // 要回复的消息id,为空是主动消息,公域机器人会异步审核,不为空是被动消息,公域机器人会校验语料 MsgID string `json:"msg_id,omitempty"` MessageReference *MessageReference `json:"message_reference,omitempty"` Markdown *Markdown `json:"markdown,omitempty"` Keyboard *keyboard.MessageKeyboard `json:"keyboard,omitempty"` // 消息按钮组件 EventID string `json:"event_id,omitempty"` // 要回复的事件id, 逻辑同MsgID }
MessageToCreate 发送消息结构体定义
type MessagesPager ¶
type MessagesPager struct { Type MessagePagerType // 拉取类型 ID string // 消息ID Limit string `json:"limit"` // 最大 20 }
MessagesPager 消息分页
func (*MessagesPager) QueryParams ¶
func (m *MessagesPager) QueryParams() map[string]string
QueryParams 转换为 query 参数
type PinsMessage ¶
type PinsMessage struct { // 频道 ID GuildID string `json:"guild_id"` // 子频道 ID ChannelID string `json:"channel_id"` // 消息 ID 数组 MessageIDs []string `json:"message_ids"` }
PinsMessage 精华消息对象
type Post ¶
type Post struct { GuildID string `json:"guild_id"` ChannelID string `json:"channel_id"` AuthorID string `json:"author_id"` PostInfo PostInfo `json:"post_info"` }
Post 帖子事件主体内容
type PostInfo ¶
type PostInfo struct { ThreadID string `json:"thread_id"` PostID string `json:"post_id"` Content string `json:"content"` DateTime string `json:"date_time"` }
PostInfo 帖子内容
type ReactionTarget ¶
type ReactionTarget struct { ID string `json:"id"` Type ReactionTargetType `json:"type"` }
ReactionTarget 表态对象类型
type RecommendChannel ¶
type RecommendChannel struct { ChannelID string `json:"channel_id"` // 子频道 ID Introduce string `json:"introduce"` // 推荐语 }
RecommendChannel 推荐子频道详情
type Reply ¶
type Reply struct { GuildID string `json:"guild_id"` ChannelID string `json:"channel_id"` AuthorID string `json:"author_id"` ReplyInfo ReplyInfo `json:"reply_info"` }
Reply 回复事件主体内容
type ReplyInfo ¶
type ReplyInfo struct { ThreadID string `json:"thread_id"` PostID string `json:"post_id"` ReplyID string `json:"reply_id"` Content string `json:"content"` DateTime string `json:"date_time"` }
ReplyInfo 回复内容
type RichMediaMsgResp ¶
type Role ¶
type Role struct { ID RoleID `json:"id,omitempty"` Name string `json:"name"` Color uint32 `json:"color"` Hoist uint32 `json:"hoist"` MemberCount uint32 `json:"number,omitempty"` // 不会被修改,创建接口修改 MemberLimit uint32 `json:"member_limit,omitempty"` // 不会被修改,创建接口修改 }
Role 频道身份组
type Schedule ¶
type Schedule struct { ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` StartTimestamp string `json:"start_timestamp,omitempty"` EndTimestamp string `json:"end_timestamp,omitempty"` JumpChannelID string `json:"jump_channel_id,omitempty"` RemindType string `json:"remind_type,omitempty"` Creator *Member `json:"creator,omitempty"` }
Schedule 日程对象
type ScheduleWrapper ¶
type ScheduleWrapper struct {
Schedule *Schedule `json:"schedule,omitempty"`
}
ScheduleWrapper 创建、修改日程的中间对象
type SearchInputResolved ¶
type SearchInputResolved struct {
Keyword string `json:"keyword,omitempty"`
}
SearchInputResolved 搜索类型的输入数据
type SearchLayout ¶
type SearchLayout struct { LayoutType LayoutType ActionType ActionType Title string Records []SearchRecord }
SearchLayout 搜索结果的布局
type SearchRecord ¶
type SearchRecord struct { Cover string `json:"cover"` Title string `json:"title"` Tips string `json:"tips"` URL string `json:"url"` }
SearchRecord 每一条搜索结果
type Session ¶
type Session struct { ID string URL string Token token.Token Intent Intent LastSeq uint32 Shards ShardConfig }
Session 连接的 session 结构,包括链接的所有必要字段
type SessionStartLimit ¶
type SessionStartLimit struct { Total uint32 `json:"total"` Remaining uint32 `json:"remaining"` ResetAfter uint32 `json:"reset_after"` MaxConcurrency uint32 `json:"max_concurrency"` }
SessionStartLimit 链接频控信息
type SettingGuide ¶
type SettingGuide struct { // 频道ID, 当通过私信发送设置引导消息时,需要指定guild_id GuildID string `json:"guild_id"` }
SettingGuide 设置引导
type SettingGuideToCreate ¶
type SettingGuideToCreate struct { Content string `json:"content,omitempty"` // 频道内发引导消息可以带@ SettingGuide *SettingGuide `json:"setting_guide,omitempty"` // 设置引导 }
SettingGuideToCreate 发送引导消息的结构体
type ShardConfig ¶
ShardConfig 连接的 shard 配置,ShardID 从 0 开始,ShardCount 最小为 1
type SpeakPermissionType ¶
type SpeakPermissionType int
SpeakPermissionType 发言权限类型定义
const ( SpeakPermissionTypePublic SpeakPermissionType = iota + 1 // 公开发言权限 SpeakPermissionTypeAdminAndMember // 指定成员可发言 )
发言权限类型定义
type Thread ¶
type Thread struct { GuildID string `json:"guild_id"` ChannelID string `json:"channel_id"` AuthorID string `json:"author_id"` ThreadInfo ThreadInfo `json:"thread_info"` }
Thread 主题事件主体内容
type ThreadInfo ¶
type ThreadInfo struct { ThreadID string `json:"thread_id"` Title string `json:"title"` Content string `json:"content"` DateTime string `json:"date_time"` }
ThreadInfo 主题信息
type UpdateChannelPermissions ¶
type UpdateChannelPermissions struct { Add string `json:"add,omitempty"` Remove string `json:"remove,omitempty"` }
UpdateChannelPermissions 修改子频道权限参数
type UpdateGuildMute ¶
type UpdateGuildMute struct { // 禁言截止时间戳,单位秒 MuteEndTimestamp string `json:"mute_end_timestamp,omitempty"` // 禁言多少秒(两个字段二选一,默认以mute_end_timstamp为准) MuteSeconds string `json:"mute_seconds,omitempty"` // 批量禁言的成员列表(全员禁言时不填写该字段) UserIDs []string `json:"user_ids,omitempty"` }
UpdateGuildMute 更新频道相关禁言的Body参数
type UpdateGuildMuteResponse ¶
type UpdateGuildMuteResponse struct { // 批量禁言成功的成员列表 UserIDs []string `json:"user_ids,omitempty"` }
UpdateGuildMuteResponse 批量禁言的回参
type UpdateResult ¶
type UpdateResult struct { RoleID `json:"role_id"` GuildID string `json:"guild_id"` Role *Role `json:"role"` }
UpdateResult 创建,删除等行为的返回
type UpdateRole ¶
type UpdateRole struct { GuildID string `json:"guild_id"` Filter *UpdateRoleFilter `json:"filter"` Update *Role `json:"info"` }
UpdateRole role 更新请求承载
type UpdateRoleFilter ¶
type UpdateRoleFilter struct { Name uint32 `json:"name"` Color uint32 `json:"color"` Hoist uint32 `json:"hoist"` }
UpdateRoleFilter 身份组可更改数据,修改的
type UpdateRoleInfo ¶
type UpdateRoleInfo struct { Name string `json:"name"` Color uint32 `json:"color"` Hoist uint32 `json:"hoist"` }
UpdateRoleInfo 身份组可更改数据
type User ¶
type User struct { ID string `json:"id"` Username string `json:"username"` Avatar string `json:"avatar"` Bot bool `json:"bot"` UnionOpenID string `json:"union_openid"` // 特殊关联应用的 openid UnionUserAccount string `json:"union_user_account"` // 机器人关联的用户信息,与union_openid关联的应用是同一个 }
User 用户
type WSC2CMessageData ¶
type WSC2CMessageData C2CMessage
type WSDirectMessageDeleteData ¶
type WSDirectMessageDeleteData MessageDelete
WSDirectMessageDeleteData 私信消息 payload
type WSFriendAddData ¶ added in v0.0.2
type WSFriendAddData FriendAddEvent
type WSFriendDelData ¶ added in v0.0.2
type WSFriendDelData FriendDelEvent
type WSFriendMsgRejectData ¶ added in v0.0.2
type WSFriendMsgRejectData FriendMsgRejectEvent
type WSFriendMsgReveiceData ¶ added in v0.0.2
type WSFriendMsgReveiceData FriendMsgReceiveEvent
type WSGroupATMessageData ¶
type WSGroupATMessageData GroupMessage
type WSGroupAddRobotData ¶ added in v0.0.2
type WSGroupAddRobotData GroupAddRobotEvent
type WSGroupDelRobotData ¶ added in v0.0.2
type WSGroupDelRobotData GroupDelRobotEvent
type WSGroupMessageData ¶
type WSGroupMessageData GroupMessage
type WSGroupMsgReceiveData ¶ added in v0.0.2
type WSGroupMsgReceiveData GroupMsgReceiveEvent
type WSGroupMsgRejectData ¶ added in v0.0.2
type WSGroupMsgRejectData GroupMsgRejectEvent
type WSHelloData ¶
type WSHelloData struct {
HeartbeatInterval int `json:"heartbeat_interval"`
}
WSHelloData hello 返回
type WSIdentityData ¶
type WSIdentityData struct { Token string `json:"token"` Intents Intent `json:"intents"` Shard []uint32 `json:"shard"` // array of two integers (shard_id, num_shards) Properties struct { Os string `json:"$os,omitempty"` Browser string `json:"$browser,omitempty"` Device string `json:"$device,omitempty"` } `json:"properties,omitempty"` }
WSIdentityData 鉴权数据
type WSMessageReactionData ¶
type WSMessageReactionData MessageReaction
WSMessageReactionData 表情表态事件
type WSPayload ¶
type WSPayload struct { WSPayloadBase Data interface{} `json:"d,omitempty"` RawMessage []byte `json:"-"` // 原始的 message 数据 }
WSPayload websocket 消息结构
type WSPayloadBase ¶
type WSPayloadBase struct { OPCode OPCode `json:"op"` Seq uint32 `json:"s,omitempty"` Type EventType `json:"t,omitempty"` }
WSPayloadBase 基础消息结构,排除了 data
type WSPublicMessageDeleteData ¶
type WSPublicMessageDeleteData MessageDelete
WSPublicMessageDeleteData 公域机器人的消息删除 payload
type WSReadyData ¶
type WSReadyData struct { Version int `json:"version"` SessionID string `json:"session_id"` User struct { ID string `json:"id"` Username string `json:"username"` Bot bool `json:"bot"` } `json:"user"` Shard []uint32 `json:"shard"` }
WSReadyData ready,鉴权后返回
type WSResumeData ¶
type WSResumeData struct { Token string `json:"token"` SessionID string `json:"session_id"` Seq uint32 `json:"seq"` }
WSResumeData 重连数据
type WSUser ¶
type WSUser struct { ID string `json:"id"` Username string `json:"username"` Bot bool `json:"bot"` }
WSUser 当前连接的用户信息
type WebsocketAP ¶
type WebsocketAP struct { URL string `json:"url"` Shards uint32 `json:"shards"` SessionStartLimit SessionStartLimit `json:"session_start_limit"` }
WebsocketAP wss 接入点信息
Source Files ¶
- announces.go
- api_permissions.go
- audio.go
- c2c.go
- channel.go
- channel_permissions.go
- direct_message.go
- dto.go
- duration.go
- emoji.go
- forum.go
- group.go
- guild.go
- http_gateway.go
- interaction.go
- interaction_search.go
- member.go
- message.go
- message_ark.go
- message_audit.go
- message_create.go
- message_delete.go
- message_reaction.go
- message_setting.go
- mute.go
- pager.go
- pins.go
- role.go
- schedule.go
- timestamp.go
- user.go
- websocket.go
- websocket_event.go
- websocket_intent.go
- websocket_opcode.go
- websocket_payload.go