2022-08-14 05:51:45 -04:00
|
|
|
|
/* eslint-disable max-len */
|
|
|
|
|
const {MessageEmbed} = require('discord.js');
|
|
|
|
|
module.exports = {
|
|
|
|
|
name: 'list',
|
|
|
|
|
alias: [],
|
|
|
|
|
description: 'List players',
|
|
|
|
|
usage: '',
|
|
|
|
|
trusted: 0,
|
2022-11-16 22:30:51 -05:00
|
|
|
|
execute: async function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
2022-08-19 00:19:55 -04:00
|
|
|
|
try {
|
2022-11-10 08:03:14 -05:00
|
|
|
|
const component = [];
|
|
|
|
|
component.push({text: 'Players ', color: 'green'});
|
|
|
|
|
component.push({text: '(', color: 'dark_gray'});
|
|
|
|
|
component.push({text: bot.players.list.length, color: 'gray'});
|
|
|
|
|
component.push({text: ')', color: 'dark_gray'});
|
|
|
|
|
component.push('\n');
|
2022-10-13 04:35:28 -04:00
|
|
|
|
for (const property of bot.players.list) {
|
|
|
|
|
// if (property.match.startsWith('@')) continue;
|
2022-11-10 08:03:14 -05:00
|
|
|
|
component.push({
|
|
|
|
|
text: property.name,
|
|
|
|
|
color: 'yellow',
|
|
|
|
|
clickEvent: {
|
|
|
|
|
action: 'copy_to_clipboard',
|
|
|
|
|
value: property.name,
|
|
|
|
|
},
|
|
|
|
|
hoverEvent: {
|
|
|
|
|
action: 'show_text',
|
|
|
|
|
contents: [{
|
|
|
|
|
text: 'Click here to copy the username to your clipboard',
|
|
|
|
|
color: 'green',
|
|
|
|
|
}],
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
component.push({
|
|
|
|
|
text: ' › ',
|
|
|
|
|
color: 'dark_gray',
|
|
|
|
|
});
|
|
|
|
|
component.push({
|
|
|
|
|
text: property.UUID,
|
|
|
|
|
color: 'aqua',
|
|
|
|
|
clickEvent: {
|
|
|
|
|
action: 'copy_to_clipboard',
|
|
|
|
|
value: property.UUID,
|
|
|
|
|
},
|
|
|
|
|
hoverEvent: {
|
|
|
|
|
action: 'show_text',
|
|
|
|
|
contents: [{
|
|
|
|
|
text: 'Click here to copy the UUID to your clipboard',
|
|
|
|
|
color: 'green',
|
|
|
|
|
}],
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
component.push('\n');
|
2022-08-19 00:19:55 -04:00
|
|
|
|
}
|
2022-11-10 08:03:14 -05:00
|
|
|
|
component.pop();
|
2022-11-16 06:41:30 -05:00
|
|
|
|
bot.tellraw(selector, component);
|
2022-08-19 00:19:55 -04:00
|
|
|
|
} catch (e) {
|
|
|
|
|
return;
|
2022-08-14 05:51:45 -04:00
|
|
|
|
}
|
|
|
|
|
},
|
2022-10-17 04:54:24 -04:00
|
|
|
|
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc) {
|
2022-08-19 00:19:55 -04:00
|
|
|
|
try {
|
2022-10-13 02:05:01 -04:00
|
|
|
|
let players = '';
|
2022-10-13 04:35:28 -04:00
|
|
|
|
for (const property of bot.players.list) {
|
|
|
|
|
// if (property.match.startsWith('@')) continue;
|
|
|
|
|
players += `\`${property.name}\` › \`${property.UUID}\`` + '\n';
|
2022-08-19 00:19:55 -04:00
|
|
|
|
}
|
|
|
|
|
const Embed = new MessageEmbed()
|
|
|
|
|
.setColor('#FFFF00')
|
2022-11-10 08:03:14 -05:00
|
|
|
|
.setTitle(`Players (${bot.players.list.length})`)
|
2022-10-22 04:04:11 -04:00
|
|
|
|
.setDescription(players.substring(0, 4096));
|
2022-08-19 00:19:55 -04:00
|
|
|
|
channeldc.send({embeds: [Embed]});
|
|
|
|
|
} catch (e) {
|
|
|
|
|
return;
|
2022-08-14 05:51:45 -04:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
};
|