model

package
v0.0.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 12, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddReactionReq added in v0.0.14

type AddReactionReq struct {
	MsgId string `json:"msg_id"`
	Emoji string `json:"emoji"`
}

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 Badge added in v0.0.14

type Badge struct {
	Id   string `json:"id"`
	Name string `json:"name"`
	Icon string `json:"icon"`
}

Badge

type BadgeListResp added in v0.0.14

type BadgeListResp struct {
	Items []Badge `json:"items"`
}

type BaseResponse

type BaseResponse struct {
	Message string         `json:"message"`
	Code    int32          `json:"code"`
	Data    map[string]any `json:"data"`
}

type Blacklist added in v0.0.14

type Blacklist struct {
	UserId   string `json:"user_id"`
	CreateAt int64  `json:"create_at"`
}

Blacklist

type BlacklistListResp added in v0.0.14

type BlacklistListResp struct {
	Items []Blacklist `json:"items"`
	Meta  Meta        `json:"meta"`
}

type Card added in v0.0.15

type Card struct {
	Type    string    `json:"type"`
	Theme   CardTheme `json:"theme,omitempty"`
	Size    CardSize  `json:"size,omitempty"`
	Modules []any     `json:"modules"`
}

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 CardSize added in v0.0.15

type CardSize string
const (
	CardSizeLg CardSize = "lg"
	CardSizeSm CardSize = "sm"
)

type CardTheme added in v0.0.15

type CardTheme string
const (
	CardThemePrimary   CardTheme = "primary"
	CardThemeSuccess   CardTheme = "success"
	CardThemeDanger    CardTheme = "danger"
	CardThemeWarning   CardTheme = "warning"
	CardThemeInfo      CardTheme = "info"
	CardThemeSecondary CardTheme = "secondary"
	CardThemeNone      CardTheme = "none"
)

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 ChannelListResp struct {
	Items []Channel `json:"items"`
	Meta  Meta      `json:"meta"`
	Sort  Sort      `json:"sort"`
}

type ChannelUser added in v0.0.14

type ChannelUser struct {
	Id       string `json:"id"`
	Username string `json:"username"`
	Avatar   string `json:"avatar"`
	Online   bool   `json:"online"`
}

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 CreateDirectMessageReq struct {
	Type     int    `json:"type,omitempty"`
	TargetId string `json:"target_id,omitempty"` // 用户 ID
	ChatCode string `json:"chat_code,omitempty"`
	Content  string `json:"content"`
	Quote    string `json:"quote,omitempty"`
	Nonce    string `json:"nonce,omitempty"`
}

type CreateDirectMessageResp added in v0.0.14

type CreateDirectMessageResp struct {
	MsgId        string `json:"msg_id"`
	MsgTimestamp int64  `json:"msg_timestamp"`
	Nonce        string `json:"nonce"`
}

type CreateGuildRoleReq added in v0.0.14

type CreateGuildRoleReq struct {
	GuildId string `json:"guild_id"`
	Name    string `json:"name,omitempty"`
}

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 CreateMessageResp struct {
	MsgId        string `json:"msg_id"`
	MsgTimestamp int64  `json:"msg_timestamp"`
	Nonce        string `json:"nonce"`
}

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 DeleteGuildRoleReq struct {
	GuildId string `json:"guild_id"`
	RoleId  int    `json:"role_id"`
}

type DeleteReactionReq added in v0.0.14

type DeleteReactionReq struct {
	MsgId  string `json:"msg_id"`
	Emoji  string `json:"emoji"`
	UserId string `json:"user_id,omitempty"`
}

type DirectMessage added in v0.0.14

type DirectMessage struct {
	Id         string     `json:"id"`
	Type       int        `json:"type"`
	Content    string     `json:"content"`
	AuthorId   string     `json:"author_id"`
	CreateAt   int64      `json:"create_at"`
	Reactions  []Reaction `json:"reactions"`
	ReadStatus bool       `json:"read_status"`
}

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 Emoji added in v0.0.14

type Emoji struct {
	Id   string `json:"id"`
	Name string `json:"name"`
}

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 GrantRoleReq struct {
	GuildId string `json:"guild_id"`
	RoleId  int    `json:"role_id"`
	UserId  string `json:"user_id"`
}

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

type GuildEmoji struct {
	Name string `json:"name"`
	Id   string `json:"id"`
	User User   `json:"user"`
}

Emoji

type GuildEmojiListResp added in v0.0.14

