model

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ThemeTypeSecondary CardThemeType = "secondary"
	ThemeTypePrimary   CardThemeType = "primary"
	ThemeTypeSuccess   CardThemeType = "success"
	ThemeTypeDanger    CardThemeType = "danger"
	ThemeTypeWarning   CardThemeType = "warning"
	ThemeTypeInfo      CardThemeType = "info"
	ThemeTypeNone      CardThemeType = "none"

	SizeXs CardSize = "xs"
	SizeSm CardSize = "sm"
	SizeMd CardSize = "md"
	SizeLg CardSize = "lg"
)
View Source
const StatusBan = 10

Variables

This section is empty.

Functions

This section is empty.

Types

type AssetResp added in v1.4.0

type AssetResp struct {
	Url string `json:"url"`
}

===== Asset =====

type CardMessage

type CardMessage CardModule

type CardMessageReq

type CardMessageReq []*CardMessage

Card Message

type CardModule

type CardModule struct {
	Type      string        `json:"type"`
	Theme     CardThemeType `json:"theme,omitempty"`
	Title     string        `json:"title,omitempty"`
	Text      CardText      `json:"text,omitempty"`
	Size      CardSize      `json:"size,omitempty"`
	Modules   []CardModule  `json:"modules,omitempty"`
	Fields    []CardModule  `json:"fields,omitempty"`
	Elements  []CardModule  `json:"elements,omitempty"`
	Content   string        `json:"content,omitempty"`
	Mode      string        `json:"mode,omitempty"`
	Accessory *CardModule   `json:"accessory,omitempty"`
	Value     string        `json:"value,omitempty"`
	Cover     string        `json:"cover,omitempty"`
	Click     string        `json:"click,omitempty"`
	Code      string        `json:"code,omitempty"`
	Circle    bool          `json:"circle,omitempty"`
	Src       string        `json:"src,omitempty"`
	StartTime int64         `json:"startTime,omitempty"`
	EndTime   int64         `json:"endTime,omitempty"`
}

func NewCard

func NewCard(theme CardThemeType, size CardSize) *CardModule

func NewComment

func NewComment(elements []CardModule) *CardModule

func NewCountdownDay

func NewCountdownDay(endTime time.Time) *CardModule

func NewCountdownHour

func NewCountdownHour(endTime *time.Time) *CardModule

func NewCountdownSecond

func NewCountdownSecond(startTime, endTime *time.Time) *CardModule

func NewDivider

func NewDivider() *CardModule

func NewImage

func NewImage(src string) *CardModule

func NewImageGroup

func NewImageGroup(src []string) *CardModule

func NewInvite added in v1.5.0

func NewInvite(code string) *CardModule

func NewKMarkdown

func NewKMarkdown(content string) *CardModule

func NewMultiLinesKMarkdown

func NewMultiLinesKMarkdown(lines []string) *CardModule

func NewRightImgKMarkdown

func NewRightImgKMarkdown(content, src string) *CardModule

func NewText

func NewText(content string) *CardModule

func NewTextHeader

func NewTextHeader(content string) *CardModule

type CardSize

type CardSize string

type CardText

type CardText struct {
	Type    string     `json:"type,omitempty"`
	Content string     `json:"content,omitempty"`
	Cols    int        `json:"cols,omitempty"`
	Fields  []CardText `json:"fields,omitempty"`
}

type CardThemeType

type CardThemeType string

type Channel

type Channel struct {
	Id                   string      `json:"id"`
	Name                 string      `json:"name"`
	UserId               string      `json:"user_id"`
	GuildId              string      `json:"guild_id"`
	Topic                string      `json:"topic"`
	IsCategory           bool        `json:"is_category"`
	ParentId             string      `json:"parent_id"`
	Level                int         `json:"level"`
	SlowMode             int         `json:"slow_mode"`
	Type                 ChannelType `json:"type"`
	PermissionOverwrites []any       `json:"permission_overwrites"`
	PermissionUsers      []any       `json:"permission_users"`
	PermissionSync       int         `json:"permission_sync"`
	HasPassword          bool        `json:"has_password"`
}

type ChannelEventType

type ChannelEventType string
const (
	ChannelEventTypeGroup     ChannelEventType = "GROUP"
	ChannelEventTypePerson    ChannelEventType = "PERSON"
	ChannelEventTypeBroadcast ChannelEventType = "BROADCAST"
)

