mirror of
https://github.com/xfgryujk/blivechat.git
synced 2024-12-26 04:41:40 +08:00
Relay 方式传递 author_id (uid) (#138)
* Relay 方式传递各种 author_id (uid) * Rename author_id to uid
This commit is contained in:
parent
60efe1d55b
commit
09a8538406
@ -68,6 +68,7 @@ def make_text_message_data(
|
||||
translation: str = '',
|
||||
content_type: int = ContentType.TEXT,
|
||||
content_type_params: list = None,
|
||||
uid: int = 0
|
||||
):
|
||||
# 为了节省带宽用list而不是dict
|
||||
return [
|
||||
@ -103,6 +104,8 @@ def make_text_message_data(
|
||||
content_type_params if content_type_params is not None else [],
|
||||
# 15: textEmoticons
|
||||
[], # 已废弃,保留
|
||||
# 16: authorId
|
||||
author_id
|
||||
]
|
||||
|
||||
|
||||
|
@ -148,7 +148,7 @@ export default class ChatClientRelay {
|
||||
medalLevel: data[10],
|
||||
id: data[11],
|
||||
translation: data[12],
|
||||
emoticon: emoticon,
|
||||
emoticon: emoticon
|
||||
}
|
||||
this.onAddText(data)
|
||||
break
|
||||
|
@ -449,6 +449,7 @@ class LiveMsgHandler(blivedm.BaseHandler):
|
||||
translation=translation,
|
||||
content_type=content_type,
|
||||
content_type_params=content_type_params,
|
||||
uid=message.uid
|
||||
))
|
||||
|
||||
if need_translate:
|
||||
@ -473,7 +474,8 @@ class LiveMsgHandler(blivedm.BaseHandler):
|
||||
'authorName': message.uname,
|
||||
'totalCoin': message.total_coin,
|
||||
'giftName': message.gift_name,
|
||||
'num': message.num
|
||||
'num': message.num,
|
||||
'uid': message.uid
|
||||
})
|
||||
|
||||
def _on_buy_guard(self, client: WebLiveClient, message: dm_web_models.GuardBuyMessage):
|
||||
@ -493,7 +495,8 @@ class LiveMsgHandler(blivedm.BaseHandler):
|
||||
'avatarUrl': avatar_url,
|
||||
'timestamp': message.start_time,
|
||||
'authorName': message.username,
|
||||
'privilegeType': message.guard_level
|
||||
'privilegeType': message.guard_level,
|
||||
'uid': message.uid
|
||||
})
|
||||
|
||||
def _on_super_chat(self, client: WebLiveClient, message: dm_web_models.SuperChatMessage):
|
||||
@ -523,7 +526,8 @@ class LiveMsgHandler(blivedm.BaseHandler):
|
||||
'authorName': message.uname,
|
||||
'price': message.price,
|
||||
'content': message.message,
|
||||
'translation': translation
|
||||
'translation': translation,
|
||||
'uid': message.uid
|
||||
})
|
||||
|
||||
if need_translate:
|
||||
@ -620,6 +624,7 @@ class LiveMsgHandler(blivedm.BaseHandler):
|
||||
translation=translation,
|
||||
content_type=content_type,
|
||||
content_type_params=content_type_params,
|
||||
uid=message.uid
|
||||
))
|
||||
|
||||
if need_translate:
|
||||
@ -644,7 +649,8 @@ class LiveMsgHandler(blivedm.BaseHandler):
|
||||
'authorName': message.uname,
|
||||
'totalCoin': message.price * message.gift_num,
|
||||
'giftName': message.gift_name,
|
||||
'num': message.gift_num
|
||||
'num': message.gift_num,
|
||||
'uid': message.uid
|
||||
})
|
||||
|
||||
def _on_open_live_buy_guard(self, client: OpenLiveClient, message: dm_open_models.GuardBuyMessage):
|
||||
@ -660,7 +666,8 @@ class LiveMsgHandler(blivedm.BaseHandler):
|
||||
'avatarUrl': avatar_url,
|
||||
'timestamp': message.timestamp,
|
||||
'authorName': message.user_info.uname,
|
||||
'privilegeType': message.guard_level
|
||||
'privilegeType': message.guard_level,
|
||||
'uid': message.user_info.uid
|
||||
})
|
||||
|
||||
def _on_open_live_super_chat(self, client: OpenLiveClient, message: dm_open_models.SuperChatMessage):
|
||||
@ -690,7 +697,8 @@ class LiveMsgHandler(blivedm.BaseHandler):
|
||||
'authorName': message.uname,
|
||||
'price': message.rmb,
|
||||
'content': message.message,
|
||||
'translation': translation
|
||||
'translation': translation,
|
||||
'uid': message.uid
|
||||
})
|
||||
|
||||
if need_translate:
|
||||
|
Loading…
Reference in New Issue
Block a user