From a3791d170ceded22e2a47dc849417313acc2b978 Mon Sep 17 00:00:00 2001 From: Taken Date: Sat, 20 Jan 2024 17:19:08 +0100 Subject: [PATCH] Fixed formatting on all command files --- src/commands/check.ts | 26 +-- src/commands/help.ts | 26 ++- src/commands/instructions.ts | 37 ++-- src/commands/kick.ts | 84 ++++----- src/commands/ping.ts | 20 +- src/commands/pp.ts | 15 +- src/commands/remove.ts | 82 ++++----- src/commands/reqs.ts | 80 +++----- src/commands/send.ts | 55 +++--- src/commands/setnick.ts | 59 +++--- src/commands/setup.ts | 88 +++------ src/commands/slowmode.ts | 101 +++++----- src/commands/snipe.ts | 48 +++-- src/commands/staff.ts | 16 +- src/commands/staff/beast.ts | 223 ++++++++--------------- src/commands/staff/help.ts | 31 ++-- src/commands/staff/updatediscordroles.ts | 158 ++++------------ src/commands/timeout.ts | 142 +++++---------- src/commands/unban.ts | 108 +++++------ src/commands/update.ts | 152 +++++---------- src/commands/uuid.ts | 41 ++--- src/commands/verify.ts | 147 ++++++--------- src/commands/whoami.ts | 40 ++-- src/commands/whois.ts | 39 ++-- yarn.lock | 5 - 25 files changed, 655 insertions(+), 1168 deletions(-) diff --git a/src/commands/check.ts b/src/commands/check.ts index eb3213a..2ef1de4 100644 --- a/src/commands/check.ts +++ b/src/commands/check.ts @@ -120,10 +120,10 @@ export = { }) } else { if (player.stats.Bedwars) { - const hsbwexp = player.stats?.Bedwars?.Experience || 0 - const hsbwfk = player.stats?.Bedwars?.final_kills_bedwars || 0 - const hsbwfd = player.stats?.Bedwars?.final_deaths_bedwars || 0 - const hsbwwins = player.stats?.Bedwars?.wins_bedwars || 0 + const hsbwexp = player.stats.Bedwars?.Experience || 0 + const hsbwfk = player.stats.Bedwars?.final_kills_bedwars || 0 + const hsbwfd = player.stats.Bedwars?.final_deaths_bedwars || 0 + const hsbwwins = player.stats.Bedwars?.wins_bedwars || 0 const hsbwstars = bedwarsLevel(hsbwexp) const hsbwfkdr = hsbwfk / hsbwfd || 0 @@ -151,10 +151,10 @@ export = { } if (player.stats.SkyWars) { - const hsswexp = player.stats?.SkyWars?.skywars_experience || 0 - const hsswkills = player.stats?.SkyWars?.kills || 0 - const hsswdeaths = player.stats?.SkyWars?.deaths || 0 - const hsswwins = player.stats?.SkyWars?.wins || 0 + const hsswexp = player.stats.SkyWars?.skywars_experience || 0 + const hsswkills = player.stats.SkyWars?.kills || 0 + const hsswdeaths = player.stats.SkyWars?.deaths || 0 + const hsswwins = player.stats.SkyWars?.wins || 0 const hsswstars = skywarsLevel(hsswexp) const hsswkd = hsswkills / hsswdeaths || 0 @@ -181,10 +181,10 @@ export = { } if (player.stats.Duels) { - const hsduelskills = player.stats?.Duels?.kills || 0 - const hsduelsdeaths = player.stats?.Duels?.deaths || 0 - const hsduelswins = player.stats?.Duels?.wins || 0 - const hsduelslosses = player.stats?.Duels?.losses || 0 + const hsduelskills = player.stats.Duels?.kills || 0 + const hsduelsdeaths = player.stats.Duels?.deaths || 0 + const hsduelswins = player.stats.Duels?.wins || 0 + const hsduelslosses = player.stats.Duels?.losses || 0 const hsduelskd = hsduelskills / hsduelsdeaths || 0 const hsduelswlr = hsduelswins / hsduelslosses || 0 @@ -212,7 +212,7 @@ export = { } // network level - const hypixelExp = player.networkExp || 0 + const hypixelExp = player?.networkExp || 0 const level = hypixelLevel(hypixelExp) await interaction.editReply({ diff --git a/src/commands/help.ts b/src/commands/help.ts index eeb8c0f..972fc73 100644 --- a/src/commands/help.ts +++ b/src/commands/help.ts @@ -58,21 +58,19 @@ export = { const embedColor = Number(color.replace("#", "0x")) await interaction.editReply({ - embeds: [ - { - title: "Commands", - description: "List of commands", - fields: commandList, - color: embedColor, - thumbnail: { - url: interaction.guild!.iconURL() || "" - }, - footer: { - icon_url: interaction.guild!.iconURL() || undefined, - text: interaction.guild!.name + " | " + devMessage - } + embeds: [{ + title: "Commands", + description: "List of commands", + fields: commandList, + color: embedColor, + thumbnail: { + url: interaction.guild!.iconURL() || "" + }, + footer: { + icon_url: interaction.guild!.iconURL() || undefined, + text: interaction.guild!.name + " | " + devMessage } - ] + }] }) } } as Command diff --git a/src/commands/instructions.ts b/src/commands/instructions.ts index ee02634..9404db2 100644 --- a/src/commands/instructions.ts +++ b/src/commands/instructions.ts @@ -18,27 +18,24 @@ export = { const embedColor = Number(color.replace("#", "0x")) await interaction.reply({ - embeds: [ - { - title: "Verification", - description: - "1. Log onto hypixel.\n" + - "2. Right click with the head in your hotbar.\n" + - "3. Click on the social media icon.\n" + - "4. Click on the discord icon.\n" + - "5. Type your username in the chat and press enter.\n" + - "6. Run the `/verify` command in this channel.\n", - color: embedColor, - footer: { - text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined - }, - image: { - url: instructionsgif, - proxy_url: instructionsgif - } + embeds: [{ + title: "Verification", + description: "1. Log onto hypixel.\n" + + "2. Right click with the head in your hotbar.\n" + + "3. Click on the social media icon.\n" + + "4. Click on the discord icon.\n" + + "5. Type your username in the chat and press enter.\n" + + "6. Run the `/verify` command in this channel.\n", + color: embedColor, + footer: { + text: interaction.guild!.name + " | " + devMessage, + icon_url: interaction.guild!.iconURL() || undefined + }, + image: { + url: instructionsgif, + proxy_url: instructionsgif } - ] + }] }) } } as Command diff --git a/src/commands/kick.ts b/src/commands/kick.ts index 5055ad6..1fab864 100644 --- a/src/commands/kick.ts +++ b/src/commands/kick.ts @@ -1,9 +1,4 @@ -import { - SlashCommandBuilder, - PermissionFlagsBits, - userMention, - GuildMember -} from "discord.js" +import { SlashCommandBuilder, PermissionFlagsBits, userMention, GuildMember } from "discord.js" import { admin, helper } from "config/roles.json" import { color, devMessage } from "config/options.json" import { Command } from "interfaces" @@ -36,8 +31,7 @@ export = { await interaction.deferReply() const member = interaction.options.getMember("member") as GuildMember - const reason = - interaction.options.getString("reason") ?? "No reason provided." + const reason = interaction.options.getString("reason") ?? "No reason provided." const embedColor = Number(color.replace("#", "0x")) const mod = await interaction.guild!.members.fetch(interaction.user.id) @@ -45,9 +39,7 @@ export = { const modRoles = mod.roles.cache.map(role => role.id) if (!modRoles.includes(helper) && !modRoles.includes(admin)) { - await interaction.editReply( - "You do not have permission to use this command." - ) + await interaction.editReply("You do not have permission to use this command.") return } @@ -79,54 +71,44 @@ export = { await member.kick(reason + ` - ${mod.user.username}`) await logToChannel("mod", { - embeds: [ - { - author: { - name: mod.user.username, - icon_url: mod.user.avatarURL() || undefined - }, - title: "Member Kicked", - description: ` + embeds: [{ + author: { + name: mod.user.username, + icon_url: mod.user.avatarURL() || undefined + }, + title: "Member Kicked", + description: ` **User:** ${userMention(member.user.id)} **Mod:** ${userMention(mod.user.id)} **Reason:** ${reason} `, - color: embedColor, - thumbnail: { - url: mod.user.avatarURL() || "" - }, - footer: { - text: "ID: " + member.user.id, - icon_url: member.user.avatarURL() || undefined - }, - timestamp: new Date().toISOString() - } - ] + color: embedColor, + thumbnail: { + url: mod.user.avatarURL() || "" + }, + footer: { + text: "ID: " + member.user.id, + icon_url: member.user.avatarURL() || undefined + }, + timestamp: new Date().toISOString() + }] }) await interaction.editReply({ - embeds: [ - { - title: "Member Kicked", - description: - "**User:** " + - userMention(member.user.id) + - "\n" + - "**Reason:** " + - reason + - "\n" + - "**Moderator:** " + - mod.user.username, - color: embedColor, - thumbnail: { - url: member.user.avatarURL() || "" - }, - footer: { - icon_url: interaction.guild!.iconURL() || undefined, - text: interaction.guild!.name + " | " + devMessage - } + embeds: [{ + title: "Member Kicked", + description: "**User:** " + userMention(member.user.id) + "\n" + + "**Reason:** " + reason + "\n" + + "**Moderator:** " + mod.user.username, + color: embedColor, + thumbnail: { + url: member.user.avatarURL() || "" + }, + footer: { + icon_url: interaction.guild!.iconURL() || undefined, + text: interaction.guild!.name + " | " + devMessage } - ] + }] }) } } as Command diff --git a/src/commands/ping.ts b/src/commands/ping.ts index 9167783..c9b04b8 100644 --- a/src/commands/ping.ts +++ b/src/commands/ping.ts @@ -19,17 +19,15 @@ export = { const embedColor = Number(color.replace("#", "0x")) await interaction.editReply({ - embeds: [ - { - description: "Ping of the bot is " + client.ws.ping + "ms.", - color: embedColor, - footer: { - text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild?.iconURL() || undefined - }, - timestamp: new Date().toISOString() - } - ] + embeds: [{ + description: "Ping of the bot is " + client.ws.ping + "ms.", + color: embedColor, + footer: { + text: interaction.guild!.name + " | " + devMessage, + icon_url: interaction.guild?.iconURL() || undefined + }, + timestamp: new Date().toISOString() + }] }) } } as Command diff --git a/src/commands/pp.ts b/src/commands/pp.ts index 3eafb33..ed23119 100644 --- a/src/commands/pp.ts +++ b/src/commands/pp.ts @@ -21,8 +21,7 @@ export = { .setDMPermission(false), async execute(interaction) { - const user = (interaction.options.getUser("user") || - interaction.user) as User + const user = (interaction.options.getUser("user") || interaction.user) as User const embedColor = Number(color.replace("#", "0x")) let size: number @@ -33,13 +32,11 @@ export = { } await interaction.reply({ - embeds: [ - { - title: `${user.username}'s pp size`, - description: `8${"=".repeat(size)}D`, - color: embedColor - } - ] + embeds: [{ + title: `${user.username}'s pp size`, + description: `8${"=".repeat(size)}D`, + color: embedColor + }] }) } } as Command diff --git a/src/commands/remove.ts b/src/commands/remove.ts index d16ceeb..08d81ed 100644 --- a/src/commands/remove.ts +++ b/src/commands/remove.ts @@ -1,8 +1,4 @@ -import { - SlashCommandBuilder, - PermissionFlagsBits, - userMention -} from "discord.js" +import { SlashCommandBuilder, PermissionFlagsBits, userMention } from "discord.js" import { color, devMessage } from "config/options.json" import waitinglistSchema from "schemas/waitinglistSchema" import { Command } from "interfaces" @@ -36,8 +32,7 @@ export = { await interaction.deferReply() const user = interaction.options.getUser("user")! - const reason = - interaction.options.getString("reason") ?? "No reason provided." + const reason = interaction.options.getString("reason") ?? "No reason provided." const mod = interaction.user! const embedColor = Number(color.replace("#", "0x")) @@ -45,14 +40,10 @@ export = { if (!waitinglist) { await interaction.editReply({ - embeds: [ - { - description: - userMention(user.id) + - " is not on the waiting list.", - color: embedColor - } - ] + embeds: [{ + description: userMention(user.id) + " is not on the waiting list.", + color: embedColor + }] }) return } @@ -60,49 +51,40 @@ export = { await waitinglistSchema.findOneAndDelete({ userID: user.id }) await logToChannel("mod", { - embeds: [ - { - author: { - name: mod.username, - icon_url: mod.avatarURL() || undefined - }, - title: "Waiting List - Remove User", - description: ` + embeds: [{ + author: { + name: mod.username, + icon_url: mod.avatarURL() || undefined + }, + title: "Waiting List - Remove User", + description: ` **User:** ${userMention(user.id)} **Reason:** ${reason} **Mod:** ${userMention(mod.id)} `, - color: embedColor, - thumbnail: { - url: mod.avatarURL() || "" - }, - footer: { - icon_url: user.avatarURL() || undefined, - text: "ID: " + user.id - }, - timestamp: new Date().toISOString() - } - ] + color: embedColor, + thumbnail: { + url: mod.avatarURL() || "" + }, + footer: { + icon_url: user.avatarURL() || undefined, + text: "ID: " + user.id + }, + timestamp: new Date().toISOString() + }] }) await interaction.editReply({ - embeds: [ - { - title: "Waiting List - Remove User", - description: - "**User:** " + - userMention(user.id) + - "\n" + - "**Reason:** `" + - reason + - "`", - color: embedColor, - footer: { - text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined - } + embeds: [{ + title: "Waiting List - Remove User", + description: "**User:** " + userMention(user.id) + "\n" + + "**Reason:** `" + reason + "`", + color: embedColor, + footer: { + text: interaction.guild!.name + " | " + devMessage, + icon_url: interaction.guild!.iconURL() || undefined } - ] + }] }) } } as Command diff --git a/src/commands/reqs.ts b/src/commands/reqs.ts index 3158279..baa32c7 100644 --- a/src/commands/reqs.ts +++ b/src/commands/reqs.ts @@ -1,14 +1,6 @@ import { SlashCommandBuilder } from "discord.js" import { color, devMessage } from "config/options.json" -import { - bwfkdr, - bwstars, - bwwins, - swstars, - swkdr, - duelswins, - duelswlr -} from "config/reqs.json" +import { bwfkdr, bwstars, bwwins, swstars, swkdr, duelswins, duelswlr } from "config/reqs.json" import { Command } from "interfaces" export = { @@ -26,52 +18,36 @@ export = { const embedColor = Number(color.replace("#", "0x")) await interaction.reply({ - embeds: [ - { - title: "Requirements", - description: - "**You must make 100k-150k weekly GEXP.\nAs well as onne of the game stats below**", - color: embedColor, - thumbnail: { - url: interaction.guild!.iconURL() || "" + embeds: [{ + title: "Requirements", + description: "**You must make 100k-150k weekly GEXP.\nAs well as onne of the game stats below**", + color: embedColor, + thumbnail: { + url: interaction.guild!.iconURL() || "" + }, + fields: [ + { + name: "**Bedwars**", + value: "**Stars:** `" + bwstars.toString() + + "`\n**Wins:** `" + bwwins.toString() + + "`\n**FKDR:** `" + bwfkdr.toString() + "`" }, - fields: [ - { - name: "**Bedwars**", - value: - "**Stars:** `" + - bwstars.toString() + - "`\n**Wins:** `" + - bwwins.toString() + - "`\n**FKDR:** `" + - bwfkdr.toString() + - "`" - }, - { - name: "**Skywars**", - value: - "**Stars:** `" + - swstars.toString() + - "`\n**KDR:** `" + - swkdr.toString() + - "`" - }, - { - name: "**Duels**", - value: - "**Wins:** `" + - duelswins.toString() + - "`\n**WLR:** `" + - duelswlr.toString() + - "`" - } - ], - footer: { - text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined + { + name: "**Skywars**", + value: "**Stars:** `" + swstars.toString() + + "`\n**KDR:** `" + swkdr.toString() + "`" + }, + { + name: "**Duels**", + value: "**Wins:** `" + duelswins.toString() + + "`\n**WLR:** `" + duelswlr.toString() + "`" } + ], + footer: { + text: interaction.guild!.name + " | " + devMessage, + icon_url: interaction.guild!.iconURL() || undefined } - ] + }] }) } } as Command diff --git a/src/commands/send.ts b/src/commands/send.ts index a6bde93..90b2e2f 100644 --- a/src/commands/send.ts +++ b/src/commands/send.ts @@ -1,9 +1,4 @@ -import { - SlashCommandBuilder, - PermissionFlagsBits, - ChannelType, - TextChannel -} from "discord.js" +import { SlashCommandBuilder, PermissionFlagsBits, ChannelType, TextChannel } from "discord.js" import { color, devMessage } from "config/options.json" import { Command } from "interfaces" @@ -26,10 +21,7 @@ export = { option .setName("channel") .setDescription("The channel to send the message to.") - .addChannelTypes( - ChannelType.GuildText, - ChannelType.GuildAnnouncement - ) + .addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement) ) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDMPermission(false), @@ -38,38 +30,33 @@ export = { await interaction.deferReply({ ephemeral: true }) const message = interaction.options.getString("message")! - const channel = (interaction.options.getChannel("channel") || - interaction.channel) as TextChannel + const channel = (interaction.options.getChannel("channel") || interaction.channel) as TextChannel const embedColor = Number(color.replace("#", "0x")) channel.send({ - embeds: [ - { - title: interaction.guild!.name, - description: message, - color: embedColor, - thumbnail: { - url: interaction.guild!.iconURL() || "" - }, - footer: { - text: interaction.guild!.id + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined - } + embeds: [{ + title: interaction.guild!.name, + description: message, + color: embedColor, + thumbnail: { + url: interaction.guild!.iconURL() || "" + }, + footer: { + text: interaction.guild!.id + " | " + devMessage, + icon_url: interaction.guild!.iconURL() || undefined } - ] + }] }) await interaction.editReply({ - embeds: [ - { - description: "Message sent.", - color: embedColor, - footer: { - text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined - } + embeds: [{ + description: "Message sent.", + color: embedColor, + footer: { + text: interaction.guild!.name + " | " + devMessage, + icon_url: interaction.guild!.iconURL() || undefined } - ] + }] }) } } as Command diff --git a/src/commands/setnick.ts b/src/commands/setnick.ts index 30c7cec..3c2d9a4 100644 --- a/src/commands/setnick.ts +++ b/src/commands/setnick.ts @@ -1,9 +1,4 @@ -import { - SlashCommandBuilder, - PermissionFlagsBits, - userMention, - GuildMember -} from "discord.js" +import { SlashCommandBuilder, PermissionFlagsBits, userMention, GuildMember } from "discord.js" import { color, devMessage } from "config/options.json" import { Command } from "interfaces" import logToChannel from "utils/functions/logtochannel" @@ -48,42 +43,38 @@ export = { await member.setNickname(nickname, `Set by ${interaction.user.tag}`) await logToChannel("mod", { - embeds: [ - { - author: { - name: interaction.user.username, - icon_url: interaction.user.avatarURL() || undefined - }, - title: "Nickname", - description: ` + embeds: [{ + author: { + name: interaction.user.username, + icon_url: interaction.user.avatarURL() || undefined + }, + title: "Nickname", + description: ` **User:** ${userMention(member.id)} **Nickname:** ${nickname} **Moderator:** ${userMention(interaction.user.id)} `, - color: embedColor, - thumbnail: { - url: interaction.user.avatarURL() || "" - }, - footer: { - text: "ID: " + member.user.id, - icon_url: member.user.avatarURL() || undefined - }, - timestamp: new Date().toISOString() - } - ] + color: embedColor, + thumbnail: { + url: interaction.user.avatarURL() || "" + }, + footer: { + text: "ID: " + member.user.id, + icon_url: member.user.avatarURL() || undefined + }, + timestamp: new Date().toISOString() + }] }) await interaction.reply({ - embeds: [ - { - description: `Successfully set the nickname of ${userMention(member.id)} to ${nickname}`, - color: embedColor, - footer: { - text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined - } + embeds: [{ + description: `Successfully set the nickname of ${userMention(member.id)} to ${nickname}`, + color: embedColor, + footer: { + text: interaction.guild!.name + " | " + devMessage, + icon_url: interaction.guild!.iconURL() || undefined } - ], + }], ephemeral: true }) } diff --git a/src/commands/setup.ts b/src/commands/setup.ts index 5c6ab17..f6c9fd6 100644 --- a/src/commands/setup.ts +++ b/src/commands/setup.ts @@ -1,12 +1,4 @@ -import { - SlashCommandBuilder, - PermissionFlagsBits, - ButtonBuilder, - ActionRowBuilder, - ButtonStyle, - ChannelType, - TextChannel -} from "discord.js" +import { SlashCommandBuilder, PermissionFlagsBits, ButtonBuilder, ActionRowBuilder, ButtonStyle, ChannelType, TextChannel } from "discord.js" import { color, devMessage } from "config/options.json" import { Command } from "interfaces" @@ -27,13 +19,8 @@ export = { .addChannelOption(option => option .setName("channel") - .setDescription( - "The channel to send the application to." - ) - .addChannelTypes( - ChannelType.GuildText, - ChannelType.GuildAnnouncement - ) + .setDescription("The channel to send the application to.") + .addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement) .setRequired(true) ) ) @@ -44,13 +31,8 @@ export = { .addChannelOption(option => option .setName("channel") - .setDescription( - "The channel to send the application to." - ) - .addChannelTypes( - ChannelType.GuildText, - ChannelType.GuildAnnouncement - ) + .setDescription("The channel to send the application to.") + .addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement) .setRequired(true) ) ) @@ -61,13 +43,8 @@ export = { .addChannelOption(option => option .setName("channel") - .setDescription( - "The channel to send the verfiy message to." - ) - .addChannelTypes( - ChannelType.GuildText, - ChannelType.GuildAnnouncement - ) + .setDescription("The channel to send the verfiy message to.") + .addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement) .setRequired(true) ) ) @@ -78,13 +55,8 @@ export = { .addChannelOption(option => option .setName("channel") - .setDescription( - "The channel to send the waiting list message to." - ) - .addChannelTypes( - ChannelType.GuildText, - ChannelType.GuildAnnouncement - ) + .setDescription("The channel to send the waiting list message to.") + .addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement) .setRequired(true) ) ) @@ -95,13 +67,8 @@ export = { .addChannelOption(option => option .setName("channel") - .setDescription( - "The channel to send the application to." - ) - .addChannelTypes( - ChannelType.GuildText, - ChannelType.GuildAnnouncement - ) + .setDescription("The channel to send the application to.") + .addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement) .setRequired(true) ) ) @@ -120,8 +87,7 @@ export = { if (subcommand === "sendguildapplication") { title = "Guild Application" - description = - "You can apply for the guild by clicking the button below." + description = "You can apply for the guild by clicking the button below." customId = "guildapply" label = "Apply" emoji = "✅" @@ -129,8 +95,7 @@ export = { if (subcommand === "sendstaffapplication") { title = "Staff Application" - description = - "You can apply for the staff team by clicking the button below." + description = "You can apply for the staff team by clicking the button below." customId = "staffapply" label = "Apply" emoji = "✅" @@ -138,8 +103,7 @@ export = { if (subcommand === "sendinactivityapplication") { title = "Inactivity Log" - description = - "You can send an inactivity log by clicking the button below." + description = "You can send an inactivity log by clicking the button below." customId = "guildinactivitylog" label = "Submit" emoji = "✅" @@ -162,20 +126,18 @@ export = { } await channel.send({ - embeds: [ - { - title: title, - description: description, - color: embedColor, - thumbnail: { - url: interaction.guild!.iconURL() || "" - }, - footer: { - text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined - } + embeds: [{ + title: title, + description: description, + color: embedColor, + thumbnail: { + url: interaction.guild!.iconURL() || "" + }, + footer: { + text: interaction.guild!.name + " | " + devMessage, + icon_url: interaction.guild!.iconURL() || undefined } - ], + }], components: [ new ActionRowBuilder().addComponents( new ButtonBuilder() diff --git a/src/commands/slowmode.ts b/src/commands/slowmode.ts index 6c4571d..f73128a 100644 --- a/src/commands/slowmode.ts +++ b/src/commands/slowmode.ts @@ -1,11 +1,4 @@ -import { - SlashCommandBuilder, - PermissionFlagsBits, - ChannelType, - TextChannel, - channelMention, - userMention -} from "discord.js" +import { SlashCommandBuilder, PermissionFlagsBits, ChannelType, TextChannel, channelMention, userMention } from "discord.js" import { color, devMessage } from "config/options.json" import { Command } from "interfaces" import logToChannel from "utils/functions/logtochannel" @@ -28,10 +21,7 @@ export = { option .setName("channel") .setDescription("The channel to set the slowmode of.") - .addChannelTypes( - ChannelType.GuildText, - ChannelType.GuildAnnouncement - ) + .addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement) ) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDMPermission(false), @@ -40,64 +30,57 @@ export = { await interaction.deferReply({ ephemeral: true }) const seconds = interaction.options.getInteger("seconds") ?? 5 - const channel = (interaction.options.getChannel("channel") || - interaction.channel) as TextChannel + const channel = (interaction.options.getChannel("channel") || interaction.channel) as TextChannel const embedColor = Number(color.replace("#", "0x")) if (seconds > 21600) { await channel.setRateLimitPerUser(21600) await interaction.editReply({ - embeds: [ - { - description: `Set the slowmode of ${channel} to 21600 seconds.`, - color: embedColor, - footer: { - text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined - } - } - ] - }) - return - } - - await logToChannel("mod", { - embeds: [ - { - author: { - name: interaction.user.username, - icon_url: interaction.user.avatarURL() || undefined - }, - title: "Slowmode Update", - description: ` - **Channel:** ${channelMention(channel.id)} - **Slowmode:** ${seconds} seconds - **Mod:** ${userMention(interaction.user.id)} - `, - color: embedColor, - thumbnail: { - url: interaction.user.avatarURL() || "" - }, - footer: { - icon_url: interaction.guild!.iconURL() || undefined, - text: " ID: " + channel.id - }, - timestamp: new Date().toISOString() - } - ] - }) - - await interaction.editReply({ - embeds: [ - { - description: `Set the slowmode of ${channel} to ${seconds} seconds.`, + embeds: [{ + description: `Set the slowmode of ${channel} to 21600 seconds.`, color: embedColor, footer: { text: interaction.guild!.name + " | " + devMessage, icon_url: interaction.guild!.iconURL() || undefined } + }] + }) + return + } + + await logToChannel("mod", { + embeds: [{ + author: { + name: interaction.user.username, + icon_url: interaction.user.avatarURL() || undefined + }, + title: "Slowmode Update", + description: ` + **Channel:** ${channelMention(channel.id)} + **Slowmode:** ${seconds} seconds + **Mod:** ${userMention(interaction.user.id)} + `, + color: embedColor, + thumbnail: { + url: interaction.user.avatarURL() || "" + }, + footer: { + icon_url: interaction.guild!.iconURL() || undefined, + text: " ID: " + channel.id + }, + timestamp: new Date().toISOString() + }] + }) + + await interaction.editReply({ + embeds: [{ + description: `Set the slowmode of ${channel} to ${seconds} seconds.`, + color: embedColor, + footer: { + text: interaction.guild!.name + " | " + devMessage, + icon_url: interaction.guild!.iconURL() || undefined } - ] + }] }) await channel.setRateLimitPerUser(seconds) } diff --git a/src/commands/snipe.ts b/src/commands/snipe.ts index d0bcc40..bf78f5c 100644 --- a/src/commands/snipe.ts +++ b/src/commands/snipe.ts @@ -33,12 +33,10 @@ export = { if (!snipeCache.length) { await interaction.editReply({ - embeds: [ - { - description: "No messages to snipe", - color: embedColor - } - ] + embeds: [{ + description: "No messages to snipe", + color: embedColor + }] }) return } @@ -50,32 +48,28 @@ export = { messages.push(`**Message #${i}:** ${data.content}\n`) } else { messages.push(`**Message #${i}:** ${data.content}`) - messages.push( - `**Attachments:** ${data.attachments.join(", ")}\n` - ) + messages.push(`**Attachments:** ${data.attachments.join(", ")}\n`) } i++ } await interaction.editReply({ - embeds: [ - { - author: { - name: member.user.username, - icon_url: member.user.avatarURL() || undefined - }, - description: messages.join("\n"), - thumbnail: { - url: member.user.avatarURL() || "" - }, - color: embedColor, - footer: { - text: "ID: " + member.user.id, - icon_url: interaction.guild!.iconURL() || undefined - }, - timestamp: new Date().toISOString() - } - ] + embeds: [{ + author: { + name: member.user.username, + icon_url: member.user.avatarURL() || undefined + }, + description: messages.join("\n"), + thumbnail: { + url: member.user.avatarURL() || "" + }, + color: embedColor, + footer: { + text: "ID: " + member.user.id, + icon_url: interaction.guild!.iconURL() || undefined + }, + timestamp: new Date().toISOString() + }] }) } } as Command diff --git a/src/commands/staff.ts b/src/commands/staff.ts index c3fd7e1..0a7ef52 100644 --- a/src/commands/staff.ts +++ b/src/commands/staff.ts @@ -59,16 +59,14 @@ export = { } await interaction.reply({ - embeds: [ - { - description: "This command is currently under development", - color: embedColor, - footer: { - text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined - } + embeds: [{ + description: "This command is currently under development", + color: embedColor, + footer: { + text: interaction.guild!.name + " | " + devMessage, + icon_url: interaction.guild!.iconURL() || undefined } - ] + }] }) } } as Command diff --git a/src/commands/staff/beast.ts b/src/commands/staff/beast.ts index 0bd4281..b09dec3 100644 --- a/src/commands/staff/beast.ts +++ b/src/commands/staff/beast.ts @@ -1,27 +1,9 @@ -import { - bwwins, - beastbwfkdr, - beastbwstars, - beastswkdr, - beastswstars, - beastduelswins, - duelswlr -} from "config/reqs.json" +import { bwwins, beastbwfkdr, beastbwstars, beastswkdr, beastswstars, beastduelswins, duelswlr } from "config/reqs.json" import { color, devMessage } from "config/options.json" -import { - hypixelLevel, - bedwarsLevel, - skywarsLevel, - getUUID, - getPlayer, - getGuild, - getHeadURL -} from "utils/Hypixel" +import { hypixelLevel, bedwarsLevel, skywarsLevel, getUUID, getPlayer, getGuild, getHeadURL } from "utils/Hypixel" import { ChatInputCommandInteraction } from "discord.js" -export default async function beast( - interaction: ChatInputCommandInteraction -): Promise { +export default async function beast(interaction: ChatInputCommandInteraction): Promise { await interaction.deferReply() const ign = interaction.options.getString("ign")! @@ -33,46 +15,38 @@ export default async function beast( } await interaction.editReply({ - embeds: [ - { - description: "Fetching your uuid...", - color: embedColor - } - ] + embeds: [{ + description: "Fetching your uuid...", + color: embedColor + }] }) const uuid = await getUUID(ign) if (!uuid) { interaction.editReply({ - embeds: [ - { - description: "That player doesn't exist.", - color: embedColor - } - ] + embeds: [{ + description: "That player doesn't exist.", + color: embedColor + }] }) return } await interaction.editReply({ - embeds: [ - { - description: "Fetching your player data...", - color: embedColor - } - ] + embeds: [{ + description: "Fetching your player data...", + color: embedColor + }] }) const head = await getHeadURL(ign) const player = await getPlayer(uuid) if (!player) { interaction.editReply({ - embeds: [ - { - description: "That player hasn't played Hypixel before.", - color: embedColor - } - ] + embeds: [{ + description: "That player hasn't played Hypixel before.", + color: embedColor + }] }) return } @@ -94,12 +68,10 @@ export default async function beast( } await interaction.editReply({ - embeds: [ - { - description: "Fetching your guild data...", - color: embedColor - } - ] + embeds: [{ + description: "Fetching your guild data...", + color: embedColor + }] }) const guild = await getGuild(uuid) @@ -128,44 +100,28 @@ export default async function beast( }) } else { if (player.stats.Bedwars) { - const hsbwexp = player.stats.Bedwars.Experience || 0 + const hsbwexp = player.stats.Bedwars?.Experience || 0 + const hsbwfk = player.stats.Bedwars?.final_kills_bedwars || 0 + const hsbwfd = player.stats.Bedwars?.final_deaths_bedwars || 0 + const hsbwwins = player.stats.Bedwars?.wins_bedwars || 0 const hsbwstars = bedwarsLevel(hsbwexp) - const hsbwfk = player.stats?.Bedwars?.final_kills_bedwars || 0 - const hsbwfd = player.stats?.Bedwars?.final_deaths_bedwars || 0 const hsbwfkdr = hsbwfk / hsbwfd || 0 - const hsbwwins = player.stats.Bedwars.wins_bedwars || 0 let bwtitle = "" - if ( - hsbwstars < beastbwstars || - hsbwfkdr < beastbwfkdr || - hsbwwins < bwwins - ) { - bwtitle = - " This player does not meet the BedWars requirements." + if (hsbwstars < beastbwstars || hsbwfkdr < beastbwfkdr || hsbwwins < bwwins) { + bwtitle = " This player does not meet the BedWars requirements." } else { - bwtitle = - " This player meets the BedWars requirements." + bwtitle = " This player meets the BedWars requirements." } statsFields.push({ name: bwtitle, - value: - "**➺ Stars:** `" + - hsbwstars.toFixed(2).toString() + - " / " + - beastbwstars.toString() + - "`\n" + - "**➺ FKDR:** `" + - hsbwfkdr.toFixed(2).toString() + - " / " + - beastbwfkdr.toString() + - "`\n" + - "**➺ Wins:** `" + - hsbwwins.toString() + - " / " + - bwwins.toString() + - "`" + value: "**➺ Stars:** `" + hsbwstars.toFixed(2).toString() + + " / " + beastbwstars.toString() + "`\n" + + "**➺ FKDR:** `" + hsbwfkdr.toFixed(2).toString() + + " / " + beastbwfkdr.toString() + "`\n" + + "**➺ Wins:** `" + hsbwwins.toString() + + " / " + bwwins.toString() + "`" }) } else { statsFields.push({ @@ -175,38 +131,27 @@ export default async function beast( } if (player.stats.SkyWars) { - const hsswexp = player.stats?.SkyWars?.skywars_experience || 0 + const hsswexp = player.stats.SkyWars?.skywars_experience || 0 + const hsswkills = player.stats.SkyWars?.kills || 0 + const hsswdeaths = player.stats.SkyWars?.deaths || 0 + const hsswwins = player.stats.SkyWars?.wins || 0 const hsswstars = skywarsLevel(hsswexp) - const hsswkills = player.stats?.SkyWars?.kills || 0 - const hsswdeaths = player.stats?.SkyWars?.deaths || 0 const hsswkd = hsswkills / hsswdeaths || 0 - const hsswwins = player.stats?.SkyWars?.wins || 0 let swtitle = "" if (hsswstars < beastswstars || hsswkd < beastswkdr) { - swtitle = - " This player does not meet the SkyWars requirements." + swtitle = " This player does not meet the SkyWars requirements." } else { - swtitle = - " This player meets the SkyWars requirements." + swtitle = " This player meets the SkyWars requirements." } statsFields.push({ name: swtitle, - value: - "**➺ Stars:** `" + - hsswstars.toFixed(2).toString() + - " / " + - beastswstars.toString() + - "`\n" + - "**➺ KDR:** `" + - hsswkd.toFixed(2).toString() + - " / " + - beastswkdr.toString() + - "`\n" + - "**➺ Wins:** `" + - hsswwins.toString() + - "`" + value: "**➺ Stars:** `" + hsswstars.toFixed(2).toString() + + " / " + beastswstars.toString() + "`\n" + + "**➺ KDR:** `" + hsswkd.toFixed(2).toString() + + " / " + beastswkdr.toString() + "`\n" + + "**➺ Wins:** `" + hsswwins.toString() + "`" }) } else { statsFields.push({ @@ -216,38 +161,27 @@ export default async function beast( } if (player.stats.Duels) { - const hsduelskills = player.stats?.Duels?.kills || 0 - const hsduelsdeaths = player.stats?.Duels?.deaths || 0 - const hsduelskd = hsduelskills / hsduelsdeaths || 0 - const hsduelswins = player.stats?.Duels?.wins || 0 - const hsduelslosses = player.stats?.Duels?.losses || 0 - const hsduelswlr = hsduelswins / hsduelslosses || 0 + const hsduelskills = player.stats.Duels?.kills || 0 + const hsduelsdeaths = player.stats.Duels?.deaths || 0 + const hsduelswins = player.stats.Duels?.wins || 0 + const hsduelslosses = player.stats.Duels?.losses || 0 + const hsduelskd = hsduelskills / hsduelsdeaths + const hsduelswlr = hsduelswins / hsduelslosses let duelstitle = "" if (hsduelswins < beastduelswins || hsduelswlr < duelswlr) { - duelstitle = - " This player does not meet the Duels requirements." + duelstitle = " This player does not meet the Duels requirements." } else { - duelstitle = - " This player meets the Duels requirements." + duelstitle = " This player meets the Duels requirements." } statsFields.push({ name: duelstitle, - value: - "**➺ Wins:** `" + - hsduelswins.toString() + - " / " + - beastduelswins.toString() + - "`\n" + - "**➺ WLR:** `" + - hsduelswlr.toFixed(2).toString() + - " / " + - duelswlr.toString() + - "`\n" + - "**➺ KDR:** `" + - hsduelskd.toFixed(2).toString() + - "`\n" + value: "**➺ Wins:** `" + hsduelswins.toString() + + " / " + beastduelswins.toString() + "`\n" + + "**➺ WLR:** `" + hsduelswlr.toFixed(2).toString() + + " / " + duelswlr.toString() + "`\n" + + "**➺ KDR:** `" + hsduelskd.toFixed(2).toString() + "`" }) } else { statsFields.push({ @@ -258,30 +192,23 @@ export default async function beast( } // network level - const hypixelExp = player.networkExp || 0 + const hypixelExp = player?.networkExp || 0 const level = hypixelLevel(hypixelExp) await interaction.editReply({ - embeds: [ - { - title: rank + player.displayname + guildTag, - description: - "**Network Level:** `" + - level.toFixed(2).toString() + - "`\n" + - "**Current Guild:** `" + - guildName + - "`", - color: embedColor, - thumbnail: { - url: head! - }, - footer: { - text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined - }, - fields: statsFields - } - ] + embeds: [{ + title: rank + player.displayname + guildTag, + description: "**Network Level:** `" + level.toFixed(2).toString() + "`\n" + + "**Current Guild:** `" + guildName + "`", + color: embedColor, + thumbnail: { + url: head! + }, + footer: { + text: interaction.guild!.name + " | " + devMessage, + icon_url: interaction.guild!.iconURL() || undefined + }, + fields: statsFields + }] }) } diff --git a/src/commands/staff/help.ts b/src/commands/staff/help.ts index 6779ea1..2d40101 100644 --- a/src/commands/staff/help.ts +++ b/src/commands/staff/help.ts @@ -2,10 +2,7 @@ import { ChatInputCommandInteraction } from "discord.js" import { color, devMessage } from "config/options.json" import { ExtendedClient as Client } from "utils/Client" -export default async function help( - interaction: ChatInputCommandInteraction, - client: Client -): Promise { +export default async function help(interaction: ChatInputCommandInteraction, client: Client): Promise { await interaction.deferReply({ ephemeral: true }) type CommandList = { @@ -48,20 +45,18 @@ export default async function help( const embedColor = Number(color.replace("#", "0x")) await interaction.editReply({ - embeds: [ - { - title: "Commands", - description: "List of commands", - fields: commandList, - color: embedColor, - thumbnail: { - url: interaction.guild!.iconURL() || "" - }, - footer: { - icon_url: interaction.guild!.iconURL() || undefined, - text: interaction.guild?.name + " | " + devMessage - } + embeds: [{ + title: "Commands", + description: "List of commands", + fields: commandList, + color: embedColor, + thumbnail: { + url: interaction.guild!.iconURL() || "" + }, + footer: { + icon_url: interaction.guild!.iconURL() || undefined, + text: interaction.guild?.name + " | " + devMessage } - ] + }] }) } diff --git a/src/commands/staff/updatediscordroles.ts b/src/commands/staff/updatediscordroles.ts index 500e43b..d9d4cd7 100644 --- a/src/commands/staff/updatediscordroles.ts +++ b/src/commands/staff/updatediscordroles.ts @@ -6,36 +6,29 @@ import env from "utils/Env" import { getGuild } from "utils/Hypixel" import { GuildData } from "interfaces" -export default async function updateDiscordRoles( - interaction: ChatInputCommandInteraction -): Promise { +export default async function updateDiscordRoles(interaction: ChatInputCommandInteraction): Promise { const discordMember = interaction.member as GuildMember const embedColor = Number(color.replace("#", "0x")) await interaction.deferReply() if (discordMember.user.id !== env.prod.dev) { await interaction.editReply({ - embeds: [ - { - description: - "You do not have permission to use this command.", - color: embedColor - } - ] + embeds: [{ + description: "You do not have permission to use this command.", + color: embedColor + }] }) return } - const guildMembers = await interaction - .guild!.members.fetch() - .then(members => - members.map(member => { - return { - id: member.id, - member: member - } - }) - ) + const guildMembers = await interaction.guild!.members.fetch().then( + members => members.map(member => { + return { + id: member.id, + member: member + } + }) + ) const guildData = (await getGuild(hypixelGuildID, "id")) as GuildData @@ -59,133 +52,58 @@ export default async function updateDiscordRoles( }) await interaction.editReply({ - embeds: [ - { - description: `Updating roles for ${guildMembers.length} members...`, - color: embedColor - } - ] + embeds: [{ + description: `Updating roles for ${guildMembers.length} members...`, + color: embedColor + }] }) for (const gmember of guildMembers) { - const memberData = verifiedUsers.find( - user => user.userID === gmember.id - ) + const memberData = verifiedUsers.find(user => user.userID === gmember.id) if (!memberData) { const rolesToremove = roleManage("default").rolesToRemove - await gmember.member.roles.remove( - rolesToremove, - "Updating all discord members" - ) + await gmember.member.roles.remove(rolesToremove, "Updating all discord members") continue } if (!guildMemberIDs.includes(memberData?.uuid || "none")) { const rolesToremove = roleManage("default").rolesToRemove - await gmember.member.roles.remove( - rolesToremove, - "Updating all discord members" - ) + await gmember.member.roles.remove(rolesToremove, "Updating all discord members") continue } else if (guildMemberIDs.includes(memberData!.uuid)) { - const guildMemberRank = hypixelGuildMembers.find( - gmember => gmember.uuid === memberData!.uuid - )!.rank + const guildMemberRank = hypixelGuildMembers.find(gmember => gmember.uuid === memberData!.uuid)!.rank console.log("Updating roles for " + gmember.member.user.username) if (guildMemberRank === "Guild Master") { - // const rolesToRemove = removeThese.filter(role => role !== gm && role !== guildStaff && role !== guildRole) - // await gmember.member.roles.remove(rolesToRemove, "Updating all discord members") - // await gmember.member.roles.add( gm, "Updating all discord members",) - // await gmember.member.roles.add( guildStaff, "Updating all discord members",) - // await gmember.member.roles.add( guildRole, "Updating all discord members",) const rolesmanage = roleManage("gm") - gmember.member.roles.remove( - rolesmanage.rolesToRemove, - "Updating all discord members" - ) - gmember.member.roles.add( - rolesmanage.rolesToAdd, - "Updating all discord members" - ) + gmember.member.roles.remove(rolesmanage.rolesToRemove, "Updating all discord members") + gmember.member.roles.add(rolesmanage.rolesToAdd, "Updating all discord members") continue } else if (guildMemberRank === "Manager") { - // const rolesToRemove = removeThese.filter(role => role !== manager && role !== guildStaff && role !== guildRole) - // await gmember.member.roles.remove( rolesToRemove, "Updating all discord members",) - // await gmember.member.roles.add( manager, "Updating all discord members",) - // await gmember.member.roles.add( guildStaff, "Updating all discord members",) - // await gmember.member.roles.add( guildRole, "Updating all discord members",) const rolesmanage = roleManage("manager") - gmember.member.roles.remove( - rolesmanage.rolesToRemove, - "Updating all discord members" - ) - gmember.member.roles.add( - rolesmanage.rolesToAdd, - "Updating all discord members" - ) + gmember.member.roles.remove(rolesmanage.rolesToRemove, "Updating all discord members") + gmember.member.roles.add(rolesmanage.rolesToAdd, "Updating all discord members") continue } else if (guildMemberRank === "Moderator") { - // const rolesToRemove = removeThese.filter(role => role !== moderator && role !== guildStaff && role !== guildRole) - // await gmember.member.roles.remove( rolesToRemove, "Updating all discord members",) - // await gmember.member.roles.add( moderator, "Updating all discord members",) - // await gmember.member.roles.add( guildStaff, "Updating all discord members",) - // await gmember.member.roles.add( guildRole, "Updating all discord members",) const rolesmanage = roleManage("moderator") - gmember.member.roles.remove( - rolesmanage.rolesToRemove, - "Updating all discord members" - ) - gmember.member.roles.add( - rolesmanage.rolesToAdd, - "Updating all discord members" - ) + gmember.member.roles.remove(rolesmanage.rolesToRemove, "Updating all discord members") + gmember.member.roles.add(rolesmanage.rolesToAdd, "Updating all discord members") continue } else if (guildMemberRank === "Beast") { - // const rolesToRemove = removeThese.filter(role => role !== beast && role !== guildRole) - // await gmember.member.roles.remove( rolesToRemove, "Updating all discord members",) - // await gmember.member.roles.add( beast, "Updating all discord members",) - // await gmember.member.roles.add( guildRole, "Updating all discord members",) const rolesmanage = roleManage("beast") - gmember.member.roles.remove( - rolesmanage.rolesToRemove, - "Updating all discord members" - ) - gmember.member.roles.add( - rolesmanage.rolesToAdd, - "Updating all discord members" - ) + gmember.member.roles.remove(rolesmanage.rolesToRemove, "Updating all discord members") + gmember.member.roles.add(rolesmanage.rolesToAdd, "Updating all discord members") continue } else if (guildMemberRank === "Elite") { - // const rolesToRemove = removeThese.filter(role => role !== elite && role !== guildRole) - // await gmember.member.roles.remove( rolesToRemove, "Updating all discord members",) - // await gmember.member.roles.add( elite, "Updating all discord members",) - // await gmember.member.roles.add( guildRole, "Updating all discord members",) const rolesmanage = roleManage("elite") - gmember.member.roles.remove( - rolesmanage.rolesToRemove, - "Updating all discord members" - ) - gmember.member.roles.add( - rolesmanage.rolesToAdd, - "Updating all discord members" - ) + gmember.member.roles.remove(rolesmanage.rolesToRemove, "Updating all discord members") + gmember.member.roles.add(rolesmanage.rolesToAdd, "Updating all discord members") continue } else if (guildMemberRank === "Member") { - // const rolesToRemove = removeThese.filter(role => role !== member && role !== guildRole) - // await gmember.member.roles.remove( rolesToRemove, "Updating all discord members",) - // await gmember.member.roles.add( member, "Updating all discord members",) - // await gmember.member.roles.add( guildRole, "Updating all discord members",) const rolesmanage = roleManage("member") - gmember.member.roles.remove( - rolesmanage.rolesToRemove, - "Updating all discord members" - ) - gmember.member.roles.add( - rolesmanage.rolesToAdd, - "Updating all discord members" - ) + gmember.member.roles.remove(rolesmanage.rolesToRemove, "Updating all discord members") + gmember.member.roles.add(rolesmanage.rolesToAdd, "Updating all discord members") continue } continue @@ -195,11 +113,9 @@ export default async function updateDiscordRoles( console.log("Successfully updated all roles.") await interaction.editReply({ - embeds: [ - { - description: "Successfully updated all roles.", - color: embedColor - } - ] + embeds: [{ + description: "Successfully updated all roles.", + color: embedColor + }] }) } diff --git a/src/commands/timeout.ts b/src/commands/timeout.ts index 281e204..607cd9d 100644 --- a/src/commands/timeout.ts +++ b/src/commands/timeout.ts @@ -1,10 +1,4 @@ -import { - SlashCommandBuilder, - PermissionFlagsBits, - userMention, - ChatInputCommandInteraction, - GuildMember -} from "discord.js" +import { SlashCommandBuilder, PermissionFlagsBits, userMention, ChatInputCommandInteraction, GuildMember } from "discord.js" import { color, devMessage } from "config/options.json" import { Command } from "interfaces" import ms from "ms" @@ -44,8 +38,7 @@ export = { const target = interaction.options.getMember("user")! as GuildMember const timeString = interaction.options.getString("time")! - const reason = - interaction.options.getString("reason") || "No reason provided" + const reason = interaction.options.getString("reason") || "No reason provided" const mod = interaction.member! as GuildMember const embedColor = Number(color.replace("#", "0x")) const time = ms(timeString) @@ -54,65 +47,50 @@ export = { if (target.user.bot) { interaction.editReply({ - embeds: [ - { - description: "You cannot timeout a bot.", - color: embedColor - } - ] + embeds: [{ + description: "You cannot timeout a bot.", + color: embedColor + }] }) return } if (target.id == interaction.guild!.ownerId) { await interaction.editReply({ - embeds: [ - { - description: "You cannot timeout the server owner.", - color: embedColor - } - ] + embeds: [{ + description: "You cannot timeout the server owner.", + color: embedColor + }] }) return } - if ( - interaction.guild!.members.me!.roles.highest.position <= - target.roles.highest.position - ) { + if (interaction.guild!.members.me!.roles.highest.position <= target.roles.highest.position) { interaction.editReply({ - embeds: [ - { - description: - "I cannot timeout this user because their role is higher than mine.", - color: embedColor - } - ] + embeds: [{ + description: "I cannot timeout this user because their role is higher than mine.", + color: embedColor + }] }) return } if (mod.roles.highest.position <= target.roles.highest.position) { await interaction.editReply({ - embeds: [ - { - description: - "You cannot timeout this user because their role is higher than yours.", - color: embedColor - } - ] + embeds: [{ + description: "You cannot timeout this user because their role is higher than yours.", + color: embedColor + }] }) return } if (target.id == interaction.user.id) { interaction.editReply({ - embeds: [ - { - description: "You cannot timeout yourself.", - color: embedColor - } - ] + embeds: [{ + description: "You cannot timeout yourself.", + color: embedColor + }] }) return } @@ -123,75 +101,55 @@ export = { if (target.isCommunicationDisabled()) { if (time === 0) { title = "Timeout Removed" - description = - "Removed timeout of " + - userMention(target.id) + - " for " + - reason + description = "Removed timeout of " + userMention(target.id) + " for " + reason timeouttime = null } else { title = "Timeout Updated" - description = - "Updated timeout of " + - userMention(target.id) + - " to " + - prettyTime + - " for " + - reason + description = "Updated timeout of " + userMention(target.id) + " to " + prettyTime + " for " + reason timeouttime = time } } else { title = "Member Timed Out" - description = - "Timed out " + - userMention(target.id) + - " for " + - prettyTime + - " for " + - reason + description = "Timed out " + userMention(target.id) + " for " + prettyTime + " for " + reason timeouttime = time } await target.timeout(timeouttime, reason) await logToChannel("mod", { - embeds: [ - { - author: { - name: mod.user.username, - icon_url: mod.user.avatarURL() || undefined - }, - title: title, - description: ` + embeds: [{ + author: { + name: mod.user.username, + icon_url: mod.user.avatarURL() || undefined + }, + title: title, + description: ` **User:** ${userMention(target.id)} ${timeouttime === null ? "**Time:** `None`" : "**Time:** `" + prettyTime + "`"} **Reason:** \`${reason}\` **Mod:** ${userMention(mod.id)} `, - color: embedColor, - thumbnail: { - url: mod.user.avatarURL() || "" - }, - footer: { - text: "ID: " + target.id, - icon_url: target.user.avatarURL() || undefined - }, - timestamp: new Date().toISOString() - } - ] + color: embedColor, + thumbnail: { + url: mod.user.avatarURL() || "" + }, + footer: { + text: "ID: " + target.id, + icon_url: target.user.avatarURL() || undefined + }, + timestamp: new Date().toISOString() + }] }) await interaction.editReply({ - embeds: [ - { - description: description, - color: embedColor, - footer: { - text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined - } + embeds: [{ + description: description, + color: embedColor, + footer: { + text: interaction.guild!.name + " | " + devMessage, + icon_url: interaction.guild!.iconURL() || undefined } - ] + }] }) } } as Command diff --git a/src/commands/unban.ts b/src/commands/unban.ts index 08b4cbc..47ae00f 100644 --- a/src/commands/unban.ts +++ b/src/commands/unban.ts @@ -1,9 +1,4 @@ -import { - SlashCommandBuilder, - PermissionFlagsBits, - userMention, - User -} from "discord.js" +import { SlashCommandBuilder, PermissionFlagsBits, userMention, User } from "discord.js" import { color, devMessage } from "config/options.json" import { Command } from "interfaces" import logToChannel from "utils/functions/logtochannel" @@ -37,20 +32,17 @@ export = { await interaction.deferReply() const userid = interaction.options.getString("user")! - const reason = - interaction.options.getString("reason") || "No reason provided" + const reason = interaction.options.getString("reason") || "No reason provided" const mod = interaction.user const embedColor = Number(color.replace("#", "0x")) let user: User if (userid === "none") { await interaction.editReply({ - embeds: [ - { - description: "You haven't specified a user to unban", - color: embedColor - } - ] + embeds: [{ + description: "You haven't specified a user to unban", + color: embedColor + }] }) return } @@ -59,12 +51,10 @@ export = { user = await interaction.client.users.fetch(userid) } catch (error) { await interaction.editReply({ - embeds: [ - { - description: "The user you specified is not valid", - color: embedColor - } - ] + embeds: [{ + description: "The user you specified is not valid", + color: embedColor + }] }) return } @@ -72,54 +62,44 @@ export = { await interaction.guild!.members.unban(user.id, reason) await logToChannel("mod", { - embeds: [ - { - author: { - name: mod.username, - icon_url: mod.avatarURL() || undefined - }, - title: "Member Unbanned", - description: ` - **User:** ${userMention(user!.id)} - **Mod:** ${userMention(mod.id)} - **Reason:** ${reason} - `, - color: embedColor, - thumbnail: { - url: mod.avatarURL() || "" - }, - footer: { - text: "ID: " + user!.id, - icon_url: user.avatarURL() || undefined - }, - timestamp: new Date().toISOString() - } - ] + embeds: [{ + author: { + name: mod.username, + icon_url: mod.avatarURL() || undefined + }, + title: "Member Unbanned", + description: ` + **User:** ${userMention(user!.id)} + **Mod:** ${userMention(mod.id)} + **Reason:** ${reason} + `, + color: embedColor, + thumbnail: { + url: mod.avatarURL() || "" + }, + footer: { + text: "ID: " + user!.id, + icon_url: user.avatarURL() || undefined + }, + timestamp: new Date().toISOString() + }] }) await interaction.editReply({ - embeds: [ - { - title: "User unbanned", - description: - "The user " + - user!.username + - " has been unbanned.\n" + - "**Reason:** `" + - reason + - "`\n" + - "**Moderator:** " + - userMention(mod.id), - color: embedColor, - thumbnail: { - url: user!.avatarURL() || "" - }, - footer: { - icon_url: interaction.guild!.iconURL() || undefined, - text: interaction.guild!.name + " | " + devMessage - } + embeds: [{ + title: "User unbanned", + description: "The user " + user!.username + " has been unbanned.\n" + + "**Reason:** `" + reason + "`\n" + + "**Moderator:** " + userMention(mod.id), + color: embedColor, + thumbnail: { + url: user!.avatarURL() || "" + }, + footer: { + icon_url: interaction.guild!.iconURL() || undefined, + text: interaction.guild!.name + " | " + devMessage } - ] + }] }) } } as Command diff --git a/src/commands/update.ts b/src/commands/update.ts index 4592219..54c868e 100644 --- a/src/commands/update.ts +++ b/src/commands/update.ts @@ -25,28 +25,23 @@ export = { if (!verifyData) { await interaction.editReply({ - embeds: [ - { - description: - "You are not verified. Please run `/verify` to verify yourself", - color: embedColor, - footer: { - text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined - } + embeds: [{ + description: "You are not verified. Please run `/verify` to verify yourself", + color: embedColor, + footer: { + text: interaction.guild!.name + " | " + devMessage, + icon_url: interaction.guild!.iconURL() || undefined } - ] + }] }) return } await interaction.editReply({ - embeds: [ - { - description: "Fetching your guild data...", - color: embedColor - } - ] + embeds: [{ + description: "Fetching your guild data...", + color: embedColor + }] }) const guild = await getGuild(verifyData.uuid) @@ -61,138 +56,87 @@ export = { const head = await getHeadURL(ign) if (guildID !== hypixelGuildID) { const roles = roleManage("default") - await user.roles.remove( - roles.rolesToRemove, - "User used the update command" - ) - await user.roles.add( - roles.rolesToAdd, - "User used the update command" - ) + await user.roles.remove(roles.rolesToRemove, "User used the update command") + await user.roles.add(roles.rolesToAdd, "User used the update command") await interaction.editReply({ - embeds: [ - { - description: "Updated your roles to `Default Member`", - color: embedColor, - thumbnail: { - url: head! - }, - footer: { - text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined - } + embeds: [{ + description: "Updated your roles to `Default Member`", + color: embedColor, + thumbnail: { + url: head! + }, + footer: { + text: interaction.guild!.name + " | " + devMessage, + icon_url: interaction.guild!.iconURL() || undefined } - ] + }] }) return } if (guildID === hypixelGuildID) { const GuildMembers = guild!.members - const guildRank = GuildMembers.find( - member => member.uuid === verifyData.uuid - )!.rank + const guildRank = GuildMembers.find(member => member.uuid === verifyData.uuid)!.rank let replyRank: string | null = null - await user.roles.add( - roleManage("default").rolesToAdd, - "User used the update command" - ) + await user.roles.add(roleManage("default").rolesToAdd, "User used the update command") if (guildRank === "Guild Master") { const roles = roleManage("gm") - await user.roles.remove( - roles.rolesToRemove, - "User used the update command" - ) - await user.roles.add( - roles.rolesToAdd, - "User used the update command" - ) + await user.roles.remove(roles.rolesToRemove, "User used the update command") + await user.roles.add(roles.rolesToAdd, "User used the update command") replyRank = "Guild Master" } if (guildRank === "Manager") { const roles = roleManage("manager") - await user.roles.remove( - roles.rolesToRemove, - "User used the update command" - ) - await user.roles.add( - roles.rolesToAdd, - "User used the update command" - ) + await user.roles.remove(roles.rolesToRemove, "User used the update command") + await user.roles.add(roles.rolesToAdd, "User used the update command") replyRank = "Manager" } if (guildRank === "Moderator") { const roles = roleManage("moderator") - await user.roles.remove( - roles.rolesToRemove, - "User used the update command" - ) - await user.roles.add( - roles.rolesToAdd, - "User used the update command" - ) + await user.roles.remove(roles.rolesToRemove, "User used the update command") + await user.roles.add(roles.rolesToAdd, "User used the update command") replyRank = "Moderator" } if (guildRank === "Beast") { const roles = roleManage("beast") - await user.roles.remove( - roles.rolesToRemove, - "User used the update command" - ) - await user.roles.add( - roles.rolesToAdd, - "User used the update command" - ) + await user.roles.remove(roles.rolesToRemove, "User used the update command") + await user.roles.add(roles.rolesToAdd, "User used the update command") replyRank = "Beast" } if (guildRank === "Elite") { const roles = roleManage("elite") - await user.roles.remove( - roles.rolesToRemove, - "User used the update command" - ) - await user.roles.add( - roles.rolesToAdd, - "User used the update command" - ) + await user.roles.remove(roles.rolesToRemove, "User used the update command") + await user.roles.add(roles.rolesToAdd, "User used the update command") replyRank = "Elite" } if (guildRank === "Member") { const roles = roleManage("member") - await user.roles.remove( - roles.rolesToRemove, - "User used the update command" - ) - await user.roles.add( - roles.rolesToAdd, - "User used the update command" - ) + await user.roles.remove(roles.rolesToRemove, "User used the update command") + await user.roles.add(roles.rolesToAdd, "User used the update command") replyRank = "Member" } await interaction.editReply({ - embeds: [ - { - description: - "Updated your roles to `" + replyRank + "`", - color: embedColor, - thumbnail: { - url: head! - }, - footer: { - text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined - } + embeds: [{ + description: + "Updated your roles to `" + replyRank + "`", + color: embedColor, + thumbnail: { + url: head! + }, + footer: { + text: interaction.guild!.name + " | " + devMessage, + icon_url: interaction.guild!.iconURL() || undefined } - ] + }] }) } } diff --git a/src/commands/uuid.ts b/src/commands/uuid.ts index d2880a2..557fbe8 100644 --- a/src/commands/uuid.ts +++ b/src/commands/uuid.ts @@ -32,37 +32,28 @@ export = { if (!uuid) { interaction.editReply({ - embeds: [ - { - description: "That player doesn't exist!", - color: embedColor - } - ] + embeds: [{ + 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 + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined - } + embeds: [{ + title: newIgn, + description: "**UUID:** `" + uuid + "`\n" + + "**Formatted UUID:** `" + formattedUuid + "`", + color: embedColor, + thumbnail: { + url: head! + }, + footer: { + text: interaction.guild!.name + " | " + devMessage, + icon_url: interaction.guild!.iconURL() || undefined } - ] + }] }) } } as Command diff --git a/src/commands/verify.ts b/src/commands/verify.ts index fcadc5f..df2a4c7 100644 --- a/src/commands/verify.ts +++ b/src/commands/verify.ts @@ -34,69 +34,53 @@ export = { const verifyData = await verify.findOne({ userID: user.id }) if (verifyData) { - interaction.editReply( - "You are already verified.\n" + - "Try running /update to update your roles." - ) + interaction.editReply("You are already verified.\n" + "Try running /update to update your roles.") return } if (!ign) { interaction.editReply({ - embeds: [ - { - description: - " Please provide your in-game name.", - color: embedColor - } - ] + embeds: [{ + description: " Please provide your in-game name.", + color: embedColor + }] }) return } await interaction.editReply({ - embeds: [ - { - description: "Fetching your uuid...", - color: embedColor - } - ] + embeds: [{ + description: "Fetching your uuid...", + color: embedColor + }] }) const uuid = await getUUID(ign) if (!uuid) { interaction.editReply({ - embeds: [ - { - description: - " That player does not exist.", - color: embedColor - } - ] + embeds: [{ + description: " That player does not exist.", + color: embedColor + }] }) return } await interaction.editReply({ - embeds: [ - { - description: "Fetching your player data...", - color: embedColor - } - ] + embeds: [{ + description: "Fetching your player data...", + color: embedColor + }] }) const head = await getHeadURL(ign) const player = (await getPlayer(uuid)) as PlayerData if (!player) { interaction.editReply({ - embeds: [ - { - description: - " That player hasn't played Hypixel before.", - color: embedColor - } - ] + embeds: [{ + description: " That player hasn't played Hypixel before.", + color: embedColor + }] }) return } @@ -109,60 +93,40 @@ export = { } await interaction.editReply({ - embeds: [ - { - description: "Checking your Discord tag...", - color: embedColor - } - ] + embeds: [{ + description: "Checking your Discord tag...", + color: embedColor + }] }) const linkedDiscord = player?.socialMedia?.links?.DISCORD || null if (!linkedDiscord) { interaction.editReply({ - embeds: [ - { - description: - " There is no Discord account linked to `" + - player.displayname + - "`.\n\n" + - "**Please set your Discord tag on hypixel to `" + - username + - "` and try again.**", - color: embedColor - } - ] + embeds: [{ + description: " There is no Discord account linked to `" + player.displayname + "`.\n\n" + + "**Please set your Discord tag on hypixel to `" + username + "` and try again.**", + color: embedColor + }] }) return } if (linkedDiscord !== username) { interaction.editReply({ - embeds: [ - { - description: - " The Discord account linked to `" + - player.displayname + - "` is currently `" + - linkedDiscord + - "`\n\n" + - "**Please set your Discord tag on hypixel to `" + - username + - "` and try again.**", - color: embedColor - } - ] + embeds: [{ + description: " The Discord account linked to `" + player.displayname + "` is currently `" + linkedDiscord + "`\n\n" + + "**Please set your Discord tag on hypixel to `" + username + "` and try again.**", + color: embedColor + }] }) return } await interaction.editReply({ - embeds: [ - { - description: "Fetching your guild data...", - color: embedColor - } - ] + embeds: [{ + description: "Fetching your guild data...", + color: embedColor + }] }) const guild = (await getGuild(uuid)) as GuildData | null @@ -175,9 +139,7 @@ export = { if (guildID === hypixelGuildID) { const GuildMembers = guild!.members - const guildRank = GuildMembers.find( - member => member.uuid === player.uuid - )!.rank + const guildRank = GuildMembers.find(member => member.uuid === player.uuid)!.rank if (guildRank === "Guild Master") { const roles = roleManage("gm") @@ -221,25 +183,18 @@ export = { await newVerify.save() await interaction.editReply({ - embeds: [ - { - title: interaction.guild!.name, - description: - "You have successfully verified `" + - username + - "` with the account `" + - player.displayname + - "`.", - color: embedColor, - thumbnail: { - url: head! - }, - footer: { - icon_url: interaction.guild!.iconURL() || undefined, - text: interaction.guild!.name + " | " + devMessage - } + embeds: [{ + title: interaction.guild!.name, + description: "You have successfully verified `" + username + "` with the account `" + player.displayname + "`.", + color: embedColor, + thumbnail: { + url: head! + }, + footer: { + icon_url: interaction.guild!.iconURL() || undefined, + text: interaction.guild!.name + " | " + devMessage } - ] + }] }) } } as Command diff --git a/src/commands/whoami.ts b/src/commands/whoami.ts index 0cf3a90..b2d4efe 100644 --- a/src/commands/whoami.ts +++ b/src/commands/whoami.ts @@ -24,12 +24,10 @@ export = { if (!verifyData) { await interaction.editReply({ - embeds: [ - { - description: "You are not verified!", - color: embedColor - } - ] + embeds: [{ + description: "You are not verified!", + color: embedColor + }] }) return } @@ -38,25 +36,19 @@ export = { 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() || undefined - } + 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() || undefined } - ] + }] }) } } as Command diff --git a/src/commands/whois.ts b/src/commands/whois.ts index e844944..571fb43 100644 --- a/src/commands/whois.ts +++ b/src/commands/whois.ts @@ -1,8 +1,4 @@ -import { - SlashCommandBuilder, - PermissionFlagsBits, - userMention -} from "discord.js" +import { SlashCommandBuilder, PermissionFlagsBits, userMention } from "discord.js" import { getIGN, getHeadURL } from "utils/Hypixel" import { color, devMessage } from "config/options.json" import verify from "schemas/verifySchema" @@ -34,9 +30,7 @@ export = { const verifiedUser = await verify.findOne({ userID: user.id }) if (!verifiedUser) { - interaction.editReply({ - content: "This user has not verified their account." - }) + interaction.editReply("You are not verified!") return } @@ -44,24 +38,19 @@ export = { const head = await getHeadURL(ign) await interaction.editReply({ - embeds: [ - { - title: interaction.guild!.name, - description: - "**User:** " + - userMention(user.id) + - "\n**IGN:** " + - ign, - color: embedColor, - thumbnail: { - url: head! - }, - footer: { - text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined - } + embeds: [{ + title: interaction.guild!.name, + description: "**User:** " + userMention(user.id) + + "\n**IGN:** " + ign, + color: embedColor, + thumbnail: { + url: head! + }, + footer: { + text: interaction.guild!.name + " | " + devMessage, + icon_url: interaction.guild!.iconURL() || undefined } - ] + }] }) } } as Command diff --git a/yarn.lock b/yarn.lock index 72dc8cd..36dcee8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1195,11 +1195,6 @@ prelude-ls@^1.2.1: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== -prettier@^3.2.1: - version "3.2.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.2.1.tgz#babf33580e16c796a9740b9fae551624f7bfeaab" - integrity sha512-qSUWshj1IobVbKc226Gw2pync27t0Kf0EdufZa9j7uBSJay1CC+B3K5lAAZoqgX3ASiKuWsk6OmzKRetXNObWg== - pretty-ms@^8.0.0: version "8.0.0" resolved "https://registry.yarnpkg.com/pretty-ms/-/pretty-ms-8.0.0.tgz#a35563b2a02df01e595538f86d7de54ca23194a3"