sdk: 根据37要求修改问题

This commit is contained in:
luying
2021-12-03 17:28:16 +08:00
parent a6ee89854a
commit 000742ace7
5 changed files with 26 additions and 7 deletions
@@ -3,7 +3,7 @@ import {Application, RouteRecord, FrontendOrBackendSession, HandlerCallback, pin
import { refresh } from '../../../services/refreshService';
import { checkPrivateChat, checkGuildChat, checkOtherChat, checkRoleName, checkGuildName } from "../../../services/sdkService";
import { resResult, checkWhiteListWithUid, genCode } from "../../../pubUtils/util";
import { CHANNEL_PREFIX, STATUS } from "../../../consts";
import { CHANNEL_PREFIX, MSG_TYPE, STATUS } from "../../../consts";
import { UserModel } from "../../../db/User";
import { SERVER_DEBUG_MODE } from "../../../pubUtils/dicParam";
export function globalFilter(app: Application) {
@@ -46,12 +46,14 @@ Filter.prototype.before = async function (routeRecord: RouteRecord, msg: any, se
switch(routeRecord.route) {
case 'chat.chatHandler.sendPrivateMessage':
{
if(msg.type == MSG_TYPE.IMG) break;
let result = await checkPrivateChat(roleId, msg.targetRoleId, msg.content);
if(!result) hasBlockWords = true;
break;
}
case 'chat.chatHandler.sendGroupMessage':
{
if(msg.type == MSG_TYPE.IMG) break;
if(msg.channel == CHANNEL_PREFIX.GUILD) {
let result = await checkGuildChat(roleId, guildCode, msg.content);
if(!result) hasBlockWords = true;