mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-14 10:44:55 -05:00
uuid fix discord + improve + change eslint a bit
This commit is contained in:
parent
33701de582
commit
0712f78ce4
2 changed files with 13 additions and 13 deletions
|
@ -10,7 +10,5 @@
|
|||
"ecmaVersion": "latest",
|
||||
"sourceType": "module"
|
||||
},
|
||||
"rules": {
|
||||
"linebreak-style": 0
|
||||
}
|
||||
"rules": {}
|
||||
}
|
||||
|
|
|
@ -3,13 +3,14 @@ module.exports = {
|
|||
name: 'uuid',
|
||||
alias: [],
|
||||
description: 'Gets the UUID of a player. If no player specified it will show your UUID instead',
|
||||
usage: '',
|
||||
usage: '[player (required on Discord)]',
|
||||
trusted: 0,
|
||||
execute (bot, username, 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')
|
||||
const player = bot.players.list.find((user) => user.name === playername)
|
||||
if (!player) throw new SyntaxError('Invalid username')
|
||||
const playerUUID = player.UUID
|
||||
bot.tellraw(selector,
|
||||
[
|
||||
{
|
||||
|
@ -17,11 +18,11 @@ module.exports = {
|
|||
color: 'green'
|
||||
},
|
||||
{
|
||||
text: player,
|
||||
text: playerUUID,
|
||||
color: 'aqua',
|
||||
clickEvent: {
|
||||
action: 'copy_to_clipboard',
|
||||
value: player
|
||||
value: playerUUID
|
||||
},
|
||||
hoverEvent: {
|
||||
action: 'show_text',
|
||||
|
@ -61,21 +62,22 @@ module.exports = {
|
|||
])
|
||||
}
|
||||
},
|
||||
discordExecute (bot, username, sender, prefix, args, channeldc, message) {
|
||||
discordExecute (bot, username, sender, prefix, args, channeldc, message, config) {
|
||||
if (args[0]) {
|
||||
const playername = args.join(' ')
|
||||
const player = bot.playersAddedPlayers[playername]
|
||||
if (player === undefined) throw new SyntaxError('Invalid UUID')
|
||||
const player = bot.players.list.find((user) => user.name === playername)
|
||||
if (!player) throw new SyntaxError('Invalid username')
|
||||
const playerUUID = player.UUID
|
||||
const Embed = new MessageEmbed()
|
||||
.setColor(config.discord.embedsColors.normal)
|
||||
.setTitle('UUID')
|
||||
.setDescription(`${playername}'s UUID: ${player}`)
|
||||
.setDescription(`${playername}'s UUID: ${playerUUID}`)
|
||||
channeldc.send({ embeds: [Embed] })
|
||||
} else {
|
||||
const Embed = new MessageEmbed()
|
||||
.setColor(config.discord.embedsColors.error)
|
||||
.setTitle('Error')
|
||||
.setDescription('Invalid player name')
|
||||
.setDescription('No player name specified')
|
||||
channeldc.send({ embeds: [Embed] })
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue