mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-14 18:54:55 -05:00
38 lines
1.2 KiB
JavaScript
38 lines
1.2 KiB
JavaScript
/* eslint-disable max-len */
|
||
const sleep = require('sleep-promise');
|
||
const {MessageEmbed} = require('discord.js');
|
||
module.exports = {
|
||
name: 'list',
|
||
alias: [],
|
||
description: 'List players',
|
||
usage: '',
|
||
trusted: 0,
|
||
execute: async function(bot) {
|
||
try {
|
||
bot.tellraw('@a', [{text: 'Players:', color: 'green'}]);
|
||
await sleep(60);
|
||
for (const property of bot.players.list) {
|
||
// if (property.match.startsWith('@')) continue;
|
||
bot.tellraw('@a', [{text: `${property.name}`, color: 'yellow'}, {text: ' › ', color: 'aqua'}, {text: `${property.UUID}`, color: 'aqua'}]);
|
||
}
|
||
} catch (e) {
|
||
return;
|
||
}
|
||
},
|
||
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc) {
|
||
try {
|
||
let players = '';
|
||
for (const property of bot.players.list) {
|
||
// if (property.match.startsWith('@')) continue;
|
||
players += `\`${property.name}\` › \`${property.UUID}\`` + '\n';
|
||
}
|
||
const Embed = new MessageEmbed()
|
||
.setColor('#FFFF00')
|
||
.setTitle('Players')
|
||
.setDescription(players.substring(0, 4096));
|
||
channeldc.send({embeds: [Embed]});
|
||
} catch (e) {
|
||
return;
|
||
}
|
||
},
|
||
};
|