diff --git a/plugins/commands.js b/plugins/commands.js index 6283741..b8ce4c3 100644 --- a/plugins/commands.js +++ b/plugins/commands.js @@ -61,29 +61,11 @@ function inject (bot, dcclient, config) { bot.command_handler.main(prefix, username, message, sender, channeldc, hash, ownerhash, selector, proxy) } } - let previousMessage = { username: '', message: '' } - let ratelimit = 0 bot.on('chat', async (_username, _message) => { - // try catch cuz TypeError: Cannot read properties of undefined (reading 'replace') - try { - if ( - previousMessage.username === _username && - previousMessage.message === _message - ) { - if (ratelimit === 3) ratelimit = 0 - ratelimit++ - return - } - - previousMessage = { username: _username, _message } - - const username = _username.replace(/§.?/g, '') - const sender = bot.players.list.find((val) => val.name === username)?.UUID - const message = _message.replace(/* /§r/g */ /§.?/g, '')/* .replace(/§/g, '') */ - bot.command_handler.run(username, message, sender, channeldc, bot.hash, bot.ownerHash) - } catch (e) { - bot.console.error(e) - } + const username = _username?.replace(/§.?/g, '') + const sender = bot.players.list.find((val) => val.name === username)?.UUID + const message = _message?.replace(/* /§r/g */ /§.?/g, '')/* .replace(/§/g, '') */ + bot.command_handler.run(username, message, sender, channeldc, bot.hash, bot.ownerHash) }) bot.on('cspy', async function (_username, _message) { const username = _username.replace(/§.?/g, '')