2022-12-24 00:59:52 -05:00
|
|
|
|
const { EmbedBuilder } = require('discord.js')
|
2022-08-14 05:51:45 -04:00
|
|
|
|
module.exports = {
|
|
|
|
|
name: 'list',
|
|
|
|
|
alias: [],
|
|
|
|
|
description: 'List players',
|
|
|
|
|
usage: '',
|
|
|
|
|
trusted: 0,
|
2022-12-14 08:51:30 -05:00
|
|
|
|
execute: async function (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
|
2022-08-19 00:19:55 -04:00
|
|
|
|
try {
|
2022-11-27 02:35:28 -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',
|
2022-11-27 02:35:28 -05:00
|
|
|
|
value: property.name
|
2022-11-10 08:03:14 -05:00
|
|
|
|
},
|
|
|
|
|
hoverEvent: {
|
|
|
|
|
action: 'show_text',
|
|
|
|
|
contents: [{
|
|
|
|
|
text: 'Click here to copy the username to your clipboard',
|
2022-11-27 02:35:28 -05:00
|
|
|
|
color: 'green'
|
|
|
|
|
}]
|
|
|
|
|
}
|
|
|
|
|
})
|
2022-11-10 08:03:14 -05:00
|
|
|
|
component.push({
|
|
|
|
|
text: ' › ',
|
2022-11-27 02:35:28 -05:00
|
|
|
|
color: 'dark_gray'
|
|
|
|
|
})
|
2022-11-10 08:03:14 -05:00
|
|
|
|
component.push({
|
|
|
|
|
text: property.UUID,
|
|
|
|
|
color: 'aqua',
|
|
|
|
|
clickEvent: {
|
|
|
|
|
action: 'copy_to_clipboard',
|
2022-11-27 02:35:28 -05:00
|
|
|
|
value: property.UUID
|
2022-11-10 08:03:14 -05:00
|
|
|
|
},
|
|
|
|
|
hoverEvent: {
|
|
|
|
|
action: 'show_text',
|
|
|
|
|
contents: [{
|
|
|
|
|
text: 'Click here to copy the UUID to your clipboard',
|
2022-11-27 02:35:28 -05:00
|
|
|
|
color: 'green'
|
|
|
|
|
}]
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
component.push('\n')
|
2022-08-19 00:19:55 -04:00
|
|
|
|
}
|
2022-11-27 02:35:28 -05:00
|
|
|
|
component.pop()
|
|
|
|
|
bot.tellraw(selector, component)
|
2022-08-19 00:19:55 -04:00
|
|
|
|
} catch (e) {
|
2022-11-27 02:35:28 -05:00
|
|
|
|
|
2022-08-14 05:51:45 -04:00
|
|
|
|
}
|
|
|
|
|
},
|
2022-12-14 08:51:30 -05:00
|
|
|
|
discordExecute (bot, username, sender, prefix, args, channeldc, message, config) {
|
2022-08-19 00:19:55 -04:00
|
|
|
|
try {
|
2022-11-27 02:35:28 -05:00
|
|
|
|
let players = ''
|
2022-10-13 04:35:28 -04:00
|
|
|
|
for (const property of bot.players.list) {
|
|
|
|
|
// if (property.match.startsWith('@')) continue;
|
2022-11-27 02:35:28 -05:00
|
|
|
|
players += `\`${property.name}\` › \`${property.UUID}\`` + '\n'
|
2022-08-19 00:19:55 -04:00
|
|
|
|
}
|
2022-12-24 00:59:52 -05:00
|
|
|
|
const Embed = new EmbedBuilder()
|
2022-12-01 05:15:30 -05:00
|
|
|
|
.setColor(config.discord.embedsColors.normal)
|
2022-11-27 02:35:28 -05:00
|
|
|
|
.setTitle(`Players (${bot.players.list.length})`)
|
|
|
|
|
.setDescription(players.substring(0, 4096))
|
|
|
|
|
channeldc.send({ embeds: [Embed] })
|
2022-08-19 00:19:55 -04:00
|
|
|
|
} catch (e) {
|
2022-11-27 02:35:28 -05:00
|
|
|
|
|
2022-08-14 05:51:45 -04:00
|
|
|
|
}
|
2022-11-27 02:35:28 -05:00
|
|
|
|
}
|
|
|
|
|
}
|