import type { BilibiliInternal, FansMedal } from '@laplace.live/internal' /** * Gift * * 礼物 * * @see BilibiliInternal.WebSocket.Prod.SEND_GIFT for the original version * @see BilibiliInternal.WebSocket.Prod.SEND_GIFT_V2 for the new protobuf version * @see BiliBilibiliInternal.WebSocket.OpenPlatform.LIVE_OPEN_PLATFORM_SEND_GIFT for the Open Platform version */ export interface Gift { type: 'gift' /** * 礼物有可能会大量刷屏,因此 时间戳:房间:UID 可能会导致 React key 重复,因此需要额外 * 增加 `combo_total_coin` 来避免重复,在开放平台中,此字段为 * `combo_info.combo_count * combo_info.combo_base_num`(连击次数 * 每次连击的礼物个数) */ id: string origin: number originIdx: number uid: number username: string /** * 礼物会返回头像,直接使用以节约流量 */ avatar: string message: string /** * 包含了折扣(大航海折扣)后的礼物总价(单价 * 数量) */ price: number /** * 实际货币单位的价格 */ priceNormalized: number duration: number /** * 'gold': 金瓜子,现金购买 * 'silver': 银瓜子,兑换的礼物 */ coinType: 'gold' | 'silver' | string /** * 0: 白字 * 1: 总督 * 2: 提督 * 3: 舰长 */ guardType: number /** * 未知,先预留 */ giftType: number /** * 礼物动作名称,投喂,etc. */ giftAction: string giftAmount: number giftId: number giftName: string /** * 被投喂礼物在当前用户包裹中剩余多少 * 0 可能代表非包裹礼物(需购买礼物) */ giftRemain: number /** * Mar 26, 2025 之后加的,为了兼容之前的数据可能为空 */ giftIcon: string /** * 当前礼物所处的事务源 * - 'Live' - 普通直播 * - 'voice_chat_room' - 语音连麦,多人连麦时会影响 `receiver`,即 `receive_user_info` */ bizSource: 'Live' | 'voice_chat_room' | string /** * 当前礼物的接收方,多人连麦时会与当前主播不同,可从 `bizSource` 进行判断 */ receiver: { uid: number uname: string master: { uid: number uname: string room_id: number } | null } blindGift: BilibiliInternal.WebSocket.Prod.SEND_GIFT_BLIND_GIFT | null timestamp: number timestampNormalized: number medal: FansMedal wealthMedalLevel: number read: boolean }