Documentation
¶
Index ¶
- type AddReactionReq
- type AssetCreateReq
- type AssetCreateResp
- type Badge
- type BadgeListResp
- type BaseResponse
- type Blacklist
- type BlacklistListResp
- type Card
- type CardBuilder
- func (b *CardBuilder) AddContextKmarkdown(text string) *CardBuilder
- func (b *CardBuilder) AddDivider() *CardBuilder
- func (b *CardBuilder) AddHeader(text string) *CardBuilder
- func (b *CardBuilder) AddSectionKmarkdown(text string) *CardBuilder
- func (b *CardBuilder) AddSectionText(text string) *CardBuilder
- func (b *CardBuilder) Build() Card
- func (b *CardBuilder) Size(s CardSize) *CardBuilder
- func (b *CardBuilder) Theme(t CardTheme) *CardBuilder
- type CardMessage
- type CardMessageBuilder
- type CardSize
- type CardTheme
- type Channel
- type ChannelListResp
- type ChannelUser
- type ChannelUserListResp
- type CreateChannelReq
- type CreateDirectMessageReq
- type CreateDirectMessageResp
- type CreateGuildRoleReq
- type CreateMessageRequest
- type CreateMessageResp
- type DeleteChannelReq
- type DeleteDirectMessageReq
- type DeleteGuildRoleReq
- type DeleteReactionReq
- type DirectMessage
- type DirectMessageListResp
- type ElementButton
- type ElementImage
- type ElementText
- type ElementType
- type Emoji
- type GameActivityReq
- type GrantRoleReq
- type Guild
- type GuildEmoji
- type GuildEmojiListResp
- type GuildListResp
- type GuildRole
- type GuildRoleListResp
- type GuildUser
- type GuildUserListResp
- type IntimacyUpdateReq
- type Invite
- type InviteListResp
- type JoinVoiceReq
- type JoinVoiceResp
- type KickoutUserReq
- type LeaveVoiceReq
- type MentionInfo
- type MentionUser
- type Message
- type MessageDeleteReq
- type MessageListResp
- type MessageUpdateReq
- type Meta
- type ModuleActionGroup
- type ModuleContext
- type ModuleDivider
- type ModuleHeader
- type ModuleSection
- type ModuleType
- type MoveUserReq
- type Quote
- type Reaction
- type RevokeRoleReq
- type Role
- type Sort
- type UpdateChannelReq
- type UpdateDirectMessageReq
- type UpdateGuildRoleReq
- type User
- type UserMeResp
- type UserViewResp
- type ViewChannelOption
- type ViewChannelResp
- type VoiceChannel
- type VoiceListResp
- type WebhookData
- type WebhookRequest
- type WebhookResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddReactionReq ¶ added in v0.0.14
type AssetCreateReq ¶ added in v0.0.14
type AssetCreateReq struct {
File []byte `json:"file"` // 需要特殊处理 multipart
}
type AssetCreateResp ¶ added in v0.0.14
type AssetCreateResp struct {
Url string `json:"url"`
}
type BadgeListResp ¶ added in v0.0.14
type BadgeListResp struct {
Items []Badge `json:"items"`
}
type BaseResponse ¶
type BlacklistListResp ¶ added in v0.0.14
type CardBuilder ¶ added in v0.0.15
type CardBuilder struct {
// contains filtered or unexported fields
}
CardBuilder builds a single card
func NewCardBuilder ¶ added in v0.0.15
func NewCardBuilder() *CardBuilder
func (*CardBuilder) AddContextKmarkdown ¶ added in v0.0.15
func (b *CardBuilder) AddContextKmarkdown(text string) *CardBuilder
func (*CardBuilder) AddDivider ¶ added in v0.0.15
func (b *CardBuilder) AddDivider() *CardBuilder
func (*CardBuilder) AddHeader ¶ added in v0.0.15
func (b *CardBuilder) AddHeader(text string) *CardBuilder
func (*CardBuilder) AddSectionKmarkdown ¶ added in v0.0.15
func (b *CardBuilder) AddSectionKmarkdown(text string) *CardBuilder
func (*CardBuilder) AddSectionText ¶ added in v0.0.15
func (b *CardBuilder) AddSectionText(text string) *CardBuilder
func (*CardBuilder) Build ¶ added in v0.0.15
func (b *CardBuilder) Build() Card
func (*CardBuilder) Size ¶ added in v0.0.15
func (b *CardBuilder) Size(s CardSize) *CardBuilder
func (*CardBuilder) Theme ¶ added in v0.0.15
func (b *CardBuilder) Theme(t CardTheme) *CardBuilder
type CardMessage ¶ added in v0.0.15
type CardMessage []Card
CardMessage is an array of cards
func (CardMessage) String ¶ added in v0.0.15
func (m CardMessage) String() string
type CardMessageBuilder ¶ added in v0.0.15
type CardMessageBuilder struct {
// contains filtered or unexported fields
}
CardMessageBuilder builds a card message
func NewCardMessageBuilder ¶ added in v0.0.15
func NewCardMessageBuilder() *CardMessageBuilder
func (*CardMessageBuilder) AddCard ¶ added in v0.0.15
func (b *CardMessageBuilder) AddCard(card Card) *CardMessageBuilder
func (*CardMessageBuilder) Build ¶ added in v0.0.15
func (b *CardMessageBuilder) Build() string
type Channel ¶ added in v0.0.14
type Channel struct {
Id string `json:"id,omitempty"` // 频道 id
GuildId string `json:"guild_id,omitempty"` // 服务器 id
UserId string `json:"user_id,omitempty"` // 频道创建者 id
ParentId string `json:"parent_id,omitempty"` // 父分组频道 id
Name string `json:"name,omitempty"` // 频道名称
Topic string `json:"topic,omitempty"` // 频道简介
ChannelType int `json:"type,omitempty"` // 频道类型,0 分组,1 文字,2 语音
Level int `json:"level,omitempty"` // 频道排序
SlowMode int `json:"slow_mode,omitempty"` // 慢速限制,用户发送消息之后再次发送消息的等待时间,单位秒
HasPassword bool `json:"has_password,omitempty"` // 是否已设置密码
LimitAmount int `json:"limit_amount,omitempty"` // 人数限制
IsCategory bool `json:"is_category,omitempty"` // 是否为分组类型
PermissionSync int `json:"permission_sync,omitempty"` // 是否与分组频道同步权限
VoiceQuality string `json:"voice_quality,omitempty"` // 语音频道质量级别,1 流畅,2 正常,3 高质量
ServerUrl string `json:"server_url,omitempty"` // 语音服务器地址,HOST:PORT/PATH 的格式
Children []Channel `json:"children,omitempty"` // 子频道列表,API 返回的 View 详情中可能是 Channel 对象列表
}
type ChannelListResp ¶ added in v0.0.14
type ChannelUser ¶ added in v0.0.14
type ChannelUserListResp ¶ added in v0.0.14
type ChannelUserListResp struct {
Items []ChannelUser `json:"items"`
Meta Meta `json:"meta"`
}
type CreateChannelReq ¶ added in v0.0.14
type CreateChannelReq struct {
GuildId string `json:"guild_id"`
Name string `json:"name"`
Type int `json:"type,omitempty"`
ParentId string `json:"parent_id,omitempty"`
LimitAmount int `json:"limit_amount,omitempty"`
VoiceQuality string `json:"voice_quality,omitempty"`
IsCategory int `json:"is_category,omitempty"` // 1 是, 0 否
}
type CreateDirectMessageReq ¶ added in v0.0.14
type CreateDirectMessageResp ¶ added in v0.0.14
type CreateGuildRoleReq ¶ added in v0.0.14
type CreateMessageRequest ¶ added in v0.0.13
type CreateMessageRequest struct {
MessageType int `json:"type"` // 否 POST 消息类型, 见[type], 不传默认为 9, 代表kmarkdown。 9 代表 kmarkdown 消息, 10 代表卡片消息。
TargetId string `json:"target_id"` // 是 POST 目标频道 id
Content string `json:"content"` // 是 POST 消息内容
Quote string `json:"quote,omitempty"` // 否 POST 回复某条消息的 msgId
Nonce string `json:"nonce,omitempty"` // 否 POST nonce, 服务端不做处理, 原样返回
TempTargetId string `json:"temp_target_id,omitempty"` // 否 POST 用户 id,如果传了,代表该消息是临时消息,该消息不会存数据库,但是会在频道内只给该用户推送临时消息。用于在频道内针对用户的操作进行单独的回应通知等。
TemplateId string `json:"template_id,omitempty"` // 否 POST 模板消息id, 如果使用了,content会作为模板消息的input,参见模板消息
ReplyMsgId string `json:"reply_msg_id,omitempty"` // 否 POST 当前消息回复的用户5分钟内发送到相同频道的消息的msg_id,如果是当前开发者的第一次回复,扣减当日发送量按n分之一条计算
}
type CreateMessageResp ¶ added in v0.0.13
type DeleteChannelReq ¶ added in v0.0.14
type DeleteChannelReq struct {
ChannelId string `json:"channel_id"`
}
type DeleteDirectMessageReq ¶ added in v0.0.14
type DeleteDirectMessageReq struct {
MsgId string `json:"msg_id"`
}
type DeleteGuildRoleReq ¶ added in v0.0.14
type DeleteReactionReq ¶ added in v0.0.14
type DirectMessage ¶ added in v0.0.14
type DirectMessageListResp ¶ added in v0.0.14
type DirectMessageListResp struct {
Items []DirectMessage `json:"items"`
}
type ElementButton ¶ added in v0.0.15
type ElementButton struct {
Type ElementType `json:"type"`
Theme CardTheme `json:"theme,omitempty"`
Value string `json:"value"`
Click string `json:"click,omitempty"` // link, return-val
Text ElementText `json:"text"`
}
type ElementImage ¶ added in v0.0.15
type ElementImage struct {
Type ElementType `json:"type"`
Src string `json:"src"`
Alt string `json:"alt,omitempty"`
Size string `json:"size,omitempty"` // sm, lg
Circle bool `json:"circle,omitempty"`
}
type ElementText ¶ added in v0.0.15
type ElementText struct {
Type ElementType `json:"type"`
Content string `json:"content"`
}
type ElementType ¶ added in v0.0.15
type ElementType string
const ( ElementTypePlainText ElementType = "plain-text" ElementTypeKMarkdown ElementType = "kmarkdown" ElementTypeImage ElementType = "image" ElementTypeButton ElementType = "button" ElementTypeParagraph ElementType = "paragraph" )
type GameActivityReq ¶ added in v0.0.14
type GameActivityReq struct {
Id int `json:"id"`
DataType int `json:"data_type"` // 1: 进程名称, 2: 游戏名称
Name string `json:"name"`
Icon string `json:"icon,omitempty"`
}
Game
type GrantRoleReq ¶ added in v0.0.14
type Guild ¶ added in v0.0.14
type Guild struct {
Id string `json:"id"`
Name string `json:"name"`
Topic string `json:"topic"`
UserId string `json:"user_id"`
Icon string `json:"icon"`
NotifyType int `json:"notify_type"`
Region string `json:"region"`
EnableOpen bool `json:"enable_open"`
OpenId string `json:"open_id"`
DefaultChannelId string `json:"default_channel_id"`
WelcomeChannelId string `json:"welcome_channel_id"`
BoostNum int `json:"boost_num"`
Level int `json:"level"`
Roles []Role `json:"roles,omitempty"`
Channels []Channel `json:"channels,omitempty"`
}
type GuildEmoji ¶ added in v0.0.14
Emoji
type GuildEmojiListResp ¶ added in v0.0.14
type GuildEmojiListResp struct {
Items []GuildEmoji `json:"items"`
}
type GuildListResp ¶ added in v0.0.14
type GuildRoleListResp ¶ added in v0.0.14
type GuildRoleListResp struct {
Items []GuildRole `json:"items"`
}
type GuildUser ¶ added in v0.0.14
type GuildUser struct {
Id string `json:"id"`
Username string `json:"username"`
IdentifyNum string `json:"identify_num"`
Online bool `json:"online"`
Status int `json:"status"`
Bot bool `json:"bot"`
Avatar string `json:"avatar"`
VipAvatar string `json:"vip_avatar"`
Nickname string `json:"nickname"`
Roles []int `json:"roles"`
}
type GuildUserListResp ¶ added in v0.0.14
type IntimacyUpdateReq ¶ added in v0.0.14
type IntimacyUpdateReq struct {
UserId string `json:"user_id"`
Score int `json:"score,omitempty"`
SocialInfo string `json:"social_info,omitempty"`
ImgUrl string `json:"img_url,omitempty"`
}
Intimacy
type Invite ¶ added in v0.0.14
type Invite struct {
UrlCode string `json:"url_code"`
Url string `json:"url"`
GuildId string `json:"guild_id"`
ChannelId string `json:"channel_id"`
ExpireTime int `json:"expire_time"`
PeopleUses int `json:"people_uses"`
}
Invite
type InviteListResp ¶ added in v0.0.14
type JoinVoiceReq ¶ added in v0.0.14
type JoinVoiceResp ¶ added in v0.0.14
type KickoutUserReq ¶ added in v0.0.14
type LeaveVoiceReq ¶ added in v0.0.14
type LeaveVoiceReq struct {
ChannelId string `json:"channel_id"`
}
type MentionInfo ¶ added in v0.0.14
type MentionInfo struct {
MentionPart []MentionUser `json:"mention_part"`
MentionRolePart []Role `json:"mention_role_part"`
}
type MentionUser ¶ added in v0.0.14
type Message ¶ added in v0.0.14
type Message struct {
Id string `json:"id"`
Type int `json:"type"`
Content string `json:"content"`
Mention []string `json:"mention"`
MentionAll bool `json:"mention_all"`
MentionRoles []int `json:"mention_roles"` // API docs say array of role IDs
MentionHere bool `json:"mention_here"`
Embeds []any `json:"embeds"` // 复杂结构,暂时使用 any
Attachments any `json:"attachments"`
CreateAt int64 `json:"create_at"`
UpdatedAt int64 `json:"updated_at"`
Reactions []Reaction `json:"reactions"`
Author User `json:"author"`
ImageName string `json:"image_name"`
ReadStatus bool `json:"read_status"`
Quote *Quote `json:"quote"`
MentionInfo *MentionInfo `json:"mention_info"`
}
type MessageDeleteReq ¶ added in v0.0.14
type MessageDeleteReq struct {
MsgId string `json:"msg_id"`
}
type MessageListResp ¶ added in v0.0.14
type MessageListResp struct {
Items []Message `json:"items"`
}
type MessageUpdateReq ¶ added in v0.0.14
type ModuleActionGroup ¶ added in v0.0.15
type ModuleActionGroup struct {
Type ModuleType `json:"type"`
Elements []any `json:"elements"`
}
type ModuleContext ¶ added in v0.0.15
type ModuleContext struct {
Type ModuleType `json:"type"`
Elements []any `json:"elements"`
}
type ModuleDivider ¶ added in v0.0.15
type ModuleDivider struct {
Type ModuleType `json:"type"`
}
type ModuleHeader ¶ added in v0.0.15
type ModuleHeader struct {
Type ModuleType `json:"type"`
Text ElementText `json:"text"`
}
type ModuleSection ¶ added in v0.0.15
type ModuleSection struct {
Type ModuleType `json:"type"`
Text any `json:"text,omitempty"` // ElementText or ElementParagraph
Mode string `json:"mode,omitempty"` // right, left, hidden
Accessory any `json:"accessory,omitempty"`
}
type ModuleType ¶ added in v0.0.15
type ModuleType string
const ( ModuleTypeHeader ModuleType = "header" ModuleTypeSection ModuleType = "section" ModuleTypeImageGroup ModuleType = "image-group" ModuleTypeContainer ModuleType = "container" ModuleTypeActionGroup ModuleType = "action-group" ModuleTypeContext ModuleType = "context" ModuleTypeDivider ModuleType = "divider" ModuleTypeFile ModuleType = "file" ModuleTypeAudio ModuleType = "audio" ModuleTypeVideo ModuleType = "video" ModuleTypeCountdown ModuleType = "countdown" ModuleTypeInvite ModuleType = "invite" )
type MoveUserReq ¶ added in v0.0.14
type RevokeRoleReq ¶ added in v0.0.14
type UpdateChannelReq ¶ added in v0.0.14
type UpdateChannelReq struct {
ChannelId string `json:"channel_id"`
Name string `json:"name,omitempty"`
Topic string `json:"topic,omitempty"`
SlowMode int `json:"slow_mode,omitempty"`
LimitAmount int `json:"limit_amount,omitempty"`
VoiceQuality string `json:"voice_quality,omitempty"`
Password string `json:"password,omitempty"`
}
type UpdateDirectMessageReq ¶ added in v0.0.14
type UpdateGuildRoleReq ¶ added in v0.0.14
type UpdateGuildRoleReq struct {
GuildId string `json:"guild_id"`
RoleId int `json:"role_id"`
Name string `json:"name,omitempty"`
Color int `json:"color,omitempty"`
Position int `json:"position,omitempty"`
Hoist int `json:"hoist,omitempty"`
Mentionable int `json:"mentionable,omitempty"`
Permissions int `json:"permissions,omitempty"`
}
type UserMeResp ¶ added in v0.0.14
type UserMeResp = User // Reusing User struct
type UserViewResp ¶ added in v0.0.14
type UserViewResp = User
type ViewChannelOption ¶ added in v0.0.13
type ViewChannelOption struct {
NeedChildren bool
}
type ViewChannelResp ¶ added in v0.0.13
type ViewChannelResp = Channel
type VoiceChannel ¶ added in v0.0.14
type VoiceListResp ¶ added in v0.0.14
type VoiceListResp struct {
Items []VoiceChannel `json:"items"`
Meta Meta `json:"meta"`
}
type WebhookData ¶ added in v0.0.14
type WebhookData struct {
Type int `json:"type"`
ChannelType string `json:"channel_type"`
TargetId string `json:"target_id"`
AuthorId string `json:"author_id"`
Content string `json:"content"`
MsgId string `json:"msg_id"`
MsgTimestamp int64 `json:"msg_timestamp"`
Nonce string `json:"nonce"`
Extra json.RawMessage `json:"extra"` // 不同的消息类型,结构不一致
VerifyToken string `json:"verify_token"` // 机器人的 verify token
Challenge string `json:"challenge"` // 客户端需要原样返回的 Challenge 值
}
type WebhookRequest ¶ added in v0.0.14
type WebhookRequest struct {
S int `json:"s"` // 信令类型
D *WebhookData `json:"d"` // 数据
Encrypt string `json:"encrypt,omitempty"`
}
type WebhookResponse ¶ added in v0.0.14
type WebhookResponse struct {
Challenge string `json:"challenge"`
}
Click to show internal directories.
Click to hide internal directories.