type ChannelInfo

type ChannelInfo struct {
	ChannelId   string      `json:"id"`
	UserId      string      `json:"user_id"`
	ParentId    string      `json:"parent_id"`
	Name        string      `json:"name"`
	Type        ChannelType `json:"type"`
	Level       int         `json:"level"`
	LimitAmount int         `json:"limit_amount"`
	IsCategory  bool        `json:"is_category"`
}

type ChannelListResp

type ChannelListResp struct {
	WebResult
	Data *ChannelResp `json:"data"`
}

==== Channel ====

type ChannelResp

type ChannelResp struct {
	Channels []*ChannelInfo `json:"items"`
	Meta     PageMeta       `json:"meta"`
}

type ChannelType

type ChannelType int
const (
	ChannelTypeText  ChannelType = 0
	ChannelTypeVoice ChannelType = 1
)

type Event

type Event struct {
	ChannelType  ChannelEventType `json:"channel_type"`
	EventType    EventType        `json:"type"`
	TargetId     string           `json:"target_id"`
	AuthorId     string           `json:"author_id"`
	Content      string           `json:"content"`
	MsgId        string           `json:"msg_id"`
	MsgTimestamp int              `json:"msg_timestamp"`
	Nonce        string           `json:"nonce"`
	Extra        interface{}      `json:"extra"`
}

func (*Event) GetSystemExtra

func (e *Event) GetSystemExtra() *SystemExtra

func (*Event) GetUserExtra

func (e *Event) GetUserExtra() *UserExtra

type EventType

type EventType int
const (
	EventTypeText      EventType = 1
	EventTypePicture   EventType = 2
	EventTypeVideo     EventType = 3
	EventTypeFile      EventType = 4
	EventTypeVoice     EventType = 8
	EventTypeKMarkdown EventType = 9
	EventTypeCard      EventType = 10
	EventTypeSystem    EventType = 255
)

type ExitedChannel added in v1.3.0

type ExitedChannel struct {
	UserId    string `json:"user_id" mapstructure:"user_id"`
	ChannelId string `json:"channel_id" mapstructure:"channel_id"`
	ExitedAt  int    `json:"exited_at" mapstructure:"exited_at"`
}

用户退出语音频道

type GatewayInfo

type GatewayInfo struct {
	Url string `json:"url"`
}

GatewayInfo Get gateway resp

type GatewayResp

type GatewayResp struct {
	WebResult
	GatewayInfo GatewayInfo `json:"data"`
}

type Guild

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       NotifyType `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"`
	Roles            []Role     `json:"roles"`
	Channels         []Channel  `json:"channels"`
}

type GuildInfo

type GuildInfo struct {
	GuildId          string     `json:"id"`
	Name             string     `json:"name"`
	Topic            string     `json:"topic"`
	UserId           string     `json:"user_id"`
	Icon             string     `json:"icon"`
	NotifyType       NotifyType `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"`
}

type GuildListResp

type GuildListResp struct {
	WebResult
	Data *GuildResp `json:"data"`
}

==== Guild ====

type GuildResp

type GuildResp struct {
	Guilds []*GuildInfo `json:"items"`
	Meta   PageMeta     `json:"meta"`
}

type HelloPack

type HelloPack struct {
	Code      SignalCode `json:"code"`
	SessionId string     `json:"sessionId"`
}

type JoinedChannel added in v1.3.0

type JoinedChannel struct {
	UserId    string `json:"user_id" mapstructure:"user_id"`
	ChannelId string `json:"channel_id" mapstructure:"channel_id"`
	JoinedAt  int    `json:"joined_at" mapstructure:"joined_at"`
}

system extra Body ==== 用户相关事件 ==== 用户加入语音频道

type KookResponse added in v1.3.0

type KookResponse[T interface{}] struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    T      `json:"data"`
}

type MessageBtnClick added in v1.3.0

type MessageBtnClick struct {
	GuildId  string `json:"guild_id" mapstructure:"guild_id"`
	MsgId    string `json:"msg_id" mapstructure:"msg_id"`
	TargetId string `json:"target_id" mapstructure:"target_id"`
	UserId   string `json:"user_id" mapstructure:"user_id"`
	UserInfo User   `json:"user_info" mapstructure:"user_info"`
	Value    string `json:"value" mapstructure:"value"`
}

Card 消息中的 Button 点击事件

