mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-27 01:25:33 -05:00
new regex
This commit is contained in:
parent
53912e0b7d
commit
13c7c5fd1e
1 changed files with 4 additions and 4 deletions
|
@ -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);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue