diff --git a/commands/list.js b/commands/list.js index fc479fa..dd0525f 100644 --- a/commands/list.js +++ b/commands/list.js @@ -8,23 +8,31 @@ module.exports = { usage: '', trusted: 0, execute: async function(bot) { - bot.core.run('minecraft:tellraw @a ' + JSON.stringify(['', {text: 'Players:', color: 'green'}])); - await sleep(60); - for (const property of bot.tabcompleteplayers) { - if (property.match.startsWith('@')) continue; - bot.core.run('minecraft:tellraw @a ' + JSON.stringify(['', {text: `${property.match}`, color: 'yellow'}, {text: ' › ', color: 'aqua'}, {text: `${bot.players.getPlayer(property.match).UUID}`, color: 'aqua'}])); + try { + bot.core.run('minecraft:tellraw @a ' + JSON.stringify(['', {text: 'Players:', color: 'green'}])); + await sleep(60); + for (const property of bot.tabcompleteplayers) { + if (property.match.startsWith('@')) continue; + bot.core.run('minecraft:tellraw @a ' + JSON.stringify(['', {text: `${property.match}`, color: 'yellow'}, {text: ' › ', color: 'aqua'}, {text: `${bot.players.getPlayer(property.match).UUID}`, color: 'aqua'}])); + } + } catch (e) { + return; } }, discordExecute: async function(bot, username, usernameraw, sender, prefix, args, channeldc) { - let players = ''; - for (const property of bot.tabcompleteplayers) { - if (property.match.startsWith('@')) continue; - players += `\`${property.match}\` › \`${bot.players.getPlayer(property.match).UUID}\`` + '\n'; + try { + let players = ''; + for (const property of bot.tabcompleteplayers) { + if (property.match.startsWith('@')) continue; + players += `\`${property.match}\` › \`${bot.players.getPlayer(property.match).UUID}\`` + '\n'; + } + const Embed = new MessageEmbed() + .setColor('#FFFF00') + .setTitle('Players') + .setDescription(players); + channeldc.send({embeds: [Embed]}); + } catch (e) { + return; } - const Embed = new MessageEmbed() - .setColor('#FFFF00') - .setTitle('Players') - .setDescription(players); - channeldc.send({embeds: [Embed]}); }, };