mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-14 10:44:55 -05:00
use _ instead of doubling it
This commit is contained in:
parent
681fa526e4
commit
66bf765f8c
1 changed files with 8 additions and 7 deletions
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable require-jsdoc */
|
||||
/* eslint-disable max-len */
|
||||
const path = require('path');
|
||||
const {MessageEmbed} = require('discord.js');
|
||||
|
@ -47,23 +48,23 @@ function inject(bot, dcclient, config) {
|
|||
bot.command_handler.main(prefix, username, usernameraw, message, sender, channeldc);
|
||||
}
|
||||
};
|
||||
bot.on('message', async (usernamee, messagee, senderr) => {
|
||||
bot.on('message', async (_username, _message, _sender) => {
|
||||
// try catch cuz TypeError: Cannot read properties of undefined (reading 'replace')
|
||||
try {
|
||||
const usernameraw = usernamee.replace(/§[a-f0-9rlonmk]/g, '').replace(/§/g, '');
|
||||
const sender = bot.options.host === 'sus.shhnowisnottheti.me' && senderr !== '00000000-0000-0000-0000-000000000000' ? senderr : bot.playersAddedPlayers[usernameraw];
|
||||
const usernameraw = _username.replace(/§[a-f0-9rlonmk]/g, '').replace(/§/g, '');
|
||||
const sender = bot.options.host === 'sus.shhnowisnottheti.me' && _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 = messagee.replace(/* /§r/g */ /§[a-f0-9rlonmk]/g, '')/* .replace(/§/g, '')*/;
|
||||
const message = _message.replace(/* /§r/g */ /§[a-f0-9rlonmk]/g, '')/* .replace(/§/g, '')*/;
|
||||
bot.command_handler.run(username, usernameraw, message, sender);
|
||||
} catch (e) {
|
||||
bot.console.error(e);
|
||||
}
|
||||
});
|
||||
bot.on('cspy', async function(usernamee, messagee) {
|
||||
const username = usernamee.replace(/§[a-f0-9rlonmk]/g, '').replace(/§/g, '');
|
||||
const message = messagee.replace(/§[a-f0-9rlonmk]/g, '').replace(/§/g, '');
|
||||
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 sender = bot.playersAddedPlayers[username];
|
||||
bot.command_handler.run(username, username, message, sender);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue