From 13c7c5fd1ec64501eb644b783a43e987ad0473cb Mon Sep 17 00:00:00 2001 From: ChomeNS Date: Mon, 21 Nov 2022 17:12:14 +0700 Subject: [PATCH] new regex --- plugins/commands.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/commands.js b/plugins/commands.js index 8c3e60b..d33704b 100644 --- a/plugins/commands.js +++ b/plugins/commands.js @@ -51,20 +51,20 @@ function inject(bot, dcclient, config) { bot.on('message', async (_username, _message, _sender) => { // try catch cuz TypeError: Cannot read properties of undefined (reading 'replace') try { - const usernameraw = _username.replace(/§[a-f0-9rlonmk]/g, '').replace(/§/g, ''); + const usernameraw = _username.replace(/§.?/g, ''); const sender = _sender !== '00000000-0000-0000-0000-000000000000' ? _sender : bot.playersAddedPlayers[usernameraw]; let username; if (!bot.getplayerusername[sender]) username = usernameraw; else username = bot.getplayerusername[sender]; - const message = _message.replace(/* /§r/g */ /§[a-f0-9rlonmk]/g, '')/* .replace(/§/g, '')*/; + const message = _message.replace(/* /§r/g */ /§.?/g, '')/* .replace(/§/g, '')*/; bot.command_handler.run(username, usernameraw, message, sender, channeldc, bot.hash, bot.ownerHash); } catch (e) { bot.console.error(e); } }); bot.on('cspy', async function(_username, _message) { - const username = _username.replace(/§[a-f0-9rlonmk]/g, '').replace(/§/g, ''); - const message = _message.replace(/§[a-f0-9rlonmk]/g, '').replace(/§/g, ''); + const username = _username.replace(/§.?/g, ''); + const message = _message.replace(/§.?/g, ''); const sender = bot.playersAddedPlayers[username]; bot.command_handler.run(username, username, message, sender, channeldc, bot.hash, bot.ownerHash, username); });