更新开放平台模型礼物价格的注释

This commit is contained in:
John Smith 2023-09-18 20:00:33 +08:00
parent 4351881f2e
commit 4da27950c8
2 changed files with 3 additions and 2 deletions

View File

@ -135,7 +135,7 @@ class GiftMessage:
gift_num: int = 0 gift_num: int = 0
"""赠送道具数量""" """赠送道具数量"""
price: int = 0 price: int = 0
"""支付金额(1000 = 1元 = 10电池),盲盒:爆出道具的价值""" """(礼物单价)支付金额(1000 = 1元 = 10电池),盲盒:爆出道具的价值""" # 这个B 站文档又不写清楚是单价还是总价
paid: bool = False paid: bool = False
"""是否是付费道具""" """是否是付费道具"""
fans_medal_level: int = 0 fans_medal_level: int = 0

View File

@ -51,8 +51,9 @@ class MyHandler(blivedm.BaseHandler):
def _on_open_live_gift(self, client: blivedm.OpenLiveClient, message: open_models.GiftMessage): def _on_open_live_gift(self, client: blivedm.OpenLiveClient, message: open_models.GiftMessage):
coin_type = '金瓜子' if message.paid else '银瓜子' 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}' 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): 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}') print(f'[{message.room_id}] {message.user_info.uname} 购买 大航海等级={message.guard_level}')