try-catch *list

This commit is contained in:
ChomeNS 2022-08-19 11:19:55 +07:00
parent becd6fcf16
commit ad734e0f6a

View file

@ -8,23 +8,31 @@ module.exports = {
usage: '', usage: '',
trusted: 0, trusted: 0,
execute: async function(bot) { execute: async function(bot) {
bot.core.run('minecraft:tellraw @a ' + JSON.stringify(['', {text: 'Players:', color: 'green'}])); try {
await sleep(60); bot.core.run('minecraft:tellraw @a ' + JSON.stringify(['', {text: 'Players:', color: 'green'}]));
for (const property of bot.tabcompleteplayers) { await sleep(60);
if (property.match.startsWith('@')) continue; for (const property of bot.tabcompleteplayers) {
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'}])); 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) { discordExecute: async function(bot, username, usernameraw, sender, prefix, args, channeldc) {
let players = ''; try {
for (const property of bot.tabcompleteplayers) { let players = '';
if (property.match.startsWith('@')) continue; for (const property of bot.tabcompleteplayers) {
players += `\`${property.match}\` \`${bot.players.getPlayer(property.match).UUID}\`` + '\n'; 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]});
}, },
}; };