mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-14 10:44:55 -05:00
remove + add
This commit is contained in:
parent
a6f4c9f035
commit
bb26fe5ba0
1 changed files with 4 additions and 22 deletions
|
@ -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, '')
|
||||
|
|
Loading…
Reference in a new issue