type MessageCreateReq

type MessageCreateReq struct {
	Type         EventType `json:"type"`
	TargetId     string    `json:"target_id"`
	Content      string    `json:"content"`
	Quote        string    `json:"quote"`
	Nonce        string    `json:"nonce"`
	TempTargetId string    `json:"temp_target_id"`
}

type MessageCreateResp added in v1.3.0

type MessageCreateResp struct {
	MsgId       string `json:"msg_id"`
	MsgTimestap int    `json:"msg_timestamp"`
	Nonce       string `json:"nonce"`
}

type MessageDeleteReq

type MessageDeleteReq struct {
	MsgId string `json:"msg_id"`
}

type MessageUpdateReq

type MessageUpdateReq struct {
	MsgId        string `json:"msg_id"`
	Content      string `json:"content"`
	Quote        string `json:"quote"`
	TempTargetId string `json:"temp_target_id"`
}

type NotifyType

type NotifyType int
const (
	NotifyTypeServer    NotifyType = 0
	NotifyTypeAll       NotifyType = 1
	NotifyTypeMentioned NotifyType = 2
	NotifyTypeIgnore    NotifyType = 3
)

type PageMeta

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

type Role

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 SelfExitedGuild added in v1.3.0

type SelfExitedGuild struct {
	GuildId string `json:"guild_id" mapstructure:"guild_id"`
}

自己退出服务器

type SelfJoinedGuild added in v1.3.0

type SelfJoinedGuild struct {
	GuildId string `json:"guild_id" mapstructure:"guild_id"`
	State   string `json:"state" mapstructure:"state"`
}

自己新加入服务器

type Signal

type Signal struct {
	SignalType   SignalType     `json:"s"`
	SerialNumber int            `json:"sn"`
	Data         map[string]any `json:"d"`
}

ws 连接相关

func NewPing

func NewPing(sn int) *Signal

func ParseSignal

func ParseSignal(data []byte) *Signal

type SignalCode

type SignalCode int
const (
	Success          SignalCode = 0
	ConnMissParam    SignalCode = 40100
	InvalidToken     SignalCode = 40101
	ValidFailedToken SignalCode = 40102
	ExpiredToken     SignalCode = 40103

	ResumeMissParam SignalCode = 40106
	ExpiredSession  SignalCode = 40107
	InvalidSN       SignalCode = 40108
)

type SignalType

type SignalType int
const (
	SIG_EVENT      SignalType = 0
	SIG_HELLO      SignalType = 1
	SIG_PING       SignalType = 2
	SIG_PONG       SignalType = 3
	SIG_RESUME     SignalType = 4
	SIG_RECONNECT  SignalType = 5
	SIG_RESUME_ACK SignalType = 6
)

type SystemExtra

type SystemExtra struct {
	SystemEventType string                 `json:"type"`
	Body            map[string]interface{} `json:"body"`
}

type User

type User struct {
	Id             string `json:"id"`
	Username       string `json:"username"`
	Nickname       string `json:"nickname"`
	IdentifyNum    string `json:"identify_num"`
	Online         bool   `json:"online"`
	Bot            bool   `json:"bot"`
	Status         int    `json:"status"`
	Avatar         string `json:"avatar"`
	VipAvatar      string `json:"vip_avatar"`
	MobileVerified bool   `json:"mobile_verified"`
	Roles          []int  `json:"roles"`
}

type UserExtra

type UserExtra struct {
	EventType    EventType     `json:"type" mapstructure:"event_type"`
	GuildId      string        `json:"guild_id" mapstructure:"guild_id"`
	ChannelName  string        `json:"channel_name" mapstructure:"channel_name"`
	Mention      []string      `json:"mention" mapstructure:"mention"`
	MentionAll   bool          `json:"mention_all" mapstructure:"mention_all"`
	MentionRoles []interface{} `json:"mention_roles" mapstructure:"mention_roles"`
	MentionHere  bool          `json:"mention_here" mapstructure:"mention_here"`
	Author       User          `json:"author" mapstructure:"author"`
}

type UserUpdated added in v1.3.0

type UserUpdated struct {
	UserId   string `json:"user_id"`
	UserName string `json:"username" mapstructure:"username"`
	Avatar   int    `json:"avatar" mapstructure:"avatar"`
}

用户信息更新

type WebResult

type WebResult struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

Jump to

Keyboard shortcuts

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