don't run commands when sender is undefined

This commit is contained in:
ChomeNS 2022-10-14 12:11:06 +07:00
parent 3767f4c053
commit 97c66474f7
2 changed files with 2 additions and 1 deletions

View file

@ -9,6 +9,6 @@ module.exports = {
execute: function(bot, username, usernameraw, sender, prefix, args) {
const rtppos = `${between(20000000, 500000)} 100 ${between(20000000, 500000)}`;
bot.core.run('minecraft:tellraw @a ' + JSON.stringify([{text: 'Teleporting ', color: 'white'}, {text: username, color: 'aqua'}, {text: ' to ', color: 'white'}, {text: rtppos, color: 'green'}, {text: '...', color: 'white'}]));
bot.core.run(`minecraft:execute unless entity @s[name= run ] run tp ${username} ${rtppos}`);
bot.core.run(`essentials:teleport ${sender} ${rtppos}`);
},
};

View file

@ -50,6 +50,7 @@ function inject(bot, dcclient) {
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];
if (!sender) return;
const username = bot.getplayerusername[sender];
const message = messagee.replace(/§r/g /* /§[a-f0-9rlonmk]/g */, '')/* .replace(/§/g, '')*/;
bot.command_handler.run(username, usernameraw, message, sender);