From 1a985fe43fc471ab112a4de828455e05fd9fdd1f Mon Sep 17 00:00:00 2001 From: Taken Date: Sun, 31 Dec 2023 13:30:41 +0100 Subject: [PATCH 1/2] Added whoami command --- src/commands/whoami.ts | 65 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 src/commands/whoami.ts diff --git a/src/commands/whoami.ts b/src/commands/whoami.ts new file mode 100644 index 0000000..8f586a2 --- /dev/null +++ b/src/commands/whoami.ts @@ -0,0 +1,65 @@ +import { SlashCommandBuilder, userMention } from "discord.js" +import { Command } from "../interfaces" +import { color, devMessage } from "../../config/options.json" +import verify from "../schemas/verifySchema" +import { getIGN, getHeadURL } from "../utils/Hypixel" + +export = { + name: "whoami", + description: "Get your user info", + type: "slash", + public: true, + dev: true, + + data: new SlashCommandBuilder() + .setName("whoami") + .setDescription("Get your user info") + .setDMPermission(false), + + async execute(interaction) { + await interaction.deferReply() + + const user = interaction.user + const verifyData = await verify.findOne({ userID: user.id }) + const embedColor = Number(color.replace("#", "0x")) + + if (!verifyData) { + await interaction.editReply({ + embeds: [ + { + description: "You are not verified!", + color: embedColor, + }, + ], + }) + return + } + + const ign = await getIGN(verifyData.uuid) + const head = await getHeadURL(ign!) + + await interaction.editReply({ + embeds: [ + { + title: "User Info", + description: + "**User:** " + + userMention(user.id) + + "\n**IGN:** `" + + ign + + "`", + color: embedColor, + thumbnail: { + url: head!, + }, + footer: { + text: interaction.guild!.name + " | " + devMessage, + icon_url: interaction.guild!.iconURL({ + forceStatic: true, + })!, + }, + }, + ], + }) + }, +} as Command From 719c5623ab351b727bc8573c40ec0c7b2d084b65 Mon Sep 17 00:00:00 2001 From: Taken Date: Sun, 31 Dec 2023 13:31:08 +0100 Subject: [PATCH 2/2] Eslint and formatting --- src/commands/check.ts | 4 +++- src/commands/guild.ts | 5 ++++- src/commands/guild/info.ts | 4 +++- src/commands/guild/member.ts | 4 +++- src/commands/guild/top.ts | 10 ++++++++-- src/commands/help.ts | 6 ++++-- src/commands/ping.ts | 5 ++++- src/commands/reqs.ts | 9 +++++++-- src/commands/staff/updatediscordroles.ts | 3 ++- src/commands/uuid.ts | 5 ++++- src/interfaces/Autocomplete.ts | 2 +- src/interfaces/Button.ts | 2 +- src/interfaces/Command.ts | 7 +++++-- src/interfaces/ContextMenu.ts | 2 +- src/interfaces/Event.ts | 2 +- src/interfaces/Modal.ts | 2 +- 16 files changed, 52 insertions(+), 20 deletions(-) diff --git a/src/commands/check.ts b/src/commands/check.ts index cff6c84..533dbb5 100644 --- a/src/commands/check.ts +++ b/src/commands/check.ts @@ -306,7 +306,9 @@ export = { }, footer: { text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL({ forceStatic: true })!, + icon_url: interaction.guild!.iconURL({ + forceStatic: true, + })!, }, fields: statsFields, }, diff --git a/src/commands/guild.ts b/src/commands/guild.ts index caec139..58207ba 100644 --- a/src/commands/guild.ts +++ b/src/commands/guild.ts @@ -108,7 +108,10 @@ export = { color: embedColor, footer: { text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL({ forceStatic: false }) || undefined, + icon_url: + interaction.guild!.iconURL({ + forceStatic: false, + }) || undefined, }, }, ], diff --git a/src/commands/guild/info.ts b/src/commands/guild/info.ts index 0ae61d7..8162af5 100644 --- a/src/commands/guild/info.ts +++ b/src/commands/guild/info.ts @@ -234,7 +234,9 @@ async function guildInfo( color: embedColor, footer: { text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL({ forceStatic: false }) || undefined, + icon_url: + interaction.guild!.iconURL({ forceStatic: false }) || + undefined, }, }, ], diff --git a/src/commands/guild/member.ts b/src/commands/guild/member.ts index 2cbe1cd..a369cd1 100644 --- a/src/commands/guild/member.ts +++ b/src/commands/guild/member.ts @@ -204,7 +204,9 @@ async function guildMember( ], footer: { text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL({ forceStatic: false })!, + icon_url: interaction.guild!.iconURL({ + forceStatic: false, + })!, }, }, ], diff --git a/src/commands/guild/top.ts b/src/commands/guild/top.ts index 3d02f07..ee5c3b0 100644 --- a/src/commands/guild/top.ts +++ b/src/commands/guild/top.ts @@ -279,8 +279,14 @@ async function guildTop( color: embedColor, fields: newList, footer: { - text: interaction.guild!.name + " | " + devMessage + cacheStatusText, - icon_url: interaction.guild!.iconURL({ forceStatic: false })!, + text: + interaction.guild!.name + + " | " + + devMessage + + cacheStatusText, + icon_url: interaction.guild!.iconURL({ + forceStatic: false, + })!, }, }, ], diff --git a/src/commands/help.ts b/src/commands/help.ts index aba68dc..03fb21e 100644 --- a/src/commands/help.ts +++ b/src/commands/help.ts @@ -66,10 +66,12 @@ export = { fields: commandList, color: embedColor, thumbnail: { - url: interaction.guild!.iconURL({ forceStatic: true, })!, + url: interaction.guild!.iconURL({ forceStatic: true })!, }, footer: { - icon_url: interaction.guild!.iconURL({ forceStatic: false})!, + icon_url: interaction.guild!.iconURL({ + forceStatic: false, + })!, text: interaction.guild!.name + " | " + devMessage, }, }, diff --git a/src/commands/ping.ts b/src/commands/ping.ts index 40c1a5b..897dfa9 100644 --- a/src/commands/ping.ts +++ b/src/commands/ping.ts @@ -26,7 +26,10 @@ export = { color: embedColor, footer: { text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild?.iconURL({ forceStatic: false }) || undefined, + icon_url: + interaction.guild?.iconURL({ + forceStatic: false, + }) || undefined, }, timestamp: new Date().toISOString(), }, diff --git a/src/commands/reqs.ts b/src/commands/reqs.ts index 4e39e68..e4c9122 100644 --- a/src/commands/reqs.ts +++ b/src/commands/reqs.ts @@ -35,7 +35,9 @@ export = { color: embedColor, thumbnail: { url: - interaction?.guild?.iconURL({ forceStatic: false, }) || "", + interaction?.guild?.iconURL({ + forceStatic: false, + }) || "", }, fields: [ { @@ -70,7 +72,10 @@ export = { ], footer: { text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL({ forceStatic: false }) || undefined, + icon_url: + interaction.guild!.iconURL({ + forceStatic: false, + }) || undefined, }, }, ], diff --git a/src/commands/staff/updatediscordroles.ts b/src/commands/staff/updatediscordroles.ts index 6dfeb3a..c7a3296 100644 --- a/src/commands/staff/updatediscordroles.ts +++ b/src/commands/staff/updatediscordroles.ts @@ -17,7 +17,8 @@ export async function updateDiscordRoles( await interaction.editReply({ embeds: [ { - description: "You do not have permission to use this command.", + description: + "You do not have permission to use this command.", color: embedColor, }, ], diff --git a/src/commands/uuid.ts b/src/commands/uuid.ts index 4ce1f8d..bdd7ca1 100644 --- a/src/commands/uuid.ts +++ b/src/commands/uuid.ts @@ -60,7 +60,10 @@ export = { }, footer: { text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild?.iconURL({ forceStatic: false }) || undefined, + icon_url: + interaction.guild?.iconURL({ + forceStatic: false, + }) || undefined, }, }, ], diff --git a/src/interfaces/Autocomplete.ts b/src/interfaces/Autocomplete.ts index 284d6cb..919a1ea 100644 --- a/src/interfaces/Autocomplete.ts +++ b/src/interfaces/Autocomplete.ts @@ -1,9 +1,9 @@ +/* eslint-disable no-unused-vars */ import { AutocompleteInteraction } from "discord.js" export default interface Autocomplete { name: string description: string type: "autocomplete" - // eslint-disable-next-line no-unused-vars execute: (interacion: AutocompleteInteraction) => Promise } diff --git a/src/interfaces/Button.ts b/src/interfaces/Button.ts index f4024d9..b7d332b 100644 --- a/src/interfaces/Button.ts +++ b/src/interfaces/Button.ts @@ -1,9 +1,9 @@ +/* eslint-disable no-unused-vars */ import { ButtonInteraction } from "discord.js" export default interface Button { name: string description: string type: "button" - // eslint-disable-next-line no-unused-vars execute: (interaction: ButtonInteraction) => Promise } diff --git a/src/interfaces/Command.ts b/src/interfaces/Command.ts index 4a3239a..4057322 100644 --- a/src/interfaces/Command.ts +++ b/src/interfaces/Command.ts @@ -1,3 +1,4 @@ +/* eslint-disable no-unused-vars */ import { ChatInputCommandInteraction, SlashCommandBuilder } from "discord.js" import { ExtendedClient as Client } from "../utils/Client" @@ -12,6 +13,8 @@ export default interface Command { "addSubcommand" | "addSubcommandGroup" | "addIntegerOption" > subcommands?: boolean - // eslint-disable-next-line no-unused-vars - execute: ( interaction: ChatInputCommandInteraction, client: Client,) => Promise + execute: ( + interaction: ChatInputCommandInteraction, + client: Client, + ) => Promise } diff --git a/src/interfaces/ContextMenu.ts b/src/interfaces/ContextMenu.ts index a9eb460..50612e9 100644 --- a/src/interfaces/ContextMenu.ts +++ b/src/interfaces/ContextMenu.ts @@ -1,3 +1,4 @@ +/* eslint-disable no-unused-vars */ import { ContextMenuCommandInteraction, ContextMenuCommandBuilder, @@ -9,6 +10,5 @@ export default interface ContextMenu { type: "contextmenu" dev?: boolean data: ContextMenuCommandBuilder - // eslint-disable-next-line no-unused-vars execute: (interaction: ContextMenuCommandInteraction) => Promise } diff --git a/src/interfaces/Event.ts b/src/interfaces/Event.ts index cd2085d..8a487b6 100644 --- a/src/interfaces/Event.ts +++ b/src/interfaces/Event.ts @@ -1,3 +1,4 @@ +/* eslint-disable no-unused-vars */ import { ClientEvents } from "discord.js" export default interface Event { @@ -5,6 +6,5 @@ export default interface Event { description: string type: "event" event: keyof ClientEvents - // eslint-disable-next-line no-unused-vars execute(...args: any[]): void } diff --git a/src/interfaces/Modal.ts b/src/interfaces/Modal.ts index d0e8271..6fe3cb5 100644 --- a/src/interfaces/Modal.ts +++ b/src/interfaces/Modal.ts @@ -1,9 +1,9 @@ +/* eslint-disable no-unused-vars */ import { ModalSubmitInteraction } from "discord.js" export default interface Modal { name: string description: string type: "modal" - // eslint-disable-next-line no-unused-vars execute: (interaction: ModalSubmitInteraction) => Promise }