new regex

This commit is contained in:
ChomeNS 2022-11-21 17:12:14 +07:00
parent 53912e0b7d
commit 13c7c5fd1e

View file

@ -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);
});