mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-23 15:47:57 -05:00
83 lines
2.4 KiB
JavaScript
83 lines
2.4 KiB
JavaScript
/* eslint-disable max-len */
|
|
const { MessageEmbed } = require('discord.js')
|
|
module.exports = {
|
|
name: 'uuid',
|
|
alias: [],
|
|
description: 'Gets the UUID of a player. If no player specified it will show your UUID instead',
|
|
usage: '',
|
|
trusted: 0,
|
|
execute (bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
|
if (args[0]) {
|
|
const playername = args.join(' ')
|
|
const player = bot.playersAddedPlayers[playername]
|
|
if (player === undefined) throw new SyntaxError('Invalid Username')
|
|
bot.tellraw(selector,
|
|
[
|
|
{
|
|
text: `${playername}'s UUID: `,
|
|
color: 'green'
|
|
},
|
|
{
|
|
text: player,
|
|
color: 'aqua',
|
|
clickEvent: {
|
|
action: 'copy_to_clipboard',
|
|
value: player
|
|
},
|
|
hoverEvent: {
|
|
action: 'show_text',
|
|
contents: [
|
|
{
|
|
text: 'Click here to copy the UUID to your clipboard',
|
|
color: 'green'
|
|
}
|
|
]
|
|
}
|
|
}
|
|
])
|
|
} else {
|
|
bot.tellraw(selector,
|
|
[
|
|
{
|
|
text: 'Your UUID: ',
|
|
color: 'green'
|
|
},
|
|
{
|
|
text: sender,
|
|
color: 'aqua',
|
|
clickEvent: {
|
|
action: 'copy_to_clipboard',
|
|
value: sender
|
|
},
|
|
hoverEvent: {
|
|
action: 'show_text',
|
|
contents: [
|
|
{
|
|
text: 'Click here to copy the uuid to your clipboard',
|
|
color: 'green'
|
|
}
|
|
]
|
|
}
|
|
}
|
|
])
|
|
}
|
|
},
|
|
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc, message) {
|
|
if (args[0]) {
|
|
const playername = args.join(' ')
|
|
const player = bot.playersAddedPlayers[playername]
|
|
if (player === undefined) throw new SyntaxError('Invalid UUID')
|
|
const Embed = new MessageEmbed()
|
|
.setColor(config.discord.embedsColors.normal)
|
|
.setTitle('UUID')
|
|
.setDescription(`${playername}'s UUID: ${player}`)
|
|
channeldc.send({ embeds: [Embed] })
|
|
} else {
|
|
const Embed = new MessageEmbed()
|
|
.setColor(config.discord.embedsColors.error)
|
|
.setTitle('Error')
|
|
.setDescription('Invalid player name')
|
|
channeldc.send({ embeds: [Embed] })
|
|
}
|
|
}
|
|
}
|