Merge branch 'dev' into 'main'
Dev See merge request illegitimate/illegitimate-bot!61
This commit is contained in:
56
commands/uuid.js
Normal file
56
commands/uuid.js
Normal file
@@ -0,0 +1,56 @@
|
||||
const { SlashCommandBuilder } = require('discord.js')
|
||||
const { color } = require('../config/options.json')
|
||||
const { getUUID, getIGN, getHeadURL, formatUuid } = require('../utils/utils.js')
|
||||
|
||||
module.exports = {
|
||||
name: 'uuid',
|
||||
description: 'Get a player\'s UUID',
|
||||
type: 'slash',
|
||||
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('uuid')
|
||||
.setDescription('Get a player\'s UUID')
|
||||
.addStringOption(option => option
|
||||
.setName('ign')
|
||||
.setDescription('Player\'s name')
|
||||
.setRequired(true)
|
||||
),
|
||||
|
||||
/** @param { import('discord.js').ChatInputCommandInteraction } interaction */
|
||||
|
||||
async execute(interaction) {
|
||||
|
||||
await interaction.deferReply()
|
||||
|
||||
const ign = interaction.options.getString('ign')
|
||||
const uuid = await getUUID(ign)
|
||||
const formattedUuid = formatUuid(uuid)
|
||||
const newIgn = await getIGN(uuid)
|
||||
const head = await getHeadURL(ign)
|
||||
const embedColor = Number(color.replace('#', '0x'))
|
||||
|
||||
if (!uuid) {
|
||||
interaction.editReply({
|
||||
description: 'That player doesn\'t exist!',
|
||||
color: embedColor
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
title: newIgn,
|
||||
description: "**UUID:** `" + uuid + "`\n" +
|
||||
"**Formatted UUID:** `" + formattedUuid + "`",
|
||||
color: embedColor,
|
||||
thumbnail: {
|
||||
url: head
|
||||
},
|
||||
footer: {
|
||||
text: interaction.guild.name + " | Developed by taken.lua",
|
||||
icon_url: interaction.guild.iconURL({ dynamic: true })
|
||||
}
|
||||
}]
|
||||
})
|
||||
}
|
||||
}
|
||||
5
utils/functions/uuid.js
Normal file
5
utils/functions/uuid.js
Normal file
@@ -0,0 +1,5 @@
|
||||
function formatUuid(uuid) {
|
||||
return uuid.replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/, '$1-$2-$3-$4-$5')
|
||||
}
|
||||
|
||||
module.exports = { formatUuid }
|
||||
@@ -1,6 +1,7 @@
|
||||
const { skywarsLevel } = require('./functions/skywars.js')
|
||||
const { bedwarsLevel } = require('./functions/bedwars.js')
|
||||
const { hypixelLevel } = require('./functions/hypixel.js')
|
||||
const { formatUuid } = require('./functions/uuid.js')
|
||||
const { guildLevel, scaledGEXP } = require('./functions/guild.js')
|
||||
const { getUUID, getIGN, getPlayer, getGuild, getHeadURL } = require('./functions/account.js')
|
||||
|
||||
@@ -14,5 +15,6 @@ module.exports = {
|
||||
getIGN,
|
||||
getPlayer,
|
||||
getGuild,
|
||||
getHeadURL
|
||||
getHeadURL,
|
||||
formatUuid
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user