mirror of
https://github.com/xfgryujk/blivechat.git
synced 2026-08-22 11:23:28 +08:00
支持显示at人、开放平台接口支持显示房管
This commit is contained in:
@@ -11,7 +11,7 @@
|
|||||||
## 特性
|
## 特性
|
||||||
|
|
||||||
* 兼容YouTube直播评论栏的样式
|
* 兼容YouTube直播评论栏的样式
|
||||||
* 高亮舰队、 ~~房管~~ 、主播的用户名
|
* 高亮舰队、房管、主播的用户名
|
||||||
* 自带两种样式生成器,经典YouTube风格和仿微信风格
|
* 自带两种样式生成器,经典YouTube风格和仿微信风格
|
||||||
* 支持屏蔽弹幕、合并礼物等设置
|
* 支持屏蔽弹幕、合并礼物等设置
|
||||||
* 支持前端直连B站服务器或者通过后端转发
|
* 支持前端直连B站服务器或者通过后端转发
|
||||||
|
|||||||
2
blivedm
2
blivedm
Submodule blivedm updated: 0685fe1cfd...100ed8fdf9
@@ -233,12 +233,19 @@ export default class ChatClientDirectOpenLive extends ChatClientOfficialBase {
|
|||||||
let authorType
|
let authorType
|
||||||
if (data.open_id === this.roomOwnerOpenId) {
|
if (data.open_id === this.roomOwnerOpenId) {
|
||||||
authorType = 3
|
authorType = 3
|
||||||
|
} else if (data.is_admin) {
|
||||||
|
authorType = 2
|
||||||
} else if (data.guard_level !== 0) {
|
} else if (data.guard_level !== 0) {
|
||||||
authorType = 1
|
authorType = 1
|
||||||
} else {
|
} else {
|
||||||
authorType = 0
|
authorType = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let showContent = data.msg
|
||||||
|
if (data.reply_uname !== '') {
|
||||||
|
showContent = `@${data.reply_uname} ${showContent}`
|
||||||
|
}
|
||||||
|
|
||||||
let emoticon = null
|
let emoticon = null
|
||||||
if (data.dm_type === 1) {
|
if (data.dm_type === 1) {
|
||||||
emoticon = data.emoji_img_url
|
emoticon = data.emoji_img_url
|
||||||
@@ -249,7 +256,7 @@ export default class ChatClientDirectOpenLive extends ChatClientOfficialBase {
|
|||||||
timestamp: data.timestamp,
|
timestamp: data.timestamp,
|
||||||
authorName: data.uname,
|
authorName: data.uname,
|
||||||
authorType: authorType,
|
authorType: authorType,
|
||||||
content: data.msg,
|
content: showContent,
|
||||||
privilegeType: data.guard_level,
|
privilegeType: data.guard_level,
|
||||||
isGiftDanmaku: chat.isGiftDanmakuByContent(data.msg),
|
isGiftDanmaku: chat.isGiftDanmakuByContent(data.msg),
|
||||||
medalLevel: data.fans_medal_wearing_status ? data.fans_medal_level : 0,
|
medalLevel: data.fans_medal_wearing_status ? data.fans_medal_level : 0,
|
||||||
|
|||||||
@@ -98,14 +98,30 @@ export default class ChatClientDirectWeb extends ChatClientOfficialBase {
|
|||||||
authorType = 0
|
authorType = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
let authorName = info[2][1]
|
let extra
|
||||||
|
try {
|
||||||
|
extra = modeInfo.extra
|
||||||
|
if (typeof extra !== 'object') {
|
||||||
|
extra = JSON.parse(extra)
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
extra = {}
|
||||||
|
}
|
||||||
|
|
||||||
let content = info[1]
|
let content = info[1]
|
||||||
|
let replyUname = extra.reply_uname ?? ''
|
||||||
|
let showContent = content
|
||||||
|
if (replyUname !== '') {
|
||||||
|
showContent = `@${replyUname} ${showContent}`
|
||||||
|
}
|
||||||
|
|
||||||
|
let authorName = info[2][1]
|
||||||
let data = new chatModels.AddTextMsg({
|
let data = new chatModels.AddTextMsg({
|
||||||
avatarUrl: avatarUrl,
|
avatarUrl: avatarUrl,
|
||||||
timestamp: info[0][4] / 1000,
|
timestamp: info[0][4] / 1000,
|
||||||
authorName: authorName,
|
authorName: authorName,
|
||||||
authorType: authorType,
|
authorType: authorType,
|
||||||
content: content,
|
content: showContent,
|
||||||
privilegeType: privilegeType,
|
privilegeType: privilegeType,
|
||||||
isGiftDanmaku: Boolean(info[0][9]) || chat.isGiftDanmakuByContent(content),
|
isGiftDanmaku: Boolean(info[0][9]) || chat.isGiftDanmakuByContent(content),
|
||||||
authorLevel: info[4][0],
|
authorLevel: info[4][0],
|
||||||
|
|||||||
@@ -524,6 +524,11 @@ class LiveMsgHandler(blivedm.BaseHandler):
|
|||||||
else:
|
else:
|
||||||
author_type = 0
|
author_type = 0
|
||||||
|
|
||||||
|
show_content = message.msg
|
||||||
|
reply_uname = message.extra_dict.get('reply_uname', '')
|
||||||
|
if reply_uname != '':
|
||||||
|
show_content = f'@{reply_uname} {show_content}'
|
||||||
|
|
||||||
if message.dm_type == 1:
|
if message.dm_type == 1:
|
||||||
content_type = api.chat.ContentType.EMOTICON
|
content_type = api.chat.ContentType.EMOTICON
|
||||||
content_type_params = api.chat.make_emoticon_params(
|
content_type_params = api.chat.make_emoticon_params(
|
||||||
@@ -552,7 +557,7 @@ class LiveMsgHandler(blivedm.BaseHandler):
|
|||||||
timestamp=int(message.timestamp / 1000),
|
timestamp=int(message.timestamp / 1000),
|
||||||
author_name=message.uname,
|
author_name=message.uname,
|
||||||
author_type=author_type,
|
author_type=author_type,
|
||||||
content=message.msg,
|
content=show_content,
|
||||||
privilege_type=message.privilege_type,
|
privilege_type=message.privilege_type,
|
||||||
is_gift_danmaku=bool(message.msg_type),
|
is_gift_danmaku=bool(message.msg_type),
|
||||||
author_level=message.user_level,
|
author_level=message.user_level,
|
||||||
@@ -736,11 +741,17 @@ class LiveMsgHandler(blivedm.BaseHandler):
|
|||||||
|
|
||||||
if message.open_id == client.room_owner_open_id:
|
if message.open_id == client.room_owner_open_id:
|
||||||
author_type = 3 # 主播
|
author_type = 3 # 主播
|
||||||
|
elif message.is_admin:
|
||||||
|
author_type = 2 # 房管
|
||||||
elif message.guard_level != 0: # 1总督,2提督,3舰长
|
elif message.guard_level != 0: # 1总督,2提督,3舰长
|
||||||
author_type = 1 # 舰队
|
author_type = 1 # 舰队
|
||||||
else:
|
else:
|
||||||
author_type = 0
|
author_type = 0
|
||||||
|
|
||||||
|
show_content = message.msg
|
||||||
|
if message.reply_uname != '':
|
||||||
|
show_content = f'@{message.reply_uname} {show_content}'
|
||||||
|
|
||||||
if message.dm_type == 1:
|
if message.dm_type == 1:
|
||||||
content_type = api.chat.ContentType.EMOTICON
|
content_type = api.chat.ContentType.EMOTICON
|
||||||
content_type_params = api.chat.make_emoticon_params(message.emoji_img_url)
|
content_type_params = api.chat.make_emoticon_params(message.emoji_img_url)
|
||||||
@@ -766,7 +777,7 @@ class LiveMsgHandler(blivedm.BaseHandler):
|
|||||||
timestamp=message.timestamp,
|
timestamp=message.timestamp,
|
||||||
author_name=message.uname,
|
author_name=message.uname,
|
||||||
author_type=author_type,
|
author_type=author_type,
|
||||||
content=message.msg,
|
content=show_content,
|
||||||
privilege_type=message.guard_level,
|
privilege_type=message.guard_level,
|
||||||
medal_level=0 if not message.fans_medal_wearing_status else message.fans_medal_level,
|
medal_level=0 if not message.fans_medal_wearing_status else message.fans_medal_level,
|
||||||
id_=message.msg_id,
|
id_=message.msg_id,
|
||||||
|
|||||||
Reference in New Issue
Block a user