Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

# 消息捕获开关默认为开启状态,对于小冰的天气消息和歌曲消息不再进行捕获 #155

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/main/resources/js/chat-room.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,13 @@ var DarwColorPicker = null;
var redPacketMap = new Map();
var catchUserParam = window.localStorage['robot_list'] ? window.localStorage['robot_list'] : '';
var catchUsers = catchUserParam.length > 0 ? catchUserParam.split(',') : [];
var catchWordFlag = window.localStorage['catch-word-flag'] == true || window.localStorage['catch-word-flag'] == 'true' ? true : false;
var catchWordFlag;
if (window.localStorage['catch-word-flag']) {
catchWordFlag = window.localStorage['catch-word-flag'] == true || window.localStorage['catch-word-flag'] == 'true' ? true : false;
} else {
window.localStorage['catch-word-flag'] = true;
catchWordFlag = true;
}
$('#catch-word').prop('checked', catchWordFlag);
var ChatRoom = {
init: function () {
Expand Down Expand Up @@ -1699,7 +1705,7 @@ ${result.info.msg}
let robotAvatar = data.userAvatarURL;
// 看看是否有备注
let remark = ChatRoom.remarkList[data.userOId];
if ((!more) && catchUsers.includes(userName) && newContent.indexOf("\"msgType\":\"redPacket\"") == -1) {
if ((!more) && catchUsers.includes(userName) && newContent.indexOf("\"msgType\":\"redPacket\"") == -1 && newContent.indexOf("\"msgType\":\"music\"") == -1 && newContent.indexOf("\"msgType\":\"weather\"") == -1) {
let robotDom = '<div class="robot-msg-item"><div class="avatar" style="background-image: url(' + robotAvatar + ')"></div><div class="robot-msg-content"><div class="robot-username"><p>'+userName+'</p></div> ' + newContent + ' <div class="fn__right" style="margin-top: 5px; font-size: 10px;">'+data.time+'</div></div></div>';
ChatRoom.addRobotMsg(robotDom);
} else if ((!more) && $('#catch-word').prop('checked') && newContent.indexOf("\"msgType\":\"redPacket\"") == -1 && (newMd.startsWith("鸽 ") || newMd.startsWith("小冰 ") || newMd.startsWith("凌 ") || newMd.startsWith("ida "))) {
Expand Down
Loading