type GuildEmojiListResp struct {
	Items []GuildEmoji `json:"items"`
}

type GuildListResp added in v0.0.14

type GuildListResp struct {
	Items []Guild `json:"items"`
	Meta  Meta    `json:"meta"`
	Sort  Sort    `json:"sort"`
}

type GuildRole added in v0.0.14

type GuildRole struct {
	RoleId      int    `json:"role_id"`
	Name        string `json:"name"`
	Color       int    `json:"color"`
	Position    int    `json:"position"`
	Hoist       int    `json:"hoist"`
	Mentionable int    `json:"mentionable"`
	Permissions int    `json:"permissions"`
}

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 GuildUserListResp struct {
	Items        []GuildUser `json:"items"`
	Meta         Meta        `json:"meta"`
	Sort         Sort        `json:"sort"`
	UserCount    int         `json:"user_count"`
	OnlineCount  int         `json:"online_count"`
	OfflineCount int         `json:"offline_count"`
}

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 InviteListResp struct {
	Items []Invite `json:"items"`
	Meta  Meta     `json:"meta"`
}

type JoinVoiceReq added in v0.0.14

type JoinVoiceReq struct {
	ChannelId string `json:"channel_id"`
	Password  string `json:"password,omitempty"`
}

type JoinVoiceResp added in v0.0.14

type JoinVoiceResp struct {
	Ip        string `json:"ip"`
	Port      string `json:"port"`
	RtcpPort  string `json:"rtcp_port"`
	RtcpMux   bool   `json:"rtcp_mux"`
	Bitrate   int    `json:"bitrate"`
	AudioSsrc string `json:"audio_ssrc"`
	AudioPt   string `json:"audio_pt"`
}

type KickoutUserReq added in v0.0.14

type KickoutUserReq struct {
	TargetId string   `json:"target_id"`
	UserIds  []string `json:"user_ids"`
}

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 MentionUser struct {
	Id       string `json:"id"`
	Username string `json:"username"`
	FullName string `json:"full_name"`
	Avatar   string `json:"avatar"`
}

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 MessageUpdateReq struct {
	MsgId        string `json:"msg_id"`
	Content      string `json:"content"`
	Quote        string `json:"quote,omitempty"`
	TempTargetId string `json:"temp_target_id,omitempty"`
}

type Meta added in v0.0.14

type Meta struct {
	Page      int `json:"page"`
	PageTotal int `json:"page_total"`
	PageSize  int `json:"page_size"`
	Total     int `json:"total"`
}

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 MoveUserReq struct {
	TargetId string   `json:"target_id"`
	UserIds  []string `json:"user_ids"`
}

type Quote added in v0.0.14

type Quote struct {
	Id       string `json:"id"`
	Type     int    `json:"type"`
	Content  string `json:"content"`
	CreateAt int64  `json:"create_at"`
	Author   User   `json:"author"`
}

type Reaction added in v0.0.14

type Reaction struct {
	Emoji Emoji `json:"emoji"`
	Count int   `json:"count"`
	Me    bool  `json:"me"`
}

type RevokeRoleReq added in v0.0.14

type RevokeRoleReq struct {
	GuildId string `json:"guild_id"`
	RoleId  int    `json:"role_id"`
	UserId  string `json:"user_id"`
}

type Role added in v0.0.14

type Role struct {
	RoleId      int    `json:"role_id"`
	Name        string `json:"name"`
	Color       int    `json:"color"`
	Position    int    `json:"position"`
	Hoist       int    `json:"hoist"`
	Mentionable int    `json:"mentionable"`
	Permissions int    `json:"permissions"`
}

type Sort added in v0.0.14

type Sort struct {
	Id int `json:"id"`
}

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 UpdateDirectMessageReq struct {
	MsgId   string `json:"msg_id"`
	Content string `json:"content"`
	Quote   string `json:"quote,omitempty"`
}

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 User added in v0.0.14

type User struct {
	Id          string `json:"id"`
	Username    string `json:"username"`
	IdentifyNum string `json:"identify_num,omitempty"`
	Online      bool   `json:"online"`
	Avatar      string `json:"avatar"`
	Bot         bool   `json:"bot"`
	Nickname    string `json:"nickname,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 VoiceChannel struct {
	Id       string `json:"id"`
	GuildId  string `json:"guild_id"`
	ParentId string `json:"parent_id"`
	Name     string `json:"name"`
}

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"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL