开放平台接口修正礼物价格,web接口支持显示头像、修正上舰消息的单位

This commit is contained in:
John Smith
2024-12-23 21:21:52 +08:00
parent 7f77fdd889
commit 3273fb4d34
4 changed files with 34 additions and 14 deletions

View File

@@ -261,7 +261,7 @@ export default class ChatClientDirectOpenLive extends ChatClientOfficialBase {
sendGiftCallback(command) {
let data = command.data
let totalCoin = data.price * data.gift_num
let totalCoin = data.r_price * data.gift_num
data = new chatModels.AddGiftMsg({
id: data.msg_id,
avatarUrl: chat.processAvatarUrl(data.uface),

View File

@@ -70,6 +70,12 @@ export default class ChatClientDirectWeb extends ChatClientOfficialBase {
async danmuMsgCallback(command) {
let info = command.info
let modeInfo = info[0][15]
let avatarUrl = modeInfo?.user?.base?.face ?? ''
if (!avatarUrl) {
avatarUrl = await chat.getAvatarUrl(uid, authorName)
}
let roomId, medalLevel
if (info[3]) {
roomId = info[3][3]
@@ -95,7 +101,7 @@ export default class ChatClientDirectWeb extends ChatClientOfficialBase {
let authorName = info[2][1]
let content = info[1]
let data = new chatModels.AddTextMsg({
avatarUrl: await chat.getAvatarUrl(uid, authorName),
avatarUrl: avatarUrl,
timestamp: info[0][4] / 1000,
authorName: authorName,
authorType: authorType,
@@ -126,13 +132,25 @@ export default class ChatClientDirectWeb extends ChatClientOfficialBase {
this.msgHandler.onAddGift(data)
}
async guardBuyCallback(command) {
async userToastV2Callback(command) {
let data = command.data
let {
sender_uinfo: {
uid,
base: {
name: username,
},
},
guard_info: {
start_time: timestamp,
guard_level: guardLevel,
},
} = data
data = new chatModels.AddMemberMsg({
avatarUrl: await chat.getAvatarUrl(data.uid, data.username),
timestamp: data.start_time,
authorName: data.username,
privilegeType: data.guard_level
avatarUrl: await chat.getAvatarUrl(uid, username),
timestamp: timestamp,
authorName: username,
privilegeType: guardLevel,
})
this.msgHandler.onAddMember(data)
}
@@ -163,7 +181,7 @@ export default class ChatClientDirectWeb extends ChatClientOfficialBase {
const CMD_CALLBACK_MAP = {
DANMU_MSG: ChatClientDirectWeb.prototype.danmuMsgCallback,
SEND_GIFT: ChatClientDirectWeb.prototype.sendGiftCallback,
GUARD_BUY: ChatClientDirectWeb.prototype.guardBuyCallback,
USER_TOAST_MSG_V2: ChatClientDirectWeb.prototype.userToastV2Callback,
SUPER_CHAT_MESSAGE: ChatClientDirectWeb.prototype.superChatMessageCallback,
SUPER_CHAT_MESSAGE_DELETE: ChatClientDirectWeb.prototype.superChatMessageDeleteCallback
}