message

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2025 License: MIT Imports: 6 Imported by: 7

Documentation

Index

Constants

View Source
const (
	TextDanmaku = iota
	EmoticonDanmaku
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ComboSend

type ComboSend struct {
	Action         string `json:"action"`           // 操作类型
	BatchComboId   string `json:"batch_combo_id"`   // 批量组合ID
	BatchComboNum  int    `json:"batch_combo_num"`  // 批量组合数量
	ComboId        string `json:"combo_id"`         // 组合ID
	ComboNum       int    `json:"combo_num"`        // 组合数量
	ComboTotalCoin int    `json:"combo_total_coin"` // 组合总硬币数
	Dmscore        int    `json:"dmscore"`          // DM分数
	GiftId         int    `json:"gift_id"`          // 礼物ID
	GiftName       string `json:"gift_name"`        // 礼物名称
	GiftNum        int    `json:"gift_num"`         // 礼物数量
	IsShow         int    `json:"is_show"`          // 是否显示
	MedalInfo      struct {
		AnchorRoomid     int    `json:"anchor_roomid"`      // 主播房间ID
		AnchorUname      string `json:"anchor_uname"`       // 主播用户名
		GuardLevel       int    `json:"guard_level"`        // 守护等级
		IconId           int    `json:"icon_id"`            // 图标ID
		IsLighted        int    `json:"is_lighted"`         // 是否点亮
		MedalColor       int    `json:"medal_color"`        // 勋章颜色
		MedalColorBorder int    `json:"medal_color_border"` // 勋章边框颜色
		MedalColorEnd    int    `json:"medal_color_end"`    // 勋章结束颜色
		MedalColorStart  int    `json:"medal_color_start"`  // 勋章开始颜色
		MedalLevel       int    `json:"medal_level"`        // 勋章等级
		MedalName        string `json:"medal_name"`         // 勋章名称
		Special          string `json:"special"`            // 特殊标记
		TargetId         int    `json:"target_id"`          // 目标ID
	} `json:"medal_info"`
	NameColor  string      `json:"name_color"`  // 名称颜色
	RUname     string      `json:"r_uname"`     // 接收者用户名
	Ruid       int         `json:"ruid"`        // 接收者用户ID
	SendMaster interface{} `json:"send_master"` // 发送者信息
	TotalNum   int         `json:"total_num"`   // 总数量
	Uid        int         `json:"uid"`         // 用户ID
	Uname      string      `json:"uname"`       // 用户名
}

组合发送结构体

type CommonNoticeDanmaku

type CommonNoticeDanmaku struct {
	ContentSegments []struct {
		FontColor string `json:"font_color"`
		Text      string `json:"text"`
		Type      int    `json:"type"`
	} `json:"content_segments"`
	Dmscore   int   `json:"dmscore"`
	Terminals []int `json:"terminals"`
}

type Danmaku

type Danmaku struct {
	Sender    *User
	Content   string
	Extra     *Extra
	Emoticon  *Emoticon
	Type      int
	Timestamp int64
	Raw       string
}

func (*Danmaku) Parse

func (d *Danmaku) Parse(data []byte)

type Emoticon

type Emoticon struct {
	BulgeDisplay   int    `json:"bulge_display"`
	EmoticonUnique string `json:"emoticon_unique"`
	Height         int    `json:"height"`
	InPlayerArea   int    `json:"in_player_area"`
	IsDynamic      int    `json:"is_dynamic"`
	Url            string `json:"url"`
	Width          int    `json:"width"`
}

type Extra

type Extra struct {
	SendFromMe            bool   `json:"send_from_me"`
	MasterPlayerHidden    bool   `json:"master_player_hidden"`
	Mode                  int    `json:"mode"`
	Color                 int    `json:"color"`
	DmType                int    `json:"dm_type"`
	FontSize              int    `json:"font_size"`
	PlayerMode            int    `json:"player_mode"`
	ShowPlayerType        int    `json:"show_player_type"`
	Content               string `json:"content"`
	UserHash              string `json:"user_hash"`
	EmoticonUnique        string `json:"emoticon_unique"`
	BulgeDisplay          int    `json:"bulge_display"`
	RecommendScore        int    `json:"recommend_score"`
	MainStateDmColor      string `json:"main_state_dm_color"`
	ObjectiveStateDmColor string `json:"objective_state_dm_color"`
	Direction             int    `json:"direction"`
	PkDirection           int    `json:"pk_direction"`
	QuartetDirection      int    `json:"quartet_direction"`
	AnniversaryCrowd      int    `json:"anniversary_crowd"`
	YeahSpaceType         string `json:"yeah_space_type"`
	YeahSpaceURL          string `json:"yeah_space_url"`
	JumpToURL             string `json:"jump_to_url"`
	SpaceType             string `json:"space_type"`
	SpaceURL              string `json:"space_url"`
	// Animation             any    `json:"animation"`
	// Emots                 any    `json:"emots"`
	IsAudited bool   `json:"is_audited"`
	IDStr     string `json:"id_str"`
	// Icon                  any    `json:"icon"`
	ShowReply       bool   `json:"show_reply"`
	ReplyMid        int    `json:"reply_mid"`
	ReplyUname      string `json:"reply_uname"`
	ReplyUnameColor string `json:"reply_uname_color"`
	ReplyIsMystery  bool   `json:"reply_is_mystery"`
	ReplyTypeEnum   int    `json:"reply_type_enum"`
	HitCombo        int    `json:"hit_combo"`
	EsportsJumpURL  string `json:"esports_jump_url"`
}

type Gift

type Gift struct {
	Action            string      `json:"action"`               // 操作类型
	BatchComboId      string      `json:"batch_combo_id"`       // 批量组合ID
	BatchComboSend    interface{} `json:"batch_combo_send"`     // 批量组合发送信息
	BeatId            string      `json:"beatId"`               // Beat ID
	BizSource         string      `json:"biz_source"`           // 业务来源
	BlindGift         interface{} `json:"blind_gift"`           // 盲盒礼物信息
	BroadcastId       int         `json:"broadcast_id"`         // 广播ID
	CoinType          string      `json:"coin_type"`            // 币种类型
	ComboResourcesId  int         `json:"combo_resources_id"`   // 组合资源ID
	ComboSend         interface{} `json:"combo_send"`           // 组合发送信息
	ComboStayTime     int         `json:"combo_stay_time"`      // 组合停留时间
	ComboTotalCoin    int         `json:"combo_total_coin"`     // 组合总硬币数
	CritProb          int         `json:"crit_prob"`            // 批判概率
	Demarcation       int         `json:"demarcation"`          // 分界线
	DiscountPrice     int         `json:"discount_price"`       // 折扣价格
	Dmscore           int         `json:"dmscore"`              // DM分数
	Draw              int         `json:"draw"`                 // 抽奖
	Effect            int         `json:"effect"`               // 效果
	EffectBlock       int         `json:"effect_block"`         // 效果块
	Face              string      `json:"face"`                 // 头像URL
	FloatScResourceId int         `json:"float_sc_resource_id"` // 浮动资源ID
	GiftId            int         `json:"giftId"`               // 礼物ID
	GiftName          string      `json:"giftName"`             // 礼物名称
	GiftType          int         `json:"giftType"`             // 礼物类型
	Gold              int         `json:"gold"`                 // 金币数量
	GuardLevel        int         `json:"guard_level"`          // 守护等级
	IsFirst           bool        `json:"is_first"`             // 是否首次赠送
	IsSpecialBatch    int         `json:"is_special_batch"`     // 是否特殊批量
	Magnification     float64     `json:"magnification"`        // 放大倍数
	MedalInfo         struct {
		AnchorRoomid     int    `json:"anchor_roomid"`      // 主播房间ID
		AnchorUname      string `json:"anchor_uname"`       // 主播用户名
		GuardLevel       int    `json:"guard_level"`        // 守护等级
		IconId           int    `json:"icon_id"`            // 图标ID
		IsLighted        int    `json:"is_lighted"`         // 是否点亮
		MedalColor       int    `json:"medal_color"`        // 勋章颜色
		MedalColorBorder int    `json:"medal_color_border"` // 勋章边框颜色
		MedalColorEnd    int    `json:"medal_color_end"`    // 勋章结束颜色
		MedalColorStart  int    `json:"medal_color_start"`  // 勋章开始颜色
		MedalLevel       int    `json:"medal_level"`        // 勋章等级
		MedalName        string `json:"medal_name"`         // 勋章名称
		Special          string `json:"special"`            // 特殊标记
		TargetId         int    `json:"target_id"`          // 目标ID
	} `json:"medal_info"`
	NameColor         string      `json:"name_color"`           // 名称颜色
	Num               int         `json:"num"`                  // 数量
	OriginalGiftName  string      `json:"original_gift_name"`   // 原始礼物名称
	Price             int         `json:"price"`                // 价格
	Rcost             int         `json:"rcost"`                // 实际花费
	Remain            int         `json:"remain"`               // 剩余数量
	Rnd               string      `json:"rnd"`                  // 随机数
	SendMaster        interface{} `json:"send_master"`          // 发送者信息
	Silver            int         `json:"silver"`               // 银币数量
	Super             int         `json:"super"`                // 是否超级礼物
	SuperBatchGiftNum int         `json:"super_batch_gift_num"` // 超级批量礼物数量
	SuperGiftNum      int         `json:"super_gift_num"`       // 超级礼物数量
	SvgaBlock         int         `json:"svga_block"`           // SVGA块
	TagImage          string      `json:"tag_image"`            // 标签图片URL
	Tid               string      `json:"tid"`                  // TID
	Timestamp         int         `json:"timestamp"`            // 时间戳
	TopList           interface{} `json:"top_list"`             // 顶级列表
	TotalCoin         int         `json:"total_coin"`           // 总硬币数
	Uid               int         `json:"uid"`                  // 用户ID
	Uname             string      `json:"uname"`                // 用户名
}

礼物消息结构体

func (*Gift) Parse

func (g *Gift) Parse(data []byte)

解析礼物消息数据

type GuardBuy

type GuardBuy struct {
	Uid        int    `json:"uid"`         // 用户ID
	Username   string `json:"username"`    // 用户名
	GuardLevel int    `json:"guard_level"` // 守护等级
	Num        int    `json:"num"`         // 数量
	Price      int    `json:"price"`       // 价格
	GiftId     int    `json:"gift_id"`     // 礼物ID
	GiftName   string `json:"gift_name"`   // 礼物名称
	StartTime  int    `json:"start_time"`  // 开始时间戳
	EndTime    int    `json:"end_time"`    // 结束时间戳
}

GuardBuy 购买守护消息结构体

func (*GuardBuy) Parse

func (g *GuardBuy) Parse(data []byte)

type HotRankChanged

type HotRankChanged struct {
	Rank        int    `json:"rank"`
	Trend       int    `json:"trend"`
	Countdown   int    `json:"countdown"`
	Timestamp   int    `json:"timestamp"`
	WebUrl      string `json:"web_url"`
	LiveUrl     string `json:"live_url"`
	BlinkUrl    string `json:"blink_url"`
	LiveLinkUrl string `json:"live_link_url"`
	PcLinkUrl   string `json:"pc_link_url"`
	Icon        string `json:"icon"`
	AreaName    string `json:"area_name"`
	RankDesc    string `json:"rank_desc"`
}

type HotRankChangedV2

type HotRankChangedV2 HotRankChanged

type HotRankSettlement

type HotRankSettlement struct {
	AreaName  string `json:"area_name"`
	CacheKey  string `json:"cache_key"`
	DmMsg     string `json:"dm_msg"`
	Dmscore   int    `json:"dmscore"`
	Face      string `json:"face"`
	Icon      string `json:"icon"`
	Rank      int    `json:"rank"`
	Timestamp int    `json:"timestamp"`
	Uname     string `json:"uname"`
	Url       string `json:"url"`
}

type HotRankSettlementV2

type HotRankSettlementV2 struct {
	Rank      int    `json:"rank"`
	Uname     string `json:"uname"`
	Face      string `json:"face"`
	Timestamp int    `json:"timestamp"`
	Icon      string `json:"icon"`
	AreaName  string `json:"area_name"`
	Url       string `json:"url"`
	CacheKey  string `json:"cache_key"`
	DmMsg     string `json:"dm_msg"`
}

type InteractWord

type InteractWord struct {
	Contribution struct {
		Grade int `json:"grade"`
	} `json:"contribution"`
	Dmscore   int `json:"dmscore"`
	FansMedal struct {
		AnchorRoomid     int    `json:"anchor_roomid"`
		GuardLevel       int    `json:"guard_level"`
		IconId           int    `json:"icon_id"`
		IsLighted        int    `json:"is_lighted"`
		MedalColor       int    `json:"medal_color"`
		MedalColorBorder int    `json:"medal_color_border"`
		MedalColorEnd    int    `json:"medal_color_end"`
		MedalColorStart  int    `json:"medal_color_start"`
		MedalLevel       int    `json:"medal_level"`
		MedalName        string `json:"medal_name"`
		Score            int    `json:"score"`
		Special          string `json:"special"`
		TargetId         int    `json:"target_id"`
	} `json:"fans_medal"`
	Identities  []int  `json:"identities"`
	IsSpread    int    `json:"is_spread"`
	MsgType     int    `json:"msg_type"`
	Roomid      int    `json:"roomid"`
	Score       int64  `json:"score"`
	SpreadDesc  string `json:"spread_desc"`
	SpreadInfo  string `json:"spread_info"`
	TailIcon    int    `json:"tail_icon"`
	Timestamp   int    `json:"timestamp"`
	TriggerTime int64  `json:"trigger_time"`
	Uid         int    `json:"uid"`
	Uname       string `json:"uname"`
	UnameColor  string `json:"uname_color"`
}

type LiveInteractiveGame

type LiveInteractiveGame struct {
	Type           int         `json:"type"`
	Uid            int         `json:"uid"`
	Uname          string      `json:"uname"`
	Uface          string      `json:"uface"`
	GiftId         int         `json:"gift_id"`
	GiftName       string      `json:"gift_name"`
	GiftNum        int         `json:"gift_num"`
	Price          int         `json:"price"`
	Paid           bool        `json:"paid"`
	Msg            string      `json:"msg"`
	FansMedalLevel int         `json:"fans_medal_level"`
	GuardLevel     int         `json:"guard_level"`
	Timestamp      int         `json:"timestamp"`
	AnchorLottery  interface{} `json:"anchor_lottery"`
	PkInfo         interface{} `json:"pk_info"`
	AnchorInfo     struct {
		Uid   int    `json:"uid"`
		Uname string `json:"uname"`
		Uface string `json:"uface"`
	} `json:"anchor_info"`
}

type LiveStart added in v1.6.0

type LiveStart struct {
	Cmd             string `json:"cmd"`              // 命令
	LiveKey         string `json:"live_key"`         // 直播密钥
	VoiceBackground string `json:"voice_background"` // 语音背景
	SubSessionKey   string `json:"sub_session_key"`  // 子会话密钥
	LivePlatform    string `json:"live_platform"`    // 直播平台
	LiveModel       int    `json:"live_model"`       // 直播模式
	LiveTime        int    `json:"live_time"`        // 直播时间
	Roomid          int    `json:"roomid"`           // 房间ID
}

Live 直播消息结构体

func (*LiveStart) Parse added in v1.6.0

func (l *LiveStart) Parse(data []byte)

type LiveStop added in v1.6.0

type LiveStop struct {
	Cmd      string `json:"cmd"`
	MsgId    string `json:"msg_id"`
	PIsAck   bool   `json:"p_is_ack"`
	PMsgType int    `json:"p_msg_type"`
	Roomid   string `json:"roomid"`
	Round    int    `json:"round"` //开启轮播时存在,轮播状态: 1正在轮播 0未轮播
	SendTime int64  `json:"send_time"`
}

停止直播

func (*LiveStop) Parse added in v1.6.0

func (l *LiveStop) Parse(data []byte)

type Medal

type Medal struct {
	Name     string
	Level    int
	Color    int
	UpRoomId int
	UpUid    int
	UpName   string
}

type OnlineRankCount

type OnlineRankCount struct {
	Count int `json:"count"`
}

type Preparing

type Preparing struct {
	Cmd    string `json:"cmd"`    // 命令
	Roomid string `json:"roomid"` // 房间ID
}

Preparing 直播准备中消息结构体

type StopLiveRoomList

type StopLiveRoomList struct {
	RoomIdList []int `json:"room_id_list"` // 房间ID列表
}

StopLiveRoomList 停止直播房间列表结构体

type SuperChat

type SuperChat struct {
	BackgroundBottomColor string  `json:"background_bottom_color"` //底部背景色
	BackgroundColor       string  `json:"background_color"`        //背景色
	BackgroundColorEnd    string  `json:"background_color_end"`
	BackgroundColorStart  string  `json:"background_color_start"`
	BackgroundIcon        string  `json:"background_icon"`        //背景图标
	BackgroundImage       string  `json:"background_image"`       //背景图
	BackgroundPriceColor  string  `json:"background_price_color"` //背景价格颜色
	ColorPoint            float64 `json:"color_point"`
	Dmscore               int     `json:"dmscore"`
	EndTime               int     `json:"end_time"` //结束时间戳
	Gift                  struct {
		GiftId   int    `json:"gift_id"`   //礼物ID
		GiftName string `json:"gift_name"` //礼物名
		Num      int    `json:"num"`
	} `json:"gift"`
	Id          int `json:"id"`
	IsRanked    int `json:"is_ranked"`
	IsSendAudit int `json:"is_send_audit"`
	MedalInfo   struct {
		AnchorRoomid     int    `json:"anchor_roomid"`
		AnchorUname      string `json:"anchor_uname"`
		GuardLevel       int    `json:"guard_level"` // 舰队等级,0:非舰队,1:总督,2:提督,3:舰长
		IconId           int    `json:"icon_id"`
		IsLighted        int    `json:"is_lighted"`
		MedalColor       string `json:"medal_color"`
		MedalColorBorder int    `json:"medal_color_border"`
		MedalColorEnd    int    `json:"medal_color_end"`
		MedalColorStart  int    `json:"medal_color_start"`
		MedalLevel       int    `json:"medal_level"`
		MedalName        string `json:"medal_name"`
		Special          string `json:"special"`
		TargetId         int    `json:"target_id"`
	} `json:"medal_info"`
	Message          string `json:"message"` // 消息
	MessageFontColor string `json:"message_font_color"`
	MessageTrans     string `json:"message_trans"`
	Price            int    `json:"price"` // 价格(人民币)
	Rate             int    `json:"rate"`
	StartTime        int    `json:"start_time"` // 开始时间戳
	Time             int    `json:"time"`       //剩余时间
	Token            string `json:"token"`
	TransMark        int    `json:"trans_mark"`
	Ts               int    `json:"ts"`
	Uid              int    `json:"uid"` //用户ID
	UserInfo         struct {
		Face       string `json:"face"` //用户头像URL
		FaceFrame  string `json:"face_frame"`
		GuardLevel int    `json:"guard_level"`
		IsMainVip  int    `json:"is_main_vip"`
		IsSvip     int    `json:"is_svip"`
		IsVip      int    `json:"is_vip"`
		LevelColor string `json:"level_color"`
		Manager    int    `json:"manager"`
		NameColor  string `json:"name_color"`
		Title      string `json:"title"`
		Uname      string `json:"uname"`      //用户名
		UserLevel  int    `json:"user_level"` //用户等级
	} `json:"user_info"`
}

SuperChat 超级弹幕消息结构体 message_jpn: 消息日文翻译(目前只出现在SUPER_CHAT_MESSAGE_JPN) id_: str,消息ID,删除时用

func (*SuperChat) Parse

func (s *SuperChat) Parse(data []byte)

type User

type User struct {
	Uid          int
	Uname        string
	Admin        bool
	Urank        int
	MobileVerify bool
	Medal        *Medal
	GuardLevel   int
	UserLevel    int64
}

type UserToast

type UserToast struct {
	AnchorShow       bool   `json:"anchor_show"`
	Color            string `json:"color"`
	Dmscore          int    `json:"dmscore"`
	EffectId         int    `json:"effect_id"`
	EndTime          int    `json:"end_time"`
	FaceEffectId     int    `json:"face_effect_id"`
	GiftId           int    `json:"gift_id"`
	GuardLevel       int    `json:"guard_level"`
	IsShow           int    `json:"is_show"`
	Num              int    `json:"num"`
	OpType           int    `json:"op_type"`
	PayflowId        string `json:"payflow_id"`
	Price            int    `json:"price"`
	RoleName         string `json:"role_name"`
	RoomEffectId     int    `json:"room_effect_id"`
	StartTime        int    `json:"start_time"`
	SvgaBlock        int    `json:"svga_block"`
	TargetGuardCount int    `json:"target_guard_count"`
	ToastMsg         string `json:"toast_msg"`
	Uid              int    `json:"uid"`
	Unit             string `json:"unit"`
	UserShow         bool   `json:"user_show"`
	Username         string `json:"username"`
}

func (*UserToast) Parse

func (u *UserToast) Parse(data []byte)

type WidgetBanner

type WidgetBanner struct {
	Timestamp  int `json:"timestamp"`
	WidgetList struct {
		Field1 struct {
			Id             int      `json:"id"`
			Title          string   `json:"title"`
			Cover          string   `json:"cover"`
			WebCover       string   `json:"web_cover"`
			TipText        string   `json:"tip_text"`
			TipTextColor   string   `json:"tip_text_color"`
			TipBottomColor string   `json:"tip_bottom_color"`
			JumpUrl        string   `json:"jump_url"`
			Url            string   `json:"url"`
			StayTime       int      `json:"stay_time"`
			Site           int      `json:"site"`
			PlatformIn     []string `json:"platform_in"`
			Type           int      `json:"type"`
			BandId         int      `json:"band_id"`
			SubKey         string   `json:"sub_key"`
			SubData        string   `json:"sub_data"`
			IsAdd          bool     `json:"is_add"`
		} `json:"58"`
	} `json:"widget_list"`
}

WidgetBanner TODO: widget_list的code不定

Jump to

Keyboard shortcuts

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