From 479e132e158ac2af7ffda67f01bda8d53f7536a4 Mon Sep 17 00:00:00 2001 From: ChomeNS Date: Sat, 15 Oct 2022 11:18:58 +0700 Subject: [PATCH] =?UTF-8?q?=C2=A7r=C2=A7r=20"fix"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/chat.js | 10 +++++----- plugins/commands.js | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/chat.js b/plugins/chat.js index 6679b51..fbc7e37 100644 --- a/plugins/chat.js +++ b/plugins/chat.js @@ -21,7 +21,7 @@ function inject(bot) { if (raw.match(/.* .*§r: §.*/g)) { // if (packet.sender === '00000000-0000-0000-0000-000000000000') return; const username = raw.replace(/.*?\[.*?\] /, '').replace(/:.*/g, '').replace(/§#....../gm, ''); - const message = raw.split('§r: ')[1].substr(2); + const message = raw.split('§r: ')[1].substring(2); bot.emit('message', username, message, packet.sender); } else if (raw.match(/.* .*: .*/g)) { // if (packet.sender === '00000000-0000-0000-0000-000000000000') return; @@ -31,24 +31,24 @@ function inject(bot) { } else if (raw.match(/.* .*\u203a .*/g)) { // if (packet.sender === '00000000-0000-0000-0000-000000000000') return; const username = raw.replace(/.*?\[.*?\] /g, '').replace(/\u203a.*/g, '').replace(/§#....../gm, '').split(' ')[0]; - const message = raw.split('\u203a ')[1].substr(4); + const message = raw.split('\u203a ')[1].substring(2); bot.emit('message', username, message, packet.sender); } else if (raw.match(/.* .*\u00BB .*/g)) { // if (packet.sender === '00000000-0000-0000-0000-000000000000') return; const username = raw.replace(/.*?\[.*?\] /g, '').replace(/\u00BB.*/g, '').replace(/§#....../gm, '').split(' ')[0]; - const message = raw.split('\u00BB ')[1].substr(4); + const message = raw.split('\u00BB ')[1].substring(2); bot.emit('message', username, message, packet.sender); } else if (raw.match(/<.*§r> .*/g)) { // if (packet.sender === '00000000-0000-0000-0000-000000000000') return; - const username = raw.substr(3).split('§r>')[0]; + const username = raw.substring(3).split('§r>')[0]; const message = raw.split('§r> ')[1]; bot.emit('message', username, message, packet.sender); } else if (raw.match(/<.*> .*/g)) { // if (packet.sender === '00000000-0000-0000-0000-000000000000') return; - const username = raw.substr(3).split('>')[0]; + const username = raw.substring(3).split('>')[0]; const message = raw.split('> ')[1]; bot.emit('message', username, message, packet.sender); diff --git a/plugins/commands.js b/plugins/commands.js index 37f0251..c783bb6 100644 --- a/plugins/commands.js +++ b/plugins/commands.js @@ -8,8 +8,8 @@ function inject(bot, dcclient) { bot.command_handler.commands = loadFiles(path.join(__dirname, '../commands')); bot.command_handler.main = function(prefix, username, usernameraw, message, sender, channeldc) { let raw; - if (typeof message.content!=='undefined') raw = message.content.substr(prefix.length); - if (typeof message.content==='undefined') raw = message.substr(prefix.length); + if (typeof message.content!=='undefined') raw = message.content.substring(prefix.length); + if (typeof message.content==='undefined') raw = message.substring(prefix.length); const [commandName, ...args] = raw.split(' '); var command = bot.command_handler.commands.find((command) => command.name === commandName.toLowerCase()); try { @@ -52,7 +52,7 @@ function inject(bot, dcclient) { const sender = bot.options.host === 'sus.shhnowisnottheti.me' && senderr !== '00000000-0000-0000-0000-000000000000' ? senderr : bot.playersAddedPlayers[usernameraw]; if (!sender) return; const username = bot.getplayerusername[sender]; - const message = messagee.replace(/§r/g /* /§[a-f0-9rlonmk]/g */, '')/* .replace(/§/g, '')*/; + const message = messagee.replace(/* /§r/g */ /§[a-f0-9rlonmk]/g, '')/* .replace(/§/g, '')*/; bot.command_handler.run(username, usernameraw, message, sender); } catch (e) { return;