chomens-bot-js/commands/uuid.js

84 lines
2.5 KiB
JavaScript
Raw Normal View History

2022-08-14 05:51:45 -04:00
/* eslint-disable max-len */
2022-10-14 04:46:41 -04:00
const {MessageEmbed} = require('discord.js');
2022-08-14 05:51:45 -04:00
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,
2022-11-16 06:41:30 -05:00
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
2022-10-14 04:46:41 -04:00
if (args[0]) {
2022-08-14 05:51:45 -04:00
const playername = args.join(' ');
const player = bot.playersAddedPlayers[playername];
2022-11-05 07:52:50 -04:00
if (player === undefined) throw new SyntaxError('Invalid Username');
2022-11-16 06:41:30 -05:00
bot.tellraw(selector,
2022-11-06 06:11:41 -05:00
[
{
2022-11-06 06:12:28 -05:00
text: `${playername}'s UUID: `,
2022-11-06 06:11:41 -05:00
color: 'green',
},
{
text: player,
color: 'aqua',
clickEvent: {
action: 'copy_to_clipboard',
value: player,
},
hoverEvent: {
action: 'show_text',
contents: [
{
2022-11-06 06:12:28 -05:00
text: 'Click here to copy the UUID to your clipboard',
2022-11-06 06:11:41 -05:00
color: 'green',
},
],
},
},
]);
2022-08-14 05:51:45 -04:00
} else {
2022-11-16 06:41:30 -05:00
bot.tellraw(selector,
2022-11-06 06:11:41 -05:00
[
{
2022-11-06 06:12:28 -05:00
text: `Your UUID: `,
2022-11-06 06:11:41 -05:00
color: 'green',
},
{
2022-11-06 06:12:28 -05:00
text: sender,
2022-11-06 06:11:41 -05:00
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',
},
],
},
},
]);
2022-08-14 05:51:45 -04:00
}
},
2022-10-14 04:46:41 -04:00
discordExecute: function(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('#FFFF00')
.setTitle('UUID')
.setDescription(`${playername}'s UUID: ${player}`);
channeldc.send({embeds: [Embed]});
} else {
const Embed = new MessageEmbed()
.setColor('#FF0000')
.setTitle('Error')
.setDescription('Invalid player name');
channeldc.send({embeds: [Embed]});
}
},
2022-08-14 05:51:45 -04:00
};