起名:添加屏蔽词检测
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import {Application, RouteRecord, FrontendOrBackendSession, HandlerCallback, pinus} from "pinus";
|
||||
// import { checkEvent } from '../../../services/eventSercive';
|
||||
import { refresh } from '../../../services/refreshService';
|
||||
import { checkPrivateChat, checkGuildChat, checkOtherChat, getWorldChannelSid } from "../../../services/chatService";
|
||||
import { resResult, checkWhiteListWithUid } from "../../../pubUtils/util";
|
||||
import { checkPrivateChat, checkGuildChat, checkOtherChat, getWorldChannelSid, checkRoleName, checkGuildName } from "../../../services/chatService";
|
||||
import { resResult, checkWhiteListWithUid, genCode } from "../../../pubUtils/util";
|
||||
import { CHANNEL_PREFIX, STATUS } from "../../../consts";
|
||||
import { UserModel } from "../../../db/User";
|
||||
import { SERVER_DEBUG_MODE } from "../../../pubUtils/dicParam";
|
||||
@@ -19,6 +19,7 @@ Filter.prototype.before = async function (routeRecord: RouteRecord, msg: any, se
|
||||
const sid: string = session.get('sid');
|
||||
const roleId: string = session.get('roleId');
|
||||
const uid: number = session.get('userid');
|
||||
let guildCode = session.get('guildCode');
|
||||
|
||||
session.push('teamCode', () => {});
|
||||
|
||||
@@ -52,7 +53,6 @@ Filter.prototype.before = async function (routeRecord: RouteRecord, msg: any, se
|
||||
case 'chat.chatHandler.sendGroupMessage':
|
||||
{
|
||||
if(msg.channel == CHANNEL_PREFIX.GUILD) {
|
||||
const guildCode = session.get('guildCode');
|
||||
let result = await checkGuildChat(roleId, guildCode, msg.content);
|
||||
if(!result) hasBlockWords = true;
|
||||
break;
|
||||
@@ -62,6 +62,24 @@ Filter.prototype.before = async function (routeRecord: RouteRecord, msg: any, se
|
||||
break;
|
||||
}
|
||||
}
|
||||
case 'role.roleHandler.rename':
|
||||
case 'role.roleHandler.initRole':
|
||||
{
|
||||
let result = await checkRoleName(roleId, msg.roleName);
|
||||
if(!result) hasBlockWords = true;
|
||||
break;
|
||||
}
|
||||
case 'guild.guildHandler.createGuild':
|
||||
case 'guild.guildHandler.setGuildInfo':
|
||||
{
|
||||
if(!guildCode) {
|
||||
guildCode = genCode(6);
|
||||
msg.guildCode = guildCode;
|
||||
}
|
||||
let result = await checkGuildName(guildCode, serverId, msg.name, msg.notice);
|
||||
if(!result) hasBlockWords = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user