From d1e8236ea134140f136801252c7ec8786f3fccc8 Mon Sep 17 00:00:00 2001 From: HF Date: Wed, 29 Apr 2020 23:36:32 +0200 Subject: [PATCH] country ban for actual country not displayed country --- src/core/ChatProvider.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/core/ChatProvider.js b/src/core/ChatProvider.js index c325a4b..0021293 100644 --- a/src/core/ChatProvider.js +++ b/src/core/ChatProvider.js @@ -27,6 +27,10 @@ class ChatProvider { regexp: /ADMIN/gi, matches: 3, }, + { + regexp: /ICE CREAM/gi, + matches: 1, + }, { regexp: /JEBAĆ/gi, matches: 2, @@ -59,11 +63,12 @@ class ChatProvider { async sendMessage(user, message, channelId: number = 0) { const name = (user.regUser) ? user.regUser.name : null; - const country = (name.endsWith('berg') || name.endsWith('stein')) + const country = user.country || 'xx'; + const displayCountry = (name.endsWith('berg') || name.endsWith('stein')) ? 'il' - : (user.country || 'xx'); + : country; - if (name.startsWith('popi')) return null; + if (name.startsWith('popi') || name.startsWith('popl')) return null; if (!name) { // eslint-disable-next-line max-len return 'Couldn\'t send your message, pls log out and back in again.'; @@ -158,8 +163,8 @@ class ChatProvider { } return `You are muted for another ${muted} seconds`; } - this.addMessage(name, message, country, channelId); - webSockets.broadcastChatMessage(name, message, country, channelId); + this.addMessage(name, message, displayCountry, channelId); + webSockets.broadcastChatMessage(name, message, displayCountry, channelId); return null; }