diff --git a/src/commands/check.js b/src/commands/check.js index eb28983..fdd2ea3 100644 --- a/src/commands/check.js +++ b/src/commands/check.js @@ -204,6 +204,9 @@ module.exports = { const hypixelExp = player.networkExp || 0 const level = hypixelLevel(hypixelExp) + const footerText = interaction.guild ? interaction.guild.name : interaction.user.username + " | " + devMessage + const footerIcon = interaction.guild ? interaction.guild.iconURL({ dynamic: true }) : interaction.user.avatarURL({ dynamic: true }) + await interaction.editReply({ embeds: [{ title: rank + player.displayname + guildTag, @@ -215,8 +218,8 @@ module.exports = { url: head }, footer: { - text: interaction?.guild.name || interaction.user.username + " | " + devMessage, - icon_url: interaction?.guild.iconURL() || interaction.user.avatarURL() + text: footerText, + icon_url: footerIcon }, fields: statsFields }] diff --git a/src/commands/guild.js b/src/commands/guild.js index 3c91a90..ef1c146 100644 --- a/src/commands/guild.js +++ b/src/commands/guild.js @@ -53,13 +53,16 @@ module.exports = { return } + const footerText = interaction.guild ? interaction.guild.name : interaction.user.username + " | " + devMessage + const footerIcon = interaction.guild ? interaction.guild.iconURL({ dynamic: true }) : interaction.user.avatarURL({ dynamic: true }) + await interaction.editReply({ embeds: [{ description: "This command is currently under development", color: embedColor, footer: { - text: interaction?.guild.name || interaction.user.username + " | " + devMessage, - icon_url: interaction?.guild.iconURL({ dynamic: true }) || interaction.user.avatarURL({ dynamic: true }) + text: footerText, + icon_url: footerIcon } }] }) diff --git a/src/commands/guild/info.js b/src/commands/guild/info.js index 7359e81..d79dcf5 100644 --- a/src/commands/guild/info.js +++ b/src/commands/guild/info.js @@ -70,6 +70,9 @@ async function guildInfo(interaction) { const guildMembersDailyXP = Object.values(guildMembers).map((m) => m.expHistory[Object.keys(m.expHistory)[0]]) const totalGuildMembersDailyXP = guildMembersDailyXP.reduce((a, b) => a + b, 0) + const footerText = interaction.guild ? interaction.guild.name : interaction.user.username + " | " + devMessage + const footerIcon = interaction.guild ? interaction.guild.iconURL({ dynamic: true }) : interaction.user.avatarURL({ dynamic: true }) + await interaction.editReply({ embeds: [{ title: "**Info on** " + guildName, @@ -95,8 +98,8 @@ async function guildInfo(interaction) { ], color: embedColor, footer: { - text: interaction?.guild.name || interaction.user.username + " | " + devMessage, - icon_url: interaction?.guild.iconURL({ dynamic: true }) || interaction.user.avatarURL({ dynamic: true }) + text: footerText, + icon_url: footerIcon } }] }) diff --git a/src/commands/guild/member.js b/src/commands/guild/member.js index 9fd03e9..821b431 100644 --- a/src/commands/guild/member.js +++ b/src/commands/guild/member.js @@ -109,37 +109,38 @@ async function guildMember(interaction) { guildMemberJoinMinutes + ":" + guildMemberJoinSeconds + const footerText = interaction.guild ? interaction.guild.name : interaction.user.username + " | " + devMessage + const footerIcon = interaction.guild ? interaction.guild.iconURL({ dynamic: true }) : interaction.user.avatarURL({ dynamic: true }) + await interaction.editReply({ - embeds: [ - { - title: rank + displayName + guildTag, - description: "**Guild Name:** `" + guildName + "`\n" + - "**Guild Rank:** `" + guildRank + "`\n", - color: embedColor, - thumbnail: { - url: head, - }, - fields: [ - { - name: "**Daily GEXP**", - value: expValue, - }, - { - name: "**Weekly GEXP**", - value: "**➺ Total:** `" + totalWeeklyGexp + "`\n" + - "**➺ Daily avarage:** `" + averageWeeklyGexp + "`", - }, - { - name: "**Join date**", - value: "**➺ **`" + guildMemberJoin + "`", - }, - ], - footer: { - text: interaction.guild.name + " | " + devMessage, - icon_url: interaction.guild.iconURL({ dynamic: true }), - }, + embeds: [{ + title: rank + displayName + guildTag, + description: "**Guild Name:** `" + guildName + "`\n" + + "**Guild Rank:** `" + guildRank + "`\n", + color: embedColor, + thumbnail: { + url: head, }, - ], + fields: [ + { + name: "**Daily GEXP**", + value: expValue, + }, + { + name: "**Weekly GEXP**", + value: "**➺ Total:** `" + totalWeeklyGexp + "`\n" + + "**➺ Daily avarage:** `" + averageWeeklyGexp + "`", + }, + { + name: "**Join date**", + value: "**➺ **`" + guildMemberJoin + "`", + }, + ], + footer: { + text: footerText, + icon_url: footerIcon + }, + }], }) } diff --git a/src/commands/help.js b/src/commands/help.js index 2c8bf80..98ef090 100644 --- a/src/commands/help.js +++ b/src/commands/help.js @@ -19,6 +19,9 @@ module.exports = { const embedColor = Number(color.replace("#", "0x")) + const footerText = interaction.guild ? interaction.guild.name : interaction.user.username + " | " + devMessage + const footerIcon = interaction.guild ? interaction.guild.iconURL({ dynamic: true }) : interaction.user.avatarURL({ dynamic: true }) + await interaction.editReply({ embeds: [{ title: "Commands", @@ -43,11 +46,11 @@ module.exports = { ], color: embedColor, thumbnail: { - url: interaction.guild.iconURL({ dynamic: true }) + url: interaction?.guild.iconURL({ dynamic: true }) || null }, footer: { - icon_url: interaction?.guild.iconURL({ dynamic: true }) || interaction.user.avatarURL({ dynamic: true }), - text: interaction?.guild.name || interaction.user.username + " | " + devMessage + icon_url: footerIcon, + text: footerText } }] }) diff --git a/src/commands/ping.js b/src/commands/ping.js index 7a4901e..739e33c 100644 --- a/src/commands/ping.js +++ b/src/commands/ping.js @@ -1,5 +1,5 @@ const { SlashCommandBuilder } = require("discord.js") -const { color } = require("../../config/options.json") +const { color, devMessage } = require("../../config/options.json") module.exports = { name: "ping", @@ -20,15 +20,16 @@ module.exports = { const embedColor = Number(color.replace("#", "0x")) - console.log(client.ws.ping) + const footerText = interaction.guild ? interaction.guild.name : interaction.user.username + " | " + devMessage + const footerIcon = interaction.guild ? interaction.guild.iconURL({ dynamic: true }) : interaction.user.avatarURL({ dynamic: true }) await interaction.editReply({ embeds: [{ description: "Ping of the bot is " + client.ws.ping + "ms.", color: embedColor, footer: { - text: interaction?.guild.name || interaction.user.username, - icon_url: interaction?.guild.iconURL({ dynamic: true }) || interaction.user.avatarURL({ dynamic: true }) + text: footerText, + icon_url: footerIcon }, timestamp: new Date() }] diff --git a/src/commands/reqs.js b/src/commands/reqs.js index 93b91bd..4bd4ae9 100644 --- a/src/commands/reqs.js +++ b/src/commands/reqs.js @@ -17,6 +17,8 @@ module.exports = { await interaction.deferReply({ ephemeral: true }) const embedColor = Number(color.replace("#", "0x")) + const footerText = interaction.guild ? interaction.guild.name : interaction.user.username + " | " + devMessage + const footerIcon = interaction.guild ? interaction.guild.iconURL({ dynamic: true }) : interaction.user.avatarURL({ dynamic: true }) await interaction.editReply({ embeds: [{ @@ -44,8 +46,8 @@ module.exports = { } ], footer: { - text: interaction?.guild.name || interaction.user.username + " | " + devMessage, - icon_url: interaction?.guild.iconURL() || interaction.user.avatarURL() + text: footerText, + icon_url: footerIcon } }] }) diff --git a/src/commands/uuid.js b/src/commands/uuid.js index f88d194..9b157db 100644 --- a/src/commands/uuid.js +++ b/src/commands/uuid.js @@ -28,6 +28,8 @@ module.exports = { const newIgn = await getIGN(uuid) const head = await getHeadURL(ign) const embedColor = Number(color.replace("#", "0x")) + const footerText = interaction.guild ? interaction.guild.name : interaction.user.username + " | " + devMessage + const footerIcon = interaction.guild ? interaction.guild.iconURL({ dynamic: true }) : interaction.user.avatarURL({ dynamic: true }) if (!uuid) { interaction.editReply({ @@ -47,8 +49,8 @@ module.exports = { url: head }, footer: { - text: interaction?.guild.name || interaction.user.username + " | " + devMessage, - icon_url: interaction?.guild.iconURL({ dynamic: true }) || interaction.user.avatarURL({ dynamic: true }) + text: footerText, + icon_url: footerIcon } }] })