diff --git a/blivedm/models/open_live.py b/blivedm/models/open_live.py index 3a66d4b..33f7606 100644 --- a/blivedm/models/open_live.py +++ b/blivedm/models/open_live.py @@ -135,7 +135,7 @@ class GiftMessage: gift_num: int = 0 """赠送道具数量""" price: int = 0 - """支付金额(1000 = 1元 = 10电池),盲盒:爆出道具的价值""" + """(礼物单价)支付金额(1000 = 1元 = 10电池),盲盒:爆出道具的价值""" # 这个B 站文档又不写清楚是单价还是总价 paid: bool = False """是否是付费道具""" fans_medal_level: int = 0 diff --git a/open_live_sample.py b/open_live_sample.py index 68b1782..6e47410 100644 --- a/open_live_sample.py +++ b/open_live_sample.py @@ -51,8 +51,9 @@ class MyHandler(blivedm.BaseHandler): def _on_open_live_gift(self, client: blivedm.OpenLiveClient, message: open_models.GiftMessage): coin_type = '金瓜子' if message.paid else '银瓜子' + total_coin = message.price * message.gift_num print(f'[{message.room_id}] {message.uname} 赠送{message.gift_name}x{message.gift_num}' - f' ({coin_type}x{message.price})') + f' ({coin_type}x{total_coin})') def _on_open_live_buy_guard(self, client: blivedm.OpenLiveClient, message: open_models.GuardBuyMessage): print(f'[{message.room_id}] {message.user_info.uname} 购买 大航海等级={message.guard_level}')