Relay 方式传递 author_id (uid) (#138)

* Relay 方式传递各种 author_id (uid)

* Rename author_id to uid
This commit is contained in:
reito 2023-09-24 18:36:38 +08:00 committed by GitHub
parent 60efe1d55b
commit 09a8538406
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 7 deletions

View File

@ -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
]

View File

@ -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

View File

@ -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: