From 45b21835b20bde965e6a76e681ac2f0dc64ee207 Mon Sep 17 00:00:00 2001 From: Taken Date: Fri, 19 Jan 2024 13:16:56 +0100 Subject: [PATCH 01/15] Formatting and linting --- .eslintrc.js | 92 +++++++++++++++--------------------- .prettierrc.js | 4 +- src/commands/timeout.ts | 18 +++---- src/utils/Hypixel/bedwars.ts | 18 +++---- src/utils/Hypixel/hypixel.ts | 14 +++--- 5 files changed, 64 insertions(+), 82 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 87edc61..fdf3994 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,75 +1,59 @@ module.exports = { - "env": { - "node": true, - "es2021": true, - "browser": true + env: { + node: true, + es2021: true, + browser: true, }, - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/recommended" - ], - "overrides": [ + extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"], + overrides: [ { - "env": { - "node": true + env: { + node: true, }, - "files": [ - ".eslintrc.{js,cjs}" - ], - "parserOptions": { - "sourceType": "script" - } - } + files: [".eslintrc.{js,cjs}"], + parserOptions: { + sourceType: "script", + }, + }, ], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "ecmaVersion": "latest", - "sourceType": "module" + parser: "@typescript-eslint/parser", + parserOptions: { + ecmaVersion: "latest", + sourceType: "module", }, - "plugins": [ - "@typescript-eslint" - ], - "rules": { - "indent": [ - "error", - 4 - ], - "linebreak-style": [ - "error", - "windows" - ], - "quotes": [ - "warn", - "double" - ], - "semi": [ - "error", - "never" - ], + plugins: ["@typescript-eslint"], + rules: { + indent: ["error", 4, { SwitchCase: 1 }], + "linebreak-style": ["error", "windows"], + quotes: ["warn", "double"], + semi: ["error", "never"], "no-unused-vars": "off", "prefer-const": "warn", "no-var": "error", - "no-multiple-empty-lines": ["error", { "max": 2, "maxEOF": 1, "maxBOF": 0 }], + "no-multiple-empty-lines": ["error", { max: 2, maxEOF: 1, maxBOF: 0 }], "no-lonely-if": "error", "no-empty-function": "error", "no-inline-comments": "error", "no-trailing-spaces": ["error"], - "arrow-spacing": ["warn", { "before": true, "after": true }], - "space-before-function-paren": ["error", { - "anonymous": "never", - "named": "never", - "asyncArrow": "always" - }], + "arrow-spacing": ["warn", { before: true, after: true }], + "space-before-function-paren": [ + "error", + { + anonymous: "never", + named: "never", + asyncArrow: "always", + }, + ], "comma-spacing": "error", "@typescript-eslint/no-var-requires": "off", "@typescript-eslint/no-explicit-any": "off", "@typescript-eslint/no-unused-vars": [ "warn", { - "vars": "all", - "args": "after-used", - "ignoreRestSiblings": false - } + vars: "all", + args: "after-used", + ignoreRestSiblings: false, + }, ], - } + }, } diff --git a/.prettierrc.js b/.prettierrc.js index 3d0ed42..9257b96 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -11,7 +11,7 @@ const config = { bracketSpacing: true, arrowParens: "avoid", parser: "typescript", - endOfLine: "crlf" + endOfLine: "crlf", } -module.exports = config \ No newline at end of file +module.exports = config diff --git a/src/commands/timeout.ts b/src/commands/timeout.ts index 1f589ee..ccad633 100644 --- a/src/commands/timeout.ts +++ b/src/commands/timeout.ts @@ -123,33 +123,33 @@ export = { if (target.isCommunicationDisabled()) { if (time === 0) { title = "Timeout Removed" - ;(description = + description = "Removed timeout of " + userMention(target.id) + " for " + - reason), - (timeouttime = null) + reason + timeouttime = null } else { title = "Timeout Updated" - ;(description = + description = "Updated timeout of " + userMention(target.id) + " to " + prettyTime + " for " + - reason), - (timeouttime = time) + reason + timeouttime = time } } else { title = "Member Timed Out" - ;(description = + description = "Timed out " + userMention(target.id) + " for " + prettyTime + " for " + - reason), - (timeouttime = time) + reason + timeouttime = time } await target.timeout(timeouttime, reason) diff --git a/src/utils/Hypixel/bedwars.ts b/src/utils/Hypixel/bedwars.ts index 03d5657..4a0bc24 100644 --- a/src/utils/Hypixel/bedwars.ts +++ b/src/utils/Hypixel/bedwars.ts @@ -10,14 +10,14 @@ function getExpForLevel(level: number): number { } switch (respectedLevel) { - case 1: - return 500 - case 2: - return 1000 - case 3: - return 2000 - case 4: - return 3500 + case 1: + return 500 + case 2: + return 1000 + case 3: + return 2000 + case 4: + return 3500 } return 5000 } @@ -31,7 +31,7 @@ function getLevelRespectingPrestige(level: number): number { } const EASY_LEVELS = 4 -const EASY_LEVELS_XP = 7000 +const EASY_LEVELS_XP = 7004 const XP_PER_PRESTIGE = 96 * 5000 + EASY_LEVELS_XP const LEVELS_PER_PRESTIGE = 100 const HIGHEST_PRESTIGE = 50 diff --git a/src/utils/Hypixel/hypixel.ts b/src/utils/Hypixel/hypixel.ts index 93465d3..043c5ea 100644 --- a/src/utils/Hypixel/hypixel.ts +++ b/src/utils/Hypixel/hypixel.ts @@ -6,16 +6,14 @@ const GROWTH = 2500 const HALF_GROWTH = 0.5 * GROWTH const REVERSE_PQ_PREFIX = -(BASE - 0.5 * GROWTH) / GROWTH const REVERSE_CONST = REVERSE_PQ_PREFIX * REVERSE_PQ_PREFIX -const GROWTH_DIVIDES_2 = 2 / GROWTH +const GROWTHDIV2 = 2 / GROWTH function getLevel(exp: number): number { - return exp <= 1 - ? 1 - : Math.floor( - 1 + - REVERSE_PQ_PREFIX + - Math.sqrt(REVERSE_CONST + GROWTH_DIVIDES_2 * exp), - ) + if (exp <= 1) return 1 + + return Math.floor( + 1 + REVERSE_PQ_PREFIX + Math.sqrt(REVERSE_CONST + GROWTHDIV2 * exp), + ) } function hypixelLevel(exp: number): number { From 0a315b18ed802516432a62ad69ca1f9e6a2a82b6 Mon Sep 17 00:00:00 2001 From: Taken Date: Fri, 19 Jan 2024 18:12:51 +0100 Subject: [PATCH 02/15] Fixed formatting Signed-off-by: Taken --- src/commands/ban.ts | 106 ++++++++------------- src/commands/check.ts | 216 ++++++++++++++---------------------------- 2 files changed, 112 insertions(+), 210 deletions(-) diff --git a/src/commands/ban.ts b/src/commands/ban.ts index c5de59b..86cdcde 100644 --- a/src/commands/ban.ts +++ b/src/commands/ban.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" @@ -22,10 +17,12 @@ export = { option .setName("user") .setDescription("User to ban") - .setRequired(true), + .setRequired(true) ) .addStringOption(option => - option.setName("reason").setDescription("Reason for ban"), + option + .setName("reason") + .setDescription("Reason for ban") ) .addNumberOption(option => option @@ -39,7 +36,7 @@ export = { { name: "5 days", value: 5 }, { name: "6 days", value: 6 }, { name: "7 days", value: 7 }, - ), + ) ) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDMPermission(false), @@ -47,13 +44,9 @@ export = { async execute(interaction) { await interaction.deferReply() - const member = interaction.options.getMember( - "user", - ) as GuildMember | null - const reason = - interaction.options.getString("reason") ?? "No reason provided." - const messageDeletionDays = - interaction.options.getNumber("messagedeletiondays") ?? 0 + const member = interaction.options.getMember("user") as GuildMember | null + const reason = interaction.options.getString("reason") ?? "No reason provided." + const messageDeletionDays = interaction.options.getNumber("messagedeletiondays") ?? 0 const embedColor = Number(color.replace("#", "0x")) if (!member) { @@ -67,15 +60,12 @@ export = { if (!modRoles.includes(admin)) { await interaction.editReply( - "You do not have permission to use this command.", + "You do not have permission to use this command." ) return } - if ( - interaction.guild!.members.me!.roles.highest.position <= - member.roles.highest.position - ) { + if (interaction.guild!.members.me!.roles.highest.position <= member.roles.highest.position) { await interaction.editReply("I cannot ban this member.") return } @@ -105,62 +95,48 @@ export = { return } - await member.ban({ - reason: reason, - deleteMessageDays: messageDeletionDays, - }) + await member.ban({ reason: reason, deleteMessageDays: messageDeletionDays }) await logToChannel("mod", { - embeds: [ - { - author: { - name: mod.user.username, - icon_url: mod.user.avatarURL() || undefined, - }, - title: "Member Banned", - description: ` + embeds: [{ + author: { + name: mod.user.username, + icon_url: mod.user.avatarURL() || undefined + }, + title: "Member Banned", + description: ` **User:** ${userMention(member.user.id)} **Mod:** ${userMention(mod.user.id)} **Reason:** ${reason} **Messages Deleted:** ${messageDeletionDays} days `, - 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 Banned", - description: - "**User:** " + - userMention(member.user.id) + - "\n" + - "**Reason:** " + - reason + - "\n" + - "**Messages Deleted:** " + - messageDeletionDays + - " days", - color: embedColor, - thumbnail: { - url: member.user.avatarURL() || "", - }, - footer: { - icon_url: interaction.guild!.iconURL() || undefined, - text: interaction.guild!.name + " | " + devMessage, - }, + embeds: [{ + title: "Member Banned", + description: "**User:** " + userMention(member.user.id) + "\n" + + "**Reason:** " + reason + "\n" + + "**Messages Deleted:** " + messageDeletionDays + " days", + 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/check.ts b/src/commands/check.ts index 07162ed..eb3213a 100644 --- a/src/commands/check.ts +++ b/src/commands/check.ts @@ -1,23 +1,7 @@ import { SlashCommandBuilder } from "discord.js" -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 { 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 { Command } from "interfaces" export = { @@ -33,7 +17,7 @@ export = { option .setName("ign") .setDescription("The player's IGN.") - .setRequired(true), + .setRequired(true) ) .setDMPermission(false), @@ -44,47 +28,38 @@ export = { const embedColor = Number(color.replace("#", "0x")) 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 } @@ -106,12 +81,10 @@ export = { } await interaction.editReply({ - embeds: [ - { - description: "Fetching your guild data...", - color: embedColor, - }, - ], + embeds: [{ + description: "Fetching your guild data...", + color: embedColor + }] }) const guild = await getGuild(uuid) @@ -143,135 +116,97 @@ export = { if (!player.stats) { statsFields.push({ name: " This player never played any games.", - value: "**➺ Stats:** `None`", + value: "**➺ Stats:** `None`" }) } else { if (player.stats.Bedwars) { - const hsbwexp = player.stats.Bedwars.Experience || 0 - const hsbwstars = bedwarsLevel(hsbwexp) + 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 - const hsbwwins = player.stats.Bedwars.wins_bedwars || 0 let bwtitle = "" - if ( - hsbwstars < bwstars || - hsbwfkdr < bwfkdr || - hsbwwins < bwwins - ) { - bwtitle = - " This player does not meet the BedWars requirements." + if (hsbwstars < bwstars || hsbwfkdr < bwfkdr || 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() + - " / " + - bwstars.toString() + - "`\n" + - "**➺ FKDR:** `" + - hsbwfkdr.toFixed(2).toString() + - " / " + - bwfkdr.toString() + - "`\n" + - "**➺ Wins:** `" + - hsbwwins.toString() + - " / " + - bwwins.toString() + - "`", + value: "**➺ Stars:** `" + hsbwstars.toFixed(2).toString() + + " / " + bwstars.toString() + "`\n" + + "**➺ FKDR:** `" + hsbwfkdr.toFixed(2).toString() + + " / " + bwfkdr.toString() + "`\n" + + "**➺ Wins:** `" + hsbwwins.toString() + + " / " + bwwins.toString() + "`" }) } else { statsFields.push({ name: " This player never played BedWars.", - value: "**➺ Stats:** `None`", + value: "**➺ Stats:** `None`" }) } if (player.stats.SkyWars) { const hsswexp = player.stats?.SkyWars?.skywars_experience || 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 + const hsswstars = skywarsLevel(hsswexp) + const hsswkd = hsswkills / hsswdeaths || 0 let swtitle = "" if (hsswstars < swstars || hsswkd < swkdr) { - 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() + - " / " + - swstars.toString() + - "`\n" + - "**➺ KDR:** `" + - hsswkd.toFixed(2).toString() + - " / " + - swkdr.toString() + - "`\n" + - "**➺ Wins:** `" + - hsswwins.toString() + - "`", + value: "**➺ Stars:** `" + hsswstars.toFixed(2).toString() + + " / " + swstars.toString() + "`\n" + + "**➺ KDR:** `" + hsswkd.toFixed(2).toString() + + " / " + swkdr.toString() + "`\n" + + "**➺ Wins:** `" + hsswwins.toString() + "`" }) } else { statsFields.push({ name: " This player never played SkyWars.", - value: "**➺ Stats:** `None`", + value: "**➺ Stats:** `None`" }) } 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 hsduelskd = hsduelskills / hsduelsdeaths || 0 const hsduelswlr = hsduelswins / hsduelslosses || 0 let duelstitle = "" if (hsduelswins < duelswins || 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() + - " / " + - duelswins.toString() + - "`\n" + - "**➺ WLR:** `" + - hsduelswlr.toFixed(2).toString() + - " / " + - duelswlr.toString() + - "`\n" + - "**➺ KDR:** `" + - hsduelskd.toFixed(2).toString() + - "`\n", + value: "**➺ Wins:** `" + hsduelswins.toString() + + " / " + duelswins.toString() + "`\n" + + "**➺ WLR:** `" + hsduelswlr.toFixed(2).toString() + + " / " + duelswlr.toString() + "`\n" + + "**➺ KDR:** `" + hsduelskd.toFixed(2).toString() + "`", }) } else { statsFields.push({ name: " This player never played Duels.", - value: "**➺ Stats:** `None`", + value: "**➺ Stats:** `None`" }) } } @@ -281,30 +216,21 @@ export = { const level = hypixelLevel(hypixelExp) await interaction.editReply({ - embeds: [ - { - title: rank + player.displayname + guildTag, - description: - "**Network Level:** `" + - level.toFixed(2).toString() + - "`\n" + - "**Current Guild:** `" + - guildName + - "`\n" + - "**Guild Rank:** `" + - guildRank + - "`", - 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 + "`\n" + + "**Guild Rank:** `" + guildRank + "`", + color: embedColor, + thumbnail: { + url: head! }, - ], + footer: { + text: interaction.guild!.name + " | " + devMessage, + icon_url: interaction.guild!.iconURL() || undefined + }, + fields: statsFields + }] }) - }, + } } as Command From ee217d5f64745b1328f323572058286d3583318a Mon Sep 17 00:00:00 2001 From: Taken Date: Fri, 19 Jan 2024 18:40:45 +0100 Subject: [PATCH 03/15] Fixed more formatting --- .prettierrc.js | 2 +- src/commands-contextmenu/congratsmessage.ts | 23 +-- src/commands-contextmenu/resetnick.ts | 21 +-- src/commands-contextmenu/updateuser.ts | 171 ++++++------------- src/commands/clear.ts | 80 ++++----- src/commands/config.ts | 38 ++--- src/commands/counting.ts | 41 ++--- src/commands/counting/ban.ts | 50 ++---- src/commands/counting/setup.ts | 54 +++--- src/commands/counting/unban.ts | 50 ++---- src/commands/dev-info.ts | 14 +- src/commands/devel.ts | 10 +- src/commands/forceunverify.ts | 77 ++++----- src/commands/forceupdate.ts | 173 ++++++------------- src/commands/forceverify.ts | 178 ++++++++------------ 15 files changed, 349 insertions(+), 633 deletions(-) diff --git a/.prettierrc.js b/.prettierrc.js index 9257b96..7b72306 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -7,7 +7,7 @@ const config = { semi: false, singleQuote: false, quoteProps: "as-needed", - trailingComma: "all", + trailingComma: "none", bracketSpacing: true, arrowParens: "avoid", parser: "typescript", diff --git a/src/commands-contextmenu/congratsmessage.ts b/src/commands-contextmenu/congratsmessage.ts index 9f67033..0a816fe 100644 --- a/src/commands-contextmenu/congratsmessage.ts +++ b/src/commands-contextmenu/congratsmessage.ts @@ -1,9 +1,4 @@ -import { - ContextMenuCommandBuilder, - ApplicationCommandType, - PermissionFlagsBits, - userMention, -} from "discord.js" +import { ContextMenuCommandBuilder, ApplicationCommandType, PermissionFlagsBits, userMention } from "discord.js" import { ContextMenu } from "interfaces" export = { @@ -23,25 +18,23 @@ export = { if (!message) { return interaction.reply({ content: "That user does not exist.", - ephemeral: true, + ephemeral: true }) } const target = message.author await message.reply({ - embeds: [ - { - title: "Congratulations!", - description: `GG to ${userMention(target.id)}!`, - }, - ], + embeds: [{ + title: "Congratulations!", + description: `GG to ${userMention(target.id)}!` + }] }) await message.react("🎉") await interaction.reply({ content: "Sent a congrats message", - ephemeral: true, + ephemeral: true }) - }, + } } as ContextMenu diff --git a/src/commands-contextmenu/resetnick.ts b/src/commands-contextmenu/resetnick.ts index edaeb32..63e35e2 100644 --- a/src/commands-contextmenu/resetnick.ts +++ b/src/commands-contextmenu/resetnick.ts @@ -1,8 +1,4 @@ -import { - ContextMenuCommandBuilder, - ApplicationCommandType, - PermissionFlagsBits, -} from "discord.js" +import { ContextMenuCommandBuilder, ApplicationCommandType, PermissionFlagsBits } from "discord.js" import { ContextMenu } from "interfaces" export = { @@ -22,7 +18,7 @@ export = { if (!target) { interaction.reply({ content: "That user does not exist.", - ephemeral: true, + ephemeral: true }) return } @@ -30,7 +26,7 @@ export = { if (target.id === interaction.user.id) { interaction.reply({ content: "You can't reset your own nickname.", - ephemeral: true, + ephemeral: true }) return } @@ -38,21 +34,18 @@ export = { if (!target.manageable) { interaction.reply({ content: "I cannot reset that user's nickname.", - ephemeral: true, + ephemeral: true }) return } await target.setNickname( target.user.username, - "Reset by " + - interaction.user.username + - "#" + - interaction.user.discriminator, + "Reset by " + interaction.user.username + "#" + interaction.user.discriminator ) interaction.reply({ content: `Reset ${target.user.username}'s nickname.`, - ephemeral: true, + ephemeral: true }) - }, + } } as ContextMenu diff --git a/src/commands-contextmenu/updateuser.ts b/src/commands-contextmenu/updateuser.ts index 9f38f33..47e06e2 100644 --- a/src/commands-contextmenu/updateuser.ts +++ b/src/commands-contextmenu/updateuser.ts @@ -1,9 +1,4 @@ -import { - ApplicationCommandType, - ContextMenuCommandBuilder, - PermissionFlagsBits, - userMention, -} from "discord.js" +import { ApplicationCommandType, ContextMenuCommandBuilder, PermissionFlagsBits, userMention } from "discord.js" import { color, devMessage, hypixelGuildID } from "config/options.json" import { ContextMenu } from "interfaces" import verifySchema from "schemas/verifySchema" @@ -32,39 +27,33 @@ export = { if (!verifyData) { await interaction.editReply({ - embeds: [ - { - description: "User is not verified.", - color: embedColor, - footer: { - text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined, - }, - }, - ], + embeds: [{ + description: "User is not verified.", + color: embedColor, + footer: { + text: interaction.guild!.name + " | " + devMessage, + icon_url: interaction.guild!.iconURL() || undefined + } + }] }) return } await interaction.editReply({ - embeds: [ - { - description: "Fetching ign...", - color: embedColor, - }, - ], + embeds: [{ + description: "Fetching ign...", + color: embedColor + }] }) const ign = (await getIGN(verifyData.uuid)) as string const head = await getHeadURL(ign) await interaction.editReply({ - embeds: [ - { - description: "Fetching guild data...", - color: embedColor, - }, - ], + embeds: [{ + description: "Fetching guild data...", + color: embedColor + }] }) const guild = await getGuild(verifyData.uuid) @@ -78,141 +67,87 @@ export = { if (responseGuildID !== hypixelGuildID) { const roles = roleManage("default") - await user.roles.remove( - roles.rolesToRemove, - "User was force updated.", - ) + await user.roles.remove(roles.rolesToRemove, "User was force updated.") await user.roles.add(roles.rolesToAdd, "User was force updated.") await interaction.editReply({ - embeds: [ - { - description: - usermentioned + - " was given the the Default Member role.", - color: embedColor, - thumbnail: { - url: head!, - }, - footer: { - text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined, - }, + embeds: [{ + description: usermentioned + " was given the the Default Member role.", + color: embedColor, + thumbnail: { + url: head! }, - ], + footer: { + text: interaction.guild!.name + " | " + devMessage, + icon_url: interaction.guild!.iconURL() || undefined + } + }] }) return } if (responseGuildID === 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 was force updated.", - ) + await user.roles.add(roleManage("default").rolesToAdd, "User was force updated.") if (guildRank === "Guild Master") { const roles = roleManage("gm") - await user.roles.remove( - roles.rolesToRemove, - "User was force updated.", - ) - await user.roles.add( - roles.rolesToAdd, - "User was force updated.", - ) + await user.roles.remove(roles.rolesToRemove, "User was force updated.") + await user.roles.add(roles.rolesToAdd, "User was force updated.") replyRank = "Guild Master" } if (guildRank === "Manager") { const roles = roleManage("manager") - await user.roles.remove( - roles.rolesToRemove, - "User was force updated.", - ) - await user.roles.add( - roles.rolesToAdd, - "User was force updated.", - ) + await user.roles.remove(roles.rolesToRemove, "User was force updated.") + await user.roles.add(roles.rolesToAdd, "User was force updated.") replyRank = "Manager" } if (guildRank === "Moderator") { const roles = roleManage("moderator") - await user.roles.remove( - roles.rolesToRemove, - "User was force updated.", - ) - await user.roles.add( - roles.rolesToAdd, - "User was force updated.", - ) + await user.roles.remove(roles.rolesToRemove, "User was force updated.") + await user.roles.add(roles.rolesToAdd, "User was force updated.") replyRank = "Moderator" } if (guildRank === "Beast") { const roles = roleManage("beast") - await user.roles.remove( - roles.rolesToRemove, - "User was force updated.", - ) - await user.roles.add( - roles.rolesToAdd, - "User was force updated.", - ) + await user.roles.remove(roles.rolesToRemove, "User was force updated.") + await user.roles.add(roles.rolesToAdd, "User was force updated.") replyRank = "Beast" } if (guildRank === "Elite") { const roles = roleManage("elite") - await user.roles.remove( - roles.rolesToRemove, - "User was force updated.", - ) - await user.roles.add( - roles.rolesToAdd, - "User was force updated.", - ) + await user.roles.remove(roles.rolesToRemove, "User was force updated.") + await user.roles.add(roles.rolesToAdd, "User was force updated.") replyRank = "Elite" } if (guildRank === "Member") { const roles = roleManage("member") - await user.roles.remove( - roles.rolesToRemove, - "User was force updated.", - ) - await user.roles.add( - roles.rolesToAdd, - "User was force updated.", - ) + await user.roles.remove(roles.rolesToRemove, "User was force updated.") + await user.roles.add(roles.rolesToAdd, "User was force updated.") replyRank = "Member" } await interaction.editReply({ - embeds: [ - { - description: - usermentioned + - " was given the " + - replyRank + - " role.", - color: embedColor, - thumbnail: { - url: head!, - }, - footer: { - text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined, - }, + embeds: [{ + description: usermentioned + " was given the " + replyRank + " role.", + color: embedColor, + thumbnail: { + url: head! }, - ], + footer: { + text: interaction.guild!.name + " | " + devMessage, + icon_url: interaction.guild!.iconURL() || undefined + } + }] }) } - }, + } } as ContextMenu diff --git a/src/commands/clear.ts b/src/commands/clear.ts index 499bdad..076ecf1 100644 --- a/src/commands/clear.ts +++ b/src/commands/clear.ts @@ -1,10 +1,4 @@ -import { - SlashCommandBuilder, - PermissionFlagsBits, - TextChannel, - channelMention, - userMention, -} from "discord.js" +import { SlashCommandBuilder, PermissionFlagsBits, TextChannel, channelMention, userMention } from "discord.js" import { color } from "config/options.json" import { Command } from "interfaces" import logToChannel from "utils/functions/logtochannel" @@ -22,7 +16,7 @@ export = { option .setName("amount") .setDescription("Amount of messages to clear") - .setRequired(true), + .setRequired(true) ) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDMPermission(false), @@ -36,62 +30,52 @@ export = { if (amount < 1 || amount > 100) { await interaction.editReply({ - embeds: [ - { - description: - "Please provide an amount of messages to clear between 1 and 100.", - color: embedColor, - }, - ], + embeds: [{ + description: "Please provide an amount of messages to clear between 1 and 100.", + color: embedColor + }] }) } channel.messages.fetch({ limit: amount }).then(async messages => { - const messagesToDelete = messages - .map(m => m) - .filter( - m => - m.pinned === false && - m.system === false && - m.createdTimestamp > Date.now() - 1209600000, - ) + const messagesToDelete = messages.map(m => m).filter(m => + m.pinned === false && + m.system === false && + m.createdTimestamp > Date.now() - 1209600000 + ) await channel.bulkDelete(messagesToDelete, true) await logToChannel("mod", { - embeds: [ - { - author: { - name: interaction.user.username, - icon_url: interaction.user.avatarURL() || undefined, - }, - title: "Messages Cleared", - description: ` + embeds: [{ + author: { + name: interaction.user.username, + icon_url: interaction.user.avatarURL() || undefined + }, + title: "Messages Cleared", + description: ` **Channel:** ${channelMention(channel.id)} **Amount:** \`${messages.size}\` messages **Mod:** ${userMention(interaction.user.id)} `, - color: embedColor, - thumbnail: { - url: interaction.user.avatarURL() || "", - }, - footer: { - text: "ID: " + channel.id, - icon_url: interaction.guild!.iconURL() || undefined, - }, - timestamp: new Date().toISOString(), + color: embedColor, + thumbnail: { + url: interaction.user.avatarURL() || "" }, - ], + footer: { + text: "ID: " + channel.id, + icon_url: interaction.guild!.iconURL() || undefined + }, + timestamp: new Date().toISOString() + }] }) await interaction.editReply({ - embeds: [ - { - description: `Deleted ${messages.size} messages`, - color: embedColor, - }, - ], + embeds: [{ + description: `Deleted ${messages.size} messages`, + color: embedColor + }] }) }) - }, + } } as Command diff --git a/src/commands/config.ts b/src/commands/config.ts index 5a1a45d..ec720da 100644 --- a/src/commands/config.ts +++ b/src/commands/config.ts @@ -19,15 +19,15 @@ export = { .setDescription("The setting to configure") .setChoices({ name: "Staff Application status", - value: "staffAppStatus", + value: "staffAppStatus" }) - .setRequired(true), + .setRequired(true) ) .addStringOption(option => option .setName("value") .setDescription("The value to set") - .setRequired(true), + .setRequired(true) ) .setDMPermission(false) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), @@ -44,39 +44,25 @@ export = { const newSetting = new settings({ _id: new mongoose.Types.ObjectId(), name: setting, - value: value, + value: value }) await newSetting.save() await interaction.editReply({ - embeds: [ - { - description: - "Successfully created `" + - setting + - "` with value `" + - value + - "`.", - color: embedColor, - }, - ], + embeds: [{ + description: "Successfully created `" + setting + "` with value `" + value + "`.", + color: embedColor + }] }) } else { await settings.findOneAndUpdate({ name: setting }, { value: value }) await interaction.editReply({ - embeds: [ - { - description: - "Successfully updated `" + - setting + - "` to value `" + - value + - "`.", - }, - ], + embeds: [{ + description: "Successfully updated `" + setting + "` to value `" + value + "`." + }] }) } - }, + } } as Command diff --git a/src/commands/counting.ts b/src/commands/counting.ts index 156f2f3..69d9cc4 100644 --- a/src/commands/counting.ts +++ b/src/commands/counting.ts @@ -1,8 +1,4 @@ -import { - ChannelType, - PermissionFlagsBits, - SlashCommandBuilder, -} from "discord.js" +import { ChannelType, PermissionFlagsBits, SlashCommandBuilder } from "discord.js" import { color, devMessage } from "config/options.json" import { Command } from "interfaces" import setup from "./counting/setup" @@ -28,11 +24,8 @@ export = { .setName("channel") .setDescription("The channel to setup counting in") .setRequired(true) - .addChannelTypes( - ChannelType.GuildText, - ChannelType.GuildAnnouncement, - ), - ), + .addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement) + ) ) .addSubcommand(subcommand => subcommand @@ -42,8 +35,8 @@ export = { option .setName("user") .setDescription("The user to ban") - .setRequired(true), - ), + .setRequired(true) + ) ) .addSubcommand(subcommand => subcommand @@ -53,8 +46,8 @@ export = { option .setName("user") .setDescription("The user to ban") - .setRequired(true), - ), + .setRequired(true) + ) ) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDMPermission(false), @@ -79,16 +72,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/counting/ban.ts b/src/commands/counting/ban.ts index ac9c2de..dc0e481 100644 --- a/src/commands/counting/ban.ts +++ b/src/commands/counting/ban.ts @@ -1,48 +1,34 @@ -import { - ChatInputCommandInteraction, - GuildMember, - userMention, -} from "discord.js" +import { ChatInputCommandInteraction, GuildMember, userMention } from "discord.js" import { countingBanned } from "config/roles.json" import { color, devMessage } from "config/options.json" -export default async function ban( - interaction: ChatInputCommandInteraction, -): Promise { +export default async function ban(interaction: ChatInputCommandInteraction): Promise { const member = interaction.options.getMember("user")! as GuildMember const embedColor = Number(color.replace("#", "0x")) if (member.roles.cache.has(countingBanned)) { await interaction.reply({ - embeds: [ - { - description: - userMention(member.user.id) + - " is currently banned from counting", - color: embedColor, - footer: { - icon_url: interaction.guild!.iconURL() || undefined, - text: interaction.guild!.name + " | " + devMessage, - }, - }, - ], + embeds: [{ + description: userMention(member.user.id) + " is currently banned from counting", + color: embedColor, + footer: { + icon_url: interaction.guild!.iconURL() || undefined, + text: interaction.guild!.name + " | " + devMessage + } + }] }) } else { await member.roles.add(countingBanned) await interaction.reply({ - embeds: [ - { - description: - userMention(member.user.id) + - " has been banned from counting", - color: embedColor, - footer: { - icon_url: interaction.guild!.iconURL() || undefined, - text: interaction.guild!.name + " | " + devMessage, - }, - }, - ], + embeds: [{ + description: userMention(member.user.id) + " has been banned from counting", + color: embedColor, + footer: { + icon_url: interaction.guild!.iconURL() || undefined, + text: interaction.guild!.name + " | " + devMessage + } + }] }) } } diff --git a/src/commands/counting/setup.ts b/src/commands/counting/setup.ts index 80e0d46..98b7c21 100644 --- a/src/commands/counting/setup.ts +++ b/src/commands/counting/setup.ts @@ -1,15 +1,9 @@ -import { - ChatInputCommandInteraction, - TextChannel, - channelMention, -} from "discord.js" +import { ChatInputCommandInteraction, TextChannel, channelMention } from "discord.js" import settingsSchema from "schemas/settingsSchema" import { color, devMessage } from "config/options.json" import mongoose from "mongoose" -export default async function setup( - interaction: ChatInputCommandInteraction, -): Promise { +export default async function setup(interaction: ChatInputCommandInteraction): Promise { await interaction.deferReply() const channel = interaction.options.getChannel("channel") as TextChannel @@ -18,44 +12,36 @@ export default async function setup( if (await settingsSchema.findOne({ name: "counting" })) { await settingsSchema.findOneAndUpdate( { name: "counting" }, - { name: "counting", channel: channel.id }, + { name: "counting", channel: channel.id } ) await interaction.editReply({ - embeds: [ - { - description: - "Counting channel has been updated to " + - channelMention(channel.id), - color: embedColor, - footer: { - icon_url: interaction.guild!.iconURL() || undefined, - text: interaction.guild!.name + " | " + devMessage, - }, - }, - ], + embeds: [{ + description: "Counting channel has been updated to " + channelMention(channel.id), + color: embedColor, + footer: { + icon_url: interaction.guild!.iconURL() || undefined, + text: interaction.guild!.name + " | " + devMessage + } + }] }) } else { const counting = new settingsSchema({ _id: new mongoose.Types.ObjectId(), name: "counting", - value: channel.id, + value: channel.id }) await counting.save() await interaction.editReply({ - embeds: [ - { - description: - "Counting channel has been set to " + - channelMention(channel.id), - color: embedColor, - footer: { - icon_url: interaction.guild!.iconURL() || undefined, - text: interaction.guild!.name + " | " + devMessage, - }, - }, - ], + embeds: [{ + description: "Counting channel has been set to " + channelMention(channel.id), + color: embedColor, + footer: { + icon_url: interaction.guild!.iconURL() || undefined, + text: interaction.guild!.name + " | " + devMessage + } + }] }) } } diff --git a/src/commands/counting/unban.ts b/src/commands/counting/unban.ts index b59f01e..b73e45d 100644 --- a/src/commands/counting/unban.ts +++ b/src/commands/counting/unban.ts @@ -1,48 +1,34 @@ -import { - ChatInputCommandInteraction, - GuildMember, - userMention, -} from "discord.js" +import { ChatInputCommandInteraction, GuildMember, userMention } from "discord.js" import { countingBanned } from "config/roles.json" import { color, devMessage } from "config/options.json" -export default async function ban( - interaction: ChatInputCommandInteraction, -): Promise { +export default async function ban(interaction: ChatInputCommandInteraction): Promise { const member = interaction.options.getMember("user")! as GuildMember const embedColor = Number(color.replace("#", "0x")) if (!member.roles.cache.has(countingBanned)) { await interaction.reply({ - embeds: [ - { - description: - userMention(member.user.id) + - " is currently not banned from counting", - color: embedColor, - footer: { - icon_url: interaction.guild!.iconURL() || undefined, - text: interaction.guild!.name + " | " + devMessage, - }, - }, - ], + embeds: [{ + description: userMention(member.user.id) + " is currently not banned from counting", + color: embedColor, + footer: { + icon_url: interaction.guild!.iconURL() || undefined, + text: interaction.guild!.name + " | " + devMessage + } + }] }) } else { await member.roles.remove(countingBanned) await interaction.reply({ - embeds: [ - { - description: - userMention(member.user.id) + - " has been unbanned from counting", - color: embedColor, - footer: { - icon_url: interaction.guild!.iconURL() || undefined, - text: interaction.guild!.name + " | " + devMessage, - }, - }, - ], + embeds: [{ + description: userMention(member.user.id) + " has been unbanned from counting", + color: embedColor, + footer: { + icon_url: interaction.guild!.iconURL() || undefined, + text: interaction.guild!.name + " | " + devMessage + } + }] }) } } diff --git a/src/commands/dev-info.ts b/src/commands/dev-info.ts index 8318c1d..b4d9d43 100644 --- a/src/commands/dev-info.ts +++ b/src/commands/dev-info.ts @@ -1,8 +1,4 @@ -import { - SlashCommandBuilder, - PermissionFlagsBits, - ChatInputCommandInteraction, -} from "discord.js" +import { SlashCommandBuilder, PermissionFlagsBits } from "discord.js" import { Command } from "interfaces" export = { @@ -15,12 +11,14 @@ export = { .setName("dev-info") .setDescription("Test command for the bot.") .addStringOption(option => - option.setName("test").setDescription("Test option."), + option + .setName("test") + .setDescription("Test option.") ) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDMPermission(false), - async execute(interaction: ChatInputCommandInteraction) { + async execute(interaction) { const test = interaction.options.getString("test")! const message = await interaction.channel!.messages.fetch(test) @@ -31,5 +29,5 @@ export = { console.log(field1.value) await interaction.reply({ content: "Test command.", ephemeral: true }) - }, + } } as Command diff --git a/src/commands/devel.ts b/src/commands/devel.ts index a09f498..2b9b070 100644 --- a/src/commands/devel.ts +++ b/src/commands/devel.ts @@ -11,7 +11,9 @@ export = { .setName("devel") .setDescription("Admin command.") .addSubcommand(subcommand => - subcommand.setName("reload").setDescription("Reload the bot."), + subcommand + .setName("reload") + .setDescription("Reload the bot.") ) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDMPermission(false), @@ -23,17 +25,17 @@ export = { const { exec } = require("child_process") await interaction.reply({ content: "Reloading...", - ephemeral: true, + ephemeral: true }) exec("pm2 restart 0", async (err: Error) => { if (err) { await interaction.reply({ content: "Error while reloading: " + err, - ephemeral: true, + ephemeral: true }) } }) } - }, + } } as Command diff --git a/src/commands/forceunverify.ts b/src/commands/forceunverify.ts index 7897ae5..121a802 100644 --- a/src/commands/forceunverify.ts +++ b/src/commands/forceunverify.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 verify from "schemas/verifySchema" import { Command } from "interfaces" @@ -24,7 +19,7 @@ export = { option .setName("user") .setDescription("The user to force unverify") - .setRequired(true), + .setRequired(true) ) .setDMPermission(false) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), @@ -37,12 +32,10 @@ export = { if (!verifiedUser) { return interaction.reply({ - embeds: [ - { - description: "This user is not verified", - color: embedColor, - }, - ], + embeds: [{ + description: "This user is not verified", + color: embedColor + }] }) } @@ -51,49 +44,43 @@ export = { await verify.findOneAndDelete({ userID: member.user.id }) await member.roles.remove( roleManage("all").rolesToRemove, - "User force unverified by " + interaction.user.username, + "User force unverified by " + interaction.user.username ) await logToChannel("mod", { - embeds: [ - { - title: "Force Unverified", - author: { - name: mod.username, - icon_url: mod.avatarURL() || undefined, - }, - description: ` + embeds: [{ + title: "Force Unverified", + author: { + name: mod.username, + icon_url: mod.avatarURL() || undefined + }, + description: ` **User:** ${userMention(member.user.id)} **Mod:** ${userMention(mod.id)} **IGN:** \`${ign}\` **UUID:** \`${uuid}\` `, - color: embedColor, - thumbnail: { - url: mod.avatarURL() || "", - }, - footer: { - icon_url: member.user.avatarURL() || undefined, - text: "ID: " + member.user.id, - }, - timestamp: new Date().toISOString(), + color: embedColor, + thumbnail: { + url: mod.avatarURL() || "" }, - ], + footer: { + icon_url: member.user.avatarURL() || undefined, + text: "ID: " + member.user.id + }, + timestamp: new Date().toISOString() + }] }) await interaction.reply({ - embeds: [ - { - description: - "Successfully unverified " + - userMention(member.user.id), - color: embedColor, - footer: { - text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined, - }, - }, - ], + embeds: [{ + description: "Successfully unverified " + userMention(member.user.id), + color: embedColor, + footer: { + text: interaction.guild!.name + " | " + devMessage, + icon_url: interaction.guild!.iconURL() || undefined + } + }] }) - }, + } } as Command diff --git a/src/commands/forceupdate.ts b/src/commands/forceupdate.ts index f757862..77088df 100644 --- a/src/commands/forceupdate.ts +++ b/src/commands/forceupdate.ts @@ -1,9 +1,4 @@ -import { - SlashCommandBuilder, - PermissionFlagsBits, - userMention, - GuildMember, -} from "discord.js" +import { SlashCommandBuilder, PermissionFlagsBits, userMention, GuildMember } from "discord.js" import { getGuild, getHeadURL, getIGN } from "utils/Hypixel" import { hypixelGuildID, color, devMessage } from "config/options.json" import verify from "schemas/verifySchema" @@ -23,7 +18,7 @@ export = { option .setName("user") .setDescription("The user to force update") - .setRequired(true), + .setRequired(true) ) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDMPermission(false), @@ -38,39 +33,33 @@ export = { if (!verifyData) { await interaction.editReply({ - embeds: [ - { - description: "User is not verified.", - color: embedColor, - footer: { - text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined, - }, - }, - ], + embeds: [{ + description: "User is not verified.", + color: embedColor, + footer: { + text: interaction.guild!.name + " | " + devMessage, + icon_url: interaction.guild!.iconURL() || undefined + } + }] }) return } await interaction.editReply({ - embeds: [ - { - description: "Fetching ign...", - color: embedColor, - }, - ], + embeds: [{ + description: "Fetching ign...", + color: embedColor + }] }) const ign = (await getIGN(verifyData.uuid)) as string const head = await getHeadURL(ign) await interaction.editReply({ - embeds: [ - { - description: "Fetching guild data...", - color: embedColor, - }, - ], + embeds: [{ + description: "Fetching guild data...", + color: embedColor + }] }) const guild = await getGuild(verifyData.uuid) @@ -84,141 +73,87 @@ export = { if (responseGuildID !== hypixelGuildID) { const roles = roleManage("default") - await user.roles.remove( - roles.rolesToRemove, - "User was force updated.", - ) + await user.roles.remove(roles.rolesToRemove, "User was force updated.") await user.roles.add(roles.rolesToAdd, "User was force updated.") await interaction.editReply({ - embeds: [ - { - description: - usermentioned + - " was given the the Default Member role.", - color: embedColor, - thumbnail: { - url: head!, - }, - footer: { - text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined, - }, + embeds: [{ + description: usermentioned + " was given the the Default Member role.", + color: embedColor, + thumbnail: { + url: head! }, - ], + footer: { + text: interaction.guild!.name + " | " + devMessage, + icon_url: interaction.guild!.iconURL() || undefined + } + }] }) return } if (responseGuildID === 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 was force updated.", - ) + await user.roles.add(roleManage("default").rolesToAdd, "User was force updated.") if (guildRank === "Guild Master") { const roles = roleManage("gm") - await user.roles.remove( - roles.rolesToRemove, - "User was force updated.", - ) - await user.roles.add( - roles.rolesToAdd, - "User was force updated.", - ) + await user.roles.remove(roles.rolesToRemove, "User was force updated.") + await user.roles.add(roles.rolesToAdd, "User was force updated.") replyRank = "Guild Master" } if (guildRank === "Manager") { const roles = roleManage("manager") - await user.roles.remove( - roles.rolesToRemove, - "User was force updated.", - ) - await user.roles.add( - roles.rolesToAdd, - "User was force updated.", - ) + await user.roles.remove(roles.rolesToRemove, "User was force updated.") + await user.roles.add(roles.rolesToAdd, "User was force updated.") replyRank = "Manager" } if (guildRank === "Moderator") { const roles = roleManage("moderator") - await user.roles.remove( - roles.rolesToRemove, - "User was force updated.", - ) - await user.roles.add( - roles.rolesToAdd, - "User was force updated.", - ) + await user.roles.remove(roles.rolesToRemove, "User was force updated.") + await user.roles.add(roles.rolesToAdd, "User was force updated.") replyRank = "Moderator" } if (guildRank === "Beast") { const roles = roleManage("beast") - await user.roles.remove( - roles.rolesToRemove, - "User was force updated.", - ) - await user.roles.add( - roles.rolesToAdd, - "User was force updated.", - ) + await user.roles.remove(roles.rolesToRemove, "User was force updated.") + await user.roles.add(roles.rolesToAdd, "User was force updated.") replyRank = "Beast" } if (guildRank === "Elite") { const roles = roleManage("elite") - await user.roles.remove( - roles.rolesToRemove, - "User was force updated.", - ) - await user.roles.add( - roles.rolesToAdd, - "User was force updated.", - ) + await user.roles.remove(roles.rolesToRemove, "User was force updated.") + await user.roles.add(roles.rolesToAdd, "User was force updated.") replyRank = "Elite" } if (guildRank === "Member") { const roles = roleManage("member") - await user.roles.remove( - roles.rolesToRemove, - "User was force updated.", - ) - await user.roles.add( - roles.rolesToAdd, - "User was force updated.", - ) + await user.roles.remove(roles.rolesToRemove, "User was force updated.") + await user.roles.add(roles.rolesToAdd, "User was force updated.") replyRank = "Member" } await interaction.editReply({ - embeds: [ - { - description: - usermentioned + - " was given the the " + - replyRank + - " role.", - color: embedColor, - thumbnail: { - url: head!, - }, - footer: { - text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined, - }, + embeds: [{ + description: usermentioned + " was given the the " + replyRank + " role.", + color: embedColor, + thumbnail: { + url: head! }, - ], + footer: { + text: interaction.guild!.name + " | " + devMessage, + icon_url: interaction.guild!.iconURL() || undefined + } + }] }) } - }, + } } as Command diff --git a/src/commands/forceverify.ts b/src/commands/forceverify.ts index 6d23822..8058e3b 100644 --- a/src/commands/forceverify.ts +++ b/src/commands/forceverify.ts @@ -1,9 +1,4 @@ -import { - SlashCommandBuilder, - PermissionFlagsBits, - GuildMember, - userMention, -} from "discord.js" +import { SlashCommandBuilder, PermissionFlagsBits, GuildMember, userMention } from "discord.js" import { getUUID, getPlayer, getGuild, getHeadURL } from "utils/Hypixel" import { color, hypixelGuildID, devMessage } from "config/options.json" import verify from "schemas/verifySchema" @@ -22,10 +17,14 @@ export = { .setName("forceverify") .setDescription("Force verify a user.") .addUserOption(option => - option.setName("user").setDescription("The user to force verify."), + option + .setName("user") + .setDescription("The user to force verify.") ) .addStringOption(option => - option.setName("ign").setDescription("The user's in-game name."), + option + .setName("ign") + .setDescription("The user's in-game name.") ) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDMPermission(false), @@ -45,9 +44,8 @@ export = { } if (!user) { - interaction.editReply( - "Please provide a user to force verify.\nThis can also mean the user is not in the server.", - ) + interaction.editReply("Please provide a user to force verify.\n" + + "This can also mean the user is not in the server.") return } @@ -71,58 +69,46 @@ export = { } await interaction.editReply({ - embeds: [ - { - description: "Fetching their uuid...", - color: embedColor, - }, - ], + embeds: [{ + description: "Fetching their 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 their player data...", - color: embedColor, - }, - ], + embeds: [{ + description: "Fetching their player data...", + color: embedColor + }] }) 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 } await interaction.editReply({ - embeds: [ - { - description: "Fetching their guild data...", - color: embedColor, - }, - ], + embeds: [{ + description: "Fetching their guild data...", + color: embedColor + }] }) const guild = await getGuild(uuid) @@ -136,119 +122,87 @@ export = { const head = await getHeadURL(ign) if (responseGuildID === 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") - await user.roles.add( - roles.rolesToAdd, - "User was force verified by " + modName, - ) + await user.roles.add(roles.rolesToAdd, "User was force verified by " + modName) } if (guildRank === "Manager") { const roles = roleManage("manager") - await user.roles.add( - roles.rolesToAdd, - "User was force verified by " + modName, - ) + await user.roles.add(roles.rolesToAdd, "User was force verified by " + modName) } if (guildRank === "Moderator") { const roles = roleManage("moderator") - await user.roles.add( - roles.rolesToAdd, - "User was force verified by " + modName, - ) + await user.roles.add(roles.rolesToAdd, "User was force verified by " + modName) } if (guildRank === "Beast") { const roles = roleManage("beast") - await user.roles.add( - roles.rolesToAdd, - "User was force verified by " + modName, - ) + await user.roles.add(roles.rolesToAdd, "User was force verified by " + modName) } if (guildRank === "Elite") { const roles = roleManage("elite") - await user.roles.add( - roles.rolesToAdd, - "User was force verified by " + modName, - ) + await user.roles.add(roles.rolesToAdd, "User was force verified by " + modName) } if (guildRank === "Member") { const roles = roleManage("member") - await user.roles.add( - roles.rolesToAdd, - "User was force verified by " + modName, - ) + await user.roles.add(roles.rolesToAdd, "User was force verified by " + modName) } } - await user.roles.add( - roleManage("default").rolesToAdd, - "User was force verified by " + modName, - ) + await user.roles.add( roleManage("default").rolesToAdd, "User was force verified by " + modName) const newVerify = new verify({ _id: new mongoose.Types.ObjectId(), userID: user.id, - uuid: uuid, + uuid: uuid }) await newVerify.save() await logToChannel("mod", { - embeds: [ - { - author: { - name: modName, - icon_url: mod.avatarURL() || undefined, - }, - title: "Force Verified", - description: ` + embeds: [{ + author: { + name: modName, + icon_url: mod.avatarURL() || undefined + }, + title: "Force Verified", + description: ` **User:** ${userMention(user.id)} **Mod:** ${userMention(mod.id)} **IGN:** \`${player.displayname}\` **UUID:** \`${uuid}\` `, - color: embedColor, - thumbnail: { - url: mod.avatarURL() || "", - }, - footer: { - icon_url: user.user.avatarURL() || undefined, - text: "ID: " + user.user.id, - }, - timestamp: new Date().toISOString(), + color: embedColor, + thumbnail: { + url: mod.avatarURL() || "" }, - ], + footer: { + icon_url: user.user.avatarURL() || undefined, + text: "ID: " + user.user.id + }, + timestamp: new Date().toISOString() + }] }) await interaction.editReply({ - embeds: [ - { - title: interaction.guild!.name, - description: - "You have successfully force 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 force 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 From 3eed20e7886d2bd4aeb66ec4c964b8d937acfffc Mon Sep 17 00:00:00 2001 From: Taken Date: Fri, 19 Jan 2024 21:36:01 +0100 Subject: [PATCH 04/15] Process of format fixing --- src/commands/guild.ts | 38 ++-- src/commands/guild/info.ts | 90 ++++---- src/commands/guild/member.ts | 72 +++---- src/commands/guild/top.ts | 106 ++++----- src/commands/help.ts | 22 +- src/commands/instructions.ts | 12 +- src/commands/kick.ts | 32 +-- src/commands/ping.ts | 10 +- src/commands/pp.ts | 10 +- src/commands/remove.ts | 34 +-- src/commands/reqs.ts | 22 +- src/commands/send.ts | 28 +-- src/commands/setnick.ts | 30 +-- src/commands/setup.ts | 60 +++--- src/commands/slowmode.ts | 40 ++-- src/commands/snipe.ts | 26 +-- src/commands/staff.ts | 20 +- src/commands/staff/beast.ts | 60 +++--- src/commands/staff/help.ts | 20 +- src/commands/staff/updatediscordroles.ts | 60 +++--- src/commands/timeout.ts | 60 +++--- src/commands/unban.ts | 42 ++-- src/commands/update.ts | 68 +++--- src/commands/uuid.ts | 20 +- src/commands/verify.ts | 74 +++---- src/commands/whoami.ts | 18 +- src/commands/whois.ts | 18 +- src/components/autocomplete/unban.ts | 10 +- src/components/buttons/checkstats.ts | 30 +-- .../buttons/guildapplicationaccept.ts | 44 ++-- .../buttons/guildapplicationdeny.ts | 10 +- src/components/buttons/guildapply.ts | 202 +++++++++--------- src/components/buttons/guildinactivitylog.ts | 116 +++++----- .../buttons/inactiveapplicationaccept.ts | 4 +- .../buttons/inactiveapplicationdeny.ts | 4 +- .../buttons/staffapplicationaccept.ts | 24 +-- .../buttons/staffapplicationdeny.ts | 10 +- src/components/buttons/staffapply.ts | 168 +++++++-------- src/components/buttons/verify.ts | 8 +- src/components/buttons/waitingListUpdate.ts | 12 +- src/components/modals/denyreasonbox.ts | 20 +- src/components/modals/staffdenyreasonbox.ts | 22 +- src/components/modals/verifyModal.ts | 44 ++-- src/events/cron/weeklyGexp.ts | 41 ++-- .../server/guildMemberAdd/logNewJoins.ts | 12 +- src/events/server/interactions/logBtnsCmds.ts | 14 +- src/events/server/messages/eval.ts | 14 +- src/events/server/messages/react.ts | 2 +- src/events/server/messages/snipecache.ts | 6 +- src/events/server/ready/consolelog.ts | 2 +- src/events/server/ready/sendOnlineMessage.ts | 8 +- src/events/server/ready/status.ts | 4 +- .../server/voiceStateUpdate/vcJoinLeave.ts | 26 +-- src/interfaces/Command.ts | 2 +- src/interfaces/ContextMenu.ts | 2 +- src/interfaces/index.ts | 2 +- src/schemas/guildAppSchema.ts | 2 +- src/schemas/settingsSchema.ts | 2 +- src/schemas/snipeCacheSchema.ts | 2 +- src/schemas/staffAppSchema.ts | 2 +- src/schemas/verifySchema.ts | 2 +- src/schemas/waitinglistSchema.ts | 2 +- src/utils/Autodeploy.ts | 20 +- src/utils/Client.ts | 8 +- src/utils/Env.ts | 6 +- src/utils/Events/autocomplete.ts | 16 +- src/utils/Events/button.ts | 26 +-- src/utils/Events/command.ts | 26 +-- src/utils/Events/contextmenu.ts | 28 +-- src/utils/Events/cron.ts | 2 +- src/utils/Events/modal.ts | 26 +-- src/utils/Hypixel/account.ts | 10 +- src/utils/Hypixel/guild.ts | 2 +- src/utils/Hypixel/hypixel.ts | 2 +- src/utils/functions/colors.ts | 2 +- src/utils/functions/logtochannel.ts | 8 +- src/utils/functions/rolesmanage.ts | 16 +- 77 files changed, 1079 insertions(+), 1086 deletions(-) diff --git a/src/commands/guild.ts b/src/commands/guild.ts index dc3b939..ecbb312 100644 --- a/src/commands/guild.ts +++ b/src/commands/guild.ts @@ -23,8 +23,8 @@ export = { option .setName("ign") .setDescription("The IGN of the player.") - .setRequired(true), - ), + .setRequired(true) + ) ) .addSubcommand(subcommand => subcommand @@ -34,9 +34,9 @@ export = { option .setName("query") .setDescription( - "The query to search for. [Default: player]", + "The query to search for. [Default: player]" ) - .setRequired(true), + .setRequired(true) ) .addStringOption(option => option @@ -45,9 +45,9 @@ export = { .addChoices( { name: "Guild Member", value: "ign" }, { name: "Guild Name", value: "name" }, - { name: "Guild Id", value: "id" }, - ), - ), + { name: "Guild Id", value: "id" } + ) + ) ) .addSubcommand(subcommand => subcommand @@ -57,9 +57,9 @@ export = { option .setName("query") .setDescription( - "The query to search for. [Default: player]", + "The query to search for. [Default: player]" ) - .setRequired(true), + .setRequired(true) ) .addStringOption(option => option @@ -68,16 +68,16 @@ export = { .addChoices( { name: "Guild Member", value: "ign" }, { name: "Guild Name", value: "name" }, - { name: "Guild Id", value: "id" }, - ), + { name: "Guild Id", value: "id" } + ) ) .addNumberOption(option => option .setName("amount") .setDescription( - "The amount of guild members to show. [Default: 10]", - ), - ), + "The amount of guild members to show. [Default: 10]" + ) + ) ) .setDMPermission(false), @@ -107,10 +107,10 @@ export = { color: embedColor, footer: { text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined, - }, - }, - ], + icon_url: interaction.guild!.iconURL() || undefined + } + } + ] }) - }, + } } as Command diff --git a/src/commands/guild/info.ts b/src/commands/guild/info.ts index 3fae00b..034faa6 100644 --- a/src/commands/guild/info.ts +++ b/src/commands/guild/info.ts @@ -4,7 +4,7 @@ import { ChatInputCommandInteraction } from "discord.js" import { GuildData } from "interfaces" export default async function guildInfo( - interaction: ChatInputCommandInteraction, + interaction: ChatInputCommandInteraction ): Promise { await interaction.deferReply() @@ -18,9 +18,9 @@ export default async function guildInfo( embeds: [ { description: "Fetching your uuid...", - color: embedColor, - }, - ], + color: embedColor + } + ] }) const uuid = await getUUID(query) @@ -29,9 +29,9 @@ export default async function guildInfo( embeds: [ { description: "That player doen't exist!", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -40,9 +40,9 @@ export default async function guildInfo( embeds: [ { description: "Fetching your player data...", - color: embedColor, - }, - ], + color: embedColor + } + ] }) const player = await getPlayer(uuid) @@ -51,9 +51,9 @@ export default async function guildInfo( embeds: [ { description: "That player has never joined the server!", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -62,9 +62,9 @@ export default async function guildInfo( embeds: [ { description: "Fetching your guild data...", - color: embedColor, - }, - ], + color: embedColor + } + ] }) guild = await getGuild(uuid, "player") @@ -73,9 +73,9 @@ export default async function guildInfo( embeds: [ { description: "That player is not in a guild!", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -84,9 +84,9 @@ export default async function guildInfo( embeds: [ { description: "Fetching your guild data...", - color: embedColor, - }, - ], + color: embedColor + } + ] }) guild = await getGuild(query, "name") @@ -95,9 +95,9 @@ export default async function guildInfo( embeds: [ { description: "That guild doesn't exist!", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -106,9 +106,9 @@ export default async function guildInfo( embeds: [ { description: "Fetching your guild data...", - color: embedColor, - }, - ], + color: embedColor + } + ] }) guild = await getGuild(query, "id") @@ -117,9 +117,9 @@ export default async function guildInfo( embeds: [ { description: "That guild doesn't exist!", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -157,14 +157,14 @@ export default async function guildInfo( const guildOwner = guildMembers.find(m => m.rank === "Guild Master")!.uuid const guildOwnerName = await getIGN(guildOwner) const guildRanksUnsorted = guild!.ranks.sort( - (a, b) => b.priority - a.priority, + (a, b) => b.priority - a.priority ) const guildRanks = guildRanksUnsorted .map(r => "**➺ " + r.name + "** `[" + r.tag + "]`") .join("\n") const allGuildMembersWeeklyXP = guildMembers.map( - member => member.expHistory, + member => member.expHistory ) const guildMembersWeeklyXP = allGuildMembersWeeklyXP.map(member => { return Object.values(member).reduce((a, b) => a + b, 0) @@ -172,17 +172,17 @@ export default async function guildInfo( const totalGuildMembersWeeklyXPUnformatted = guildMembersWeeklyXP.reduce( (a, b) => a + b, - 0, + 0 ) const totalGuildMembersWeeklyXP = new Intl.NumberFormat("en-US").format( - totalGuildMembersWeeklyXPUnformatted, + totalGuildMembersWeeklyXPUnformatted ) const averageGuildMembersWeeklyXPUnformatted = Math.round( - totalGuildMembersWeeklyXPUnformatted / 7, + totalGuildMembersWeeklyXPUnformatted / 7 ) const averageGuildMembersWeeklyXP = new Intl.NumberFormat("en-US").format( - averageGuildMembersWeeklyXPUnformatted, + averageGuildMembersWeeklyXPUnformatted ) await interaction.editReply({ @@ -205,7 +205,7 @@ export default async function guildInfo( fields: [ { name: "**Guild Ranks**", - value: guildRanks, + value: guildRanks }, { name: "**GEXP**", @@ -218,19 +218,19 @@ export default async function guildInfo( "`\n" + "**➺ Total GEXP:** `" + guildExp + - "`", + "`" }, { name: "**Guild Created**", - value: "**➺ **`" + guildCreatedTime + "`", - }, + value: "**➺ **`" + guildCreatedTime + "`" + } ], color: embedColor, footer: { text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined, - }, - }, - ], + icon_url: interaction.guild!.iconURL() || undefined + } + } + ] }) } diff --git a/src/commands/guild/member.ts b/src/commands/guild/member.ts index 071591e..7f00b19 100644 --- a/src/commands/guild/member.ts +++ b/src/commands/guild/member.ts @@ -3,7 +3,7 @@ import { color, devMessage } from "config/options.json" import { ChatInputCommandInteraction } from "discord.js" export default async function guildMember( - interaction: ChatInputCommandInteraction, + interaction: ChatInputCommandInteraction ): Promise { await interaction.deferReply() @@ -14,9 +14,9 @@ export default async function guildMember( embeds: [ { description: "Fetching your uuid...", - color: embedColor, - }, - ], + color: embedColor + } + ] }) const uuid = await getUUID(ign) @@ -25,9 +25,9 @@ export default async function guildMember( embeds: [ { description: "This user does not exist", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -36,9 +36,9 @@ export default async function guildMember( embeds: [ { description: "Fetching your player data...", - color: embedColor, - }, - ], + color: embedColor + } + ] }) const head = await getHeadURL(ign) @@ -50,14 +50,14 @@ export default async function guildMember( description: "This user never logged on to hypixel", color: embedColor, thumbnail: { - url: head!, + url: head! }, footer: { text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined, - }, - }, - ], + icon_url: interaction.guild!.iconURL() || undefined + } + } + ] }) return } @@ -83,9 +83,9 @@ export default async function guildMember( embeds: [ { description: "Fetching your guild data...", - color: embedColor, - }, - ], + color: embedColor + } + ] }) const guild = await getGuild(uuid) @@ -96,14 +96,14 @@ export default async function guildMember( description: "This user is not in a guild", color: embedColor, thumbnail: { - url: head!, + url: head! }, footer: { text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined, - }, - }, - ], + icon_url: interaction.guild!.iconURL() || undefined + } + } + ] }) return } @@ -129,16 +129,16 @@ export default async function guildMember( const expValue = allDaysGexp.join("") const totalWeeklyGexpUnformatted = Object.values(memberGexp).reduce( (a, b) => a + b, - 0, + 0 ) const totalWeeklyGexp = new Intl.NumberFormat("en-US").format( - totalWeeklyGexpUnformatted, + totalWeeklyGexpUnformatted ) const averageWeeklyGexpUnformatted = Math.round( - totalWeeklyGexpUnformatted / 7, + totalWeeklyGexpUnformatted / 7 ) const averageWeeklyGexp = new Intl.NumberFormat("en-US").format( - averageWeeklyGexpUnformatted, + averageWeeklyGexpUnformatted ) const guildMemberJoinMS = guildMember!.joined @@ -176,12 +176,12 @@ export default async function guildMember( "`\n", color: embedColor, thumbnail: { - url: head!, + url: head! }, fields: [ { name: "**Daily GEXP**", - value: expValue, + value: expValue }, { name: "**Weekly GEXP**", @@ -191,18 +191,18 @@ export default async function guildMember( "`\n" + "**➺ Daily avarage:** `" + averageWeeklyGexp + - "`", + "`" }, { name: "**Join date**", - value: "**➺ **`" + guildMemberJoin + "`", - }, + value: "**➺ **`" + guildMemberJoin + "`" + } ], footer: { text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined, - }, - }, - ], + icon_url: interaction.guild!.iconURL() || undefined + } + } + ] }) } diff --git a/src/commands/guild/top.ts b/src/commands/guild/top.ts index 56a0dfb..33f2815 100644 --- a/src/commands/guild/top.ts +++ b/src/commands/guild/top.ts @@ -6,7 +6,7 @@ import Illegitimate from "utils/Illegitimate" const redis = Illegitimate.redis export default async function guildTop( - interaction: ChatInputCommandInteraction, + interaction: ChatInputCommandInteraction ): Promise { await interaction.deferReply() @@ -21,9 +21,9 @@ export default async function guildTop( embeds: [ { description: "You can't use this command in DMs!", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -33,9 +33,9 @@ export default async function guildTop( embeds: [ { description: "Fetching your uuid...", - color: embedColor, - }, - ], + color: embedColor + } + ] }) const uuid = await getUUID(query) @@ -44,9 +44,9 @@ export default async function guildTop( embeds: [ { description: "That player doen't exist!", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -55,9 +55,9 @@ export default async function guildTop( embeds: [ { description: "Fetching your player data...", - color: embedColor, - }, - ], + color: embedColor + } + ] }) const player = await getPlayer(uuid) @@ -66,9 +66,9 @@ export default async function guildTop( embeds: [ { description: "That player has never joined the server!", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -77,9 +77,9 @@ export default async function guildTop( embeds: [ { description: "Fetching your guild data...", - color: embedColor, - }, - ], + color: embedColor + } + ] }) guild = await getGuild(uuid, "player") @@ -88,9 +88,9 @@ export default async function guildTop( embeds: [ { description: "That player is not in a guild!", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -99,9 +99,9 @@ export default async function guildTop( embeds: [ { description: "Fetching your guild data...", - color: embedColor, - }, - ], + color: embedColor + } + ] }) guild = await getGuild(query, "name") @@ -110,9 +110,9 @@ export default async function guildTop( embeds: [ { description: "That guild doesn't exist!", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -121,9 +121,9 @@ export default async function guildTop( embeds: [ { description: "Fetching your guild data...", - color: embedColor, - }, - ], + color: embedColor + } + ] }) guild = await getGuild(query, "id") @@ -132,9 +132,9 @@ export default async function guildTop( embeds: [ { description: "That guild doesn't exist!", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -152,20 +152,20 @@ export default async function guildTop( }) .reduce((a, b) => a + b, 0) const gexpToday = new Intl.NumberFormat("en-US").format( - gexpTodayUnformatted, + gexpTodayUnformatted ) const averageGuildMemberGEXPUnformatted = Math.floor( - gexpTodayUnformatted / guildMembers.length, + gexpTodayUnformatted / guildMembers.length ) const averageGuildMemberGEXP = new Intl.NumberFormat("en-US").format( - averageGuildMemberGEXPUnformatted, + averageGuildMemberGEXPUnformatted ) const allMembersDailyGEXP = guildMembers.map(member => { return { uuid: member.uuid, - gexp: member.expHistory[Object.keys(member.expHistory)[0]], + gexp: member.expHistory[Object.keys(member.expHistory)[0]] } }) @@ -199,9 +199,9 @@ export default async function guildTop( " members of " + guildName + "...", - color: embedColor, - }, - ], + color: embedColor + } + ] }) for (let i = 0; i < allMembersSortedUUIDArray.length; i++) { @@ -210,7 +210,7 @@ export default async function guildTop( guildData.push({ ign: ign!, - uuid: uuid, + uuid: uuid }) } @@ -218,7 +218,7 @@ export default async function guildTop( "guildTop+" + guildId, JSON.stringify(guildData), "EX", - 60 * 30, + 60 * 30 ) } else { cacheStatus = true @@ -231,9 +231,9 @@ export default async function guildTop( " members of " + guildName + "using cache...", - color: embedColor, - }, - ], + color: embedColor + } + ] }) guildData = JSON.parse(cachedData) } @@ -244,7 +244,7 @@ export default async function guildTop( for (let i = 0; i < amount; i++) { const gexp = new Intl.NumberFormat("en-US").format(topMembers[i].gexp) const ign = guildData.find( - member => member.uuid === topMembers[i].uuid, + member => member.uuid === topMembers[i].uuid )?.ign const position = i + 1 @@ -253,7 +253,7 @@ export default async function guildTop( } const list = Array.from({ length: sliceSize }, (_, i) => - fieldsValueRaw.slice(i * sliceSize, (i + 1) * sliceSize), + fieldsValueRaw.slice(i * sliceSize, (i + 1) * sliceSize) ) const newList: NewList = [] @@ -263,7 +263,7 @@ export default async function guildTop( newList[index] = { name: "", value: item.join("\n"), - inline: false, + inline: false } }) @@ -288,9 +288,9 @@ export default async function guildTop( " | " + devMessage + cacheStatusText, - icon_url: interaction.guild!.iconURL() || undefined, - }, - }, - ], + icon_url: interaction.guild!.iconURL() || undefined + } + } + ] }) } diff --git a/src/commands/help.ts b/src/commands/help.ts index bacb1b5..eeb8c0f 100644 --- a/src/commands/help.ts +++ b/src/commands/help.ts @@ -24,7 +24,7 @@ export = { const commandRawList = client.commands.map(command => { return { name: command.name, - command: command, + command: command } }) @@ -34,22 +34,22 @@ export = { if (!command.command.subcommands && command.command.public) { commandList.push({ name: "**/" + commandName + "**", - value: "`" + command.command.description + "`", + value: "`" + command.command.description + "`" }) } else if (command.command.subcommands && command.command.public) { const subcommands = command.command.data.options.map( subcommand => { return { name: commandName + " " + subcommand.toJSON().name, - description: subcommand.toJSON().description, + description: subcommand.toJSON().description } - }, + } ) for (const subcommand of subcommands) { commandList.push({ name: "**/" + subcommand.name + "**", - value: "`" + subcommand.description + "`", + value: "`" + subcommand.description + "`" }) } } @@ -65,14 +65,14 @@ export = { fields: commandList, color: embedColor, thumbnail: { - url: interaction.guild!.iconURL() || "", + url: interaction.guild!.iconURL() || "" }, footer: { icon_url: interaction.guild!.iconURL() || undefined, - text: interaction.guild!.name + " | " + devMessage, - }, - }, - ], + text: interaction.guild!.name + " | " + devMessage + } + } + ] }) - }, + } } as Command diff --git a/src/commands/instructions.ts b/src/commands/instructions.ts index 7ecc3c6..ee02634 100644 --- a/src/commands/instructions.ts +++ b/src/commands/instructions.ts @@ -31,14 +31,14 @@ export = { color: embedColor, footer: { text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined, + icon_url: interaction.guild!.iconURL() || undefined }, image: { url: instructionsgif, - proxy_url: instructionsgif, - }, - }, - ], + proxy_url: instructionsgif + } + } + ] }) - }, + } } as Command diff --git a/src/commands/kick.ts b/src/commands/kick.ts index bf2c4fa..5055ad6 100644 --- a/src/commands/kick.ts +++ b/src/commands/kick.ts @@ -2,7 +2,7 @@ import { SlashCommandBuilder, PermissionFlagsBits, userMention, - GuildMember, + GuildMember } from "discord.js" import { admin, helper } from "config/roles.json" import { color, devMessage } from "config/options.json" @@ -22,12 +22,12 @@ export = { option .setName("member") .setDescription("Member to kick.") - .setRequired(true), + .setRequired(true) ) .addStringOption(option => option .setName("reason") - .setDescription("Reason for kicking the member."), + .setDescription("Reason for kicking the member.") ) .setDefaultMemberPermissions(PermissionFlagsBits.KickMembers) .setDMPermission(false), @@ -46,7 +46,7 @@ export = { if (!modRoles.includes(helper) && !modRoles.includes(admin)) { await interaction.editReply( - "You do not have permission to use this command.", + "You do not have permission to use this command." ) return } @@ -83,7 +83,7 @@ export = { { author: { name: mod.user.username, - icon_url: mod.user.avatarURL() || undefined, + icon_url: mod.user.avatarURL() || undefined }, title: "Member Kicked", description: ` @@ -93,15 +93,15 @@ export = { `, color: embedColor, thumbnail: { - url: mod.user.avatarURL() || "", + url: mod.user.avatarURL() || "" }, footer: { text: "ID: " + member.user.id, - icon_url: member.user.avatarURL() || undefined, + icon_url: member.user.avatarURL() || undefined }, - timestamp: new Date().toISOString(), - }, - ], + timestamp: new Date().toISOString() + } + ] }) await interaction.editReply({ @@ -119,14 +119,14 @@ export = { mod.user.username, color: embedColor, thumbnail: { - url: member.user.avatarURL() || "", + url: member.user.avatarURL() || "" }, footer: { icon_url: interaction.guild!.iconURL() || undefined, - text: interaction.guild!.name + " | " + devMessage, - }, - }, - ], + text: interaction.guild!.name + " | " + devMessage + } + } + ] }) - }, + } } as Command diff --git a/src/commands/ping.ts b/src/commands/ping.ts index b660850..9167783 100644 --- a/src/commands/ping.ts +++ b/src/commands/ping.ts @@ -25,11 +25,11 @@ export = { color: embedColor, footer: { text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild?.iconURL() || undefined, + icon_url: interaction.guild?.iconURL() || undefined }, - timestamp: new Date().toISOString(), - }, - ], + timestamp: new Date().toISOString() + } + ] }) - }, + } } as Command diff --git a/src/commands/pp.ts b/src/commands/pp.ts index 9b9acab..3eafb33 100644 --- a/src/commands/pp.ts +++ b/src/commands/pp.ts @@ -16,7 +16,7 @@ export = { option .setName("user") .setDescription("User to show pp size") - .setRequired(false), + .setRequired(false) ) .setDMPermission(false), @@ -37,9 +37,9 @@ export = { { title: `${user.username}'s pp size`, description: `8${"=".repeat(size)}D`, - color: embedColor, - }, - ], + color: embedColor + } + ] }) - }, + } } as Command diff --git a/src/commands/remove.ts b/src/commands/remove.ts index 9a1f3c8..d16ceeb 100644 --- a/src/commands/remove.ts +++ b/src/commands/remove.ts @@ -1,7 +1,7 @@ import { SlashCommandBuilder, PermissionFlagsBits, - userMention, + userMention } from "discord.js" import { color, devMessage } from "config/options.json" import waitinglistSchema from "schemas/waitinglistSchema" @@ -21,13 +21,13 @@ export = { option .setName("user") .setDescription("The user to remove.") - .setRequired(true), + .setRequired(true) ) .addStringOption(option => option .setName("reason") .setDescription("The reason for removing the user.") - .setRequired(false), + .setRequired(false) ) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDMPermission(false), @@ -50,9 +50,9 @@ export = { description: userMention(user.id) + " is not on the waiting list.", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -64,7 +64,7 @@ export = { { author: { name: mod.username, - icon_url: mod.avatarURL() || undefined, + icon_url: mod.avatarURL() || undefined }, title: "Waiting List - Remove User", description: ` @@ -74,15 +74,15 @@ export = { `, color: embedColor, thumbnail: { - url: mod.avatarURL() || "", + url: mod.avatarURL() || "" }, footer: { icon_url: user.avatarURL() || undefined, - text: "ID: " + user.id, + text: "ID: " + user.id }, - timestamp: new Date().toISOString(), - }, - ], + timestamp: new Date().toISOString() + } + ] }) await interaction.editReply({ @@ -99,10 +99,10 @@ export = { color: embedColor, footer: { text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined, - }, - }, - ], + icon_url: interaction.guild!.iconURL() || undefined + } + } + ] }) - }, + } } as Command diff --git a/src/commands/reqs.ts b/src/commands/reqs.ts index 600780a..3158279 100644 --- a/src/commands/reqs.ts +++ b/src/commands/reqs.ts @@ -7,7 +7,7 @@ import { swstars, swkdr, duelswins, - duelswlr, + duelswlr } from "config/reqs.json" import { Command } from "interfaces" @@ -33,7 +33,7 @@ export = { "**You must make 100k-150k weekly GEXP.\nAs well as onne of the game stats below**", color: embedColor, thumbnail: { - url: interaction.guild!.iconURL() || "", + url: interaction.guild!.iconURL() || "" }, fields: [ { @@ -45,7 +45,7 @@ export = { bwwins.toString() + "`\n**FKDR:** `" + bwfkdr.toString() + - "`", + "`" }, { name: "**Skywars**", @@ -54,7 +54,7 @@ export = { swstars.toString() + "`\n**KDR:** `" + swkdr.toString() + - "`", + "`" }, { name: "**Duels**", @@ -63,15 +63,15 @@ export = { duelswins.toString() + "`\n**WLR:** `" + duelswlr.toString() + - "`", - }, + "`" + } ], footer: { text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined, - }, - }, - ], + icon_url: interaction.guild!.iconURL() || undefined + } + } + ] }) - }, + } } as Command diff --git a/src/commands/send.ts b/src/commands/send.ts index 5e36d14..a6bde93 100644 --- a/src/commands/send.ts +++ b/src/commands/send.ts @@ -2,7 +2,7 @@ import { SlashCommandBuilder, PermissionFlagsBits, ChannelType, - TextChannel, + TextChannel } from "discord.js" import { color, devMessage } from "config/options.json" import { Command } from "interfaces" @@ -20,7 +20,7 @@ export = { option .setName("message") .setDescription("The message to send.") - .setRequired(true), + .setRequired(true) ) .addChannelOption(option => option @@ -28,8 +28,8 @@ export = { .setDescription("The channel to send the message to.") .addChannelTypes( ChannelType.GuildText, - ChannelType.GuildAnnouncement, - ), + ChannelType.GuildAnnouncement + ) ) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDMPermission(false), @@ -49,14 +49,14 @@ export = { description: message, color: embedColor, thumbnail: { - url: interaction.guild!.iconURL() || "", + url: interaction.guild!.iconURL() || "" }, footer: { text: interaction.guild!.id + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined, - }, - }, - ], + icon_url: interaction.guild!.iconURL() || undefined + } + } + ] }) await interaction.editReply({ @@ -66,10 +66,10 @@ export = { color: embedColor, footer: { text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined, - }, - }, - ], + icon_url: interaction.guild!.iconURL() || undefined + } + } + ] }) - }, + } } as Command diff --git a/src/commands/setnick.ts b/src/commands/setnick.ts index 839144c..30c7cec 100644 --- a/src/commands/setnick.ts +++ b/src/commands/setnick.ts @@ -2,7 +2,7 @@ import { SlashCommandBuilder, PermissionFlagsBits, userMention, - GuildMember, + GuildMember } from "discord.js" import { color, devMessage } from "config/options.json" import { Command } from "interfaces" @@ -21,13 +21,13 @@ export = { option .setName("user") .setDescription("The user to set the nickname for") - .setRequired(true), + .setRequired(true) ) .addStringOption(option => option .setName("nickname") .setDescription("The nickname to set") - .setRequired(true), + .setRequired(true) ) .setDefaultMemberPermissions(PermissionFlagsBits.ManageNicknames) .setDMPermission(false), @@ -40,7 +40,7 @@ export = { if (!member.manageable) { interaction.reply({ content: "I cannot set the nickname for this user!", - ephemeral: true, + ephemeral: true }) return } @@ -52,7 +52,7 @@ export = { { author: { name: interaction.user.username, - icon_url: interaction.user.avatarURL() || undefined, + icon_url: interaction.user.avatarURL() || undefined }, title: "Nickname", description: ` @@ -62,15 +62,15 @@ export = { `, color: embedColor, thumbnail: { - url: interaction.user.avatarURL() || "", + url: interaction.user.avatarURL() || "" }, footer: { text: "ID: " + member.user.id, - icon_url: member.user.avatarURL() || undefined, + icon_url: member.user.avatarURL() || undefined }, - timestamp: new Date().toISOString(), - }, - ], + timestamp: new Date().toISOString() + } + ] }) await interaction.reply({ @@ -80,11 +80,11 @@ export = { color: embedColor, footer: { text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined, - }, - }, + icon_url: interaction.guild!.iconURL() || undefined + } + } ], - ephemeral: true, + ephemeral: true }) - }, + } } as Command diff --git a/src/commands/setup.ts b/src/commands/setup.ts index d22412a..5c6ab17 100644 --- a/src/commands/setup.ts +++ b/src/commands/setup.ts @@ -5,7 +5,7 @@ import { ActionRowBuilder, ButtonStyle, ChannelType, - TextChannel, + TextChannel } from "discord.js" import { color, devMessage } from "config/options.json" import { Command } from "interfaces" @@ -28,14 +28,14 @@ export = { option .setName("channel") .setDescription( - "The channel to send the application to.", + "The channel to send the application to." ) .addChannelTypes( ChannelType.GuildText, - ChannelType.GuildAnnouncement, + ChannelType.GuildAnnouncement ) - .setRequired(true), - ), + .setRequired(true) + ) ) .addSubcommand(subcommand => subcommand @@ -45,14 +45,14 @@ export = { option .setName("channel") .setDescription( - "The channel to send the application to.", + "The channel to send the application to." ) .addChannelTypes( ChannelType.GuildText, - ChannelType.GuildAnnouncement, + ChannelType.GuildAnnouncement ) - .setRequired(true), - ), + .setRequired(true) + ) ) .addSubcommand(subcommand => subcommand @@ -62,14 +62,14 @@ export = { option .setName("channel") .setDescription( - "The channel to send the verfiy message to.", + "The channel to send the verfiy message to." ) .addChannelTypes( ChannelType.GuildText, - ChannelType.GuildAnnouncement, + ChannelType.GuildAnnouncement ) - .setRequired(true), - ), + .setRequired(true) + ) ) .addSubcommand(subcommand => subcommand @@ -79,14 +79,14 @@ export = { option .setName("channel") .setDescription( - "The channel to send the waiting list message to.", + "The channel to send the waiting list message to." ) .addChannelTypes( ChannelType.GuildText, - ChannelType.GuildAnnouncement, + ChannelType.GuildAnnouncement ) - .setRequired(true), - ), + .setRequired(true) + ) ) .addSubcommand(subcommand => subcommand @@ -96,14 +96,14 @@ export = { option .setName("channel") .setDescription( - "The channel to send the application to.", + "The channel to send the application to." ) .addChannelTypes( ChannelType.GuildText, - ChannelType.GuildAnnouncement, + ChannelType.GuildAnnouncement ) - .setRequired(true), - ), + .setRequired(true) + ) ) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDMPermission(false), @@ -168,13 +168,13 @@ export = { description: description, color: embedColor, thumbnail: { - url: interaction.guild!.iconURL() || "", + url: interaction.guild!.iconURL() || "" }, footer: { text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined, - }, - }, + icon_url: interaction.guild!.iconURL() || undefined + } + } ], components: [ new ActionRowBuilder().addComponents( @@ -182,14 +182,14 @@ export = { .setCustomId(customId) .setLabel(label) .setStyle(ButtonStyle.Primary) - .setEmoji({ name: emoji }), - ), - ], + .setEmoji({ name: emoji }) + ) + ] }) await interaction.reply({ content: "Message sent", - ephemeral: true, + ephemeral: true }) - }, + } } as Command diff --git a/src/commands/slowmode.ts b/src/commands/slowmode.ts index 78c1015..6c4571d 100644 --- a/src/commands/slowmode.ts +++ b/src/commands/slowmode.ts @@ -4,7 +4,7 @@ import { ChannelType, TextChannel, channelMention, - userMention, + userMention } from "discord.js" import { color, devMessage } from "config/options.json" import { Command } from "interfaces" @@ -22,9 +22,7 @@ export = { .addIntegerOption(option => option .setName("seconds") - .setDescription( - "The amount of seconds to set the slowmode to.", - ), + .setDescription("The amount of seconds to set the slowmode to.") ) .addChannelOption(option => option @@ -32,8 +30,8 @@ export = { .setDescription("The channel to set the slowmode of.") .addChannelTypes( ChannelType.GuildText, - ChannelType.GuildAnnouncement, - ), + ChannelType.GuildAnnouncement + ) ) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDMPermission(false), @@ -55,10 +53,10 @@ export = { color: embedColor, footer: { text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined, - }, - }, - ], + icon_url: interaction.guild!.iconURL() || undefined + } + } + ] }) return } @@ -68,7 +66,7 @@ export = { { author: { name: interaction.user.username, - icon_url: interaction.user.avatarURL() || undefined, + icon_url: interaction.user.avatarURL() || undefined }, title: "Slowmode Update", description: ` @@ -78,15 +76,15 @@ export = { `, color: embedColor, thumbnail: { - url: interaction.user.avatarURL() || "", + url: interaction.user.avatarURL() || "" }, footer: { icon_url: interaction.guild!.iconURL() || undefined, - text: " ID: " + channel.id, + text: " ID: " + channel.id }, - timestamp: new Date().toISOString(), - }, - ], + timestamp: new Date().toISOString() + } + ] }) await interaction.editReply({ @@ -96,11 +94,11 @@ export = { color: embedColor, footer: { text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined, - }, - }, - ], + icon_url: interaction.guild!.iconURL() || undefined + } + } + ] }) await channel.setRateLimitPerUser(seconds) - }, + } } as Command diff --git a/src/commands/snipe.ts b/src/commands/snipe.ts index aa55175..d0bcc40 100644 --- a/src/commands/snipe.ts +++ b/src/commands/snipe.ts @@ -17,7 +17,7 @@ export = { option .setName("user") .setDescription("The user to snipe") - .setRequired(true), + .setRequired(true) ) .setDMPermission(false), @@ -26,7 +26,7 @@ export = { const member = interaction.options.getMember("user") as GuildMember const snipeCache = await snipeCacheSchema.find({ userid: member.user.id, - channelid: interaction.channel!.id, + channelid: interaction.channel!.id }) const embedColor = Number(color.replace("#", "0x")) const messages: string[] = [] @@ -36,9 +36,9 @@ export = { embeds: [ { description: "No messages to snipe", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -51,7 +51,7 @@ export = { } else { messages.push(`**Message #${i}:** ${data.content}`) messages.push( - `**Attachments:** ${data.attachments.join(", ")}\n`, + `**Attachments:** ${data.attachments.join(", ")}\n` ) } i++ @@ -62,20 +62,20 @@ export = { { author: { name: member.user.username, - icon_url: member.user.avatarURL() || undefined, + icon_url: member.user.avatarURL() || undefined }, description: messages.join("\n"), thumbnail: { - url: member.user.avatarURL() || "", + url: member.user.avatarURL() || "" }, color: embedColor, footer: { text: "ID: " + member.user.id, - icon_url: interaction.guild!.iconURL() || undefined, + icon_url: interaction.guild!.iconURL() || undefined }, - timestamp: new Date().toISOString(), - }, - ], + timestamp: new Date().toISOString() + } + ] }) - }, + } } as Command diff --git a/src/commands/staff.ts b/src/commands/staff.ts index cabc336..c3fd7e1 100644 --- a/src/commands/staff.ts +++ b/src/commands/staff.ts @@ -18,7 +18,7 @@ export = { .addSubcommand(subcommand => subcommand .setName("help") - .setDescription("Get help with staff commands"), + .setDescription("Get help with staff commands") ) .addSubcommand(subcommand => subcommand @@ -28,15 +28,13 @@ export = { option .setName("ign") .setDescription("The IGN of the player.") - .setRequired(true), - ), + .setRequired(true) + ) ) .addSubcommand(subcommand => subcommand .setName("updatediscordroles") - .setDescription( - "Update the discord roles of all guild members", - ), + .setDescription("Update the discord roles of all guild members") ) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDMPermission(false), @@ -67,10 +65,10 @@ export = { color: embedColor, footer: { text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined, - }, - }, - ], + icon_url: interaction.guild!.iconURL() || undefined + } + } + ] }) - }, + } } as Command diff --git a/src/commands/staff/beast.ts b/src/commands/staff/beast.ts index 543a8d0..0bd4281 100644 --- a/src/commands/staff/beast.ts +++ b/src/commands/staff/beast.ts @@ -5,7 +5,7 @@ import { beastswkdr, beastswstars, beastduelswins, - duelswlr, + duelswlr } from "config/reqs.json" import { color, devMessage } from "config/options.json" import { @@ -15,12 +15,12 @@ import { getUUID, getPlayer, getGuild, - getHeadURL, + getHeadURL } from "utils/Hypixel" import { ChatInputCommandInteraction } from "discord.js" export default async function beast( - interaction: ChatInputCommandInteraction, + interaction: ChatInputCommandInteraction ): Promise { await interaction.deferReply() @@ -36,9 +36,9 @@ export default async function beast( embeds: [ { description: "Fetching your uuid...", - color: embedColor, - }, - ], + color: embedColor + } + ] }) const uuid = await getUUID(ign) @@ -47,9 +47,9 @@ export default async function beast( embeds: [ { description: "That player doesn't exist.", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -58,9 +58,9 @@ export default async function beast( embeds: [ { description: "Fetching your player data...", - color: embedColor, - }, - ], + color: embedColor + } + ] }) const head = await getHeadURL(ign) @@ -70,9 +70,9 @@ export default async function beast( embeds: [ { description: "That player hasn't played Hypixel before.", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -97,9 +97,9 @@ export default async function beast( embeds: [ { description: "Fetching your guild data...", - color: embedColor, - }, - ], + color: embedColor + } + ] }) const guild = await getGuild(uuid) @@ -124,7 +124,7 @@ export default async function beast( if (!player.stats) { statsFields.push({ name: " This player never played any games.", - value: "**➺ Stats:** `None`", + value: "**➺ Stats:** `None`" }) } else { if (player.stats.Bedwars) { @@ -165,12 +165,12 @@ export default async function beast( hsbwwins.toString() + " / " + bwwins.toString() + - "`", + "`" }) } else { statsFields.push({ name: " This player never played BedWars.", - value: "**➺ Stats:** `None`", + value: "**➺ Stats:** `None`" }) } @@ -206,12 +206,12 @@ export default async function beast( "`\n" + "**➺ Wins:** `" + hsswwins.toString() + - "`", + "`" }) } else { statsFields.push({ name: " This player never played SkyWars.", - value: "**➺ Stats:** `None`", + value: "**➺ Stats:** `None`" }) } @@ -247,12 +247,12 @@ export default async function beast( "`\n" + "**➺ KDR:** `" + hsduelskd.toFixed(2).toString() + - "`\n", + "`\n" }) } else { statsFields.push({ name: " This player never played Duels.", - value: "**➺ Stats:** `None`", + value: "**➺ Stats:** `None`" }) } } @@ -274,14 +274,14 @@ export default async function beast( "`", color: embedColor, thumbnail: { - url: head!, + url: head! }, footer: { text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined, + icon_url: interaction.guild!.iconURL() || undefined }, - fields: statsFields, - }, - ], + fields: statsFields + } + ] }) } diff --git a/src/commands/staff/help.ts b/src/commands/staff/help.ts index 52aa557..6779ea1 100644 --- a/src/commands/staff/help.ts +++ b/src/commands/staff/help.ts @@ -4,7 +4,7 @@ import { ExtendedClient as Client } from "utils/Client" export default async function help( interaction: ChatInputCommandInteraction, - client: Client, + client: Client ): Promise { await interaction.deferReply({ ephemeral: true }) @@ -16,7 +16,7 @@ export default async function help( const commandRawList = client.commands.map(command => { return { name: command.name, - command: command, + command: command } }) @@ -26,20 +26,20 @@ export default async function help( if (!command.command.subcommands && !command.command.public) { commandList.push({ name: "**/" + commandName + "**", - value: "`" + command.command.description + "`", + value: "`" + command.command.description + "`" }) } else if (command.command.subcommands && !command.command.public) { const subcommands = command.command.data.options.map(subcommand => { return { name: commandName + " " + subcommand.toJSON().name, - description: subcommand.toJSON().description, + description: subcommand.toJSON().description } }) for (const subcommand of subcommands) { commandList.push({ name: "**/" + subcommand.name + "**", - value: "`" + subcommand.description + "`", + value: "`" + subcommand.description + "`" }) } } @@ -55,13 +55,13 @@ export default async function help( fields: commandList, color: embedColor, thumbnail: { - url: interaction.guild!.iconURL() || "", + url: interaction.guild!.iconURL() || "" }, footer: { icon_url: interaction.guild!.iconURL() || undefined, - text: interaction.guild?.name + " | " + devMessage, - }, - }, - ], + text: interaction.guild?.name + " | " + devMessage + } + } + ] }) } diff --git a/src/commands/staff/updatediscordroles.ts b/src/commands/staff/updatediscordroles.ts index 362cff8..500e43b 100644 --- a/src/commands/staff/updatediscordroles.ts +++ b/src/commands/staff/updatediscordroles.ts @@ -7,7 +7,7 @@ import { getGuild } from "utils/Hypixel" import { GuildData } from "interfaces" export default async function updateDiscordRoles( - interaction: ChatInputCommandInteraction, + interaction: ChatInputCommandInteraction ): Promise { const discordMember = interaction.member as GuildMember const embedColor = Number(color.replace("#", "0x")) @@ -19,9 +19,9 @@ export default async function updateDiscordRoles( { description: "You do not have permission to use this command.", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -32,9 +32,9 @@ export default async function updateDiscordRoles( members.map(member => { return { id: member.id, - member: member, + member: member } - }), + }) ) const guildData = (await getGuild(hypixelGuildID, "id")) as GuildData @@ -42,7 +42,7 @@ export default async function updateDiscordRoles( const hypixelGuildMembers = guildData.members.map(gmember => { return { uuid: gmember.uuid, - rank: gmember.rank, + rank: gmember.rank } }) const guildMemberIDs = hypixelGuildMembers.map(gmember => gmember.uuid) @@ -54,7 +54,7 @@ export default async function updateDiscordRoles( const verifiedUsers = allVerifiedUsers.map(user => { return { userID: user.userID, - uuid: user.uuid, + uuid: user.uuid } }) @@ -62,21 +62,21 @@ export default async function updateDiscordRoles( embeds: [ { description: `Updating roles for ${guildMembers.length} members...`, - color: embedColor, - }, - ], + color: embedColor + } + ] }) for (const gmember of guildMembers) { const memberData = verifiedUsers.find( - user => user.userID === gmember.id, + user => user.userID === gmember.id ) if (!memberData) { const rolesToremove = roleManage("default").rolesToRemove await gmember.member.roles.remove( rolesToremove, - "Updating all discord members", + "Updating all discord members" ) continue } @@ -85,12 +85,12 @@ export default async function updateDiscordRoles( const rolesToremove = roleManage("default").rolesToRemove await gmember.member.roles.remove( rolesToremove, - "Updating all discord members", + "Updating all discord members" ) continue } else if (guildMemberIDs.includes(memberData!.uuid)) { const guildMemberRank = hypixelGuildMembers.find( - gmember => gmember.uuid === memberData!.uuid, + gmember => gmember.uuid === memberData!.uuid )!.rank console.log("Updating roles for " + gmember.member.user.username) @@ -103,11 +103,11 @@ export default async function updateDiscordRoles( const rolesmanage = roleManage("gm") gmember.member.roles.remove( rolesmanage.rolesToRemove, - "Updating all discord members", + "Updating all discord members" ) gmember.member.roles.add( rolesmanage.rolesToAdd, - "Updating all discord members", + "Updating all discord members" ) continue } else if (guildMemberRank === "Manager") { @@ -119,11 +119,11 @@ export default async function updateDiscordRoles( const rolesmanage = roleManage("manager") gmember.member.roles.remove( rolesmanage.rolesToRemove, - "Updating all discord members", + "Updating all discord members" ) gmember.member.roles.add( rolesmanage.rolesToAdd, - "Updating all discord members", + "Updating all discord members" ) continue } else if (guildMemberRank === "Moderator") { @@ -135,11 +135,11 @@ export default async function updateDiscordRoles( const rolesmanage = roleManage("moderator") gmember.member.roles.remove( rolesmanage.rolesToRemove, - "Updating all discord members", + "Updating all discord members" ) gmember.member.roles.add( rolesmanage.rolesToAdd, - "Updating all discord members", + "Updating all discord members" ) continue } else if (guildMemberRank === "Beast") { @@ -150,11 +150,11 @@ export default async function updateDiscordRoles( const rolesmanage = roleManage("beast") gmember.member.roles.remove( rolesmanage.rolesToRemove, - "Updating all discord members", + "Updating all discord members" ) gmember.member.roles.add( rolesmanage.rolesToAdd, - "Updating all discord members", + "Updating all discord members" ) continue } else if (guildMemberRank === "Elite") { @@ -165,11 +165,11 @@ export default async function updateDiscordRoles( const rolesmanage = roleManage("elite") gmember.member.roles.remove( rolesmanage.rolesToRemove, - "Updating all discord members", + "Updating all discord members" ) gmember.member.roles.add( rolesmanage.rolesToAdd, - "Updating all discord members", + "Updating all discord members" ) continue } else if (guildMemberRank === "Member") { @@ -180,11 +180,11 @@ export default async function updateDiscordRoles( const rolesmanage = roleManage("member") gmember.member.roles.remove( rolesmanage.rolesToRemove, - "Updating all discord members", + "Updating all discord members" ) gmember.member.roles.add( rolesmanage.rolesToAdd, - "Updating all discord members", + "Updating all discord members" ) continue } @@ -198,8 +198,8 @@ export default async function updateDiscordRoles( embeds: [ { description: "Successfully updated all roles.", - color: embedColor, - }, - ], + color: embedColor + } + ] }) } diff --git a/src/commands/timeout.ts b/src/commands/timeout.ts index ccad633..281e204 100644 --- a/src/commands/timeout.ts +++ b/src/commands/timeout.ts @@ -3,7 +3,7 @@ import { PermissionFlagsBits, userMention, ChatInputCommandInteraction, - GuildMember, + GuildMember } from "discord.js" import { color, devMessage } from "config/options.json" import { Command } from "interfaces" @@ -23,18 +23,18 @@ export = { option .setName("user") .setDescription("The user to timeout") - .setRequired(true), + .setRequired(true) ) .addStringOption(option => option .setName("time") .setDescription("The time to timeout the user for") - .setRequired(true), + .setRequired(true) ) .addStringOption(option => option .setName("reason") - .setDescription("The reason for the timeout"), + .setDescription("The reason for the timeout") ) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDMPermission(false), @@ -57,9 +57,9 @@ export = { embeds: [ { description: "You cannot timeout a bot.", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -69,9 +69,9 @@ export = { embeds: [ { description: "You cannot timeout the server owner.", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -85,9 +85,9 @@ export = { { description: "I cannot timeout this user because their role is higher than mine.", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -98,9 +98,9 @@ export = { { description: "You cannot timeout this user because their role is higher than yours.", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -110,9 +110,9 @@ export = { embeds: [ { description: "You cannot timeout yourself.", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -159,7 +159,7 @@ export = { { author: { name: mod.user.username, - icon_url: mod.user.avatarURL() || undefined, + icon_url: mod.user.avatarURL() || undefined }, title: title, description: ` @@ -170,15 +170,15 @@ export = { `, color: embedColor, thumbnail: { - url: mod.user.avatarURL() || "", + url: mod.user.avatarURL() || "" }, footer: { text: "ID: " + target.id, - icon_url: target.user.avatarURL() || undefined, + icon_url: target.user.avatarURL() || undefined }, - timestamp: new Date().toISOString(), - }, - ], + timestamp: new Date().toISOString() + } + ] }) await interaction.editReply({ @@ -188,10 +188,10 @@ export = { color: embedColor, footer: { text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined, - }, - }, - ], + icon_url: interaction.guild!.iconURL() || undefined + } + } + ] }) - }, + } } as Command diff --git a/src/commands/unban.ts b/src/commands/unban.ts index ef567db..08b4cbc 100644 --- a/src/commands/unban.ts +++ b/src/commands/unban.ts @@ -2,7 +2,7 @@ import { SlashCommandBuilder, PermissionFlagsBits, userMention, - User, + User } from "discord.js" import { color, devMessage } from "config/options.json" import { Command } from "interfaces" @@ -22,13 +22,13 @@ export = { .setName("user") .setDescription("The user to unban") .setAutocomplete(true) - .setRequired(true), + .setRequired(true) ) .addStringOption(option => option .setName("reason") .setDescription("The reason for unbanning the user") - .setRequired(false), + .setRequired(false) ) .setDefaultMemberPermissions(PermissionFlagsBits.BanMembers) .setDMPermission(false), @@ -48,9 +48,9 @@ export = { embeds: [ { description: "You haven't specified a user to unban", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -62,9 +62,9 @@ export = { embeds: [ { description: "The user you specified is not valid", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -76,7 +76,7 @@ export = { { author: { name: mod.username, - icon_url: mod.avatarURL() || undefined, + icon_url: mod.avatarURL() || undefined }, title: "Member Unbanned", description: ` @@ -86,15 +86,15 @@ export = { `, color: embedColor, thumbnail: { - url: mod.avatarURL() || "", + url: mod.avatarURL() || "" }, footer: { text: "ID: " + user!.id, - icon_url: user.avatarURL() || undefined, + icon_url: user.avatarURL() || undefined }, - timestamp: new Date().toISOString(), - }, - ], + timestamp: new Date().toISOString() + } + ] }) await interaction.editReply({ @@ -112,14 +112,14 @@ export = { userMention(mod.id), color: embedColor, thumbnail: { - url: user!.avatarURL() || "", + url: user!.avatarURL() || "" }, footer: { icon_url: interaction.guild!.iconURL() || undefined, - text: interaction.guild!.name + " | " + devMessage, - }, - }, - ], + text: interaction.guild!.name + " | " + devMessage + } + } + ] }) - }, + } } as Command diff --git a/src/commands/update.ts b/src/commands/update.ts index 11da935..4592219 100644 --- a/src/commands/update.ts +++ b/src/commands/update.ts @@ -32,10 +32,10 @@ export = { color: embedColor, footer: { text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined, - }, - }, - ], + icon_url: interaction.guild!.iconURL() || undefined + } + } + ] }) return } @@ -44,9 +44,9 @@ export = { embeds: [ { description: "Fetching your guild data...", - color: embedColor, - }, - ], + color: embedColor + } + ] }) const guild = await getGuild(verifyData.uuid) @@ -63,11 +63,11 @@ export = { const roles = roleManage("default") await user.roles.remove( roles.rolesToRemove, - "User used the update command", + "User used the update command" ) await user.roles.add( roles.rolesToAdd, - "User used the update command", + "User used the update command" ) await interaction.editReply({ @@ -76,14 +76,14 @@ export = { description: "Updated your roles to `Default Member`", color: embedColor, thumbnail: { - url: head!, + url: head! }, footer: { text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined, - }, - }, - ], + icon_url: interaction.guild!.iconURL() || undefined + } + } + ] }) return } @@ -91,24 +91,24 @@ export = { if (guildID === hypixelGuildID) { const GuildMembers = guild!.members const guildRank = GuildMembers.find( - member => member.uuid === verifyData.uuid, + member => member.uuid === verifyData.uuid )!.rank let replyRank: string | null = null await user.roles.add( roleManage("default").rolesToAdd, - "User used the update command", + "User used the update command" ) if (guildRank === "Guild Master") { const roles = roleManage("gm") await user.roles.remove( roles.rolesToRemove, - "User used the update command", + "User used the update command" ) await user.roles.add( roles.rolesToAdd, - "User used the update command", + "User used the update command" ) replyRank = "Guild Master" } @@ -117,11 +117,11 @@ export = { const roles = roleManage("manager") await user.roles.remove( roles.rolesToRemove, - "User used the update command", + "User used the update command" ) await user.roles.add( roles.rolesToAdd, - "User used the update command", + "User used the update command" ) replyRank = "Manager" } @@ -130,11 +130,11 @@ export = { const roles = roleManage("moderator") await user.roles.remove( roles.rolesToRemove, - "User used the update command", + "User used the update command" ) await user.roles.add( roles.rolesToAdd, - "User used the update command", + "User used the update command" ) replyRank = "Moderator" } @@ -143,11 +143,11 @@ export = { const roles = roleManage("beast") await user.roles.remove( roles.rolesToRemove, - "User used the update command", + "User used the update command" ) await user.roles.add( roles.rolesToAdd, - "User used the update command", + "User used the update command" ) replyRank = "Beast" } @@ -156,11 +156,11 @@ export = { const roles = roleManage("elite") await user.roles.remove( roles.rolesToRemove, - "User used the update command", + "User used the update command" ) await user.roles.add( roles.rolesToAdd, - "User used the update command", + "User used the update command" ) replyRank = "Elite" } @@ -169,11 +169,11 @@ export = { const roles = roleManage("member") await user.roles.remove( roles.rolesToRemove, - "User used the update command", + "User used the update command" ) await user.roles.add( roles.rolesToAdd, - "User used the update command", + "User used the update command" ) replyRank = "Member" } @@ -185,15 +185,15 @@ export = { "Updated your roles to `" + replyRank + "`", color: embedColor, thumbnail: { - url: head!, + url: head! }, footer: { text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined, - }, - }, - ], + icon_url: interaction.guild!.iconURL() || undefined + } + } + ] }) } - }, + } } as Command diff --git a/src/commands/uuid.ts b/src/commands/uuid.ts index edac880..d2880a2 100644 --- a/src/commands/uuid.ts +++ b/src/commands/uuid.ts @@ -16,7 +16,7 @@ export = { option .setName("ign") .setDescription("Player's name") - .setRequired(true), + .setRequired(true) ) .setDMPermission(false), @@ -35,9 +35,9 @@ export = { embeds: [ { description: "That player doesn't exist!", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -55,14 +55,14 @@ export = { "`", color: embedColor, thumbnail: { - url: head!, + url: head! }, footer: { text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined, - }, - }, - ], + icon_url: interaction.guild!.iconURL() || undefined + } + } + ] }) - }, + } } as Command diff --git a/src/commands/verify.ts b/src/commands/verify.ts index 761bed2..fcadc5f 100644 --- a/src/commands/verify.ts +++ b/src/commands/verify.ts @@ -21,7 +21,7 @@ export = { option .setName("ign") .setDescription("Your in-game name.") - .setRequired(true), + .setRequired(true) ) .setDMPermission(false), @@ -36,7 +36,7 @@ export = { if (verifyData) { interaction.editReply( "You are already verified.\n" + - "Try running /update to update your roles.", + "Try running /update to update your roles." ) return } @@ -47,9 +47,9 @@ export = { { description: " Please provide your in-game name.", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -58,9 +58,9 @@ export = { embeds: [ { description: "Fetching your uuid...", - color: embedColor, - }, - ], + color: embedColor + } + ] }) const uuid = await getUUID(ign) @@ -70,9 +70,9 @@ export = { { description: " That player does not exist.", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -81,9 +81,9 @@ export = { embeds: [ { description: "Fetching your player data...", - color: embedColor, - }, - ], + color: embedColor + } + ] }) const head = await getHeadURL(ign) @@ -94,9 +94,9 @@ export = { { description: " That player hasn't played Hypixel before.", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -112,9 +112,9 @@ export = { embeds: [ { description: "Checking your Discord tag...", - color: embedColor, - }, - ], + color: embedColor + } + ] }) const linkedDiscord = player?.socialMedia?.links?.DISCORD || null @@ -129,9 +129,9 @@ export = { "**Please set your Discord tag on hypixel to `" + username + "` and try again.**", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -149,9 +149,9 @@ export = { "**Please set your Discord tag on hypixel to `" + username + "` and try again.**", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -160,9 +160,9 @@ export = { embeds: [ { description: "Fetching your guild data...", - color: embedColor, - }, - ], + color: embedColor + } + ] }) const guild = (await getGuild(uuid)) as GuildData | null @@ -176,7 +176,7 @@ export = { if (guildID === hypixelGuildID) { const GuildMembers = guild!.members const guildRank = GuildMembers.find( - member => member.uuid === player.uuid, + member => member.uuid === player.uuid )!.rank if (guildRank === "Guild Master") { @@ -215,7 +215,7 @@ export = { const newVerify = new verify({ _id: new mongoose.Types.ObjectId(), userID: user.id, - uuid: uuid, + uuid: uuid }) await newVerify.save() @@ -232,14 +232,14 @@ export = { "`.", color: embedColor, thumbnail: { - url: head!, + url: head! }, footer: { icon_url: interaction.guild!.iconURL() || undefined, - text: interaction.guild!.name + " | " + devMessage, - }, - }, - ], + text: interaction.guild!.name + " | " + devMessage + } + } + ] }) - }, + } } as Command diff --git a/src/commands/whoami.ts b/src/commands/whoami.ts index c96c40d..0cf3a90 100644 --- a/src/commands/whoami.ts +++ b/src/commands/whoami.ts @@ -27,9 +27,9 @@ export = { embeds: [ { description: "You are not verified!", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -49,14 +49,14 @@ export = { "`", color: embedColor, thumbnail: { - url: head!, + url: head! }, footer: { text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined, - }, - }, - ], + icon_url: interaction.guild!.iconURL() || undefined + } + } + ] }) - }, + } } as Command diff --git a/src/commands/whois.ts b/src/commands/whois.ts index a540f70..e844944 100644 --- a/src/commands/whois.ts +++ b/src/commands/whois.ts @@ -1,7 +1,7 @@ import { SlashCommandBuilder, PermissionFlagsBits, - userMention, + userMention } from "discord.js" import { getIGN, getHeadURL } from "utils/Hypixel" import { color, devMessage } from "config/options.json" @@ -21,7 +21,7 @@ export = { option .setName("user") .setDescription("The user to get the ign of.") - .setRequired(true), + .setRequired(true) ) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDMPermission(false), @@ -35,7 +35,7 @@ export = { const verifiedUser = await verify.findOne({ userID: user.id }) if (!verifiedUser) { interaction.editReply({ - content: "This user has not verified their account.", + content: "This user has not verified their account." }) return } @@ -54,14 +54,14 @@ export = { ign, color: embedColor, thumbnail: { - url: head!, + url: head! }, footer: { text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined, - }, - }, - ], + icon_url: interaction.guild!.iconURL() || undefined + } + } + ] }) - }, + } } as Command diff --git a/src/components/autocomplete/unban.ts b/src/components/autocomplete/unban.ts index a4dc180..8597051 100644 --- a/src/components/autocomplete/unban.ts +++ b/src/components/autocomplete/unban.ts @@ -12,8 +12,8 @@ export = { await interaction.respond([ { name: "Please start typing a username to unban", - value: "none", - }, + value: "none" + } ]) return } @@ -22,16 +22,16 @@ export = { const filteredUsers = bannedUsers.filter(user => user.user.username .toLowerCase() - .includes(focusedOption.value.toLowerCase()), + .includes(focusedOption.value.toLowerCase()) ) const results = filteredUsers.map(user => ({ name: user.user.username, - value: user.user.id, + value: user.user.id })) await interaction.respond(results.slice(0, 25)).catch(err => { console.log(err) }) - }, + } } as Autocomplete diff --git a/src/components/buttons/checkstats.ts b/src/components/buttons/checkstats.ts index d297312..c8d2708 100644 --- a/src/components/buttons/checkstats.ts +++ b/src/components/buttons/checkstats.ts @@ -7,7 +7,7 @@ import { swstars, swkdr, duelswins, - duelswlr, + duelswlr } from "config/reqs.json" import { hypixelLevel, @@ -15,7 +15,7 @@ import { skywarsLevel, getPlayer, getGuild, - getHeadURL, + getHeadURL } from "utils/Hypixel" import { Button } from "interfaces" @@ -40,9 +40,9 @@ export = { { description: "That player hasn't played Hypixel before.", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -93,7 +93,7 @@ export = { if (!player.stats) { statsFields.push({ name: " This player never played any games.", - value: "**➺ Stats:** `None`", + value: "**➺ Stats:** `None`" }) } else { if (player.stats.Bedwars) { @@ -134,7 +134,7 @@ export = { hsbwwins.toString() + " / " + bwwins.toString() + - "`", + "`" }) } @@ -170,7 +170,7 @@ export = { "`\n" + "**➺ Wins:** `" + hsswwins.toString() + - "`", + "`" }) } @@ -206,7 +206,7 @@ export = { "`\n" + "**➺ KDR:** `" + hsduelskd.toFixed(2).toString() + - "`", + "`" }) } } @@ -231,15 +231,15 @@ export = { "`", color: embedColor, thumbnail: { - url: head!, + url: head! }, footer: { text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined, + icon_url: interaction.guild!.iconURL() || undefined }, - fields: statsFields, - }, - ], + fields: statsFields + } + ] }) - }, + } } as Button diff --git a/src/components/buttons/guildapplicationaccept.ts b/src/components/buttons/guildapplicationaccept.ts index 1f0cbb0..42cad9e 100644 --- a/src/components/buttons/guildapplicationaccept.ts +++ b/src/components/buttons/guildapplicationaccept.ts @@ -2,13 +2,13 @@ import { ActionRowBuilder, ButtonStyle, ButtonBuilder, - TextChannel, + TextChannel } from "discord.js" import { color, waitingListChannel, waitingListMessage, - hypixelGuildID, + hypixelGuildID } from "config/options.json" import colorLog from "utils/functions/colors" import mongoose from "mongoose" @@ -55,9 +55,9 @@ export = { .setCustomId("checkstats") .setLabel("Check Stats") .setStyle(ButtonStyle.Secondary) - .setDisabled(true), - ), - ], + .setDisabled(true) + ) + ] }) await applicant.send({ @@ -66,9 +66,9 @@ export = { description: "Your application for the Illegitimate guild has been accepted.\n\n" + "Make sure to leave your current guild so that we can invite you.", - color: embedColor, - }, - ], + color: embedColor + } + ] }) const applicantEntry = await guildapp.findOne({ userID: applicantId }) @@ -80,7 +80,7 @@ export = { userID: applicantId, uuid: applicantUUID, IGN: applicantIGN, - timestamp: time, + timestamp: time }) await waitingListAdd.save() @@ -96,20 +96,20 @@ export = { "Application has been accepted by <@" + user.id + ">.", color: embedColor, thumbnail: { - url: applicant.avatarURL() || "", + url: applicant.avatarURL() || "" }, footer: { icon_url: guild.iconURL() || undefined, - text: "ID: " + applicant.id, - }, - }, - ], + text: "ID: " + applicant.id + } + } + ] }) if (process.env.NODE_ENV === "dev") return try { const channel = guild.channels.cache.get( - waitingListChannel, + waitingListChannel ) as TextChannel const wlmessage = await channel!.messages.fetch(waitingListMessage) @@ -133,7 +133,7 @@ export = { fields.push({ name: `${i + 1}. ${accepted[i].IGN}`, - value: `TS: `, + value: `TS: ` }) } @@ -145,18 +145,18 @@ export = { color: wlembed.color!, footer: { text: "Last updated by " + user.username, - icon_url: user.avatarURL() || undefined, + icon_url: user.avatarURL() || undefined }, thumbnail: wlembed.thumbnail!, fields: fields, - timestamp: new Date().toISOString(), - }, - ], + timestamp: new Date().toISOString() + } + ] }) } catch (err) { console.log( - colorLog("Error while trying to update waiting list.", "red"), + colorLog("Error while trying to update waiting list.", "red") ) } - }, + } } as Button diff --git a/src/components/buttons/guildapplicationdeny.ts b/src/components/buttons/guildapplicationdeny.ts index 9a1b453..5cc6ab4 100644 --- a/src/components/buttons/guildapplicationdeny.ts +++ b/src/components/buttons/guildapplicationdeny.ts @@ -2,7 +2,7 @@ import { ModalBuilder, ActionRowBuilder, TextInputBuilder, - TextInputStyle, + TextInputStyle } from "discord.js" import { Button } from "interfaces" @@ -21,11 +21,11 @@ export = { .setCustomId("denyreason") .setStyle(TextInputStyle.Paragraph) .setPlaceholder( - "Enter a reason for denying the application", + "Enter a reason for denying the application" ) - .setRequired(false), - ), + .setRequired(false) + ) ) await interaction.showModal(modal) - }, + } } as Button diff --git a/src/components/buttons/guildapply.ts b/src/components/buttons/guildapply.ts index c1a0833..7a26084 100644 --- a/src/components/buttons/guildapply.ts +++ b/src/components/buttons/guildapply.ts @@ -4,7 +4,7 @@ import { ActionRowBuilder, EmbedBuilder, GuildMember, - TextChannel, + TextChannel } from "discord.js" import { color } from "config/options.json" import { largeM, smallM, ignM } from "config/limitmessages.json" @@ -40,7 +40,7 @@ export = { if (userRoles.includes(guildRole)) { await interaction.editReply( - "You are already a member of the guild.", + "You are already a member of the guild." ) return } @@ -49,7 +49,7 @@ export = { if (application) { await interaction.editReply( - "You already have an application in progress.", + "You already have an application in progress." ) return } @@ -62,7 +62,7 @@ export = { .setColor(embedColor) const attachments = new EmbedBuilder() .setDescription( - "You have uploaded an attachment. Please do not upload images, videos, or GIFS.", + "You have uploaded an attachment. Please do not upload images, videos, or GIFS." ) .setColor(embedColor) @@ -75,9 +75,9 @@ export = { "If you wish to proceed with your application, please type `yes` otherwise type `cancel`.\n\n" + "**Do not upload images, videos, or GIFS.**\n" + "You have a minute to respond to this message.", - color: embedColor, - }, - ], + color: embedColor + } + ] }) } catch (error) { await interaction.editReply("Please enable your DMs.") @@ -89,7 +89,7 @@ export = { const input = await user.dmChannel!.awaitMessages({ filter: m => m.author.id === user.user.id, max: 1, - time: 1000 * 60, + time: 1000 * 60 }) if (input.size === 0) { await user.send({ embeds: [tooLong] }) @@ -116,15 +116,15 @@ export = { "`", color: embedColor, footer: { - text: "You have 5 minutes to respond to this message.", - }, - }, - ], + text: "You have 5 minutes to respond to this message." + } + } + ] }) const answer1 = await user.dmChannel!.awaitMessages({ filter: m => m.author.id === user.user.id, max: 1, - time: 1000 * 60 * 5, + time: 1000 * 60 * 5 }) if (answer1.size === 0) { await user.send({ embeds: [tooLong] }) @@ -143,9 +143,9 @@ export = { embeds: [ { description: "Max character limit is 16.", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -157,9 +157,9 @@ export = { description: "That is not a valid Minecraft username.\n" + "Application cancelled.", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -176,15 +176,15 @@ export = { "`(8 characters max)`", color: embedColor, footer: { - text: "You have 15 minutes to respond to this message.", - }, - }, - ], + text: "You have 15 minutes to respond to this message." + } + } + ] }) const answer2 = await user.dmChannel!.awaitMessages({ filter: m => m.author.id === user.user.id, max: 1, - time: 1000 * 60 * 15, + time: 1000 * 60 * 15 }) if (answer2.size === 0) { await user.send({ embeds: [tooLong] }) @@ -203,9 +203,9 @@ export = { embeds: [ { description: "Max character limit is 8.", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -223,15 +223,15 @@ export = { "`", color: embedColor, footer: { - text: "You have 15 minutes to respond to this message.", - }, - }, - ], + text: "You have 15 minutes to respond to this message." + } + } + ] }) const answer3 = await user.dmChannel!.awaitMessages({ filter: m => m.author.id === user.user.id, max: 1, - time: 1000 * 60 * 15, + time: 1000 * 60 * 15 }) if (answer3.size === 0) { await user.send({ embeds: [tooLong] }) @@ -250,9 +250,9 @@ export = { embeds: [ { description: "Max character limit is 128.", - color: embedColor, - }, - ], + color: embedColor + } + ] }) } const answer3_1 = answer3.first()!.content @@ -270,15 +270,15 @@ export = { "`", color: embedColor, footer: { - text: "You have 15 minutes to respond to this message.", - }, - }, - ], + text: "You have 15 minutes to respond to this message." + } + } + ] }) const answer4 = await user.dmChannel!.awaitMessages({ filter: m => m.author.id === user.user.id, max: 1, - time: 1000 * 60 * 15, + time: 1000 * 60 * 15 }) if (answer4.size === 0) { await user.send({ embeds: [tooLong] }) @@ -297,9 +297,9 @@ export = { embeds: [ { description: "Max character limit is 256.", - color: embedColor, - }, - ], + color: embedColor + } + ] }) } const answer4_1 = answer4.first()!.content @@ -316,15 +316,15 @@ export = { "`", color: embedColor, footer: { - text: "You have 15 minutes to respond to this message.", - }, - }, - ], + text: "You have 15 minutes to respond to this message." + } + } + ] }) const answer5 = await user.dmChannel!.awaitMessages({ filter: m => m.author.id === user.user.id, max: 1, - time: 1000 * 60 * 15, + time: 1000 * 60 * 15 }) if (answer5.size === 0) { await user.send({ embeds: [tooLong] }) @@ -343,9 +343,9 @@ export = { embeds: [ { description: "Max character limit is 128.", - color: embedColor, - }, - ], + color: embedColor + } + ] }) } const answer5_1 = answer5.first()!.content @@ -362,15 +362,15 @@ export = { "`", color: embedColor, footer: { - text: "You have 15 minutes to respond to this message.", - }, - }, - ], + text: "You have 15 minutes to respond to this message." + } + } + ] }) const answer6 = await user.dmChannel!.awaitMessages({ filter: m => m.author.id === user.user.id, max: 1, - time: 1000 * 60 * 15, + time: 1000 * 60 * 15 }) if (answer6.size === 0) { await user.send({ embeds: [tooLong] }) @@ -389,9 +389,9 @@ export = { embeds: [ { description: "Max character limit is 256.", - color: embedColor, - }, - ], + color: embedColor + } + ] }) } const answer6_1 = answer6.first()!.content @@ -408,15 +408,15 @@ export = { "`", color: embedColor, footer: { - text: "You have 15 minutes to respond to this message.", - }, - }, - ], + text: "You have 15 minutes to respond to this message." + } + } + ] }) const answer7 = await user.dmChannel!.awaitMessages({ filter: m => m.author.id === user.user.id, max: 1, - time: 1000 * 60 * 15, + time: 1000 * 60 * 15 }) if (answer7.size === 0) { await user.send({ embeds: [tooLong] }) @@ -435,9 +435,9 @@ export = { embeds: [ { description: "Max character limit is 128.", - color: embedColor, - }, - ], + color: embedColor + } + ] }) } const answer7_1 = answer7!.first()!.content @@ -453,15 +453,15 @@ export = { "`(64 characters max)`", color: embedColor, footer: { - text: "You have 15 minutes to respond to this message.", - }, - }, - ], + text: "You have 15 minutes to respond to this message." + } + } + ] }) const answer8 = await user.dmChannel!.awaitMessages({ filter: m => m.author.id === user.user.id, max: 1, - time: 1000 * 60 * 15, + time: 1000 * 60 * 15 }) if (answer8.size === 0) { await user.send({ embeds: [tooLong] }) @@ -480,9 +480,9 @@ export = { embeds: [ { description: "Max character limit is 64.", - color: embedColor, - }, - ], + color: embedColor + } + ] }) } const answer8_1 = answer8.first()!.content @@ -492,15 +492,15 @@ export = { { description: "If you want to submit your application, type `yes` if not, type `no`", - color: embedColor, - }, - ], + color: embedColor + } + ] }) const final = await user.dmChannel!.awaitMessages({ filter: m => m.author.id === user.user.id, max: 1, - time: 1000 * 60 * 5, + time: 1000 * 60 * 5 }) if (final.size === 0) { await user.send({ embeds: [tooLong] }) @@ -519,21 +519,21 @@ export = { embeds: [ { description: "Your application has been submitted!", - color: embedColor, - }, - ], + color: embedColor + } + ] }) const newGuildApp = new guildapp({ _id: new mongoose.Types.ObjectId(), userID: user.user.id, - uuid: uuid, + uuid: uuid }) await newGuildApp.save() const channel = guild.channels.cache.get( - applicationsChannel, + applicationsChannel ) as TextChannel await channel.send({ embeds: [ @@ -545,47 +545,47 @@ export = { " - Guild Application", color: embedColor, thumbnail: { - url: user.avatarURL() || "", + url: user.avatarURL() || "" }, fields: [ { name: rq(1), - value: "```" + answer1_1 + "```", + value: "```" + answer1_1 + "```" }, { name: rq(2), - value: "```" + answer2_1 + "```", + value: "```" + answer2_1 + "```" }, { name: rq(3), - value: "```" + answer3_1 + "```", + value: "```" + answer3_1 + "```" }, { name: rq(4), - value: "```" + answer4_1 + "```", + value: "```" + answer4_1 + "```" }, { name: rq(5), - value: "```" + answer5_1 + "```", + value: "```" + answer5_1 + "```" }, { name: rq(6), - value: "```" + answer6_1 + "```", + value: "```" + answer6_1 + "```" }, { name: rq(7), - value: "```" + answer7_1 + "```", + value: "```" + answer7_1 + "```" }, { name: rq(8), - value: "```" + answer8_1 + "```", - }, + value: "```" + answer8_1 + "```" + } ], footer: { icon_url: guild.iconURL() || "", - text: "ID: " + user.user.id, - }, - }, + text: "ID: " + user.user.id + } + } ], components: [ new ActionRowBuilder().addComponents( @@ -600,10 +600,10 @@ export = { new ButtonBuilder() .setCustomId("checkstats") .setLabel("Check Stats") - .setStyle(ButtonStyle.Secondary), - ), - ], + .setStyle(ButtonStyle.Secondary) + ) + ] }) } - }, + } } as Button diff --git a/src/components/buttons/guildinactivitylog.ts b/src/components/buttons/guildinactivitylog.ts index 2fb873a..7b26869 100644 --- a/src/components/buttons/guildinactivitylog.ts +++ b/src/components/buttons/guildinactivitylog.ts @@ -4,7 +4,7 @@ import { ButtonStyle, EmbedBuilder, GuildMember, - TextChannel, + TextChannel } from "discord.js" import { gm, @@ -13,7 +13,7 @@ import { beast, member, guildStaff, - guildRole, + guildRole } from "config/roles.json" import { ignM, smallM, largeM } from "config/limitmessages.json" import { inactivity } from "config/questions.json" @@ -26,7 +26,7 @@ const guildRoles = [ beast, member, guildStaff, - guildRole, + guildRole ] module.exports = { @@ -43,7 +43,7 @@ module.exports = { if (!userRoles.some(role => guildRoles.includes(role.id))) { return await interaction.reply({ content: "Only guild members can use this button.", - ephemeral: true, + ephemeral: true }) } @@ -63,7 +63,7 @@ module.exports = { .setColor(embedColor) const attachments = new EmbedBuilder() .setDescription( - "You have uploaded an attachment. Please do not upload images, videos, or GIFS.", + "You have uploaded an attachment. Please do not upload images, videos, or GIFS." ) .setColor(embedColor) @@ -78,26 +78,26 @@ module.exports = { "If you wish to proceed with your form, please type `yes`.\n\n" + "**Do not upload images, videos, or GIFS.**\n" + "You have a minute to respond to this message.", - color: embedColor, - }, - ], + color: embedColor + } + ] }) } catch (error) { return await interaction.reply({ content: "Please enable your DMs.", - ephemeral: true, + ephemeral: true }) } await interaction.reply({ content: "Please check your DMs.", - ephemeral: true, + ephemeral: true }) const input = await user.dmChannel!.awaitMessages({ filter: m => m.author.id === user.user.id, max: 1, - time: 1000 * 60, + time: 1000 * 60 }) if (input.first()!.attachments.size > 0) { await user.send({ embeds: [attachments] }) @@ -123,16 +123,16 @@ module.exports = { "`", color: embedColor, footer: { - text: "You have 5 minutes to respond to this message.", - }, - }, - ], + text: "You have 5 minutes to respond to this message." + } + } + ] }) const answer1 = await user.dmChannel!.awaitMessages({ filter: m => m.author.id === user.user.id, max: 1, - time: 1000 * 60 * 5, + time: 1000 * 60 * 5 }) if (answer1.first()!.attachments.size > 0) { await user.send({ embeds: [attachments] }) @@ -143,9 +143,9 @@ module.exports = { embeds: [ { description: "Max character limit is 16.", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -158,9 +158,9 @@ module.exports = { description: "That is not a valid Minecraft username.\n" + "Application cancelled.", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -185,15 +185,15 @@ module.exports = { "`", color: embedColor, footer: { - text: "You have 5 minutes to respond to this message.", - }, - }, - ], + text: "You have 5 minutes to respond to this message." + } + } + ] }) const answer2 = await user.dmChannel!.awaitMessages({ filter: m => m.author.id === user.user.id, max: 1, - time: 1000 * 60 * 5, + time: 1000 * 60 * 5 }) if (answer2.first()!.attachments.size > 0) { await user.send({ embeds: [attachments] }) @@ -204,9 +204,9 @@ module.exports = { embeds: [ { description: "Max character limit is 128.", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -231,15 +231,15 @@ module.exports = { "`", color: embedColor, footer: { - text: "You have 15 minutes to respond to this message.", - }, - }, - ], + text: "You have 15 minutes to respond to this message." + } + } + ] }) const answer3 = await user.dmChannel!.awaitMessages({ filter: m => m.author.id === user.user.id, max: 1, - time: 1000 * 60 * 15, + time: 1000 * 60 * 15 }) if (answer3.first()!.attachments.size > 0) { await user.send({ embeds: [attachments] }) @@ -250,9 +250,9 @@ module.exports = { embeds: [ { description: "Max character limit is 256", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -271,14 +271,14 @@ module.exports = { { description: "If you want to submit your application, type `yes` if not, type `no`", - color: embedColor, - }, - ], + color: embedColor + } + ] }) const final = await user.dmChannel!.awaitMessages({ filter: m => m.author.id === user.user.id, max: 1, - time: 1000 * 60 * 5, + time: 1000 * 60 * 5 }) if (final.first()!.attachments.size > 0) { await user.send({ embeds: [attachments] }) @@ -297,13 +297,13 @@ module.exports = { embeds: [ { description: "Your application has been submitted!", - color: embedColor, - }, - ], + color: embedColor + } + ] }) const appChannel = guild.channels.cache.get( - inactivityLogChannel, + inactivityLogChannel ) as TextChannel await appChannel.send({ @@ -316,27 +316,27 @@ module.exports = { " - Inactivity Application", color: embedColor, thumbnail: { - url: user.avatarURL() || "", + url: user.avatarURL() || "" }, fields: [ { name: rq(1), - value: "`" + answer1_1 + "`", + value: "`" + answer1_1 + "`" }, { name: rq(2), - value: "`" + answer2_1 + "`", + value: "`" + answer2_1 + "`" }, { name: rq(3), - value: "`" + answer3_1 + "`", - }, + value: "`" + answer3_1 + "`" + } ], footer: { icon_url: user.avatarURL() || undefined, - text: "ID: " + user.user.id, - }, - }, + text: "ID: " + user.user.id + } + } ], components: [ new ActionRowBuilder().addComponents( @@ -347,9 +347,9 @@ module.exports = { new ButtonBuilder() .setCustomId("inactiveapplicationdeny") .setLabel("Deny") - .setStyle(ButtonStyle.Danger), - ), - ], + .setStyle(ButtonStyle.Danger) + ) + ] }) - }, + } } as Button diff --git a/src/components/buttons/inactiveapplicationaccept.ts b/src/components/buttons/inactiveapplicationaccept.ts index f644b52..adb5138 100644 --- a/src/components/buttons/inactiveapplicationaccept.ts +++ b/src/components/buttons/inactiveapplicationaccept.ts @@ -7,7 +7,7 @@ export = { async execute(interaction) { await interaction.reply({ content: "This button is currently disabled.", - ephemeral: true, + ephemeral: true }) - }, + } } as Button diff --git a/src/components/buttons/inactiveapplicationdeny.ts b/src/components/buttons/inactiveapplicationdeny.ts index b3f184f..d48cfe4 100644 --- a/src/components/buttons/inactiveapplicationdeny.ts +++ b/src/components/buttons/inactiveapplicationdeny.ts @@ -7,7 +7,7 @@ export = { async execute(interaction) { await interaction.reply({ content: "This button is currently disabled.", - ephemeral: true, + ephemeral: true }) - }, + } } as Button diff --git a/src/components/buttons/staffapplicationaccept.ts b/src/components/buttons/staffapplicationaccept.ts index 516e45d..84e8ea4 100644 --- a/src/components/buttons/staffapplicationaccept.ts +++ b/src/components/buttons/staffapplicationaccept.ts @@ -27,9 +27,9 @@ export = { { description: "Your application for the Illegitimate staff team has been accepted.", - color: embedColor, - }, - ], + color: embedColor + } + ] }) await message.edit({ @@ -44,9 +44,9 @@ export = { .setCustomId("staffapplicationdeny") .setLabel("Deny") .setStyle(ButtonStyle.Danger) - .setDisabled(true), - ), - ], + .setDisabled(true) + ) + ] }) await staffapp.findOneAndDelete({ userID: applicantId }) @@ -58,14 +58,14 @@ export = { description: "Application accepted by <@" + user.id + ">.", color: embedColor, thumbnail: { - url: applicant.avatarURL() || "", + url: applicant.avatarURL() || "" }, footer: { icon_url: guild.iconURL() || undefined, - text: "ID: " + applicantId, - }, - }, - ], + text: "ID: " + applicantId + } + } + ] }) - }, + } } as Button diff --git a/src/components/buttons/staffapplicationdeny.ts b/src/components/buttons/staffapplicationdeny.ts index 5a00433..13d6275 100644 --- a/src/components/buttons/staffapplicationdeny.ts +++ b/src/components/buttons/staffapplicationdeny.ts @@ -2,7 +2,7 @@ import { ModalBuilder, ActionRowBuilder, TextInputBuilder, - TextInputStyle, + TextInputStyle } from "discord.js" import { Button } from "interfaces" @@ -21,11 +21,11 @@ export = { .setCustomId("staffdenyreason") .setStyle(TextInputStyle.Paragraph) .setPlaceholder( - "Enter a reason for denying the application", + "Enter a reason for denying the application" ) - .setRequired(false), - ), + .setRequired(false) + ) ) await interaction.showModal(modal) - }, + } } as Button diff --git a/src/components/buttons/staffapply.ts b/src/components/buttons/staffapply.ts index be57166..b7d5237 100644 --- a/src/components/buttons/staffapply.ts +++ b/src/components/buttons/staffapply.ts @@ -4,7 +4,7 @@ import { ActionRowBuilder, EmbedBuilder, GuildMember, - TextChannel, + TextChannel } from "discord.js" import { color, staffApplicationsChannel } from "config/options.json" import { largeM, ignM } from "config/limitmessages.json" @@ -44,7 +44,7 @@ export = { if (user.user.id !== env.prod.dev) { if (status === "0") { await interaction.editReply( - "Staff applications are currently closed.", + "Staff applications are currently closed." ) return } @@ -52,7 +52,7 @@ export = { if (!userRoles.has(guildRole)) { await interaction.editReply( - "You must be a member of the guild to apply for staff.", + "You must be a member of the guild to apply for staff." ) return } @@ -66,7 +66,7 @@ export = { if (application) { await interaction.editReply( - "You already have an application in progress.", + "You already have an application in progress." ) return } @@ -79,7 +79,7 @@ export = { .setColor(embedColor) const attachments = new EmbedBuilder() .setDescription( - "You have uploaded an attachment. Please do not upload images, videos, or GIFS.", + "You have uploaded an attachment. Please do not upload images, videos, or GIFS." ) .setColor(embedColor) @@ -92,9 +92,9 @@ export = { "If you wish to proceed with your application, please type `yes` otherwise type `cancel`.\n\n" + "**Do not upload images, videos, or GIFS.**\n" + "You have a minute to respond to this message.", - color: embedColor, - }, - ], + color: embedColor + } + ] }) } catch (error) { await interaction.editReply("Please enable your DMs.") @@ -106,7 +106,7 @@ export = { const input = await user.dmChannel!.awaitMessages({ filter: m => m.author.id === user.user.id, max: 1, - time: 1000 * 60, + time: 1000 * 60 }) if (input.size === 0) { await user.send({ embeds: [tooLong] }) @@ -133,15 +133,15 @@ export = { "`", color: embedColor, footer: { - text: "You have 5 minutes to respond to this message.", - }, - }, - ], + text: "You have 5 minutes to respond to this message." + } + } + ] }) const answer1 = await user.dmChannel!.awaitMessages({ filter: m => m.author.id === user.user.id, max: 1, - time: 1000 * 60 * 5, + time: 1000 * 60 * 5 }) if (answer1.size === 0) { await user.send({ embeds: [tooLong] }) @@ -160,9 +160,9 @@ export = { embeds: [ { description: "Max character limit is 16.", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -174,9 +174,9 @@ export = { description: "That is not a valid Minecraft username.\n" + "Application cancelled.", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -193,15 +193,15 @@ export = { "`(64 characters max)`", color: embedColor, footer: { - text: "You have 15 minutes to respond to this message.", - }, - }, - ], + text: "You have 15 minutes to respond to this message." + } + } + ] }) const answer2 = await user.dmChannel!.awaitMessages({ filter: m => m.author.id === user.user.id, max: 1, - time: 1000 * 60 * 15, + time: 1000 * 60 * 15 }) if (answer2.size === 0) { await user.send({ embeds: [tooLong] }) @@ -220,9 +220,9 @@ export = { embeds: [ { description: "Max character limit is 64.", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -240,15 +240,15 @@ export = { "`", color: embedColor, footer: { - text: "You have 15 minutes to respond to this message.", - }, - }, - ], + text: "You have 15 minutes to respond to this message." + } + } + ] }) const answer3 = await user.dmChannel!.awaitMessages({ filter: m => m.author.id === user.user.id, max: 1, - time: 1000 * 60 * 15, + time: 1000 * 60 * 15 }) if (answer3.size === 0) { await user.send({ embeds: [tooLong] }) @@ -267,9 +267,9 @@ export = { embeds: [ { description: "Max character limit is 256.", - color: embedColor, - }, - ], + color: embedColor + } + ] }) } const answer3_1 = answer3.first()!.content @@ -286,15 +286,15 @@ export = { "`", color: embedColor, footer: { - text: "You have 15 minutes to respond to this message.", - }, - }, - ], + text: "You have 15 minutes to respond to this message." + } + } + ] }) const answer4 = await user.dmChannel!.awaitMessages({ filter: m => m.author.id === user.user.id, max: 1, - time: 1000 * 60 * 15, + time: 1000 * 60 * 15 }) if (answer4.size === 0) { await user.send({ embeds: [tooLong] }) @@ -313,9 +313,9 @@ export = { embeds: [ { description: "Max character limit is 256.", - color: embedColor, - }, - ], + color: embedColor + } + ] }) } const answer4_1 = answer4.first()!.content @@ -332,15 +332,15 @@ export = { "`", color: embedColor, footer: { - text: "You have 15 minutes to respond to this message.", - }, - }, - ], + text: "You have 15 minutes to respond to this message." + } + } + ] }) const answer5 = await user.dmChannel!.awaitMessages({ filter: m => m.author.id === user.user.id, max: 1, - time: 1000 * 60 * 15, + time: 1000 * 60 * 15 }) if (answer5.size === 0) { await user.send({ embeds: [tooLong] }) @@ -359,9 +359,9 @@ export = { embeds: [ { description: "Max character limit is 256.", - color: embedColor, - }, - ], + color: embedColor + } + ] }) } const answer5_1 = answer5.first()!.content @@ -379,15 +379,15 @@ export = { "`", color: embedColor, footer: { - text: "You have 15 minutes to respond to this message.", - }, - }, - ], + text: "You have 15 minutes to respond to this message." + } + } + ] }) const answer6 = await user.dmChannel!.awaitMessages({ filter: m => m.author.id === user.user.id, max: 1, - time: 1000 * 60 * 15, + time: 1000 * 60 * 15 }) if (answer6.size === 0) { await user.send({ embeds: [tooLong] }) @@ -406,9 +406,9 @@ export = { embeds: [ { description: "Max character limit is 256.", - color: embedColor, - }, - ], + color: embedColor + } + ] }) } const answer6_1 = answer6.first()!.content @@ -418,15 +418,15 @@ export = { { description: "If you want to submit your application, type `yes` if not, type `no`", - color: embedColor, - }, - ], + color: embedColor + } + ] }) const final = await user.dmChannel!.awaitMessages({ filter: m => m.author.id === user.user.id, max: 1, - time: 1000 * 60 * 5, + time: 1000 * 60 * 5 }) if (final.size === 0) { await user.send({ embeds: [tooLong] }) @@ -445,22 +445,22 @@ export = { embeds: [ { description: "Your application has been submitted!", - color: embedColor, - }, - ], + color: embedColor + } + ] }) const newStaffApp = new staffapp({ _id: new mongoose.Types.ObjectId(), userID: user.user.id, - uuid: uuid, + uuid: uuid }) await newStaffApp.save() await user.deleteDM() const channel = guild.channels.cache.get( - staffApplicationsChannel, + staffApplicationsChannel ) as TextChannel await channel.send({ @@ -473,39 +473,39 @@ export = { " - Staff Application", color: embedColor, thumbnail: { - url: user.avatarURL() || "", + url: user.avatarURL() || "" }, fields: [ { name: rq(1), - value: "```" + answer1_1 + "```", + value: "```" + answer1_1 + "```" }, { name: rq(2), - value: "```" + answer2_1 + "```", + value: "```" + answer2_1 + "```" }, { name: rq(3), - value: "```" + answer3_1 + "```", + value: "```" + answer3_1 + "```" }, { name: rq(4), - value: "```" + answer4_1 + "```", + value: "```" + answer4_1 + "```" }, { name: rq(5), - value: "```" + answer5_1 + "```", + value: "```" + answer5_1 + "```" }, { name: rq(6), - value: "```" + answer6_1 + "```", - }, + value: "```" + answer6_1 + "```" + } ], footer: { icon_url: guild.iconURL() || undefined, - text: "ID: " + user.user.id, - }, - }, + text: "ID: " + user.user.id + } + } ], components: [ new ActionRowBuilder().addComponents( @@ -516,10 +516,10 @@ export = { new ButtonBuilder() .setCustomId("staffapplicationdeny") .setLabel("Deny") - .setStyle(ButtonStyle.Danger), - ), - ], + .setStyle(ButtonStyle.Danger) + ) + ] }) } - }, + } } as Button diff --git a/src/components/buttons/verify.ts b/src/components/buttons/verify.ts index ddb3ed8..04bfab7 100644 --- a/src/components/buttons/verify.ts +++ b/src/components/buttons/verify.ts @@ -2,7 +2,7 @@ import { ModalBuilder, ActionRowBuilder, TextInputBuilder, - TextInputStyle, + TextInputStyle } from "discord.js" import { Button } from "interfaces" @@ -23,9 +23,9 @@ export = { .setPlaceholder("Enter your ign.") .setRequired(true) .setMinLength(3) - .setMaxLength(16), - ), + .setMaxLength(16) + ) ) await interaction.showModal(modal) - }, + } } as Button diff --git a/src/components/buttons/waitingListUpdate.ts b/src/components/buttons/waitingListUpdate.ts index a17a28e..4063adf 100644 --- a/src/components/buttons/waitingListUpdate.ts +++ b/src/components/buttons/waitingListUpdate.ts @@ -32,7 +32,7 @@ export = { fields.push({ name: `${i + 1}. ${accepted[i].IGN}`, - value: `TS: `, + value: `TS: ` }) } @@ -44,15 +44,15 @@ export = { color: embed.color!, footer: { text: "Last updated by " + user.username, - icon_url: user.avatarURL() || undefined, + icon_url: user.avatarURL() || undefined }, thumbnail: embed.thumbnail!, fields: fields, - timestamp: new Date().toISOString(), - }, - ], + timestamp: new Date().toISOString() + } + ] }) await interaction.editReply("Updated the waiting list") - }, + } } as Button diff --git a/src/components/modals/denyreasonbox.ts b/src/components/modals/denyreasonbox.ts index 66574ad..869b18d 100644 --- a/src/components/modals/denyreasonbox.ts +++ b/src/components/modals/denyreasonbox.ts @@ -4,7 +4,7 @@ import { ButtonBuilder, ButtonStyle, Message, - GuildMember, + GuildMember } from "discord.js" import { color } from "config/options.json" import guildapp from "schemas/guildAppSchema" @@ -44,9 +44,9 @@ export = { .setCustomId("checkstats") .setLabel("Check Stats") .setStyle(ButtonStyle.Secondary) - .setDisabled(true), - ), - ], + .setDisabled(true) + ) + ] }) let applicant: GuildMember | null @@ -61,13 +61,13 @@ export = { "Your application for the Illegitimate guild has been denied\n" + "**Reason:** `" + reason + - "`", + "`" ) .setColor(embedColor) const missingUser = new EmbedBuilder() .setDescription( - "[WARN] User has left the server and cannot be notified.", + "[WARN] User has left the server and cannot be notified." ) .setColor(embedColor) @@ -79,13 +79,13 @@ export = { ">.\n" + "**Reason:** `" + reason + - "`", + "`" ) .setColor(embedColor) .setThumbnail(guild.iconURL() || "") .setFooter({ iconURL: guild.iconURL() || undefined, - text: "ID: " + applicantId, + text: "ID: " + applicantId }) if (applicant !== null) { @@ -102,7 +102,7 @@ export = { await guildapp.findOneAndDelete({ userID: applicantId }) await interaction.editReply({ - embeds: responseEmbeds, + embeds: responseEmbeds }) - }, + } } as Modal diff --git a/src/components/modals/staffdenyreasonbox.ts b/src/components/modals/staffdenyreasonbox.ts index 5135d5a..c16aa89 100644 --- a/src/components/modals/staffdenyreasonbox.ts +++ b/src/components/modals/staffdenyreasonbox.ts @@ -2,7 +2,7 @@ import { EmbedBuilder, ActionRowBuilder, ButtonBuilder, - ButtonStyle, + ButtonStyle } from "discord.js" import { color } from "config/options.json" import staffapp from "schemas/staffAppSchema" @@ -38,9 +38,9 @@ export = { .setCustomId("staffapplicationdeny") .setLabel("Deny") .setStyle(ButtonStyle.Danger) - .setDisabled(true), - ), - ], + .setDisabled(true) + ) + ] }) const dmMessage = new EmbedBuilder() @@ -48,7 +48,7 @@ export = { "Your application for the Illegitimate guild staff has been denied\n" + "**Reason:** `" + reason + - "`", + "`" ) .setColor(embedColor) @@ -69,14 +69,14 @@ export = { "`", color: embedColor, thumbnail: { - url: applicant.avatarURL() || "", + url: applicant.avatarURL() || "" }, footer: { icon_url: guild!.iconURL() || undefined, - text: "ID: " + applicant.id, - }, - }, - ], + text: "ID: " + applicant.id + } + } + ] }) - }, + } } as Modal diff --git a/src/components/modals/verifyModal.ts b/src/components/modals/verifyModal.ts index 12b2500..58a085b 100644 --- a/src/components/modals/verifyModal.ts +++ b/src/components/modals/verifyModal.ts @@ -11,7 +11,7 @@ import { member, guildRole, guildStaff, - defaultMember, + defaultMember } from "config/roles.json" import { Modal } from "interfaces" import { GuildMember } from "discord.js" @@ -31,7 +31,7 @@ export = { if (verifyData) { interaction.editReply( "You are already verified.\n" + - "Try running /update to update your roles.", + "Try running /update to update your roles." ) return } @@ -43,9 +43,9 @@ export = { { description: " That player does not exist.", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -58,9 +58,9 @@ export = { { description: " That player hasn't played Hypixel before.", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -84,9 +84,9 @@ export = { "**Please set your Discord tag on hypixel to `" + username + "` and try again.**", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -104,9 +104,9 @@ export = { "**Please set your Discord tag on hypixel to `" + username + "` and try again.**", - color: embedColor, - }, - ], + color: embedColor + } + ] }) return } @@ -122,7 +122,7 @@ export = { if (guildID === hypixelGuildID) { const GuildMembers = guild!.members const guildRank = GuildMembers.find( - member => member.uuid === player.uuid, + member => member.uuid === player.uuid )!.rank if (guildRank === "Guild Master" && guildID === hypixelGuildID) { @@ -163,7 +163,7 @@ export = { const newVerify = new verify({ _id: new mongoose.Types.ObjectId(), userID: user.id, - uuid: uuid, + uuid: uuid }) await newVerify.save() @@ -180,15 +180,15 @@ export = { "`.", color: embedColor, thumbnail: { - url: head!, + url: head! }, footer: { icon_url: interaction.guild!.iconURL() || undefined, - text: interaction.guild!.name + " | " + devMessage, - }, - }, - ], + text: interaction.guild!.name + " | " + devMessage + } + } + ] }) } - }, + } } as Modal diff --git a/src/events/cron/weeklyGexp.ts b/src/events/cron/weeklyGexp.ts index 2a84d02..edd37b2 100644 --- a/src/events/cron/weeklyGexp.ts +++ b/src/events/cron/weeklyGexp.ts @@ -2,7 +2,7 @@ import { hypixelGuildID, guildLogChannel, color, - devMessage, + devMessage } from "config/options.json" import colorLog from "utils/functions/colors" import { getGuild, getIGN } from "utils/Hypixel" @@ -25,9 +25,9 @@ async function guildWeekly() { embeds: [ { description: "Starting to fetch guild data...", - color: embedColor, - }, - ], + color: embedColor + } + ] }) const guild = (await getGuild(hypixelGuildID, "id")) as GuildData @@ -45,10 +45,7 @@ async function guildWeekly() { .map(member => { return { uuid: member.uuid, - exp: Object.values(member.expHistory).reduce( - (a, b) => a + b, - 0, - ), + exp: Object.values(member.expHistory).reduce((a, b) => a + b, 0) } }) .sort((a, b) => b.exp - a.exp) @@ -56,16 +53,16 @@ async function guildWeekly() { for (let i = 0; i < allMembersGexpSorted.length; i++) { const ign = await getIGN(allMembersGexpSorted[i].uuid) const gexp = new Intl.NumberFormat("en-US").format( - allMembersGexpSorted[i].exp, + allMembersGexpSorted[i].exp ) const position = i + 1 guildMembersList.push( - "**#" + position + " " + ign + ":** `" + gexp + "`", + "**#" + position + " " + ign + ":** `" + gexp + "`" ) } const list = Array.from({ length: sliceSize }, (_, i) => - guildMembersList.slice(i * sliceSize, (i + 1) * sliceSize), + guildMembersList.slice(i * sliceSize, (i + 1) * sliceSize) ) list.forEach((item, index) => { @@ -74,30 +71,30 @@ async function guildWeekly() { topWeeklyMembers[index] = { name: "", value: item.join("\n"), - inline: false, + inline: false } }) // combined weekly gexp const allGuildMembersWeeklyXP = guildMembers.map( - member => member.expHistory, + member => member.expHistory ) const guildMembersWeeklyXP = allGuildMembersWeeklyXP.map(member => { return Object.values(member).reduce((a, b) => a + b, 0) }) const totalGuildMembersWeeklyXPUnformatted = guildMembersWeeklyXP.reduce( (a, b) => a + b, - 0, + 0 ) const averageGuildMembersDailyXPUnformatted = totalGuildMembersWeeklyXPUnformatted / 7 // final values const totalGuildMembersWeeklyXP = new Intl.NumberFormat("en-US").format( - totalGuildMembersWeeklyXPUnformatted, + totalGuildMembersWeeklyXPUnformatted ) const averageGuildMembersWeeklyXP = new Intl.NumberFormat("en-US").format( - averageGuildMembersDailyXPUnformatted, + averageGuildMembersDailyXPUnformatted ) await message.edit({ @@ -115,10 +112,10 @@ async function guildWeekly() { timestamp: new Date().toISOString(), footer: { text: channel.guild.name + " | " + devMessage, - icon_url: channel.guild.iconURL() || undefined, - }, - }, - ], + icon_url: channel.guild.iconURL() || undefined + } + } + ] }) } @@ -129,10 +126,10 @@ export = { hours: 21, dayOfWeek: 7, dayOfMonth: "*", - month: "*", + month: "*" }, execute: guildWeekly, onComplete: null, start: true, - timeZone: "Europe/Zagreb", + timeZone: "Europe/Zagreb" } as Cron diff --git a/src/events/server/guildMemberAdd/logNewJoins.ts b/src/events/server/guildMemberAdd/logNewJoins.ts index b6876e0..85a3b5d 100644 --- a/src/events/server/guildMemberAdd/logNewJoins.ts +++ b/src/events/server/guildMemberAdd/logNewJoins.ts @@ -23,15 +23,15 @@ export = { member.user.createdAt.toLocaleString(), color: embedColor, thumbnail: { - url: member.user.avatarURL() || "", + url: member.user.avatarURL() || "" }, footer: { text: "ID: " + member.id, - icon_url: member.user.avatarURL() || undefined, + icon_url: member.user.avatarURL() || undefined }, - timestamp: new Date().toISOString(), - }, - ], + timestamp: new Date().toISOString() + } + ] }) - }, + } } as Event diff --git a/src/events/server/interactions/logBtnsCmds.ts b/src/events/server/interactions/logBtnsCmds.ts index c16176b..8887c6b 100644 --- a/src/events/server/interactions/logBtnsCmds.ts +++ b/src/events/server/interactions/logBtnsCmds.ts @@ -17,8 +17,8 @@ export = { interaction.commandName + " " + interaction.options.getSubcommand(), - "pink", - ), + "pink" + ) ) } catch { console.log( @@ -26,8 +26,8 @@ export = { interaction.user.username + " ran " + interaction.commandName, - "pink", - ), + "pink" + ) ) } } @@ -40,10 +40,10 @@ export = { interaction.user.discriminator + " clicked " + interaction.customId, - "pink", - ), + "pink" + ) ) return } - }, + } } as Event diff --git a/src/events/server/messages/eval.ts b/src/events/server/messages/eval.ts index 866baae..1d514a3 100644 --- a/src/events/server/messages/eval.ts +++ b/src/events/server/messages/eval.ts @@ -21,18 +21,18 @@ export = { await message.channel.send({ embeds: [ { - description: `\`\`\`js\n${outputString}\`\`\``, - }, - ], + description: `\`\`\`js\n${outputString}\`\`\`` + } + ] }) } catch (error) { await message.channel.send({ embeds: [ { - description: `\`\`\`js\n${error}\`\`\``, - }, - ], + description: `\`\`\`js\n${error}\`\`\`` + } + ] }) } - }, + } } as Event diff --git a/src/events/server/messages/react.ts b/src/events/server/messages/react.ts index 45913f6..f0dad05 100644 --- a/src/events/server/messages/react.ts +++ b/src/events/server/messages/react.ts @@ -13,5 +13,5 @@ export = { ) { message.react("Woot:734345936347725885") } - }, + } } as Event diff --git a/src/events/server/messages/snipecache.ts b/src/events/server/messages/snipecache.ts index 53c882a..ae7a9f4 100644 --- a/src/events/server/messages/snipecache.ts +++ b/src/events/server/messages/snipecache.ts @@ -20,16 +20,16 @@ export = { channel: message.channel.id, createdAt: message.createdTimestamp, deletedAt: Date.now(), - attachments: message.attachments.map(a => a.url) || [], + attachments: message.attachments.map(a => a.url) || [] } const snipeCache = new snipeCacheSchema({ _id: new mongoose.Types.ObjectId(), userid: message.author.id, channelid: message.channel.id, - data: msg, + data: msg }) await snipeCache.save() - }, + } } as Event diff --git a/src/events/server/ready/consolelog.ts b/src/events/server/ready/consolelog.ts index 520c494..b7108e9 100644 --- a/src/events/server/ready/consolelog.ts +++ b/src/events/server/ready/consolelog.ts @@ -9,5 +9,5 @@ export = { execute(client: Client) { console.log(color("Logged in as " + client.user!.tag + "!", "green")) - }, + } } as Event diff --git a/src/events/server/ready/sendOnlineMessage.ts b/src/events/server/ready/sendOnlineMessage.ts index c813454..4e3c232 100644 --- a/src/events/server/ready/sendOnlineMessage.ts +++ b/src/events/server/ready/sendOnlineMessage.ts @@ -16,9 +16,9 @@ export = { embeds: [ { description: "Bot is online!", - color: embedColor, - }, - ], + color: embedColor + } + ] }) - }, + } } as Event diff --git a/src/events/server/ready/status.ts b/src/events/server/ready/status.ts index 6f4f509..7deeb12 100644 --- a/src/events/server/ready/status.ts +++ b/src/events/server/ready/status.ts @@ -22,9 +22,9 @@ export = { let i = 1 setInterval( () => user.setActivity(statuses[i++ % statuses.length]), - 1000 * 60 * 10, + 1000 * 60 * 10 ) user.setStatus("dnd") - }, + } } as Event diff --git a/src/events/server/voiceStateUpdate/vcJoinLeave.ts b/src/events/server/voiceStateUpdate/vcJoinLeave.ts index 360f222..0d1461a 100644 --- a/src/events/server/voiceStateUpdate/vcJoinLeave.ts +++ b/src/events/server/voiceStateUpdate/vcJoinLeave.ts @@ -28,11 +28,11 @@ export = { footer: { text: "ID: " + newState.member!.id, icon_url: - newState.member!.user.avatarURL() || undefined, + newState.member!.user.avatarURL() || undefined }, - timestamp: new Date().toISOString(), - }, - ], + timestamp: new Date().toISOString() + } + ] }) } else if (oldChannel !== null && newChannel === null) { logToChannel("bot", { @@ -47,11 +47,11 @@ export = { footer: { text: "ID: " + oldState.member!.id, icon_url: - oldState.member!.user.avatarURL() || undefined, + oldState.member!.user.avatarURL() || undefined }, - timestamp: new Date().toISOString(), - }, - ], + timestamp: new Date().toISOString() + } + ] }) } else if (oldChannel !== null && newChannel !== null) { if (oldChannel.id === newChannel.id) return @@ -70,12 +70,12 @@ export = { footer: { text: "ID: " + oldState.member!.id, icon_url: - oldState.member!.user.avatarURL() || undefined, + oldState.member!.user.avatarURL() || undefined }, - timestamp: new Date().toISOString(), - }, - ], + timestamp: new Date().toISOString() + } + ] }) } - }, + } } as Event diff --git a/src/interfaces/Command.ts b/src/interfaces/Command.ts index 3d319b7..bf578f0 100644 --- a/src/interfaces/Command.ts +++ b/src/interfaces/Command.ts @@ -12,6 +12,6 @@ export default interface Command { data: SlashCommandBuilder execute: ( interaction: ChatInputCommandInteraction, - client: Client, + client: Client ) => Promise } diff --git a/src/interfaces/ContextMenu.ts b/src/interfaces/ContextMenu.ts index 8cc1d66..5ad8052 100644 --- a/src/interfaces/ContextMenu.ts +++ b/src/interfaces/ContextMenu.ts @@ -1,7 +1,7 @@ /* eslint-disable no-unused-vars */ import { ContextMenuCommandInteraction, - ContextMenuCommandBuilder, + ContextMenuCommandBuilder } from "discord.js" export default interface ContextMenu { diff --git a/src/interfaces/index.ts b/src/interfaces/index.ts index 626a4e5..9314e42 100644 --- a/src/interfaces/index.ts +++ b/src/interfaces/index.ts @@ -25,5 +25,5 @@ export { Guild, GuildData, Player, - PlayerData, + PlayerData } diff --git a/src/schemas/guildAppSchema.ts b/src/schemas/guildAppSchema.ts index 905be5c..f4eef60 100644 --- a/src/schemas/guildAppSchema.ts +++ b/src/schemas/guildAppSchema.ts @@ -3,7 +3,7 @@ import { Schema, model } from "mongoose" const guildAppSchema = new Schema({ _id: Schema.Types.ObjectId, userID: { type: String, required: true }, - uuid: { type: String, required: true }, + uuid: { type: String, required: true } }) export = model("guildapp", guildAppSchema, "guildapp") diff --git a/src/schemas/settingsSchema.ts b/src/schemas/settingsSchema.ts index 9049be0..90c8791 100644 --- a/src/schemas/settingsSchema.ts +++ b/src/schemas/settingsSchema.ts @@ -3,7 +3,7 @@ import { Schema, model } from "mongoose" const settingsSchema = new Schema({ _id: Schema.Types.ObjectId, name: { type: String, required: true }, - value: { type: String, required: true }, + value: { type: String, required: true } }) export = model("settings", settingsSchema, "settings") diff --git a/src/schemas/snipeCacheSchema.ts b/src/schemas/snipeCacheSchema.ts index abe8702..a029de8 100644 --- a/src/schemas/snipeCacheSchema.ts +++ b/src/schemas/snipeCacheSchema.ts @@ -5,7 +5,7 @@ const snipeCacheSchema = new Schema({ userid: { type: String, required: true }, channelid: { type: String, required: true }, data: { type: Object, required: true }, - date: { type: Date, default: Date.now(), expires: 600 }, + date: { type: Date, default: Date.now(), expires: 600 } }) export default model("snipeCache", snipeCacheSchema, "snipeCache") diff --git a/src/schemas/staffAppSchema.ts b/src/schemas/staffAppSchema.ts index 3cde4ce..7f3bd49 100644 --- a/src/schemas/staffAppSchema.ts +++ b/src/schemas/staffAppSchema.ts @@ -3,7 +3,7 @@ import { Schema, model } from "mongoose" const staffAppSchema = new Schema({ _id: Schema.Types.ObjectId, userID: { type: String, required: true }, - uuid: { type: String, required: true }, + uuid: { type: String, required: true } }) export = model("staffapp", staffAppSchema, "staffapp") diff --git a/src/schemas/verifySchema.ts b/src/schemas/verifySchema.ts index 1ae9e67..9a6d12a 100644 --- a/src/schemas/verifySchema.ts +++ b/src/schemas/verifySchema.ts @@ -3,7 +3,7 @@ import { Schema, model } from "mongoose" const verifySchema = new Schema({ _id: Schema.Types.ObjectId, userID: { type: String, required: true }, - uuid: { type: String, required: true }, + uuid: { type: String, required: true } }) export = model("verify", verifySchema, "verify") diff --git a/src/schemas/waitinglistSchema.ts b/src/schemas/waitinglistSchema.ts index 37c4cf1..bc0a857 100644 --- a/src/schemas/waitinglistSchema.ts +++ b/src/schemas/waitinglistSchema.ts @@ -5,7 +5,7 @@ const waitinglistSchema = new Schema({ userID: { type: String, required: true }, uuid: { type: String, required: true }, IGN: { type: String, required: true }, - timestamp: { type: Number, required: true }, + timestamp: { type: Number, required: true } }) export = model("waitinglist", waitinglistSchema, "waitinglist") diff --git a/src/utils/Autodeploy.ts b/src/utils/Autodeploy.ts index ecaf281..e43f04a 100644 --- a/src/utils/Autodeploy.ts +++ b/src/utils/Autodeploy.ts @@ -5,7 +5,7 @@ import { REST, RESTGetAPIApplicationGuildCommandResult, RESTPutAPIApplicationGuildCommandsJSONBody, - Routes, + Routes } from "discord.js" import fs from "fs" type FileType = "js" | "ts" @@ -47,27 +47,27 @@ export default async function autoDeployCommands(fileType: FileType) { const rest = new REST({ version: "10" }).setToken(env.dev.devtoken!) const currentCommands = (await rest.get( - Routes.applicationGuildCommands(env.dev.devid!, env.dev.guildid!), + Routes.applicationGuildCommands(env.dev.devid!, env.dev.guildid!) )) as RESTGetAPIApplicationGuildCommandResult[] const currentCommandsInfo = currentCommands.map(command => { return { name: command.name, - description: command.description, + description: command.description } }) const newCommandsInfo = commands.map(command => { return { name: command.name, - description: command.description, + description: command.description } }) const sortedCurrentCommandsInfo = currentCommandsInfo.sort((a, b) => - a.name.localeCompare(b.name), + a.name.localeCompare(b.name) ) const sortedNewCommandsInfo = newCommandsInfo.sort((a, b) => - a.name.localeCompare(b.name), + a.name.localeCompare(b.name) ) const newCmds = sortedNewCommandsInfo @@ -86,7 +86,7 @@ export default async function autoDeployCommands(fileType: FileType) { JSON.stringify(sortedCurrentCommandsInfo) ) { console.log( - color("Commands are the same, skipping deploy.", "lavender"), + color("Commands are the same, skipping deploy.", "lavender") ) console.log(color(newCmds, "lavender")) return @@ -96,18 +96,18 @@ export default async function autoDeployCommands(fileType: FileType) { console.log(color("Commands are different, starting deploy.", "red")) console.log(color(currentCmds, "red")) console.log( - `Started refreshing ${commands.length} application (/) commands.`, + `Started refreshing ${commands.length} application (/) commands.` ) const data = (await rest.put( Routes.applicationGuildCommands(env.dev.devid!, env.dev.guildid!), - { body: commands }, + { body: commands } )) as RESTPutAPIApplicationGuildCommandsJSONBody[] console.log(color("New commands deployed.", "lavender")) console.log(color(newCmds, "lavender")) console.log( - `Successfully reloaded ${data.length} application (/) commands.`, + `Successfully reloaded ${data.length} application (/) commands.` ) } catch (error) { console.error(error) diff --git a/src/utils/Client.ts b/src/utils/Client.ts index 323b607..83fe95e 100644 --- a/src/utils/Client.ts +++ b/src/utils/Client.ts @@ -20,14 +20,14 @@ export class ExtendedClient extends Client { GatewayIntentBits.GuildMembers, GatewayIntentBits.MessageContent, GatewayIntentBits.DirectMessages, - GatewayIntentBits.GuildVoiceStates, + GatewayIntentBits.GuildVoiceStates ], partials: [ Partials.GuildMember, Partials.User, Partials.Message, - Partials.Channel, - ], + Partials.Channel + ] }) } @@ -35,7 +35,7 @@ export class ExtendedClient extends Client { let token: string if (process.env.NODE_ENV === "dev" && process.env.TYPESCRIPT) { console.log( - color("Running in development mode. [ts-node]", "lavender"), + color("Running in development mode. [ts-node]", "lavender") ) loadAllEvents(this, "ts") token = env.dev.devtoken! diff --git a/src/utils/Env.ts b/src/utils/Env.ts index 05d4a1e..445cfbf 100644 --- a/src/utils/Env.ts +++ b/src/utils/Env.ts @@ -7,14 +7,14 @@ const env: Env = { mongoURI: process.env.MONGOURI, dev: process.env.DEV, hypixelapikey: process.env.HYPIXELAPIKEY, - redisURI: process.env.REDISURI, + redisURI: process.env.REDISURI }, dev: { devtoken: process.env.DEVTOKEN, clientid: process.env.CLIENTID, devid: process.env.DEVID, - guildid: process.env.GUILDID, - }, + guildid: process.env.GUILDID + } } export default env diff --git a/src/utils/Events/autocomplete.ts b/src/utils/Events/autocomplete.ts index 7842875..0214bfa 100644 --- a/src/utils/Events/autocomplete.ts +++ b/src/utils/Events/autocomplete.ts @@ -15,7 +15,7 @@ export default function loadAutocompleteEvents(client: Client, ft: FileType) { "..", "..", "components", - "autocomplete", + "autocomplete" ) const autocompleteFiles = fs .readdirSync(autocompletePath) @@ -31,8 +31,8 @@ export default function loadAutocompleteEvents(client: Client, ft: FileType) { console.log( colorLog( `[WARNING] The autocomplete at ${filePath} is missing a required "name", "execute" or "type" property.`, - "red", - ), + "red" + ) ) } } @@ -44,7 +44,7 @@ export default function loadAutocompleteEvents(client: Client, ft: FileType) { if (!autocomplete) { console.error( - `No autocomplete matching ${interaction.commandName} was found.`, + `No autocomplete matching ${interaction.commandName} was found.` ) return } @@ -65,10 +65,10 @@ export default function loadAutocompleteEvents(client: Client, ft: FileType) { text: interaction.user.username + " | " + - interaction.commandName, - }, - }, - ], + interaction.commandName + } + } + ] }) } console.error(error) diff --git a/src/utils/Events/button.ts b/src/utils/Events/button.ts index 435953e..3b4ceb6 100644 --- a/src/utils/Events/button.ts +++ b/src/utils/Events/button.ts @@ -23,8 +23,8 @@ export default function loadButtonEvents(client: Client, ft: FileType) { console.log( colorLog( `[WARNING] The button at ${filePath} is missing a required "name", "execute" or "type" property.`, - "red", - ), + "red" + ) ) } } @@ -36,7 +36,7 @@ export default function loadButtonEvents(client: Client, ft: FileType) { if (!button) { console.error( - `No event matching ${interaction.customId} was found.`, + `No event matching ${interaction.customId} was found.` ) return } @@ -57,10 +57,10 @@ export default function loadButtonEvents(client: Client, ft: FileType) { text: interaction.user.username + " | " + - interaction.customId, - }, - }, - ], + interaction.customId + } + } + ] }) } @@ -71,10 +71,10 @@ export default function loadButtonEvents(client: Client, ft: FileType) { { description: "There was an error while executing this button!", - color: embedColor, - }, + color: embedColor + } ], - ephemeral: true, + ephemeral: true }) } else { await interaction.editReply({ @@ -82,9 +82,9 @@ export default function loadButtonEvents(client: Client, ft: FileType) { { description: "There was an error while executing this button! 2", - color: embedColor, - }, - ], + color: embedColor + } + ] }) } } diff --git a/src/utils/Events/command.ts b/src/utils/Events/command.ts index a3a7ae1..fca4da4 100644 --- a/src/utils/Events/command.ts +++ b/src/utils/Events/command.ts @@ -23,8 +23,8 @@ export default function loadSlashCommandsEvents(client: Client, ft: FileType) { console.log( colorLog( `[WARNING] The command at ${filePath} is missing a required "data", "execute" or "type" property.`, - "red", - ), + "red" + ) ) } } @@ -37,7 +37,7 @@ export default function loadSlashCommandsEvents(client: Client, ft: FileType) { if (!command) { console.error( - `No command matching ${interaction.commandName} was found.`, + `No command matching ${interaction.commandName} was found.` ) return } @@ -58,10 +58,10 @@ export default function loadSlashCommandsEvents(client: Client, ft: FileType) { text: interaction.user.username + " | " + - interaction.commandName, - }, - }, - ], + interaction.commandName + } + } + ] }) } @@ -72,10 +72,10 @@ export default function loadSlashCommandsEvents(client: Client, ft: FileType) { { description: "There was an error while executing this command!", - color: embedColor, - }, + color: embedColor + } ], - ephemeral: true, + ephemeral: true }) } else { await interaction.editReply({ @@ -83,9 +83,9 @@ export default function loadSlashCommandsEvents(client: Client, ft: FileType) { { description: "There was an error while executing this command!", - color: embedColor, - }, - ], + color: embedColor + } + ] }) } } diff --git a/src/utils/Events/contextmenu.ts b/src/utils/Events/contextmenu.ts index d2edc23..8880504 100644 --- a/src/utils/Events/contextmenu.ts +++ b/src/utils/Events/contextmenu.ts @@ -14,7 +14,7 @@ export default function loadContextMenuEvents(client: Client, ft: FileType) { __dirname, "..", "..", - "commands-contextmenu", + "commands-contextmenu" ) const contextMenuFiles = fs .readdirSync(contextMenuPath) @@ -30,8 +30,8 @@ export default function loadContextMenuEvents(client: Client, ft: FileType) { console.log( colorLog( `[WARNING] The command at ${filePath} is missing a required "data", "execute" or "type" property.`, - "red", - ), + "red" + ) ) } } @@ -44,7 +44,7 @@ export default function loadContextMenuEvents(client: Client, ft: FileType) { if (!command) { console.error( - `No command matching ${interaction.commandName} was found.`, + `No command matching ${interaction.commandName} was found.` ) return } @@ -65,10 +65,10 @@ export default function loadContextMenuEvents(client: Client, ft: FileType) { text: interaction.user.username + " | " + - interaction.commandName, - }, - }, - ], + interaction.commandName + } + } + ] }) } @@ -79,10 +79,10 @@ export default function loadContextMenuEvents(client: Client, ft: FileType) { { description: "There was an error while executing this contextmenu command!", - color: embedColor, - }, + color: embedColor + } ], - ephemeral: true, + ephemeral: true }) } else { await interaction.editReply({ @@ -90,9 +90,9 @@ export default function loadContextMenuEvents(client: Client, ft: FileType) { { description: "There was an error while executing this contextmenu command!", - color: embedColor, - }, - ], + color: embedColor + } + ] }) } } diff --git a/src/utils/Events/cron.ts b/src/utils/Events/cron.ts index 87d48f1..530d787 100644 --- a/src/utils/Events/cron.ts +++ b/src/utils/Events/cron.ts @@ -31,7 +31,7 @@ export default function loadCronEvents() { cron.execute, cron.onComplete, cron.start, - cron.timeZone, + cron.timeZone ).start() } } diff --git a/src/utils/Events/modal.ts b/src/utils/Events/modal.ts index bd405cf..0aeba2a 100644 --- a/src/utils/Events/modal.ts +++ b/src/utils/Events/modal.ts @@ -25,8 +25,8 @@ export default function loadModalEvents(client: Client, ft: FileType) { console.log( colorLog( `[WARNING] The modal at ${filePath} is missing a required "name", "execute" or "type" property.`, - "red", - ), + "red" + ) ) } } @@ -38,7 +38,7 @@ export default function loadModalEvents(client: Client, ft: FileType) { if (!modal) { console.error( - `No modal matching ${interaction.customId} was found.`, + `No modal matching ${interaction.customId} was found.` ) return } @@ -59,10 +59,10 @@ export default function loadModalEvents(client: Client, ft: FileType) { text: interaction.user.username + " | " + - interaction.customId, - }, - }, - ], + interaction.customId + } + } + ] }) } @@ -73,9 +73,9 @@ export default function loadModalEvents(client: Client, ft: FileType) { { description: "There was an error while executing this modal!", - color: embedColor, - }, - ], + color: embedColor + } + ] }) } else { await interaction.editReply({ @@ -83,9 +83,9 @@ export default function loadModalEvents(client: Client, ft: FileType) { { description: "There was an error while executing this modal!", - color: embedColor, - }, - ], + color: embedColor + } + ] }) } } diff --git a/src/utils/Hypixel/account.ts b/src/utils/Hypixel/account.ts index 5c5d630..1765923 100644 --- a/src/utils/Hypixel/account.ts +++ b/src/utils/Hypixel/account.ts @@ -48,8 +48,8 @@ async function getPlayer(uuid: string): Promise { const playerReq: Player = await fetch(hypixel, { params: { key: apikey, - uuid: uuid, - }, + uuid: uuid + } }) if (!playerReq.data.player) { @@ -61,15 +61,15 @@ async function getPlayer(uuid: string): Promise { async function getGuild( query: string, - type?: GuildQuerqType, + type?: GuildQuerqType ): Promise { const reqType = type ? type : "player" const guildReq: Guild = await fetch(guild, { params: { key: apikey, - [reqType]: query, - }, + [reqType]: query + } }) if (!guildReq.data.guild) { diff --git a/src/utils/Hypixel/guild.ts b/src/utils/Hypixel/guild.ts index cf28d09..6f82f7f 100644 --- a/src/utils/Hypixel/guild.ts +++ b/src/utils/Hypixel/guild.ts @@ -4,7 +4,7 @@ function guildLevel(exp: number): number { const EXP_NEEDED = [ 100000, 150000, 250000, 500000, 750000, 1000000, 1250000, 1500000, - 2000000, 2500000, 2500000, 2500000, 2500000, 2500000, 3000000, + 2000000, 2500000, 2500000, 2500000, 2500000, 2500000, 3000000 ] let level = 0 diff --git a/src/utils/Hypixel/hypixel.ts b/src/utils/Hypixel/hypixel.ts index 043c5ea..83eb766 100644 --- a/src/utils/Hypixel/hypixel.ts +++ b/src/utils/Hypixel/hypixel.ts @@ -12,7 +12,7 @@ function getLevel(exp: number): number { if (exp <= 1) return 1 return Math.floor( - 1 + REVERSE_PQ_PREFIX + Math.sqrt(REVERSE_CONST + GROWTHDIV2 * exp), + 1 + REVERSE_PQ_PREFIX + Math.sqrt(REVERSE_CONST + GROWTHDIV2 * exp) ) } diff --git a/src/utils/functions/colors.ts b/src/utils/functions/colors.ts index 6bd44be..72df00f 100644 --- a/src/utils/functions/colors.ts +++ b/src/utils/functions/colors.ts @@ -4,7 +4,7 @@ const colors = { red: "#f38ba8", lavender: "#b4befe", green: "#a6e3a1", - pink: "#f5c2e7", + pink: "#f5c2e7" } export default function color(text: string, type: keyof typeof colors) { diff --git a/src/utils/functions/logtochannel.ts b/src/utils/functions/logtochannel.ts index 38cbf89..a36a47a 100644 --- a/src/utils/functions/logtochannel.ts +++ b/src/utils/functions/logtochannel.ts @@ -5,7 +5,7 @@ import { guildLogChannel, errorLogChannel, moderationLogChannel, - devLogChannel, + devLogChannel } from "config/options.json" import { Guild, MessageCreateOptions, TextChannel } from "discord.js" import Illegitimate from "utils/Illegitimate" @@ -16,14 +16,14 @@ const channels = { guild: guildLogChannel, error: errorLogChannel, mod: moderationLogChannel, - dev: devLogChannel, + dev: devLogChannel } type Channel = keyof typeof channels export default async function logToChannel( channel: Channel, - message: MessageCreateOptions, + message: MessageCreateOptions ): Promise { const guild = Illegitimate.client.guilds.cache.get(guildid) as Guild let logChannel: TextChannel @@ -36,7 +36,7 @@ export default async function logToChannel( if (!logChannel) { console.log( - `[ERROR] Could not find channel used for ${channel} logging.`, + `[ERROR] Could not find channel used for ${channel} logging.` ) return } diff --git a/src/utils/functions/rolesmanage.ts b/src/utils/functions/rolesmanage.ts index 321b7ab..a1726be 100644 --- a/src/utils/functions/rolesmanage.ts +++ b/src/utils/functions/rolesmanage.ts @@ -7,7 +7,7 @@ import { member, guildStaff, guildRole, - defaultMember, + defaultMember } from "config/roles.json" const roles = [ gm, @@ -17,7 +17,7 @@ const roles = [ elite, member, guildStaff, - guildRole, + guildRole ] type RoleType = @@ -36,7 +36,7 @@ export default function roleManage(role: RoleType): { } { if (role === "gm") { const rolesToRemove = roles.filter( - role => role !== gm && role !== guildStaff && role !== guildRole, + role => role !== gm && role !== guildStaff && role !== guildRole ) const rolesToAdd = [gm, guildStaff, guildRole] return { rolesToRemove, rolesToAdd } @@ -45,7 +45,7 @@ export default function roleManage(role: RoleType): { if (role === "manager") { const rolesToRemove = roles.filter( role => - role !== manager && role !== guildStaff && role !== guildRole, + role !== manager && role !== guildStaff && role !== guildRole ) const rolesToAdd = [manager, guildStaff, guildRole] return { rolesToRemove, rolesToAdd } @@ -54,7 +54,7 @@ export default function roleManage(role: RoleType): { if (role === "moderator") { const rolesToRemove = roles.filter( role => - role !== moderator && role !== guildStaff && role !== guildRole, + role !== moderator && role !== guildStaff && role !== guildRole ) const rolesToAdd = [moderator, guildStaff, guildRole] return { rolesToRemove, rolesToAdd } @@ -62,7 +62,7 @@ export default function roleManage(role: RoleType): { if (role === "beast") { const rolesToRemove = roles.filter( - role => role !== beast && role !== guildRole, + role => role !== beast && role !== guildRole ) const rolesToAdd = [beast, guildRole] return { rolesToRemove, rolesToAdd } @@ -70,7 +70,7 @@ export default function roleManage(role: RoleType): { if (role === "elite") { const rolesToRemove = roles.filter( - role => role !== elite && role !== guildRole, + role => role !== elite && role !== guildRole ) const rolesToAdd = [elite, guildRole] return { rolesToRemove, rolesToAdd } @@ -78,7 +78,7 @@ export default function roleManage(role: RoleType): { if (role === "member") { const rolesToRemove = roles.filter( - role => role !== member && role !== guildRole, + role => role !== member && role !== guildRole ) const rolesToAdd = [member, guildRole] return { rolesToRemove, rolesToAdd } From f34923e2c56b3bd9a18ee5730c4c2e9132f5d4b4 Mon Sep 17 00:00:00 2001 From: Taken Date: Fri, 19 Jan 2024 22:05:39 +0100 Subject: [PATCH 05/15] Updated guild command formatting --- src/commands/guild.ts | 28 ++--- src/commands/guild/info.ts | 222 +++++++++++++---------------------- src/commands/guild/member.ts | 193 ++++++++++++------------------ src/commands/guild/top.ts | 214 ++++++++++++--------------------- 4 files changed, 237 insertions(+), 420 deletions(-) diff --git a/src/commands/guild.ts b/src/commands/guild.ts index ecbb312..0c46f8b 100644 --- a/src/commands/guild.ts +++ b/src/commands/guild.ts @@ -33,9 +33,7 @@ export = { .addStringOption(option => option .setName("query") - .setDescription( - "The query to search for. [Default: player]" - ) + .setDescription("The query to search for. [Default: player]") .setRequired(true) ) .addStringOption(option => @@ -56,9 +54,7 @@ export = { .addStringOption(option => option .setName("query") - .setDescription( - "The query to search for. [Default: player]" - ) + .setDescription("The query to search for. [Default: player]") .setRequired(true) ) .addStringOption(option => @@ -74,9 +70,7 @@ export = { .addNumberOption(option => option .setName("amount") - .setDescription( - "The amount of guild members to show. [Default: 10]" - ) + .setDescription("The amount of guild members to show. [Default: 10]") ) ) .setDMPermission(false), @@ -101,16 +95,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/guild/info.ts b/src/commands/guild/info.ts index 034faa6..f45aecf 100644 --- a/src/commands/guild/info.ts +++ b/src/commands/guild/info.ts @@ -3,9 +3,7 @@ import { color, devMessage } from "config/options.json" import { ChatInputCommandInteraction } from "discord.js" import { GuildData } from "interfaces" -export default async function guildInfo( - interaction: ChatInputCommandInteraction -): Promise { +export default async function guildInfo(interaction: ChatInputCommandInteraction): Promise { await interaction.deferReply() const query = interaction.options.getString("query")! @@ -15,111 +13,91 @@ export default async function guildInfo( if (type === "ign") { await interaction.editReply({ - embeds: [ - { - description: "Fetching your uuid...", - color: embedColor - } - ] + embeds: [{ + description: "Fetching your uuid...", + color: embedColor + }] }) const uuid = await getUUID(query) if (!uuid) { interaction.editReply({ - embeds: [ - { - description: "That player doen't exist!", - color: embedColor - } - ] + embeds: [{ + description: "That player doen'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 player = await getPlayer(uuid) if (!player) { interaction.editReply({ - embeds: [ - { - description: "That player has never joined the server!", - color: embedColor - } - ] + embeds: [{ + description: "That player has never joined the server!", + color: embedColor + }] }) return } await interaction.editReply({ - embeds: [ - { - description: "Fetching your guild data...", - color: embedColor - } - ] + embeds: [{ + description: "Fetching your guild data...", + color: embedColor + }] }) guild = await getGuild(uuid, "player") if (!guild) { interaction.editReply({ - embeds: [ - { - description: "That player is not in a guild!", - color: embedColor - } - ] + embeds: [{ + description: "That player is not in a guild!", + color: embedColor + }] }) return } } else if (type === "name") { await interaction.editReply({ - embeds: [ - { - description: "Fetching your guild data...", - color: embedColor - } - ] + embeds: [{ + description: "Fetching your guild data...", + color: embedColor + }] }) guild = await getGuild(query, "name") if (!guild) { interaction.editReply({ - embeds: [ - { - description: "That guild doesn't exist!", - color: embedColor - } - ] + embeds: [{ + description: "That guild doesn't exist!", + color: embedColor + }] }) return } } else if (type === "id") { await interaction.editReply({ - embeds: [ - { - description: "Fetching your guild data...", - color: embedColor - } - ] + embeds: [{ + description: "Fetching your guild data...", + color: embedColor + }] }) guild = await getGuild(query, "id") if (!guild) { interaction.editReply({ - embeds: [ - { - description: "That guild doesn't exist!", - color: embedColor - } - ] + embeds: [{ + description: "That guild doesn't exist!", + color: embedColor + }] }) return } @@ -142,95 +120,57 @@ export default async function guildInfo( const guildCreatedSecond = guildCreated.getSeconds() const guildCreatedTime = - guildCreatedDate + - "." + - guildCreatedMonth + - "." + - guildCreatedYear + - " " + - guildCreatedHour + - ":" + - guildCreatedMinute + - ":" + + guildCreatedDate + "." + + guildCreatedMonth + "." + + guildCreatedYear + " " + + guildCreatedHour + ":" + + guildCreatedMinute + ":" + guildCreatedSecond const guildOwner = guildMembers.find(m => m.rank === "Guild Master")!.uuid const guildOwnerName = await getIGN(guildOwner) - const guildRanksUnsorted = guild!.ranks.sort( - (a, b) => b.priority - a.priority + const guildRanksUnsorted = guild!.ranks.sort((a, b) => b.priority - a.priority ) - const guildRanks = guildRanksUnsorted - .map(r => "**➺ " + r.name + "** `[" + r.tag + "]`") - .join("\n") + const guildRanks = guildRanksUnsorted.map(r => "**➺ " + r.name + "** `[" + r.tag + "]`").join("\n") - const allGuildMembersWeeklyXP = guildMembers.map( - member => member.expHistory - ) - const guildMembersWeeklyXP = allGuildMembersWeeklyXP.map(member => { - return Object.values(member).reduce((a, b) => a + b, 0) - }) + const allGuildMembersWeeklyXP = guildMembers.map(member => member.expHistory) + const guildMembersWeeklyXP = allGuildMembersWeeklyXP.map(member => { return Object.values(member).reduce((a, b) => a + b, 0) }) - const totalGuildMembersWeeklyXPUnformatted = guildMembersWeeklyXP.reduce( - (a, b) => a + b, - 0 - ) - const totalGuildMembersWeeklyXP = new Intl.NumberFormat("en-US").format( - totalGuildMembersWeeklyXPUnformatted - ) + const totalGuildMembersWeeklyXPUnformatted = guildMembersWeeklyXP.reduce((a, b) => a + b, 0) + const totalGuildMembersWeeklyXP = new Intl.NumberFormat("en-US").format(totalGuildMembersWeeklyXPUnformatted) - const averageGuildMembersWeeklyXPUnformatted = Math.round( - totalGuildMembersWeeklyXPUnformatted / 7 - ) - const averageGuildMembersWeeklyXP = new Intl.NumberFormat("en-US").format( - averageGuildMembersWeeklyXPUnformatted - ) + const averageGuildMembersWeeklyXPUnformatted = Math.round(totalGuildMembersWeeklyXPUnformatted / 7) + const averageGuildMembersWeeklyXP = new Intl.NumberFormat("en-US").format(averageGuildMembersWeeklyXPUnformatted) await interaction.editReply({ - embeds: [ - { - title: "**Info on** " + guildName, - description: - "**Guild Name: **`" + - guildName + - "`\n" + - "**Guild Tag: **`" + - guildTag + - "`\n" + - "**Guild Level: **`" + - guildLvl + - "`\n" + - "**Guild Owner: **`" + - guildOwnerName + - "`", - fields: [ - { - name: "**Guild Ranks**", - value: guildRanks - }, - { - name: "**GEXP**", - value: - "**➺ Total weekly GEXP:** `" + - totalGuildMembersWeeklyXP + - "`\n" + - "**➺ Daily avarage:** `" + - averageGuildMembersWeeklyXP + - "`\n" + - "**➺ Total GEXP:** `" + - guildExp + - "`" - }, - { - name: "**Guild Created**", - value: "**➺ **`" + guildCreatedTime + "`" - } - ], - color: embedColor, - footer: { - text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined + embeds: [{ + title: "**Info on** " + guildName, + description: "**Guild Name: **`" + guildName + "`\n" + + "**Guild Tag: **`" + guildTag + "`\n" + + "**Guild Level: **`" + guildLvl + "`\n" + + "**Guild Owner: **`" + guildOwnerName + "`", + fields: [ + { + name: "**Guild Ranks**", + value: guildRanks + }, + { + name: "**GEXP**", + value: + "**➺ Total weekly GEXP:** `" + totalGuildMembersWeeklyXP + "`\n" + + "**➺ Daily avarage:** `" + averageGuildMembersWeeklyXP + "`\n" + + "**➺ Total GEXP:** `" + guildExp + "`" + }, + { + name: "**Guild Created**", + value: "**➺ **`" + guildCreatedTime + "`" } + ], + color: embedColor, + footer: { + text: interaction.guild!.name + " | " + devMessage, + icon_url: interaction.guild!.iconURL() || undefined } - ] + }] }) } diff --git a/src/commands/guild/member.ts b/src/commands/guild/member.ts index 7f00b19..4c88e26 100644 --- a/src/commands/guild/member.ts +++ b/src/commands/guild/member.ts @@ -2,62 +2,52 @@ import { getUUID, getPlayer, getGuild, getHeadURL } from "utils/Hypixel" import { color, devMessage } from "config/options.json" import { ChatInputCommandInteraction } from "discord.js" -export default async function guildMember( - interaction: ChatInputCommandInteraction -): Promise { +export default async function guildMember(interaction: ChatInputCommandInteraction): Promise { await interaction.deferReply() const ign = interaction.options.getString("ign")! const embedColor = Number(color.replace("#", "0x")) 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: "This user does not exist", - color: embedColor - } - ] + embeds: [{ + description: "This user 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) if (!player) { await interaction.editReply({ - embeds: [ - { - description: "This user never logged on to hypixel", - color: embedColor, - thumbnail: { - url: head! - }, - footer: { - text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined - } + embeds: [{ + description: "This user never logged on to hypixel", + color: embedColor, + thumbnail: { + url: head! + }, + footer: { + text: interaction.guild!.name + " | " + devMessage, + icon_url: interaction.guild!.iconURL() || undefined } - ] + }] }) return } @@ -80,30 +70,26 @@ export default async function guildMember( } await interaction.editReply({ - embeds: [ - { - description: "Fetching your guild data...", - color: embedColor - } - ] + embeds: [{ + description: "Fetching your guild data...", + color: embedColor + }] }) const guild = await getGuild(uuid) if (!guild) { await interaction.editReply({ - embeds: [ - { - description: "This user is not in a guild", - color: embedColor, - thumbnail: { - url: head! - }, - footer: { - text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined - } + embeds: [{ + description: "This user is not in a guild", + color: embedColor, + thumbnail: { + url: head! + }, + footer: { + text: interaction.guild!.name + " | " + devMessage, + icon_url: interaction.guild!.iconURL() || undefined } - ] + }] }) return } @@ -116,30 +102,13 @@ export default async function guildMember( const guildRank = guildMember!.rank const memberGexp = guildMember!.expHistory const allDaysGexp = Object.keys(memberGexp).map(key => { - return ( - "**➺ " + - key + - ":** " + - "`" + - new Intl.NumberFormat("en-US").format(memberGexp[key]) + - "`" + - "\n" - ) + return ("**➺ " + key + ":** " + "`" + new Intl.NumberFormat("en-US").format(memberGexp[key]) + "`" + "\n") }) const expValue = allDaysGexp.join("") - const totalWeeklyGexpUnformatted = Object.values(memberGexp).reduce( - (a, b) => a + b, - 0 - ) - const totalWeeklyGexp = new Intl.NumberFormat("en-US").format( - totalWeeklyGexpUnformatted - ) - const averageWeeklyGexpUnformatted = Math.round( - totalWeeklyGexpUnformatted / 7 - ) - const averageWeeklyGexp = new Intl.NumberFormat("en-US").format( - averageWeeklyGexpUnformatted - ) + const totalWeeklyGexpUnformatted = Object.values(memberGexp).reduce((a, b) => a + b, 0) + const totalWeeklyGexp = new Intl.NumberFormat("en-US").format(totalWeeklyGexpUnformatted) + const averageWeeklyGexpUnformatted = Math.round(totalWeeklyGexpUnformatted / 7) + const averageWeeklyGexp = new Intl.NumberFormat("en-US").format(averageWeeklyGexpUnformatted) const guildMemberJoinMS = guildMember!.joined const guildMemberJoinTime = new Date(guildMemberJoinMS) @@ -151,58 +120,42 @@ export default async function guildMember( const guildMemberJoinSeconds = guildMemberJoinTime.getSeconds() const guildMemberJoin = - guildMemberJoinDate + - "." + - guildMemberJoinMonth + - "." + - guildMemberJoinYear + - " " + - guildMemberJoinHours + - ":" + - guildMemberJoinMinutes + - ":" + + guildMemberJoinDate + "." + + guildMemberJoinMonth + "." + + guildMemberJoinYear + " " + + guildMemberJoinHours + ":" + + guildMemberJoinMinutes + ":" + guildMemberJoinSeconds await interaction.editReply({ - embeds: [ - { - title: rank + displayName + guildTag, - description: - "**Guild Name:** `" + - guildName + - "`\n" + - "**Guild Rank:** `" + - guildRank + - "`\n", - color: embedColor, - thumbnail: { - url: head! + 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 }, - 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() || undefined + { + 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() || undefined } - ] + }] }) } diff --git a/src/commands/guild/top.ts b/src/commands/guild/top.ts index 33f2815..60ceae9 100644 --- a/src/commands/guild/top.ts +++ b/src/commands/guild/top.ts @@ -5,9 +5,7 @@ import { GuildData } from "interfaces" import Illegitimate from "utils/Illegitimate" const redis = Illegitimate.redis -export default async function guildTop( - interaction: ChatInputCommandInteraction -): Promise { +export default async function guildTop(interaction: ChatInputCommandInteraction): Promise { await interaction.deferReply() const query = interaction.options.getString("query")! @@ -18,123 +16,101 @@ export default async function guildTop( if (interaction.channel!.type === ChannelType.DM) { interaction.editReply({ - embeds: [ - { - description: "You can't use this command in DMs!", - color: embedColor - } - ] + embeds: [{ + description: "You can't use this command in DMs!", + color: embedColor + }] }) return } if (type === "ign") { await interaction.editReply({ - embeds: [ - { - description: "Fetching your uuid...", - color: embedColor - } - ] + embeds: [{ + description: "Fetching your uuid...", + color: embedColor + }] }) const uuid = await getUUID(query) if (!uuid) { interaction.editReply({ - embeds: [ - { - description: "That player doen't exist!", - color: embedColor - } - ] + embeds: [{ + description: "That player doen'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 player = await getPlayer(uuid) if (!player) { interaction.editReply({ - embeds: [ - { - description: "That player has never joined the server!", - color: embedColor - } - ] + embeds: [{ + description: "That player has never joined the server!", + color: embedColor + }] }) return } await interaction.editReply({ - embeds: [ - { - description: "Fetching your guild data...", - color: embedColor - } - ] + embeds: [{ + description: "Fetching your guild data...", + color: embedColor + }] }) guild = await getGuild(uuid, "player") if (!guild) { interaction.editReply({ - embeds: [ - { - description: "That player is not in a guild!", - color: embedColor - } - ] + embeds: [{ + description: "That player is not in a guild!", + color: embedColor + }] }) return } } else if (type === "name") { await interaction.editReply({ - embeds: [ - { - description: "Fetching your guild data...", - color: embedColor - } - ] + embeds: [{ + description: "Fetching your guild data...", + color: embedColor + }] }) guild = await getGuild(query, "name") if (!guild) { interaction.editReply({ - embeds: [ - { - description: "That guild doesn't exist!", - color: embedColor - } - ] + embeds: [{ + description: "That guild doesn't exist!", + color: embedColor + }] }) return } } else if (type === "id") { await interaction.editReply({ - embeds: [ - { - description: "Fetching your guild data...", - color: embedColor - } - ] + embeds: [{ + description: "Fetching your guild data...", + color: embedColor + }] }) guild = await getGuild(query, "id") if (!guild) { interaction.editReply({ - embeds: [ - { - description: "That guild doesn't exist!", - color: embedColor - } - ] + embeds: [{ + description: "That guild doesn't exist!", + color: embedColor + }] }) return } @@ -146,21 +122,13 @@ export default async function guildTop( const cachedData = await redis.get("guildTop+" + guildId) - const gexpTodayUnformatted = guildMembers - .map(member => { - return member.expHistory[Object.keys(member.expHistory)[0]] - }) - .reduce((a, b) => a + b, 0) - const gexpToday = new Intl.NumberFormat("en-US").format( - gexpTodayUnformatted - ) + const gexpTodayUnformatted = guildMembers.map(member => { + return member.expHistory[Object.keys(member.expHistory)[0]] + }).reduce((a, b) => a + b, 0) + const gexpToday = new Intl.NumberFormat("en-US").format(gexpTodayUnformatted) - const averageGuildMemberGEXPUnformatted = Math.floor( - gexpTodayUnformatted / guildMembers.length - ) - const averageGuildMemberGEXP = new Intl.NumberFormat("en-US").format( - averageGuildMemberGEXPUnformatted - ) + const averageGuildMemberGEXPUnformatted = Math.floor(gexpTodayUnformatted / guildMembers.length) + const averageGuildMemberGEXP = new Intl.NumberFormat("en-US").format(averageGuildMemberGEXPUnformatted) const allMembersDailyGEXP = guildMembers.map(member => { return { @@ -184,24 +152,15 @@ export default async function guildTop( let guildData: GuildTopData = [] const fieldsValueRaw: string[] = [] const allMembersSorted = allMembersDailyGEXP.sort((a, b) => b.gexp - a.gexp) - const allMembersSortedUUIDArray = allMembersSorted.map(member => { - return member.uuid - }) + const allMembersSortedUUIDArray = allMembersSorted.map(member => { return member.uuid }) if (!cachedData) { cacheStatus = false await interaction.editReply({ - embeds: [ - { - description: - "Fetching the top " + - amount + - " members of " + - guildName + - "...", - color: embedColor - } - ] + embeds: [{ + description: "Fetching the top " + amount + " members of " + guildName + "...", + color: embedColor + }] }) for (let i = 0; i < allMembersSortedUUIDArray.length; i++) { @@ -214,26 +173,14 @@ export default async function guildTop( }) } - await redis.set( - "guildTop+" + guildId, - JSON.stringify(guildData), - "EX", - 60 * 30 - ) + await redis.set("guildTop+" + guildId, JSON.stringify(guildData), "EX", 60 * 30) } else { cacheStatus = true await interaction.editReply({ - embeds: [ - { - description: - "Fetching the top " + - amount + - " members of " + - guildName + - "using cache...", - color: embedColor - } - ] + embeds: [{ + description: "Fetching the top " + amount + " members of " + guildName + "using cache...", + color: embedColor + }] }) guildData = JSON.parse(cachedData) } @@ -243,18 +190,14 @@ export default async function guildTop( for (let i = 0; i < amount; i++) { const gexp = new Intl.NumberFormat("en-US").format(topMembers[i].gexp) - const ign = guildData.find( - member => member.uuid === topMembers[i].uuid - )?.ign + const ign = guildData.find(member => member.uuid === topMembers[i].uuid)?.ign const position = i + 1 fieldsValueRaw.push("**#" + position + " " + ign + ":** `" + gexp + "`") } - const list = Array.from({ length: sliceSize }, (_, i) => - fieldsValueRaw.slice(i * sliceSize, (i + 1) * sliceSize) - ) + const list = Array.from({ length: sliceSize }, (_, i) => fieldsValueRaw.slice(i * sliceSize, (i + 1) * sliceSize)) const newList: NewList = [] list.forEach((item, index) => { @@ -270,27 +213,16 @@ export default async function guildTop( const cacheStatusText = cacheStatus ? " | [Cache]" : "" await interaction.editReply({ - embeds: [ - { - title: "Top members of " + guildName, - description: - "**Total daily GEXP:** `" + - gexpToday + - "`\n" + - "**Average guild memeber GEXP:** `" + - averageGuildMemberGEXP + - "`", - color: embedColor, - fields: newList, - footer: { - text: - interaction.guild!.name + - " | " + - devMessage + - cacheStatusText, - icon_url: interaction.guild!.iconURL() || undefined - } + embeds: [{ + title: "Top members of " + guildName, + description: "**Total daily GEXP:** `" + gexpToday + "`\n" + + "**Average guild memeber GEXP:** `" + averageGuildMemberGEXP + "`", + color: embedColor, + fields: newList, + footer: { + text: interaction.guild!.name + " | " + devMessage + cacheStatusText, + icon_url: interaction.guild!.iconURL() || undefined } - ] + }] }) } From a3791d170ceded22e2a47dc849417313acc2b978 Mon Sep 17 00:00:00 2001 From: Taken Date: Sat, 20 Jan 2024 17:19:08 +0100 Subject: [PATCH 06/15] 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" From e60523c7b61769cb15798d9e71769e56bcf9cd0b Mon Sep 17 00:00:00 2001 From: Taken Date: Sat, 20 Jan 2024 17:22:23 +0100 Subject: [PATCH 07/15] Saved one file and removed prettier --- package.json | 2 -- src/commands/update.ts | 3 +-- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/package.json b/package.json index d4c5bfb..877a365 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,6 @@ "dev:js": "nodemon --config nodemon-js.json dist/index.js", "dev:build": "ts-node scripts/dev-deploy.ts", "dev:delete": "ts-node scripts/delete-commands.ts", - "format": "prettier --write src/", "lint": "eslint src", "lint:fix": "eslint --fix src", "prod:build": "ts-node scripts/deploy-commands.ts" @@ -35,7 +34,6 @@ "@typescript-eslint/eslint-plugin": "^6.18.1", "@typescript-eslint/parser": "^6.18.1", "eslint": "^8.56.0", - "prettier": "^3.2.1", "ts-node": "^10.9.2", "typescript": "^5.3.3" } diff --git a/src/commands/update.ts b/src/commands/update.ts index 54c868e..26b7f09 100644 --- a/src/commands/update.ts +++ b/src/commands/update.ts @@ -126,8 +126,7 @@ export = { await interaction.editReply({ embeds: [{ - description: - "Updated your roles to `" + replyRank + "`", + description: "Updated your roles to `" + replyRank + "`", color: embedColor, thumbnail: { url: head! From 631581574c769f51f0c4f07aa6e803f33b7e75e7 Mon Sep 17 00:00:00 2001 From: Taken Date: Sat, 20 Jan 2024 17:34:25 +0100 Subject: [PATCH 08/15] Updated formatting on modals and autocomplete --- src/components/autocomplete/unban.ts | 16 +-- src/components/modals/denyreasonbox.ts | 33 ++---- src/components/modals/staffdenyreasonbox.ts | 49 +++------ src/components/modals/verifyModal.ts | 108 ++++++-------------- 4 files changed, 60 insertions(+), 146 deletions(-) diff --git a/src/components/autocomplete/unban.ts b/src/components/autocomplete/unban.ts index 8597051..192f834 100644 --- a/src/components/autocomplete/unban.ts +++ b/src/components/autocomplete/unban.ts @@ -9,21 +9,15 @@ export = { if (focusedOption.name !== "user") return if (focusedOption.value === "") { - await interaction.respond([ - { - name: "Please start typing a username to unban", - value: "none" - } - ]) + await interaction.respond([{ + name: "Please start typing a username to unban", + value: "none" + }]) return } const bannedUsers = await interaction.guild!.bans.fetch() - const filteredUsers = bannedUsers.filter(user => - user.user.username - .toLowerCase() - .includes(focusedOption.value.toLowerCase()) - ) + const filteredUsers = bannedUsers.filter(user => user.user.username.toLowerCase().includes(focusedOption.value.toLowerCase())) const results = filteredUsers.map(user => ({ name: user.user.username, diff --git a/src/components/modals/denyreasonbox.ts b/src/components/modals/denyreasonbox.ts index 869b18d..a4eb0d0 100644 --- a/src/components/modals/denyreasonbox.ts +++ b/src/components/modals/denyreasonbox.ts @@ -1,11 +1,4 @@ -import { - EmbedBuilder, - ActionRowBuilder, - ButtonBuilder, - ButtonStyle, - Message, - GuildMember -} from "discord.js" +import { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, Message, GuildMember } from "discord.js" import { color } from "config/options.json" import guildapp from "schemas/guildAppSchema" import { Modal } from "interfaces" @@ -22,9 +15,7 @@ export = { const embed = message.embeds[0] const applicantId = embed.footer!.text.split(" ")[1] - const reason = - interaction.fields.fields.get("denyreason")!.value || - "No reason provided" + const reason = interaction.fields.fields.get("denyreason")!.value || "No reason provided" const embedColor = Number(color.replace("#", "0x")) await message.edit({ @@ -57,29 +48,19 @@ export = { } const dmMessage = new EmbedBuilder() - .setDescription( - "Your application for the Illegitimate guild has been denied\n" + - "**Reason:** `" + - reason + - "`" + .setDescription("Your application for the Illegitimate guild has been denied\n" + + "**Reason:** `" + reason + "`" ) .setColor(embedColor) const missingUser = new EmbedBuilder() - .setDescription( - "[WARN] User has left the server and cannot be notified." - ) + .setDescription("[WARN] User has left the server and cannot be notified.") .setColor(embedColor) const responseEmbed = new EmbedBuilder() .setTitle("Application Denied") - .setDescription( - "The application has been denied by <@" + - interaction.user.id + - ">.\n" + - "**Reason:** `" + - reason + - "`" + .setDescription("The application has been denied by <@" + interaction.user.id + ">.\n" + + "**Reason:** `" + reason + "`" ) .setColor(embedColor) .setThumbnail(guild.iconURL() || "") diff --git a/src/components/modals/staffdenyreasonbox.ts b/src/components/modals/staffdenyreasonbox.ts index c16aa89..c822a0b 100644 --- a/src/components/modals/staffdenyreasonbox.ts +++ b/src/components/modals/staffdenyreasonbox.ts @@ -1,9 +1,4 @@ -import { - EmbedBuilder, - ActionRowBuilder, - ButtonBuilder, - ButtonStyle -} from "discord.js" +import { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } from "discord.js" import { color } from "config/options.json" import staffapp from "schemas/staffAppSchema" import { Modal } from "interfaces" @@ -16,9 +11,7 @@ export = { await interaction.deferReply() const guild = interaction.guild - const reason = - interaction.fields.fields.get("staffdenyreason")!.value || - "No reason provided" + const reason = interaction.fields.fields.get("staffdenyreason")!.value || "No reason provided" const embedColor = Number(color.replace("#", "0x")) const message = interaction.message! @@ -44,11 +37,8 @@ export = { }) const dmMessage = new EmbedBuilder() - .setDescription( - "Your application for the Illegitimate guild staff has been denied\n" + - "**Reason:** `" + - reason + - "`" + .setDescription("Your application for the Illegitimate guild staff has been denied\n" + + "**Reason:** `" + reason + "`" ) .setColor(embedColor) @@ -57,26 +47,19 @@ export = { await staffapp.findOneAndDelete({ userID: applicantId }) await interaction.editReply({ - embeds: [ - { - title: "Application Denied", - description: - "The application has been denied by <@" + - interaction.user.id + - ">.\n" + - "**Reason:** `" + - reason + - "`", - color: embedColor, - thumbnail: { - url: applicant.avatarURL() || "" - }, - footer: { - icon_url: guild!.iconURL() || undefined, - text: "ID: " + applicant.id - } + embeds: [{ + title: "Application Denied", + description: "The application has been denied by <@" + interaction.user.id + ">.\n" + + "**Reason:** `" + reason + "`", + color: embedColor, + thumbnail: { + url: applicant.avatarURL() || "" + }, + footer: { + icon_url: guild!.iconURL() || undefined, + text: "ID: " + applicant.id } - ] + }] }) } } as Modal diff --git a/src/components/modals/verifyModal.ts b/src/components/modals/verifyModal.ts index 58a085b..0ed73db 100644 --- a/src/components/modals/verifyModal.ts +++ b/src/components/modals/verifyModal.ts @@ -2,17 +2,7 @@ import { getUUID, getPlayer, getGuild, getHeadURL } from "utils/Hypixel" import { color, hypixelGuildID, devMessage } from "config/options.json" import verify from "schemas/verifySchema" import mongoose from "mongoose" -import { - gm, - manager, - moderator, - beast, - elite, - member, - guildRole, - guildStaff, - defaultMember -} from "config/roles.json" +import { gm, manager, moderator, beast, elite, member, guildRole, guildStaff, defaultMember } from "config/roles.json" import { Modal } from "interfaces" import { GuildMember } from "discord.js" @@ -29,23 +19,17 @@ export = { const verifyData = await verify.findOne({ userID: user.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 } 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 } @@ -54,13 +38,10 @@ export = { 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 } @@ -75,38 +56,22 @@ export = { const linkedDiscord = player?.socialMedia?.links?.DISCORD 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 } @@ -121,9 +86,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" && guildID === hypixelGuildID) { await user.roles.add(gm, "Verification") @@ -169,25 +132,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 } - ] + }] }) } } From 5ce69eced32e2bd325082aadb5b157a416fd1cfb Mon Sep 17 00:00:00 2001 From: Taken Date: Sat, 20 Jan 2024 20:43:12 +0100 Subject: [PATCH 09/15] Fixed formatting on button files --- src/components/buttons/checkstats.ts | 179 +-- .../buttons/guildapplicationaccept.ts | 85 +- .../buttons/guildapplicationdeny.ts | 11 +- src/components/buttons/guildapply.ts | 1023 ++++++++--------- src/components/buttons/guildinactivitylog.ts | 248 ++-- .../buttons/staffapplicationaccept.ts | 38 +- .../buttons/staffapplicationdeny.ts | 11 +- src/components/buttons/staffapply.ts | 336 +++--- src/components/buttons/verify.ts | 7 +- src/components/buttons/waitingListUpdate.ts | 26 +- 10 files changed, 802 insertions(+), 1162 deletions(-) diff --git a/src/components/buttons/checkstats.ts b/src/components/buttons/checkstats.ts index c8d2708..0bf17d3 100644 --- a/src/components/buttons/checkstats.ts +++ b/src/components/buttons/checkstats.ts @@ -1,22 +1,7 @@ import { color, devMessage } from "config/options.json" import guildapp from "schemas/guildAppSchema" -import { - bwfkdr, - bwstars, - bwwins, - swstars, - swkdr, - duelswins, - duelswlr -} from "config/reqs.json" -import { - hypixelLevel, - bedwarsLevel, - skywarsLevel, - getPlayer, - getGuild, - getHeadURL -} from "utils/Hypixel" +import { bwfkdr, bwstars, bwwins, swstars, swkdr, duelswins, duelswlr } from "config/reqs.json" +import { hypixelLevel, bedwarsLevel, skywarsLevel, getPlayer, getGuild, getHeadURL } from "utils/Hypixel" import { Button } from "interfaces" export = { @@ -36,13 +21,10 @@ export = { 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 } @@ -97,149 +79,102 @@ export = { }) } 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 < bwstars || - hsbwfkdr < bwfkdr || - hsbwwins < bwwins - ) { - bwtitle = - " This player does not meet the BedWars requirements." + if (hsbwstars < bwstars || hsbwfkdr < bwfkdr || 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() + - " / " + - bwstars.toString() + - "`\n" + - "**➺ FKDR:** `" + - hsbwfkdr.toFixed(2).toString() + - " / " + - bwfkdr.toString() + - "`\n" + - "**➺ Wins:** `" + - hsbwwins.toString() + - " / " + - bwwins.toString() + - "`" + value: "**➺ Stars:** `" + hsbwstars.toFixed(2).toString() + + " / " + bwstars.toString() + "`\n" + + "**➺ FKDR:** `" + hsbwfkdr.toFixed(2).toString() + + " / " + bwfkdr.toString() + "`\n" + + "**➺ Wins:** `" + hsbwwins.toString() + + " / " + bwwins.toString() + "`" }) } 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 - const hsswwins = player.stats?.SkyWars?.wins || 0 let swtitle = "" if (hsswstars < swstars || hsswkd < swkdr) { - 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() + - " / " + - swstars.toString() + - "`\n" + - "**➺ KDR:** `" + - hsswkd.toFixed(2).toString() + - " / " + - swkdr.toString() + - "`\n" + - "**➺ Wins:** `" + - hsswwins.toString() + - "`" + value: "**➺ Stars:** `" + hsswstars.toFixed(2).toString() + + " / " + swstars.toString() + "`\n" + + "**➺ KDR:** `" + hsswkd.toFixed(2).toString() + + " / " + swkdr.toString() + "`\n" + + "**➺ Wins:** `" + hsswwins.toString() + "`" }) } if (player.stats.Duels) { - const hsduelskills = player.stats?.Duels?.kills || 0 - const hsduelsdeaths = player.stats?.Duels?.deaths || 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 hsduelswins = player.stats?.Duels?.wins || 0 - const hsduelslosses = player.stats?.Duels?.losses || 0 const hsduelswlr = hsduelswins / hsduelslosses let duelstitle = "" if (hsduelswins < duelswins || 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() + - " / " + - duelswins.toString() + - "`\n" + - "**➺ WLR:** `" + - hsduelswlr.toFixed(2).toString() + - " / " + - duelswlr.toString() + - "`\n" + - "**➺ KDR:** `" + - hsduelskd.toFixed(2).toString() + - "`" + value: "**➺ Wins:** `" + hsduelswins.toString() + + " / " + duelswins.toString() + "`\n" + + "**➺ WLR:** `" + hsduelswlr.toFixed(2).toString() + + " / " + duelswlr.toString() + "`\n" + + "**➺ KDR:** `" + hsduelskd.toFixed(2).toString() + "`" }) } } // 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 + - "`\n" + - "**Guild Rank:** `" + - guildRank + - "`", - 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 + "`\n" + + "**Guild Rank:** `" + guildRank + "`", + color: embedColor, + thumbnail: { + url: head! + }, + footer: { + text: interaction.guild!.name + " | " + devMessage, + icon_url: interaction.guild!.iconURL() || undefined + }, + fields: statsFields + }] }) } } as Button diff --git a/src/components/buttons/guildapplicationaccept.ts b/src/components/buttons/guildapplicationaccept.ts index 42cad9e..cc93bb9 100644 --- a/src/components/buttons/guildapplicationaccept.ts +++ b/src/components/buttons/guildapplicationaccept.ts @@ -1,15 +1,5 @@ -import { - ActionRowBuilder, - ButtonStyle, - ButtonBuilder, - TextChannel -} from "discord.js" -import { - color, - waitingListChannel, - waitingListMessage, - hypixelGuildID -} from "config/options.json" +import { ActionRowBuilder, ButtonStyle, ButtonBuilder, TextChannel } from "discord.js" +import { color, waitingListChannel, waitingListMessage, hypixelGuildID } from "config/options.json" import colorLog from "utils/functions/colors" import mongoose from "mongoose" import guildapp from "schemas/guildAppSchema" @@ -35,8 +25,7 @@ export = { const applicantIGN = embed.fields[0].value.replaceAll("`", "") const applicant = await guild.members.fetch(applicantId) - const applicantUsername = - applicant.user.username + "#" + applicant.user.discriminator + const applicantUsername = applicant.user.username + "#" + applicant.user.discriminator await message.edit({ components: [ @@ -61,14 +50,11 @@ export = { }) await applicant.send({ - embeds: [ - { - description: - "Your application for the Illegitimate guild has been accepted.\n\n" + - "Make sure to leave your current guild so that we can invite you.", - color: embedColor - } - ] + embeds: [{ + description: "Your application for the Illegitimate guild has been accepted.\n\n" + + "Make sure to leave your current guild so that we can invite you.", + color: embedColor + }] }) const applicantEntry = await guildapp.findOne({ userID: applicantId }) @@ -89,28 +75,23 @@ export = { await guildapp.findOneAndDelete({ userID: applicantId }) await interaction.editReply({ - embeds: [ - { - title: applicantUsername + " - Guild Application", - description: - "Application has been accepted by <@" + user.id + ">.", - color: embedColor, - thumbnail: { - url: applicant.avatarURL() || "" - }, - footer: { - icon_url: guild.iconURL() || undefined, - text: "ID: " + applicant.id - } + embeds: [{ + title: applicantUsername + " - Guild Application", + description: "Application has been accepted by <@" + user.id + ">.", + color: embedColor, + thumbnail: { + url: applicant.avatarURL() || "" + }, + footer: { + icon_url: guild.iconURL() || undefined, + text: "ID: " + applicant.id } - ] + }] }) if (process.env.NODE_ENV === "dev") return try { - const channel = guild.channels.cache.get( - waitingListChannel - ) as TextChannel + const channel = guild.channels.cache.get(waitingListChannel) as TextChannel const wlmessage = await channel!.messages.fetch(waitingListMessage) const wlembed = wlmessage.embeds[0] @@ -138,20 +119,18 @@ export = { } await wlmessage.edit({ - embeds: [ - { - title: wlembed.title!, - description: wlembed.description!, - color: wlembed.color!, - footer: { - text: "Last updated by " + user.username, - icon_url: user.avatarURL() || undefined - }, - thumbnail: wlembed.thumbnail!, - fields: fields, - timestamp: new Date().toISOString() - } - ] + embeds: [{ + title: wlembed.title!, + description: wlembed.description!, + color: wlembed.color!, + footer: { + text: "Last updated by " + user.username, + icon_url: user.avatarURL() || undefined + }, + thumbnail: wlembed.thumbnail!, + fields: fields, + timestamp: new Date().toISOString() + }] }) } catch (err) { console.log( diff --git a/src/components/buttons/guildapplicationdeny.ts b/src/components/buttons/guildapplicationdeny.ts index 5cc6ab4..5d55c21 100644 --- a/src/components/buttons/guildapplicationdeny.ts +++ b/src/components/buttons/guildapplicationdeny.ts @@ -1,9 +1,4 @@ -import { - ModalBuilder, - ActionRowBuilder, - TextInputBuilder, - TextInputStyle -} from "discord.js" +import { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } from "discord.js" import { Button } from "interfaces" export = { @@ -20,9 +15,7 @@ export = { .setLabel("Deny Reason") .setCustomId("denyreason") .setStyle(TextInputStyle.Paragraph) - .setPlaceholder( - "Enter a reason for denying the application" - ) + .setPlaceholder("Enter a reason for denying the application") .setRequired(false) ) ) diff --git a/src/components/buttons/guildapply.ts b/src/components/buttons/guildapply.ts index 7a26084..d61d8b2 100644 --- a/src/components/buttons/guildapply.ts +++ b/src/components/buttons/guildapply.ts @@ -1,11 +1,4 @@ -import { - ButtonBuilder, - ButtonStyle, - ActionRowBuilder, - EmbedBuilder, - GuildMember, - TextChannel -} from "discord.js" +import { ButtonBuilder, ButtonStyle, ActionRowBuilder, EmbedBuilder, GuildMember, TextChannel } from "discord.js" import { color } from "config/options.json" import { largeM, smallM, ignM } from "config/limitmessages.json" import { applicationsChannel } from "config/options.json" @@ -21,6 +14,7 @@ export = { description: "Guild application button.", async execute(interaction) { + await interaction.deferReply({ ephemeral: true }) const user = interaction.member as GuildMember const guild = interaction.guild! const embedColor = Number(color.replace("#", "0x")) @@ -35,575 +29,484 @@ export = { return guildQuestions[n - 1].r } - if (interaction.customId === "guildapply") { - await interaction.deferReply({ ephemeral: true }) + if (userRoles.includes(guildRole)) { + await interaction.editReply("You are already a member of the guild.") + return + } - if (userRoles.includes(guildRole)) { - await interaction.editReply( - "You are already a member of the guild." - ) - return - } + const application = await guildapp.findOne({ userID: user.user.id }) - const application = await guildapp.findOne({ userID: user.user.id }) + if (application) { + await interaction.editReply("You already have an application in progress.") + return + } - if (application) { - await interaction.editReply( - "You already have an application in progress." - ) - return - } + const tooLong = new EmbedBuilder() + .setDescription("You took too long to respond.") + .setColor(embedColor) + const cancelled = new EmbedBuilder() + .setDescription("You have cancelled your application.") + .setColor(embedColor) + const attachments = new EmbedBuilder() + .setDescription("You have uploaded an attachment. Please do not upload images, videos, or GIFS.") + .setColor(embedColor) - const tooLong = new EmbedBuilder() - .setDescription("You took too long to respond.") - .setColor(embedColor) - const cancelled = new EmbedBuilder() - .setDescription("You have cancelled your application.") - .setColor(embedColor) - const attachments = new EmbedBuilder() - .setDescription( - "You have uploaded an attachment. Please do not upload images, videos, or GIFS." - ) - .setColor(embedColor) - - try { - await user.send({ - embeds: [ - { - title: "Guild Application", - description: - "If you wish to proceed with your application, please type `yes` otherwise type `cancel`.\n\n" + - "**Do not upload images, videos, or GIFS.**\n" + - "You have a minute to respond to this message.", - color: embedColor - } - ] - }) - } catch (error) { - await interaction.editReply("Please enable your DMs.") - return - } - - await interaction.editReply("Please check your DMs.") - - const input = await user.dmChannel!.awaitMessages({ - filter: m => m.author.id === user.user.id, - max: 1, - time: 1000 * 60 - }) - if (input.size === 0) { - await user.send({ embeds: [tooLong] }) - return - } - if (input.first()!.content.toLowerCase() !== "yes") { - await user.send({ embeds: [cancelled] }) - return - } - if (input.first()!.attachments.size > 0) { - await user.send({ embeds: [attachments] }) - return - } - - // first question + try { await user.send({ - embeds: [ - { - title: "**Question 1**", - description: - qu(1) + - "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + - ignM + - "`", - color: embedColor, - footer: { - text: "You have 5 minutes to respond to this message." - } - } - ] + embeds: [{ + title: "Guild Application", + description: "If you wish to proceed with your application, please type `yes` otherwise type `cancel`.\n\n" + + "**Do not upload images, videos, or GIFS.**\n" + + "You have a minute to respond to this message.", + color: embedColor + }] }) - const answer1 = await user.dmChannel!.awaitMessages({ - filter: m => m.author.id === user.user.id, - max: 1, - time: 1000 * 60 * 5 - }) - if (answer1.size === 0) { - await user.send({ embeds: [tooLong] }) - return - } - if (answer1.first()!.content.toLowerCase() === "cancel") { - await user.send({ embeds: [cancelled] }) - return - } - if (answer1.first()!.attachments.size > 0) { - await user.send({ embeds: [attachments] }) - return - } - if (answer1.first()!.content.length > 16) { - await user.send({ - embeds: [ - { - description: "Max character limit is 16.", - color: embedColor - } - ] - }) - return - } - const uuid = await getUUID(answer1.first()!.content) - if (!uuid) { - await user.send({ - embeds: [ - { - description: - "That is not a valid Minecraft username.\n" + - "Application cancelled.", - color: embedColor - } - ] - }) - return - } - const answer1_1 = answer1.first()!.content + } catch (error) { + await interaction.editReply("Please enable your DMs.") + return + } - // second question + await interaction.editReply("Please check your DMs.") + + const input = await user.dmChannel!.awaitMessages({ + filter: m => m.author.id === user.user.id, + max: 1, + time: 1000 * 60 + }) + if (input.size === 0) { + await user.send({ embeds: [tooLong] }) + return + } + if (input.first()!.content.toLowerCase() !== "yes") { + await user.send({ embeds: [cancelled] }) + return + } + if (input.first()!.attachments.size > 0) { + await user.send({ embeds: [attachments] }) + return + } + + // first question + await user.send({ + embeds: [{ + title: "**Question 1**", + description: qu(1) + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + ignM + "`", + color: embedColor, + footer: { + text: "You have 5 minutes to respond to this message." + } + }] + }) + const answer1 = await user.dmChannel!.awaitMessages({ + filter: m => m.author.id === user.user.id, + max: 1, + time: 1000 * 60 * 5 + }) + if (answer1.size === 0) { + await user.send({ embeds: [tooLong] }) + return + } + if (answer1.first()!.content.toLowerCase() === "cancel") { + await user.send({ embeds: [cancelled] }) + return + } + if (answer1.first()!.attachments.size > 0) { + await user.send({ embeds: [attachments] }) + return + } + if (answer1.first()!.content.length > 16) { await user.send({ - embeds: [ - { - title: "**Question 2**", - description: - qu(2) + - "\n\nPlease type your answer below or type `cancel` to cancel your application.\n" + - "`(8 characters max)`", - color: embedColor, - footer: { - text: "You have 15 minutes to respond to this message." - } - } - ] + embeds: [{ + description: "Max character limit is 16.", + color: embedColor + }] }) - const answer2 = await user.dmChannel!.awaitMessages({ - filter: m => m.author.id === user.user.id, - max: 1, - time: 1000 * 60 * 15 - }) - if (answer2.size === 0) { - await user.send({ embeds: [tooLong] }) - return - } - if (answer2.first()!.content.toLowerCase() === "cancel") { - await user.send({ embeds: [cancelled] }) - return - } - if (answer2.first()!.attachments.size > 0) { - await user.send({ embeds: [attachments] }) - return - } - if (answer2.first()!.content.length > 8) { - await user.send({ - embeds: [ - { - description: "Max character limit is 8.", - color: embedColor - } - ] - }) - return - } - const answer2_1 = answer2.first()!.content - - // third question + return + } + const uuid = await getUUID(answer1.first()!.content) + if (!uuid) { await user.send({ - embeds: [ - { - title: "**Question 3**", - description: - qu(3) + - "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + - smallM + - "`", - color: embedColor, - footer: { - text: "You have 15 minutes to respond to this message." - } - } - ] + embeds: [{ + description: "That is not a valid Minecraft username.\n" + + "Application cancelled.", + color: embedColor + }] }) - const answer3 = await user.dmChannel!.awaitMessages({ - filter: m => m.author.id === user.user.id, - max: 1, - time: 1000 * 60 * 15 - }) - if (answer3.size === 0) { - await user.send({ embeds: [tooLong] }) - return - } - if (answer3.first()!.content.toLowerCase() === "cancel") { - await user.send({ embeds: [cancelled] }) - return - } - if (answer3.first()!.attachments.size > 0) { - await user.send({ embeds: [attachments] }) - return - } - if (answer3.first()!.content.length > 128) { - await user.send({ - embeds: [ - { - description: "Max character limit is 128.", - color: embedColor - } - ] - }) - } - const answer3_1 = answer3.first()!.content + return + } + const answer1_1 = answer1.first()!.content - // fourth question + // second question + await user.send({ + embeds: [{ + title: "**Question 2**", + description: qu(2) + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n" + "`(8 characters max)`", + color: embedColor, + footer: { + text: "You have 15 minutes to respond to this message." + } + }] + }) + const answer2 = await user.dmChannel!.awaitMessages({ + filter: m => m.author.id === user.user.id, + max: 1, + time: 1000 * 60 * 15 + }) + if (answer2.size === 0) { + await user.send({ embeds: [tooLong] }) + return + } + if (answer2.first()!.content.toLowerCase() === "cancel") { + await user.send({ embeds: [cancelled] }) + return + } + if (answer2.first()!.attachments.size > 0) { + await user.send({ embeds: [attachments] }) + return + } + if (answer2.first()!.content.length > 8) { await user.send({ - embeds: [ - { - title: "**Question 4**", - description: - qu(4) + - "\n\nPlease type your answer below or type `cancel` to cancel your application." + - " `(We expect a longer answer.)`\n`" + - largeM + - "`", - color: embedColor, - footer: { - text: "You have 15 minutes to respond to this message." - } - } - ] + embeds: [{ + description: "Max character limit is 8.", + color: embedColor + }] }) - const answer4 = await user.dmChannel!.awaitMessages({ - filter: m => m.author.id === user.user.id, - max: 1, - time: 1000 * 60 * 15 - }) - if (answer4.size === 0) { - await user.send({ embeds: [tooLong] }) - return - } - if (answer4.first()!.content.toLowerCase() === "cancel") { - await user.send({ embeds: [cancelled] }) - return - } - if (answer4.first()!.attachments.size > 0) { - await user.send({ embeds: [attachments] }) - return - } - if (answer4.first()!.content.length > 256) { - await user.send({ - embeds: [ - { - description: "Max character limit is 256.", - color: embedColor - } - ] - }) - } - const answer4_1 = answer4.first()!.content + return + } + const answer2_1 = answer2.first()!.content - // fifth question + // third question + await user.send({ + embeds: [{ + title: "**Question 3**", + description: qu(3) + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + smallM + "`", + color: embedColor, + footer: { + text: "You have 15 minutes to respond to this message." + } + }] + }) + const answer3 = await user.dmChannel!.awaitMessages({ + filter: m => m.author.id === user.user.id, + max: 1, + time: 1000 * 60 * 15 + }) + if (answer3.size === 0) { + await user.send({ embeds: [tooLong] }) + return + } + if (answer3.first()!.content.toLowerCase() === "cancel") { + await user.send({ embeds: [cancelled] }) + return + } + if (answer3.first()!.attachments.size > 0) { + await user.send({ embeds: [attachments] }) + return + } + if (answer3.first()!.content.length > 128) { await user.send({ - embeds: [ - { - title: "**Question 5**", - description: - qu(5) + - "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + - smallM + - "`", - color: embedColor, - footer: { - text: "You have 15 minutes to respond to this message." - } - } - ] - }) - const answer5 = await user.dmChannel!.awaitMessages({ - filter: m => m.author.id === user.user.id, - max: 1, - time: 1000 * 60 * 15 - }) - if (answer5.size === 0) { - await user.send({ embeds: [tooLong] }) - return - } - if (answer5.first()!.content.toLowerCase() === "cancel") { - await user.send({ embeds: [cancelled] }) - return - } - if (answer5.first()!.attachments.size > 0) { - await user.send({ embeds: [attachments] }) - return - } - if (answer5.first()!.content.length > 128) { - await user.send({ - embeds: [ - { - description: "Max character limit is 128.", - color: embedColor - } - ] - }) - } - const answer5_1 = answer5.first()!.content - - // sixth question - await user.send({ - embeds: [ - { - title: "**Question 6**", - description: - qu(6) + - "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + - largeM + - "`", - color: embedColor, - footer: { - text: "You have 15 minutes to respond to this message." - } - } - ] - }) - const answer6 = await user.dmChannel!.awaitMessages({ - filter: m => m.author.id === user.user.id, - max: 1, - time: 1000 * 60 * 15 - }) - if (answer6.size === 0) { - await user.send({ embeds: [tooLong] }) - return - } - if (answer6.first()!.content.toLowerCase() === "cancel") { - await user.send({ embeds: [cancelled] }) - return - } - if (answer6.first()!.attachments.size > 0) { - await user.send({ embeds: [attachments] }) - return - } - if (answer6.first()!.content.length > 256) { - await user.send({ - embeds: [ - { - description: "Max character limit is 256.", - color: embedColor - } - ] - }) - } - const answer6_1 = answer6.first()!.content - - // seventh question - await user.send({ - embeds: [ - { - title: "**Question 7**", - description: - qu(7) + - "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + - smallM + - "`", - color: embedColor, - footer: { - text: "You have 15 minutes to respond to this message." - } - } - ] - }) - const answer7 = await user.dmChannel!.awaitMessages({ - filter: m => m.author.id === user.user.id, - max: 1, - time: 1000 * 60 * 15 - }) - if (answer7.size === 0) { - await user.send({ embeds: [tooLong] }) - return - } - if (answer7.first()!.content.toLowerCase() === "cancel") { - await user.send({ embeds: [cancelled] }) - return - } - if (answer7.first()!.attachments.size > 0) { - await user.send({ embeds: [attachments] }) - return - } - if (answer7.first()!.content.length > 128) { - await user.send({ - embeds: [ - { - description: "Max character limit is 128.", - color: embedColor - } - ] - }) - } - const answer7_1 = answer7!.first()!.content - - // eighth question - await user.send({ - embeds: [ - { - title: "**Question 8**", - description: - qu(8) + - "\n\nPlease type your answer below or type `cancel` to cancel your application.\n" + - "`(64 characters max)`", - color: embedColor, - footer: { - text: "You have 15 minutes to respond to this message." - } - } - ] - }) - const answer8 = await user.dmChannel!.awaitMessages({ - filter: m => m.author.id === user.user.id, - max: 1, - time: 1000 * 60 * 15 - }) - if (answer8.size === 0) { - await user.send({ embeds: [tooLong] }) - return - } - if (answer8.first()!.content.toLowerCase() === "cancel") { - await user.send({ embeds: [cancelled] }) - return - } - if (answer8.first()!.attachments.size > 0) { - await user.send({ embeds: [attachments] }) - return - } - if (answer8.first()!.content.length > 64) { - await user.send({ - embeds: [ - { - description: "Max character limit is 64.", - color: embedColor - } - ] - }) - } - const answer8_1 = answer8.first()!.content - - await user.send({ - embeds: [ - { - description: - "If you want to submit your application, type `yes` if not, type `no`", - color: embedColor - } - ] - }) - - const final = await user.dmChannel!.awaitMessages({ - filter: m => m.author.id === user.user.id, - max: 1, - time: 1000 * 60 * 5 - }) - if (final.size === 0) { - await user.send({ embeds: [tooLong] }) - return - } - if (final.first()!.content.toLowerCase() !== "yes") { - await user.send({ embeds: [cancelled] }) - return - } - if (final.first()!.attachments.size > 0) { - await user.send({ embeds: [attachments] }) - return - } - - await user.send({ - embeds: [ - { - description: "Your application has been submitted!", - color: embedColor - } - ] - }) - - const newGuildApp = new guildapp({ - _id: new mongoose.Types.ObjectId(), - userID: user.user.id, - uuid: uuid - }) - - await newGuildApp.save() - - const channel = guild.channels.cache.get( - applicationsChannel - ) as TextChannel - await channel.send({ - embeds: [ - { - title: - user.user.username + - "#" + - user.user.discriminator + - " - Guild Application", - color: embedColor, - thumbnail: { - url: user.avatarURL() || "" - }, - fields: [ - { - name: rq(1), - value: "```" + answer1_1 + "```" - }, - { - name: rq(2), - value: "```" + answer2_1 + "```" - }, - { - name: rq(3), - value: "```" + answer3_1 + "```" - }, - { - name: rq(4), - value: "```" + answer4_1 + "```" - }, - { - name: rq(5), - value: "```" + answer5_1 + "```" - }, - { - name: rq(6), - value: "```" + answer6_1 + "```" - }, - { - name: rq(7), - value: "```" + answer7_1 + "```" - }, - { - name: rq(8), - value: "```" + answer8_1 + "```" - } - ], - footer: { - icon_url: guild.iconURL() || "", - text: "ID: " + user.user.id - } - } - ], - components: [ - new ActionRowBuilder().addComponents( - new ButtonBuilder() - .setCustomId("guildapplicationaccept") - .setLabel("Accept") - .setStyle(ButtonStyle.Primary), - new ButtonBuilder() - .setCustomId("guildapplicationdeny") - .setLabel("Deny") - .setStyle(ButtonStyle.Danger), - new ButtonBuilder() - .setCustomId("checkstats") - .setLabel("Check Stats") - .setStyle(ButtonStyle.Secondary) - ) - ] + embeds: [{ + description: "Max character limit is 128.", + color: embedColor + }] }) } + const answer3_1 = answer3.first()!.content + + // fourth question + await user.send({ + embeds: [{ + title: "**Question 4**", + description: qu(4) + "\n\nPlease type your answer below or type `cancel` to cancel your application." + + " `(We expect a longer answer.)`\n`" + largeM + "`", + color: embedColor, + footer: { + text: "You have 15 minutes to respond to this message." + } + }] + }) + const answer4 = await user.dmChannel!.awaitMessages({ + filter: m => m.author.id === user.user.id, + max: 1, + time: 1000 * 60 * 15 + }) + if (answer4.size === 0) { + await user.send({ embeds: [tooLong] }) + return + } + if (answer4.first()!.content.toLowerCase() === "cancel") { + await user.send({ embeds: [cancelled] }) + return + } + if (answer4.first()!.attachments.size > 0) { + await user.send({ embeds: [attachments] }) + return + } + if (answer4.first()!.content.length > 256) { + await user.send({ + embeds: [{ + description: "Max character limit is 256.", + color: embedColor + }] + }) + } + const answer4_1 = answer4.first()!.content + + // fifth question + await user.send({ + embeds: [{ + title: "**Question 5**", + description: qu(5) + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + smallM + "`", + color: embedColor, + footer: { + text: "You have 15 minutes to respond to this message." + } + }] + }) + const answer5 = await user.dmChannel!.awaitMessages({ + filter: m => m.author.id === user.user.id, + max: 1, + time: 1000 * 60 * 15 + }) + if (answer5.size === 0) { + await user.send({ embeds: [tooLong] }) + return + } + if (answer5.first()!.content.toLowerCase() === "cancel") { + await user.send({ embeds: [cancelled] }) + return + } + if (answer5.first()!.attachments.size > 0) { + await user.send({ embeds: [attachments] }) + return + } + if (answer5.first()!.content.length > 128) { + await user.send({ + embeds: [{ + description: "Max character limit is 128.", + color: embedColor + }] + }) + } + const answer5_1 = answer5.first()!.content + + // sixth question + await user.send({ + embeds: [{ + title: "**Question 6**", + description: qu(6) + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + largeM + "`", + color: embedColor, + footer: { + text: "You have 15 minutes to respond to this message." + } + }] + }) + const answer6 = await user.dmChannel!.awaitMessages({ + filter: m => m.author.id === user.user.id, + max: 1, + time: 1000 * 60 * 15 + }) + if (answer6.size === 0) { + await user.send({ embeds: [tooLong] }) + return + } + if (answer6.first()!.content.toLowerCase() === "cancel") { + await user.send({ embeds: [cancelled] }) + return + } + if (answer6.first()!.attachments.size > 0) { + await user.send({ embeds: [attachments] }) + return + } + if (answer6.first()!.content.length > 256) { + await user.send({ + embeds: [{ + description: "Max character limit is 256.", + color: embedColor + }] + }) + } + const answer6_1 = answer6.first()!.content + + // seventh question + await user.send({ + embeds: [{ + title: "**Question 7**", + description: qu(7) + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + smallM + "`", + color: embedColor, + footer: { + text: "You have 15 minutes to respond to this message." + } + }] + }) + const answer7 = await user.dmChannel!.awaitMessages({ + filter: m => m.author.id === user.user.id, + max: 1, + time: 1000 * 60 * 15 + }) + if (answer7.size === 0) { + await user.send({ embeds: [tooLong] }) + return + } + if (answer7.first()!.content.toLowerCase() === "cancel") { + await user.send({ embeds: [cancelled] }) + return + } + if (answer7.first()!.attachments.size > 0) { + await user.send({ embeds: [attachments] }) + return + } + if (answer7.first()!.content.length > 128) { + await user.send({ + embeds: [{ + description: "Max character limit is 128.", + color: embedColor + }] + }) + } + const answer7_1 = answer7!.first()!.content + + // eighth question + await user.send({ + embeds: [{ + title: "**Question 8**", + description: qu(8) + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n" + "`(64 characters max)`", + color: embedColor, + footer: { + text: "You have 15 minutes to respond to this message." + } + }] + }) + const answer8 = await user.dmChannel!.awaitMessages({ + filter: m => m.author.id === user.user.id, + max: 1, + time: 1000 * 60 * 15 + }) + if (answer8.size === 0) { + await user.send({ embeds: [tooLong] }) + return + } + if (answer8.first()!.content.toLowerCase() === "cancel") { + await user.send({ embeds: [cancelled] }) + return + } + if (answer8.first()!.attachments.size > 0) { + await user.send({ embeds: [attachments] }) + return + } + if (answer8.first()!.content.length > 64) { + await user.send({ + embeds: [{ + description: "Max character limit is 64.", + color: embedColor + }] + }) + } + const answer8_1 = answer8.first()!.content + + await user.send({ + embeds: [{ + description: "If you want to submit your application, type `yes` if not, type `no`", + color: embedColor + }] + }) + + const final = await user.dmChannel!.awaitMessages({ + filter: m => m.author.id === user.user.id, + max: 1, + time: 1000 * 60 * 5 + }) + if (final.size === 0) { + await user.send({ embeds: [tooLong] }) + return + } + if (final.first()!.content.toLowerCase() !== "yes") { + await user.send({ embeds: [cancelled] }) + return + } + if (final.first()!.attachments.size > 0) { + await user.send({ embeds: [attachments] }) + return + } + + await user.send({ + embeds: [{ + description: "Your application has been submitted!", + color: embedColor + }] + }) + + const newGuildApp = new guildapp({ + _id: new mongoose.Types.ObjectId(), + userID: user.user.id, + uuid: uuid + }) + + await newGuildApp.save() + + const channel = guild.channels.cache.get(applicationsChannel) as TextChannel + await channel.send({ + embeds: [{ + title: user.user.username + "#" + user.user.discriminator + " - Guild Application", + color: embedColor, + thumbnail: { + url: user.avatarURL() || "" + }, + fields: [ + { + name: rq(1), + value: "```" + answer1_1 + "```" + }, + { + name: rq(2), + value: "```" + answer2_1 + "```" + }, + { + name: rq(3), + value: "```" + answer3_1 + "```" + }, + { + name: rq(4), + value: "```" + answer4_1 + "```" + }, + { + name: rq(5), + value: "```" + answer5_1 + "```" + }, + { + name: rq(6), + value: "```" + answer6_1 + "```" + }, + { + name: rq(7), + value: "```" + answer7_1 + "```" + }, + { + name: rq(8), + value: "```" + answer8_1 + "```" + } + ], + footer: { + icon_url: guild.iconURL() || "", + text: "ID: " + user.user.id + } + }], + components: [ + new ActionRowBuilder().addComponents( + new ButtonBuilder() + .setCustomId("guildapplicationaccept") + .setLabel("Accept") + .setStyle(ButtonStyle.Primary), + new ButtonBuilder() + .setCustomId("guildapplicationdeny") + .setLabel("Deny") + .setStyle(ButtonStyle.Danger), + new ButtonBuilder() + .setCustomId("checkstats") + .setLabel("Check Stats") + .setStyle(ButtonStyle.Secondary) + ) + ] + }) } } as Button diff --git a/src/components/buttons/guildinactivitylog.ts b/src/components/buttons/guildinactivitylog.ts index 7b26869..95a7e0a 100644 --- a/src/components/buttons/guildinactivitylog.ts +++ b/src/components/buttons/guildinactivitylog.ts @@ -1,35 +1,13 @@ -import { - ButtonBuilder, - ActionRowBuilder, - ButtonStyle, - EmbedBuilder, - GuildMember, - TextChannel -} from "discord.js" -import { - gm, - manager, - moderator, - beast, - member, - guildStaff, - guildRole -} from "config/roles.json" +import { ButtonBuilder, ActionRowBuilder, ButtonStyle, EmbedBuilder, GuildMember, TextChannel } from "discord.js" +import { gm, manager, moderator, beast, member, guildStaff, guildRole } from "config/roles.json" import { ignM, smallM, largeM } from "config/limitmessages.json" import { inactivity } from "config/questions.json" import { color, inactivityLogChannel } from "config/options.json" import { Button } from "interfaces" -const guildRoles = [ - gm, - manager, - moderator, - beast, - member, - guildStaff, - guildRole -] +import { getIGN } from "utils/Hypixel" +const guildRoles = [gm, manager, moderator, beast, member, guildStaff, guildRole] -module.exports = { +export = { name: "guildinactivitylog", description: "Configure the bot.", @@ -38,7 +16,6 @@ module.exports = { const user = interaction.member as GuildMember const embedColor = Number(color.replace("#", "0x")) const userRoles = user.roles.cache - const mojangAPI = "https://api.mojang.com/users/profiles/minecraft/" if (!userRoles.some(role => guildRoles.includes(role.id))) { return await interaction.reply({ @@ -62,25 +39,20 @@ module.exports = { .setDescription("You have cancelled your application.") .setColor(embedColor) const attachments = new EmbedBuilder() - .setDescription( - "You have uploaded an attachment. Please do not upload images, videos, or GIFS." - ) + .setDescription("You have uploaded an attachment. Please do not upload images, videos, or GIFS.") .setColor(embedColor) try { await user.send({ - embeds: [ - { - title: "Guild Inactivity Log", - description: - "Please answer the following questions to submit an inactivity log for the guild.\n" + - "If you wish to cancel your form, please press type `cancel` at any time.\n" + - "If you wish to proceed with your form, please type `yes`.\n\n" + - "**Do not upload images, videos, or GIFS.**\n" + - "You have a minute to respond to this message.", - color: embedColor - } - ] + embeds: [{ + title: "Guild Inactivity Log", + description: "Please answer the following questions to submit an inactivity log for the guild.\n" + + "If you wish to cancel your form, please press type `cancel` at any time.\n" + + "If you wish to proceed with your form, please type `yes`.\n\n" + + "**Do not upload images, videos, or GIFS.**\n" + + "You have a minute to respond to this message.", + color: embedColor + }] }) } catch (error) { return await interaction.reply({ @@ -113,20 +85,14 @@ module.exports = { } await user.send({ - embeds: [ - { - title: "**Question 1**", - description: - sq(1) + - "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + - ignM + - "`", - color: embedColor, - footer: { - text: "You have 5 minutes to respond to this message." - } + embeds: [{ + title: "**Question 1**", + description: sq(1) + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + ignM + "`", + color: embedColor, + footer: { + text: "You have 5 minutes to respond to this message." } - ] + }] }) const answer1 = await user.dmChannel!.awaitMessages({ @@ -140,27 +106,10 @@ module.exports = { } if (answer1.first()!.content.length > 16) { await user.send({ - embeds: [ - { - description: "Max character limit is 16.", - color: embedColor - } - ] - }) - return - } - try { - await fetch(mojangAPI + answer1.first()!.content) - } catch (error) { - await user.send({ - embeds: [ - { - description: - "That is not a valid Minecraft username.\n" + - "Application cancelled.", - color: embedColor - } - ] + embeds: [{ + description: "Max character limit is 16.", + color: embedColor + }] }) return } @@ -172,23 +121,27 @@ module.exports = { await user.send({ embeds: [cancelled] }) return } + if (await getIGN(answer1.first()!.content)) { + await user.send({ + embeds: [{ + description: "That is not a valid Minecraft username.\n" + + "Application cancelled.", + color: embedColor + }] + }) + return + } const answer1_1 = answer1.first()!.content await user.send({ - embeds: [ - { - title: "**Question 2**", - description: - sq(2) + - "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + - smallM + - "`", - color: embedColor, - footer: { - text: "You have 5 minutes to respond to this message." - } + embeds: [{ + title: "**Question 2**", + description: sq(2) + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + smallM + "`", + color: embedColor, + footer: { + text: "You have 5 minutes to respond to this message." } - ] + }] }) const answer2 = await user.dmChannel!.awaitMessages({ filter: m => m.author.id === user.user.id, @@ -201,12 +154,10 @@ module.exports = { } if (answer2.first()!.content.length > 128) { await user.send({ - embeds: [ - { - description: "Max character limit is 128.", - color: embedColor - } - ] + embeds: [{ + description: "Max character limit is 128.", + color: embedColor + }] }) return } @@ -221,20 +172,14 @@ module.exports = { const answer2_1 = answer1.first()!.content await user.send({ - embeds: [ - { - title: "**Question 3**", - description: - sq(3) + - "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + - largeM + - "`", - color: embedColor, - footer: { - text: "You have 15 minutes to respond to this message." - } + embeds: [{ + title: "**Question 3**", + description: sq(3) + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + largeM + "`", + color: embedColor, + footer: { + text: "You have 15 minutes to respond to this message." } - ] + }] }) const answer3 = await user.dmChannel!.awaitMessages({ filter: m => m.author.id === user.user.id, @@ -247,12 +192,10 @@ module.exports = { } if (answer3.first()!.content.length > 256) { await user.send({ - embeds: [ - { - description: "Max character limit is 256", - color: embedColor - } - ] + embeds: [{ + description: "Max character limit is 256", + color: embedColor + }] }) return } @@ -267,13 +210,10 @@ module.exports = { const answer3_1 = answer1.first()!.content await user.send({ - embeds: [ - { - description: - "If you want to submit your application, type `yes` if not, type `no`", - color: embedColor - } - ] + embeds: [{ + description: "If you want to submit your application, type `yes` if not, type `no`", + color: embedColor + }] }) const final = await user.dmChannel!.awaitMessages({ filter: m => m.author.id === user.user.id, @@ -294,50 +234,40 @@ module.exports = { } await user.send({ - embeds: [ - { - description: "Your application has been submitted!", - color: embedColor - } - ] + embeds: [{ + description: "Your application has been submitted!", + color: embedColor + }] }) - const appChannel = guild.channels.cache.get( - inactivityLogChannel - ) as TextChannel + const appChannel = guild.channels.cache.get(inactivityLogChannel) as TextChannel await appChannel.send({ - embeds: [ - { - title: - user.user.username + - "#" + - user.user.discriminator + - " - Inactivity Application", - color: embedColor, - thumbnail: { - url: user.avatarURL() || "" + embeds: [{ + title: user.user.username + "#" + user.user.discriminator + " - Inactivity Application", + color: embedColor, + thumbnail: { + url: user.avatarURL() || "" + }, + fields: [ + { + name: rq(1), + value: "`" + answer1_1 + "`" }, - fields: [ - { - name: rq(1), - value: "`" + answer1_1 + "`" - }, - { - name: rq(2), - value: "`" + answer2_1 + "`" - }, - { - name: rq(3), - value: "`" + answer3_1 + "`" - } - ], - footer: { - icon_url: user.avatarURL() || undefined, - text: "ID: " + user.user.id + { + name: rq(2), + value: "`" + answer2_1 + "`" + }, + { + name: rq(3), + value: "`" + answer3_1 + "`" } + ], + footer: { + icon_url: user.avatarURL() || undefined, + text: "ID: " + user.user.id } - ], + }], components: [ new ActionRowBuilder().addComponents( new ButtonBuilder() diff --git a/src/components/buttons/staffapplicationaccept.ts b/src/components/buttons/staffapplicationaccept.ts index 84e8ea4..ce3380a 100644 --- a/src/components/buttons/staffapplicationaccept.ts +++ b/src/components/buttons/staffapplicationaccept.ts @@ -19,17 +19,13 @@ export = { const applicantId = embed.footer!.text.split(" ")[1] const applicant = await guild.members.fetch(applicantId) - const applicantUsername = - applicant.user.username + "#" + applicant.user.discriminator + const applicantUsername = applicant.user.username + "#" + applicant.user.discriminator await applicant.send({ - embeds: [ - { - description: - "Your application for the Illegitimate staff team has been accepted.", - color: embedColor - } - ] + embeds: [{ + description: "Your application for the Illegitimate staff team has been accepted.", + color: embedColor + }] }) await message.edit({ @@ -52,20 +48,18 @@ export = { await staffapp.findOneAndDelete({ userID: applicantId }) await interaction.editReply({ - embeds: [ - { - title: applicantUsername + " - Staff Application.", - description: "Application accepted by <@" + user.id + ">.", - color: embedColor, - thumbnail: { - url: applicant.avatarURL() || "" - }, - footer: { - icon_url: guild.iconURL() || undefined, - text: "ID: " + applicantId - } + embeds: [{ + title: applicantUsername + " - Staff Application.", + description: "Application accepted by <@" + user.id + ">.", + color: embedColor, + thumbnail: { + url: applicant.avatarURL() || "" + }, + footer: { + icon_url: guild.iconURL() || undefined, + text: "ID: " + applicantId } - ] + }] }) } } as Button diff --git a/src/components/buttons/staffapplicationdeny.ts b/src/components/buttons/staffapplicationdeny.ts index 13d6275..6b3be04 100644 --- a/src/components/buttons/staffapplicationdeny.ts +++ b/src/components/buttons/staffapplicationdeny.ts @@ -1,9 +1,4 @@ -import { - ModalBuilder, - ActionRowBuilder, - TextInputBuilder, - TextInputStyle -} from "discord.js" +import { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } from "discord.js" import { Button } from "interfaces" export = { @@ -20,9 +15,7 @@ export = { .setLabel("Deny Reason") .setCustomId("staffdenyreason") .setStyle(TextInputStyle.Paragraph) - .setPlaceholder( - "Enter a reason for denying the application" - ) + .setPlaceholder( "Enter a reason for denying the application") .setRequired(false) ) ) diff --git a/src/components/buttons/staffapply.ts b/src/components/buttons/staffapply.ts index b7d5237..3c8b3d3 100644 --- a/src/components/buttons/staffapply.ts +++ b/src/components/buttons/staffapply.ts @@ -1,11 +1,4 @@ -import { - ButtonBuilder, - ButtonStyle, - ActionRowBuilder, - EmbedBuilder, - GuildMember, - TextChannel -} from "discord.js" +import { ButtonBuilder, ButtonStyle, ActionRowBuilder, EmbedBuilder, GuildMember, TextChannel } from "discord.js" import { color, staffApplicationsChannel } from "config/options.json" import { largeM, ignM } from "config/limitmessages.json" import questions from "config/questions.json" @@ -43,17 +36,13 @@ export = { if (user.user.id !== env.prod.dev) { if (status === "0") { - await interaction.editReply( - "Staff applications are currently closed." - ) + await interaction.editReply("Staff applications are currently closed.") return } } if (!userRoles.has(guildRole)) { - await interaction.editReply( - "You must be a member of the guild to apply for staff." - ) + await interaction.editReply("You must be a member of the guild to apply for staff.") return } @@ -65,9 +54,7 @@ export = { const application = await staffapp.findOne({ userID: user.user.id }) if (application) { - await interaction.editReply( - "You already have an application in progress." - ) + await interaction.editReply("You already have an application in progress.") return } @@ -78,23 +65,18 @@ export = { .setDescription("You have cancelled your application.") .setColor(embedColor) const attachments = new EmbedBuilder() - .setDescription( - "You have uploaded an attachment. Please do not upload images, videos, or GIFS." - ) + .setDescription("You have uploaded an attachment. Please do not upload images, videos, or GIFS.") .setColor(embedColor) try { await user.send({ - embeds: [ - { - title: "Staff Application", - description: - "If you wish to proceed with your application, please type `yes` otherwise type `cancel`.\n\n" + - "**Do not upload images, videos, or GIFS.**\n" + - "You have a minute to respond to this message.", - color: embedColor - } - ] + embeds: [{ + title: "Staff Application", + description: "If you wish to proceed with your application, please type `yes` otherwise type `cancel`.\n\n" + + "**Do not upload images, videos, or GIFS.**\n" + + "You have a minute to respond to this message.", + color: embedColor + }] }) } catch (error) { await interaction.editReply("Please enable your DMs.") @@ -123,20 +105,14 @@ export = { // first question await user.send({ - embeds: [ - { - title: "**Question 1**", - description: - sq(1) + - "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + - ignM + - "`", - color: embedColor, - footer: { - text: "You have 5 minutes to respond to this message." - } + embeds: [{ + title: "**Question 1**", + description: sq(1) + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + ignM + "`", + color: embedColor, + footer: { + text: "You have 5 minutes to respond to this message." } - ] + }] }) const answer1 = await user.dmChannel!.awaitMessages({ filter: m => m.author.id === user.user.id, @@ -157,26 +133,21 @@ export = { } if (answer1.first()!.content.length > 16) { await user.send({ - embeds: [ - { - description: "Max character limit is 16.", - color: embedColor - } - ] + embeds: [{ + description: "Max character limit is 16.", + color: embedColor + }] }) return } const uuid = await getUUID(answer1.first()!.content) if (!uuid) { await user.send({ - embeds: [ - { - description: - "That is not a valid Minecraft username.\n" + - "Application cancelled.", - color: embedColor - } - ] + embeds: [{ + description: "That is not a valid Minecraft username.\n" + + "Application cancelled.", + color: embedColor + }] }) return } @@ -184,19 +155,15 @@ export = { // second question await user.send({ - embeds: [ - { - title: "**Question 2**", - description: - sq(2) + - "\n\nPlease type your answer below or type `cancel` to cancel your application.\n" + - "`(64 characters max)`", - color: embedColor, - footer: { - text: "You have 15 minutes to respond to this message." - } + embeds: [{ + title: "**Question 2**", + description: sq(2) + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n" + + "`(64 characters max)`", + color: embedColor, + footer: { + text: "You have 15 minutes to respond to this message." } - ] + }] }) const answer2 = await user.dmChannel!.awaitMessages({ filter: m => m.author.id === user.user.id, @@ -217,12 +184,10 @@ export = { } if (answer2.first()!.content.length > 64) { await user.send({ - embeds: [ - { - description: "Max character limit is 64.", - color: embedColor - } - ] + embeds: [{ + description: "Max character limit is 64.", + color: embedColor + }] }) return } @@ -230,20 +195,14 @@ export = { // third question await user.send({ - embeds: [ - { - title: "**Question 3**", - description: - sq(3) + - "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + - largeM + - "`", - color: embedColor, - footer: { - text: "You have 15 minutes to respond to this message." - } + embeds: [{ + title: "**Question 3**", + description: sq(3) + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + largeM + "`", + color: embedColor, + footer: { + text: "You have 15 minutes to respond to this message." } - ] + }] }) const answer3 = await user.dmChannel!.awaitMessages({ filter: m => m.author.id === user.user.id, @@ -264,32 +223,24 @@ export = { } if (answer3.first()!.content.length > 256) { await user.send({ - embeds: [ - { - description: "Max character limit is 256.", - color: embedColor - } - ] + embeds: [{ + description: "Max character limit is 256.", + color: embedColor + }] }) } const answer3_1 = answer3.first()!.content // fourth question await user.send({ - embeds: [ - { - title: "**Question 4**", - description: - sq(4) + - "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + - largeM + - "`", - color: embedColor, - footer: { - text: "You have 15 minutes to respond to this message." - } + embeds: [{ + title: "**Question 4**", + description: sq(4) + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + largeM + "`", + color: embedColor, + footer: { + text: "You have 15 minutes to respond to this message." } - ] + }] }) const answer4 = await user.dmChannel!.awaitMessages({ filter: m => m.author.id === user.user.id, @@ -310,32 +261,24 @@ export = { } if (answer4.first()!.content.length > 256) { await user.send({ - embeds: [ - { - description: "Max character limit is 256.", - color: embedColor - } - ] + embeds: [{ + description: "Max character limit is 256.", + color: embedColor + }] }) } const answer4_1 = answer4.first()!.content // fifth question await user.send({ - embeds: [ - { - title: "**Question 5**", - description: - sq(5) + - "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + - largeM + - "`", - color: embedColor, - footer: { - text: "You have 15 minutes to respond to this message." - } + embeds: [{ + title: "**Question 5**", + description: sq(5) + "\n\nPlease type your answer below or type `cancel` to cancel your application.\n`" + largeM + "`", + color: embedColor, + footer: { + text: "You have 15 minutes to respond to this message." } - ] + }] }) const answer5 = await user.dmChannel!.awaitMessages({ filter: m => m.author.id === user.user.id, @@ -356,33 +299,25 @@ export = { } if (answer5.first()!.content.length > 256) { await user.send({ - embeds: [ - { - description: "Max character limit is 256.", - color: embedColor - } - ] + embeds: [{ + description: "Max character limit is 256.", + color: embedColor + }] }) } const answer5_1 = answer5.first()!.content // sixth question await user.send({ - embeds: [ - { - title: "**Question 6**", - description: - sq(6) + - "\n\nPlease type your answer below or type `cancel` to cancel your application." + - "`(We expect a longer answer here)`\n`" + - largeM + - "`", - color: embedColor, - footer: { - text: "You have 15 minutes to respond to this message." - } + embeds: [{ + title: "**Question 6**", + description: sq(6) + "\n\nPlease type your answer below or type `cancel` to cancel your application." + + "`(We expect a longer answer here)`\n`" + largeM + "`", + color: embedColor, + footer: { + text: "You have 15 minutes to respond to this message." } - ] + }] }) const answer6 = await user.dmChannel!.awaitMessages({ filter: m => m.author.id === user.user.id, @@ -403,24 +338,19 @@ export = { } if (answer6.first()!.content.length > 256) { await user.send({ - embeds: [ - { - description: "Max character limit is 256.", - color: embedColor - } - ] + embeds: [{ + description: "Max character limit is 256.", + color: embedColor + }] }) } const answer6_1 = answer6.first()!.content await user.send({ - embeds: [ - { - description: - "If you want to submit your application, type `yes` if not, type `no`", - color: embedColor - } - ] + embeds: [{ + description: "If you want to submit your application, type `yes` if not, type `no`", + color: embedColor + }] }) const final = await user.dmChannel!.awaitMessages({ @@ -442,12 +372,10 @@ export = { } await user.send({ - embeds: [ - { - description: "Your application has been submitted!", - color: embedColor - } - ] + embeds: [{ + description: "Your application has been submitted!", + color: embedColor + }] }) const newStaffApp = new staffapp({ @@ -459,54 +387,46 @@ export = { await newStaffApp.save() await user.deleteDM() - const channel = guild.channels.cache.get( - staffApplicationsChannel - ) as TextChannel + const channel = guild.channels.cache.get(staffApplicationsChannel) as TextChannel await channel.send({ - embeds: [ - { - title: - user.user.username + - "#" + - user.user.discriminator + - " - Staff Application", - color: embedColor, - thumbnail: { - url: user.avatarURL() || "" + embeds: [{ + title: user.user.username + "#" + user.user.discriminator + " - Staff Application", + color: embedColor, + thumbnail: { + url: user.avatarURL() || "" + }, + fields: [ + { + name: rq(1), + value: "```" + answer1_1 + "```" }, - fields: [ - { - name: rq(1), - value: "```" + answer1_1 + "```" - }, - { - name: rq(2), - value: "```" + answer2_1 + "```" - }, - { - name: rq(3), - value: "```" + answer3_1 + "```" - }, - { - name: rq(4), - value: "```" + answer4_1 + "```" - }, - { - name: rq(5), - value: "```" + answer5_1 + "```" - }, - { - name: rq(6), - value: "```" + answer6_1 + "```" - } - ], - footer: { - icon_url: guild.iconURL() || undefined, - text: "ID: " + user.user.id + { + name: rq(2), + value: "```" + answer2_1 + "```" + }, + { + name: rq(3), + value: "```" + answer3_1 + "```" + }, + { + name: rq(4), + value: "```" + answer4_1 + "```" + }, + { + name: rq(5), + value: "```" + answer5_1 + "```" + }, + { + name: rq(6), + value: "```" + answer6_1 + "```" } + ], + footer: { + icon_url: guild.iconURL() || undefined, + text: "ID: " + user.user.id } - ], + }], components: [ new ActionRowBuilder().addComponents( new ButtonBuilder() diff --git a/src/components/buttons/verify.ts b/src/components/buttons/verify.ts index 04bfab7..0e7dd19 100644 --- a/src/components/buttons/verify.ts +++ b/src/components/buttons/verify.ts @@ -1,9 +1,4 @@ -import { - ModalBuilder, - ActionRowBuilder, - TextInputBuilder, - TextInputStyle -} from "discord.js" +import { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } from "discord.js" import { Button } from "interfaces" export = { diff --git a/src/components/buttons/waitingListUpdate.ts b/src/components/buttons/waitingListUpdate.ts index 4063adf..b76a889 100644 --- a/src/components/buttons/waitingListUpdate.ts +++ b/src/components/buttons/waitingListUpdate.ts @@ -37,20 +37,18 @@ export = { } await message.edit({ - embeds: [ - { - title: embed.title!, - description: embed.description!, - color: embed.color!, - footer: { - text: "Last updated by " + user.username, - icon_url: user.avatarURL() || undefined - }, - thumbnail: embed.thumbnail!, - fields: fields, - timestamp: new Date().toISOString() - } - ] + embeds: [{ + title: embed.title!, + description: embed.description!, + color: embed.color!, + footer: { + text: "Last updated by " + user.username, + icon_url: user.avatarURL() || undefined + }, + thumbnail: embed.thumbnail!, + fields: fields, + timestamp: new Date().toISOString() + }] }) await interaction.editReply("Updated the waiting list") From 1ffcaf602d140e51e383ceee67901f4c01d898d4 Mon Sep 17 00:00:00 2001 From: Taken Date: Sat, 20 Jan 2024 20:56:08 +0100 Subject: [PATCH 10/15] Fixed formatting for event files --- src/events/cron/weeklyGexp.ts | 90 +++++++------------ .../server/guildMemberAdd/logNewJoins.ts | 33 +++---- src/events/server/interactions/logBtnsCmds.ts | 22 ++--- src/events/server/messages/eval.ts | 16 ++-- src/events/server/messages/react.ts | 5 +- src/events/server/ready/sendOnlineMessage.ts | 10 +-- .../server/voiceStateUpdate/vcJoinLeave.ts | 81 +++++++---------- 7 files changed, 94 insertions(+), 163 deletions(-) diff --git a/src/events/cron/weeklyGexp.ts b/src/events/cron/weeklyGexp.ts index edd37b2..897e3f2 100644 --- a/src/events/cron/weeklyGexp.ts +++ b/src/events/cron/weeklyGexp.ts @@ -1,9 +1,4 @@ -import { - hypixelGuildID, - guildLogChannel, - color, - devMessage -} from "config/options.json" +import { hypixelGuildID, guildLogChannel, color, devMessage } from "config/options.json" import colorLog from "utils/functions/colors" import { getGuild, getIGN } from "utils/Hypixel" import { Cron, GuildData } from "interfaces" @@ -22,18 +17,15 @@ async function guildWeekly() { const embedColor = Number(color.replace("#", "0x")) const message = await channel.send({ - embeds: [ - { - description: "Starting to fetch guild data...", - color: embedColor - } - ] + embeds: [{ + description: "Starting to fetch guild data...", + color: embedColor + }] }) const guild = (await getGuild(hypixelGuildID, "id")) as GuildData const guildMembersList: string[] = [] - const topWeeklyMembers: { name: string; value: string; inline: boolean }[] = - [] + const topWeeklyMembers: { name: string; value: string; inline: boolean }[] = [] const guildName = guild.name const guildMembers = guild.members @@ -41,24 +33,18 @@ async function guildWeekly() { const sliceSize = guildMembers.length / 4 // top weekly members - const allMembersGexpSorted = guildMembers - .map(member => { - return { - uuid: member.uuid, - exp: Object.values(member.expHistory).reduce((a, b) => a + b, 0) - } - }) - .sort((a, b) => b.exp - a.exp) + const allMembersGexpSorted = guildMembers.map(member => { + return { + uuid: member.uuid, + exp: Object.values(member.expHistory).reduce((a, b) => a + b, 0) + } + }).sort((a, b) => b.exp - a.exp) for (let i = 0; i < allMembersGexpSorted.length; i++) { const ign = await getIGN(allMembersGexpSorted[i].uuid) - const gexp = new Intl.NumberFormat("en-US").format( - allMembersGexpSorted[i].exp - ) + const gexp = new Intl.NumberFormat("en-US").format(allMembersGexpSorted[i].exp) const position = i + 1 - guildMembersList.push( - "**#" + position + " " + ign + ":** `" + gexp + "`" - ) + guildMembersList.push("**#" + position + " " + ign + ":** `" + gexp + "`") } const list = Array.from({ length: sliceSize }, (_, i) => @@ -76,46 +62,30 @@ async function guildWeekly() { }) // combined weekly gexp - const allGuildMembersWeeklyXP = guildMembers.map( - member => member.expHistory - ) + const allGuildMembersWeeklyXP = guildMembers.map(member => member.expHistory) const guildMembersWeeklyXP = allGuildMembersWeeklyXP.map(member => { return Object.values(member).reduce((a, b) => a + b, 0) }) - const totalGuildMembersWeeklyXPUnformatted = guildMembersWeeklyXP.reduce( - (a, b) => a + b, - 0 - ) - const averageGuildMembersDailyXPUnformatted = - totalGuildMembersWeeklyXPUnformatted / 7 + const totalGuildMembersWeeklyXPUnformatted = guildMembersWeeklyXP.reduce((a, b) => a + b, 0) + const averageGuildMembersDailyXPUnformatted = totalGuildMembersWeeklyXPUnformatted / 7 // final values - const totalGuildMembersWeeklyXP = new Intl.NumberFormat("en-US").format( - totalGuildMembersWeeklyXPUnformatted - ) - const averageGuildMembersWeeklyXP = new Intl.NumberFormat("en-US").format( - averageGuildMembersDailyXPUnformatted - ) + const totalGuildMembersWeeklyXP = new Intl.NumberFormat("en-US").format(totalGuildMembersWeeklyXPUnformatted) + const averageGuildMembersWeeklyXP = new Intl.NumberFormat("en-US").format(averageGuildMembersDailyXPUnformatted) await message.edit({ - embeds: [ - { - title: "**Weekly Guild XP for " + guildName + "**", - description: - "**Total weekly guild XP:** `" + - totalGuildMembersWeeklyXP + - "`\n**Average daily guild XP:** `" + - averageGuildMembersWeeklyXP + - "`", - color: embedColor, - fields: topWeeklyMembers, - timestamp: new Date().toISOString(), - footer: { - text: channel.guild.name + " | " + devMessage, - icon_url: channel.guild.iconURL() || undefined - } + embeds: [{ + title: "**Weekly Guild XP for " + guildName + "**", + description: "**Total weekly guild XP:** `" + totalGuildMembersWeeklyXP + + "`\n**Average daily guild XP:** `" + averageGuildMembersWeeklyXP + "`", + color: embedColor, + fields: topWeeklyMembers, + timestamp: new Date().toISOString(), + footer: { + text: channel.guild.name + " | " + devMessage, + icon_url: channel.guild.iconURL() || undefined } - ] + }] }) } diff --git a/src/events/server/guildMemberAdd/logNewJoins.ts b/src/events/server/guildMemberAdd/logNewJoins.ts index 85a3b5d..f6bd718 100644 --- a/src/events/server/guildMemberAdd/logNewJoins.ts +++ b/src/events/server/guildMemberAdd/logNewJoins.ts @@ -13,25 +13,20 @@ export = { const embedColor = Number(color.replace("#", "0x")) logToChannel("bot", { - embeds: [ - { - title: "New Member", - description: - userMention(member.id) + - " has joined the server.\n" + - "Account created: " + - member.user.createdAt.toLocaleString(), - color: embedColor, - thumbnail: { - url: member.user.avatarURL() || "" - }, - footer: { - text: "ID: " + member.id, - icon_url: member.user.avatarURL() || undefined - }, - timestamp: new Date().toISOString() - } - ] + embeds: [{ + title: "New Member", + description: userMention(member.id) + " has joined the server.\n" + + "Account created: " + member.user.createdAt.toLocaleString(), + color: embedColor, + thumbnail: { + url: member.user.avatarURL() || "" + }, + footer: { + text: "ID: " + member.id, + icon_url: member.user.avatarURL() || undefined + }, + timestamp: new Date().toISOString() + }] }) } } as Event diff --git a/src/events/server/interactions/logBtnsCmds.ts b/src/events/server/interactions/logBtnsCmds.ts index 8887c6b..d8ad8b2 100644 --- a/src/events/server/interactions/logBtnsCmds.ts +++ b/src/events/server/interactions/logBtnsCmds.ts @@ -12,20 +12,16 @@ export = { try { console.log( color( - interaction.user.username + - " ran " + - interaction.commandName + - " " + - interaction.options.getSubcommand(), - "pink" + interaction.user.username + " ran " + + interaction.commandName + " " + + interaction.options.getSubcommand(), "pink" ) ) } catch { console.log( color( - interaction.user.username + - " ran " + - interaction.commandName, + interaction.user.username + " ran " + + interaction.commandName, "pink" ) ) @@ -35,11 +31,9 @@ export = { if (interaction.isButton()) { console.log( color( - interaction.user.username + - "#" + - interaction.user.discriminator + - " clicked " + - interaction.customId, + interaction.user.username + "#" + + interaction.user.discriminator + " clicked " + + interaction.customId, "pink" ) ) diff --git a/src/events/server/messages/eval.ts b/src/events/server/messages/eval.ts index 1d514a3..3e0ed27 100644 --- a/src/events/server/messages/eval.ts +++ b/src/events/server/messages/eval.ts @@ -19,19 +19,15 @@ export = { const output = eval(code) const outputString = String(output) await message.channel.send({ - embeds: [ - { - description: `\`\`\`js\n${outputString}\`\`\`` - } - ] + embeds: [{ + description: `\`\`\`js\n${outputString}\`\`\`` + }] }) } catch (error) { await message.channel.send({ - embeds: [ - { - description: `\`\`\`js\n${error}\`\`\`` - } - ] + embeds: [{ + description: `\`\`\`js\n${error}\`\`\`` + }] }) } } diff --git a/src/events/server/messages/react.ts b/src/events/server/messages/react.ts index f0dad05..664c20b 100644 --- a/src/events/server/messages/react.ts +++ b/src/events/server/messages/react.ts @@ -7,10 +7,7 @@ export = { event: "messageCreate", async execute(message: Message) { - if ( - message.content.toLowerCase().includes("ur mom") && - message.author.username === "taken.lua" - ) { + if (message.content.toLowerCase().includes("ur mom") && message.author.username === "taken.lua") { message.react("Woot:734345936347725885") } } diff --git a/src/events/server/ready/sendOnlineMessage.ts b/src/events/server/ready/sendOnlineMessage.ts index 4e3c232..22ee172 100644 --- a/src/events/server/ready/sendOnlineMessage.ts +++ b/src/events/server/ready/sendOnlineMessage.ts @@ -13,12 +13,10 @@ export = { const embedColor = Number(color.replace("#", "0x")) logToChannel("online", { - embeds: [ - { - description: "Bot is online!", - color: embedColor - } - ] + embeds: [{ + description: "Bot is online!", + color: embedColor + }] }) } } as Event diff --git a/src/events/server/voiceStateUpdate/vcJoinLeave.ts b/src/events/server/voiceStateUpdate/vcJoinLeave.ts index 0d1461a..a34a293 100644 --- a/src/events/server/voiceStateUpdate/vcJoinLeave.ts +++ b/src/events/server/voiceStateUpdate/vcJoinLeave.ts @@ -17,64 +17,45 @@ export = { if (oldChannel === null && newChannel !== null) { logToChannel("bot", { - embeds: [ - { - title: "Voice Channel Join", - description: - userMention(newState.member!.id) + - " joined " + - channelMention(newChannel.id), - color: embedColor, - footer: { - text: "ID: " + newState.member!.id, - icon_url: - newState.member!.user.avatarURL() || undefined - }, - timestamp: new Date().toISOString() - } - ] + embeds: [{ + title: "Voice Channel Join", + description: userMention(newState.member!.id) + " joined " + channelMention(newChannel.id), + color: embedColor, + footer: { + text: "ID: " + newState.member!.id, + icon_url: newState.member!.user.avatarURL() || undefined + }, + timestamp: new Date().toISOString() + }] }) } else if (oldChannel !== null && newChannel === null) { logToChannel("bot", { - embeds: [ - { - title: "Voice Channel Leave", - description: - userMention(oldState.member!.id) + - " left " + - channelMention(oldChannel.id), - color: embedColor, - footer: { - text: "ID: " + oldState.member!.id, - icon_url: - oldState.member!.user.avatarURL() || undefined - }, - timestamp: new Date().toISOString() - } - ] + embeds: [{ + title: "Voice Channel Leave", + description: userMention(oldState.member!.id) + " left " + channelMention(oldChannel.id), + color: embedColor, + footer: { + text: "ID: " + oldState.member!.id, + icon_url: oldState.member!.user.avatarURL() || undefined + }, + timestamp: new Date().toISOString() + }] }) } else if (oldChannel !== null && newChannel !== null) { if (oldChannel.id === newChannel.id) return logToChannel("bot", { - embeds: [ - { - title: "Voice Channel Switch", - description: - userMention(oldState.member!.id) + - " switched from " + - channelMention(oldChannel.id) + - " to " + - channelMention(newChannel.id), - color: embedColor, - footer: { - text: "ID: " + oldState.member!.id, - icon_url: - oldState.member!.user.avatarURL() || undefined - }, - timestamp: new Date().toISOString() - } - ] + embeds: [{ + title: "Voice Channel Switch", + description: userMention(oldState.member!.id) + " switched from " + channelMention(oldChannel.id) + + " to " + channelMention(newChannel.id), + color: embedColor, + footer: { + text: "ID: " + oldState.member!.id, + icon_url: oldState.member!.user.avatarURL() || undefined + }, + timestamp: new Date().toISOString() + }] }) } } From 49020945ffaa82c8cb0cb3f129fd5fb5b1543ec8 Mon Sep 17 00:00:00 2001 From: Taken Date: Sat, 20 Jan 2024 21:23:03 +0100 Subject: [PATCH 11/15] Small tweaks to fomating --- src/commands/ban.ts | 4 +--- src/commands/config.ts | 3 ++- src/commands/guild/info.ts | 6 ++---- src/commands/guild/member.ts | 3 +-- src/commands/guild/top.ts | 2 +- src/commands/setup.ts | 10 +++++----- src/events/server/interactions/logBtnsCmds.ts | 3 ++- src/events/server/voiceStateUpdate/vcJoinLeave.ts | 4 ++-- 8 files changed, 16 insertions(+), 19 deletions(-) diff --git a/src/commands/ban.ts b/src/commands/ban.ts index 86cdcde..8fcab83 100644 --- a/src/commands/ban.ts +++ b/src/commands/ban.ts @@ -59,9 +59,7 @@ export = { const modRoles = mod.roles.cache.map(role => role.id) if (!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 } diff --git a/src/commands/config.ts b/src/commands/config.ts index ec720da..bc171b6 100644 --- a/src/commands/config.ts +++ b/src/commands/config.ts @@ -60,7 +60,8 @@ export = { await interaction.editReply({ embeds: [{ - description: "Successfully updated `" + setting + "` to value `" + value + "`." + description: "Successfully updated `" + setting + "` to value `" + value + "`.", + color: embedColor }] }) } diff --git a/src/commands/guild/info.ts b/src/commands/guild/info.ts index f45aecf..cdd099d 100644 --- a/src/commands/guild/info.ts +++ b/src/commands/guild/info.ts @@ -129,8 +129,7 @@ export default async function guildInfo(interaction: ChatInputCommandInteraction const guildOwner = guildMembers.find(m => m.rank === "Guild Master")!.uuid const guildOwnerName = await getIGN(guildOwner) - const guildRanksUnsorted = guild!.ranks.sort((a, b) => b.priority - a.priority - ) + const guildRanksUnsorted = guild!.ranks.sort((a, b) => b.priority - a.priority) const guildRanks = guildRanksUnsorted.map(r => "**➺ " + r.name + "** `[" + r.tag + "]`").join("\n") const allGuildMembersWeeklyXP = guildMembers.map(member => member.expHistory) @@ -156,8 +155,7 @@ export default async function guildInfo(interaction: ChatInputCommandInteraction }, { name: "**GEXP**", - value: - "**➺ Total weekly GEXP:** `" + totalGuildMembersWeeklyXP + "`\n" + + value: "**➺ Total weekly GEXP:** `" + totalGuildMembersWeeklyXP + "`\n" + "**➺ Daily avarage:** `" + averageGuildMembersWeeklyXP + "`\n" + "**➺ Total GEXP:** `" + guildExp + "`" }, diff --git a/src/commands/guild/member.ts b/src/commands/guild/member.ts index 4c88e26..dcfc5a0 100644 --- a/src/commands/guild/member.ts +++ b/src/commands/guild/member.ts @@ -143,8 +143,7 @@ export default async function guildMember(interaction: ChatInputCommandInteracti }, { name: "**Weekly GEXP**", - value: - "**➺ Total:** `" + totalWeeklyGexp + "`\n" + + value: "**➺ Total:** `" + totalWeeklyGexp + "`\n" + "**➺ Daily avarage:** `" + averageWeeklyGexp + "`" }, { diff --git a/src/commands/guild/top.ts b/src/commands/guild/top.ts index 60ceae9..1b9450c 100644 --- a/src/commands/guild/top.ts +++ b/src/commands/guild/top.ts @@ -152,7 +152,7 @@ export default async function guildTop(interaction: ChatInputCommandInteraction) let guildData: GuildTopData = [] const fieldsValueRaw: string[] = [] const allMembersSorted = allMembersDailyGEXP.sort((a, b) => b.gexp - a.gexp) - const allMembersSortedUUIDArray = allMembersSorted.map(member => { return member.uuid }) + const allMembersSortedUUIDArray = allMembersSorted.map(member => member.uuid) if (!cachedData) { cacheStatus = false diff --git a/src/commands/setup.ts b/src/commands/setup.ts index f6c9fd6..6f9630b 100644 --- a/src/commands/setup.ts +++ b/src/commands/setup.ts @@ -79,11 +79,11 @@ export = { const subcommand = interaction.options.getSubcommand() const channel = interaction.options.getChannel("channel") as TextChannel const embedColor = Number(color.replace("#", "0x")) - let title: string = "" - let description: string = "" - let customId: string = "" - let label: string = "" - let emoji: string = "" + let title = "" + let description = "" + let customId = "" + let label = "" + let emoji = "" if (subcommand === "sendguildapplication") { title = "Guild Application" diff --git a/src/events/server/interactions/logBtnsCmds.ts b/src/events/server/interactions/logBtnsCmds.ts index d8ad8b2..1075cc1 100644 --- a/src/events/server/interactions/logBtnsCmds.ts +++ b/src/events/server/interactions/logBtnsCmds.ts @@ -14,7 +14,8 @@ export = { color( interaction.user.username + " ran " + interaction.commandName + " " + - interaction.options.getSubcommand(), "pink" + interaction.options.getSubcommand(), + "pink" ) ) } catch { diff --git a/src/events/server/voiceStateUpdate/vcJoinLeave.ts b/src/events/server/voiceStateUpdate/vcJoinLeave.ts index a34a293..40d65cd 100644 --- a/src/events/server/voiceStateUpdate/vcJoinLeave.ts +++ b/src/events/server/voiceStateUpdate/vcJoinLeave.ts @@ -47,8 +47,8 @@ export = { logToChannel("bot", { embeds: [{ title: "Voice Channel Switch", - description: userMention(oldState.member!.id) + " switched from " + channelMention(oldChannel.id) + - " to " + channelMention(newChannel.id), + description: userMention(oldState.member!.id) + " switched from " + + channelMention(oldChannel.id) + " to " + channelMention(newChannel.id), color: embedColor, footer: { text: "ID: " + oldState.member!.id, From 614feeff3ef2985004756eb71df072e04e5e52db Mon Sep 17 00:00:00 2001 From: Taken Date: Sun, 21 Jan 2024 00:02:54 +0100 Subject: [PATCH 12/15] Updated dev flags --- src/commands/pp.ts | 2 +- src/commands/snipe.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commands/pp.ts b/src/commands/pp.ts index ed23119..6084ccd 100644 --- a/src/commands/pp.ts +++ b/src/commands/pp.ts @@ -7,7 +7,7 @@ export = { name: "pp", description: "Shows pp size", public: true, - dev: true, + dev: false, data: new SlashCommandBuilder() .setName("pp") diff --git a/src/commands/snipe.ts b/src/commands/snipe.ts index bf78f5c..a930062 100644 --- a/src/commands/snipe.ts +++ b/src/commands/snipe.ts @@ -8,7 +8,7 @@ export = { name: "snipe", description: "Snipes the last deleted message of a user", public: true, - dev: true, + dev: false, data: new SlashCommandBuilder() .setName("snipe") From 9ec53882d198b2dedc8afb38aae3e41310f36b17 Mon Sep 17 00:00:00 2001 From: Taken Date: Sun, 21 Jan 2024 00:03:19 +0100 Subject: [PATCH 13/15] Fixing formatting --- src/interfaces/Command.ts | 5 +-- src/utils/Autodeploy.ts | 56 ++++++++------------------- src/utils/Client.ts | 8 +--- src/utils/Events/autocomplete.ts | 38 ++++++------------- src/utils/Events/button.ts | 48 +++++++++-------------- src/utils/Events/command.ts | 44 ++++++++------------- src/utils/Events/contextmenu.ts | 59 ++++++++++------------------- src/utils/Events/cron.ts | 27 ++++--------- src/utils/Events/index.ts | 3 +- src/utils/Events/modal.ts | 52 +++++++++---------------- src/utils/Hypixel/account.ts | 15 ++++---- src/utils/Hypixel/guild.ts | 6 +-- src/utils/Illegitimate.ts | 12 ++++++ src/utils/functions/logtochannel.ts | 9 +---- src/utils/functions/rolesmanage.ts | 33 ++++------------ 15 files changed, 138 insertions(+), 277 deletions(-) diff --git a/src/interfaces/Command.ts b/src/interfaces/Command.ts index bf578f0..124acb4 100644 --- a/src/interfaces/Command.ts +++ b/src/interfaces/Command.ts @@ -10,8 +10,5 @@ export default interface Command { disabled?: boolean subcommands?: boolean data: SlashCommandBuilder - execute: ( - interaction: ChatInputCommandInteraction, - client: Client - ) => Promise + execute: (interaction: ChatInputCommandInteraction, client: Client) => Promise } diff --git a/src/utils/Autodeploy.ts b/src/utils/Autodeploy.ts index e43f04a..3a1f615 100644 --- a/src/utils/Autodeploy.ts +++ b/src/utils/Autodeploy.ts @@ -1,12 +1,7 @@ import { Command } from "interfaces" import color from "./functions/colors" import env from "./Env" -import { - REST, - RESTGetAPIApplicationGuildCommandResult, - RESTPutAPIApplicationGuildCommandsJSONBody, - Routes -} from "discord.js" +import { REST, RESTGetAPIApplicationGuildCommandResult, RESTPutAPIApplicationGuildCommandsJSONBody, Routes } from "discord.js" import fs from "fs" type FileType = "js" | "ts" @@ -16,19 +11,11 @@ export default async function autoDeployCommands(fileType: FileType) { let contentMenuCommands: string[] = [] if (fileType === "js") { - commandFiles = fs - .readdirSync("./dist/commands/") - .filter(file => file.endsWith(fileType)) - contentMenuCommands = fs - .readdirSync("./dist/commands-contextmenu/") - .filter(file => file.endsWith(fileType)) + commandFiles = fs.readdirSync("./dist/commands/").filter(file => file.endsWith(fileType)) + contentMenuCommands = fs.readdirSync("./dist/commands-contextmenu/").filter(file => file.endsWith(fileType)) } else if (fileType === "ts") { - commandFiles = fs - .readdirSync("./src/commands/") - .filter(file => file.endsWith(fileType)) - contentMenuCommands = fs - .readdirSync("./src/commands-contextmenu/") - .filter(file => file.endsWith(fileType)) + commandFiles = fs.readdirSync("./src/commands/").filter(file => file.endsWith(fileType)) + contentMenuCommands = fs.readdirSync("./src/commands-contextmenu/").filter(file => file.endsWith(fileType)) } for (const file of commandFiles) { @@ -70,24 +57,15 @@ export default async function autoDeployCommands(fileType: FileType) { a.name.localeCompare(b.name) ) - const newCmds = sortedNewCommandsInfo - .map(cmd => { - return " " + cmd.name + " was registered." - }) - .join("\n") - const currentCmds = sortedCurrentCommandsInfo - .map(cmd => { - return " " + cmd.name + " was unregistered." - }) - .join("\n") + const newCmds = sortedNewCommandsInfo.map(cmd => { + return " " + cmd.name + " was registered." + }).join("\n") + const currentCmds = sortedCurrentCommandsInfo.map(cmd => { + return " " + cmd.name + " was unregistered." + }).join("\n") - if ( - JSON.stringify(sortedNewCommandsInfo) === - JSON.stringify(sortedCurrentCommandsInfo) - ) { - console.log( - color("Commands are the same, skipping deploy.", "lavender") - ) + if (JSON.stringify(sortedNewCommandsInfo) === JSON.stringify(sortedCurrentCommandsInfo)) { + console.log(color("Commands are the same, skipping deploy.", "lavender")) console.log(color(newCmds, "lavender")) return } @@ -95,9 +73,7 @@ export default async function autoDeployCommands(fileType: FileType) { try { console.log(color("Commands are different, starting deploy.", "red")) console.log(color(currentCmds, "red")) - console.log( - `Started refreshing ${commands.length} application (/) commands.` - ) + console.log(`Started refreshing ${commands.length} application (/) commands.`) const data = (await rest.put( Routes.applicationGuildCommands(env.dev.devid!, env.dev.guildid!), @@ -106,9 +82,7 @@ export default async function autoDeployCommands(fileType: FileType) { console.log(color("New commands deployed.", "lavender")) console.log(color(newCmds, "lavender")) - console.log( - `Successfully reloaded ${data.length} application (/) commands.` - ) + console.log(`Successfully reloaded ${data.length} application (/) commands.`) } catch (error) { console.error(error) } diff --git a/src/utils/Client.ts b/src/utils/Client.ts index 83fe95e..83b0593 100644 --- a/src/utils/Client.ts +++ b/src/utils/Client.ts @@ -3,7 +3,6 @@ import color from "./functions/colors" import { Command, ContextMenu, Button, Modal, Autocomplete } from "interfaces" import env from "./Env" import autoDeployCommands from "./Autodeploy" -import { loadAllEvents } from "./Events" export class ExtendedClient extends Client { commands: Collection = new Collection() @@ -34,20 +33,15 @@ export class ExtendedClient extends Client { async start() { let token: string if (process.env.NODE_ENV === "dev" && process.env.TYPESCRIPT) { - console.log( - color("Running in development mode. [ts-node]", "lavender") - ) - loadAllEvents(this, "ts") + console.log(color("Running in development mode. [ts-node]", "lavender")) token = env.dev.devtoken! autoDeployCommands("ts") } else if (process.env.NODE_ENV === "dev" && !process.env.TYPESCRIPT) { console.log(color("Running in development mode.", "lavender")) - loadAllEvents(this, "js") token = env.dev.devtoken! autoDeployCommands("js") } else { console.log(color("Running in production mode.", "green")) - loadAllEvents(this, "js") token = env.prod.token! } diff --git a/src/utils/Events/autocomplete.ts b/src/utils/Events/autocomplete.ts index 0214bfa..6ad7463 100644 --- a/src/utils/Events/autocomplete.ts +++ b/src/utils/Events/autocomplete.ts @@ -10,16 +10,8 @@ type FileType = "js" | "ts" const embedColor = Number(color.replace("#", "0x")) export default function loadAutocompleteEvents(client: Client, ft: FileType) { - const autocompletePath = path.join( - __dirname, - "..", - "..", - "components", - "autocomplete" - ) - const autocompleteFiles = fs - .readdirSync(autocompletePath) - .filter(file => file.endsWith(ft)) + const autocompletePath = path.join(__dirname, "..", "..", "components", "autocomplete") + const autocompleteFiles = fs.readdirSync(autocompletePath).filter(file => file.endsWith(ft)) for (const file of autocompleteFiles) { const filePath = path.join(autocompletePath, file) @@ -43,9 +35,7 @@ export default function loadAutocompleteEvents(client: Client, ft: FileType) { const autocomplete = client.autocomplete.get(interaction.commandName) if (!autocomplete) { - console.error( - `No autocomplete matching ${interaction.commandName} was found.` - ) + console.error(`No autocomplete matching ${interaction.commandName} was found.`) return } @@ -54,21 +44,15 @@ export default function loadAutocompleteEvents(client: Client, ft: FileType) { } catch (error) { if (process.env.NODE_ENV !== "dev") { await logToChannel("error", { - embeds: [ - { - title: "Autocomplete error occured", - description: String(error), - color: embedColor, - footer: { - icon_url: - interaction.guild!.iconURL() || undefined, - text: - interaction.user.username + - " | " + - interaction.commandName - } + embeds: [{ + title: "Autocomplete error occured", + description: "```" + error + "```", + color: embedColor, + footer: { + icon_url: interaction.guild!.iconURL() || undefined, + text: interaction.user.username + " | " + interaction.commandName } - ] + }] }) } console.error(error) diff --git a/src/utils/Events/button.ts b/src/utils/Events/button.ts index 3b4ceb6..3c34a8e 100644 --- a/src/utils/Events/button.ts +++ b/src/utils/Events/button.ts @@ -35,9 +35,7 @@ export default function loadButtonEvents(client: Client, ft: FileType) { const button = client.buttons.get(interaction.customId) if (!button) { - console.error( - `No event matching ${interaction.customId} was found.` - ) + console.error(`No event matching ${interaction.customId} was found.`) return } @@ -46,45 +44,33 @@ export default function loadButtonEvents(client: Client, ft: FileType) { } catch (error) { if (process.env.NODE_ENV !== "dev") { await logToChannel("error", { - embeds: [ - { - title: "Button error occured", - description: "```" + error + "```", - color: embedColor, - footer: { - icon_url: - interaction.guild!.iconURL() || undefined, - text: - interaction.user.username + - " | " + - interaction.customId - } + embeds: [{ + title: "Button error occured", + description: "```" + error + "```", + color: embedColor, + footer: { + icon_url: interaction.guild!.iconURL() || undefined, + text: interaction.user.username + " | " + interaction.customId } - ] + }] }) } console.error(error) if (!interaction.deferred) { await interaction.reply({ - embeds: [ - { - description: - "There was an error while executing this button!", - color: embedColor - } - ], + embeds: [{ + description: "There was an error while executing this button!", + color: embedColor + }], ephemeral: true }) } else { await interaction.editReply({ - embeds: [ - { - description: - "There was an error while executing this button! 2", - color: embedColor - } - ] + embeds: [{ + description: "There was an error while executing this button! 2", + color: embedColor + }] }) } } diff --git a/src/utils/Events/command.ts b/src/utils/Events/command.ts index fca4da4..e44b0a0 100644 --- a/src/utils/Events/command.ts +++ b/src/utils/Events/command.ts @@ -47,45 +47,33 @@ export default function loadSlashCommandsEvents(client: Client, ft: FileType) { } catch (error) { if (process.env.NODE_ENV !== "dev") { await logToChannel("error", { - embeds: [ - { - title: "Command error occured", - description: "```" + error + "```", - color: embedColor, - footer: { - icon_url: - interaction.guild!.iconURL() || undefined, - text: - interaction.user.username + - " | " + - interaction.commandName - } + embeds: [{ + title: "Command error occured", + description: "```" + error + "```", + color: embedColor, + footer: { + icon_url: interaction.guild!.iconURL() || undefined, + text: interaction.user.username + " | " + interaction.commandName } - ] + }] }) } console.error(error) if (!interaction.deferred) { await interaction.reply({ - embeds: [ - { - description: - "There was an error while executing this command!", - color: embedColor - } - ], + embeds: [{ + description: "There was an error while executing this command!", + color: embedColor + }], ephemeral: true }) } else { await interaction.editReply({ - embeds: [ - { - description: - "There was an error while executing this command!", - color: embedColor - } - ] + embeds: [{ + description: "There was an error while executing this command!", + color: embedColor + }] }) } } diff --git a/src/utils/Events/contextmenu.ts b/src/utils/Events/contextmenu.ts index 8880504..405d3de 100644 --- a/src/utils/Events/contextmenu.ts +++ b/src/utils/Events/contextmenu.ts @@ -10,15 +10,8 @@ type FileType = "js" | "ts" const embedColor = Number(color.replace("#", "0x")) export default function loadContextMenuEvents(client: Client, ft: FileType) { - const contextMenuPath = path.join( - __dirname, - "..", - "..", - "commands-contextmenu" - ) - const contextMenuFiles = fs - .readdirSync(contextMenuPath) - .filter(file => file.endsWith(ft)) + const contextMenuPath = path.join(__dirname, "..", "..", "commands-contextmenu") + const contextMenuFiles = fs.readdirSync(contextMenuPath).filter(file => file.endsWith(ft)) for (const file of contextMenuFiles) { const filePath = path.join(contextMenuPath, file) @@ -43,9 +36,7 @@ export default function loadContextMenuEvents(client: Client, ft: FileType) { const command = client.contextmenus.get(interaction.commandName) if (!command) { - console.error( - `No command matching ${interaction.commandName} was found.` - ) + console.error(`No command matching ${interaction.commandName} was found.`) return } @@ -54,45 +45,33 @@ export default function loadContextMenuEvents(client: Client, ft: FileType) { } catch (error) { if (process.env.NODE_ENV !== "dev") { await logToChannel("error", { - embeds: [ - { - title: "Contextmenu error occured", - description: "```" + error + "```", - color: embedColor, - footer: { - icon_url: - interaction.guild!.iconURL() || undefined, - text: - interaction.user.username + - " | " + - interaction.commandName - } + embeds: [{ + title: "Contextmenu error occured", + description: "```" + error + "```", + color: embedColor, + footer: { + icon_url: interaction.guild!.iconURL() || undefined, + text: interaction.user.username + " | " + interaction.commandName } - ] + }] }) } console.error(error) if (!interaction.deferred) { await interaction.reply({ - embeds: [ - { - description: - "There was an error while executing this contextmenu command!", - color: embedColor - } - ], + embeds: [{ + description: "There was an error while executing this contextmenu command!", + color: embedColor + }], ephemeral: true }) } else { await interaction.editReply({ - embeds: [ - { - description: - "There was an error while executing this contextmenu command!", - color: embedColor - } - ] + embeds: [{ + description: "There was an error while executing this contextmenu command!", + color: embedColor + }] }) } } diff --git a/src/utils/Events/cron.ts b/src/utils/Events/cron.ts index 530d787..3727ae3 100644 --- a/src/utils/Events/cron.ts +++ b/src/utils/Events/cron.ts @@ -5,33 +5,20 @@ import { Cron } from "interfaces" export default function loadCronEvents() { const cronPath = path.join(__dirname, "..", "..", "events", "cron") - const cronFiles = fs - .readdirSync(cronPath) - .filter(file => file.endsWith(".js")) + const cronFiles = fs.readdirSync(cronPath).filter(file => file.endsWith(".js")) for (const file of cronFiles) { const filePath = path.join(cronPath, file) const cron: Cron = require(filePath) const time = - cron.time.seconds + - " " + - cron.time.minutes + - " " + - cron.time.hours + - " " + - cron.time.dayOfMonth + - " " + - cron.time.month + - " " + + cron.time.seconds + " " + + cron.time.minutes + " " + + cron.time.hours + " " + + cron.time.dayOfMonth + " " + + cron.time.month + " " + cron.time.dayOfWeek - new CronJob( - time, - cron.execute, - cron.onComplete, - cron.start, - cron.timeZone - ).start() + new CronJob(time, cron.execute, cron.onComplete, cron.start, cron.timeZone).start() } } diff --git a/src/utils/Events/index.ts b/src/utils/Events/index.ts index 86d6f1f..e1c2ad6 100644 --- a/src/utils/Events/index.ts +++ b/src/utils/Events/index.ts @@ -6,9 +6,8 @@ import loadContextMenuEvents from "./contextmenu" import loadCronEvents from "./cron" import loadEvents from "./events" import loadModalEvents from "./modal" -type FileType = "js" | "ts" -export function loadAllEvents(client: Client, ft: FileType) { +export default function loadAllEvents(client: Client, ft: "js" | "ts") { loadEvents(client) loadButtonEvents(client, ft) loadSlashCommandsEvents(client, ft) diff --git a/src/utils/Events/modal.ts b/src/utils/Events/modal.ts index 0aeba2a..7e3c61c 100644 --- a/src/utils/Events/modal.ts +++ b/src/utils/Events/modal.ts @@ -11,9 +11,7 @@ const embedColor = Number(color.replace("#", "0x")) export default function loadModalEvents(client: Client, ft: FileType) { const modalPath = path.join(__dirname, "..", "..", "components", "modals") - const modalFiles = fs - .readdirSync(modalPath) - .filter(file => file.endsWith(ft)) + const modalFiles = fs.readdirSync(modalPath).filter(file => file.endsWith(ft)) for (const file of modalFiles) { const filePath = path.join(modalPath, file) @@ -37,9 +35,7 @@ export default function loadModalEvents(client: Client, ft: FileType) { const modal = client.modals.get(interaction.customId) if (!modal) { - console.error( - `No modal matching ${interaction.customId} was found.` - ) + console.error(`No modal matching ${interaction.customId} was found.`) return } @@ -48,44 +44,32 @@ export default function loadModalEvents(client: Client, ft: FileType) { } catch (error) { if (process.env.NODE_ENV !== "dev") { await logToChannel("error", { - embeds: [ - { - title: "Button error occured", - description: "```" + error + "```", - color: embedColor, - footer: { - icon_url: - interaction.guild!.iconURL() || undefined, - text: - interaction.user.username + - " | " + - interaction.customId - } + embeds: [{ + title: "Button error occured", + description: "```" + error + "```", + color: embedColor, + footer: { + icon_url: interaction.guild!.iconURL() || undefined, + text: interaction.user.username + " | " + interaction.customId } - ] + }] }) } console.error(error) if (!interaction.deferred) { await interaction.reply({ - embeds: [ - { - description: - "There was an error while executing this modal!", - color: embedColor - } - ] + embeds: [{ + description: "There was an error while executing this modal!", + color: embedColor + }] }) } else { await interaction.editReply({ - embeds: [ - { - description: - "There was an error while executing this modal!", - color: embedColor - } - ] + embeds: [{ + description: "There was an error while executing this modal!", + color: embedColor + }] }) } } diff --git a/src/utils/Hypixel/account.ts b/src/utils/Hypixel/account.ts index 1765923..3140083 100644 --- a/src/utils/Hypixel/account.ts +++ b/src/utils/Hypixel/account.ts @@ -8,7 +8,7 @@ const mojanguuid = "https://sessionserver.mojang.com/session/minecraft/profile/" const hypixel = "https://api.hypixel.net/player" const guild = "https://api.hypixel.net/guild" const minotar = "https://minotar.net/helm/" -type GuildQuerqType = "player" | "name" | "id" +type GuildQueryType = "player" | "name" | "id" type Profile = { data: { @@ -47,8 +47,10 @@ async function getIGN(uuid: string): Promise { async function getPlayer(uuid: string): Promise { const playerReq: Player = await fetch(hypixel, { params: { - key: apikey, uuid: uuid + }, + headers: { + "API-Key": apikey } }) @@ -59,16 +61,15 @@ async function getPlayer(uuid: string): Promise { return playerReq.data.player } -async function getGuild( - query: string, - type?: GuildQuerqType -): Promise { +async function getGuild(query: string, type?: GuildQueryType): Promise { const reqType = type ? type : "player" const guildReq: Guild = await fetch(guild, { params: { - key: apikey, [reqType]: query + }, + headers: { + "API-Key": apikey } }) diff --git a/src/utils/Hypixel/guild.ts b/src/utils/Hypixel/guild.ts index 6f82f7f..978f115 100644 --- a/src/utils/Hypixel/guild.ts +++ b/src/utils/Hypixel/guild.ts @@ -38,10 +38,8 @@ function guildLevel(exp: number): number { */ function scaledGEXP(input: number): number { if (input <= 200000) return Number(input) - if (input <= 700000) - return Number(Math.round((input - 200000) / 10 + 200000)) - if (input > 700000) - return Number(Math.round((input - 700000) / 33 + 250000)) + if (input <= 700000) return Number(Math.round((input - 200000) / 10 + 200000)) + if (input > 700000) return Number(Math.round((input - 700000) / 33 + 250000)) return 0 } diff --git a/src/utils/Illegitimate.ts b/src/utils/Illegitimate.ts index bc625c5..4b23a7c 100644 --- a/src/utils/Illegitimate.ts +++ b/src/utils/Illegitimate.ts @@ -3,13 +3,25 @@ import color from "utils/functions/colors" import { Redis } from "ioredis" import env from "utils/Env" import { connect } from "mongoose" +import loadAllEvents from "./Events" const client = new Client() const redis = new Redis(env.prod.redisURI!) +let ft: "js" | "ts" +if (process.env.NODE_ENV === "dev" && process.env.TYPESCRIPT === "true") { + ft = "ts" +} else { + ft = "js" +} class Bot { async start() { this.init() + loadAllEvents(client, ft) client.start() + this.databases() + } + + private async databases() { redis.on("ready", () => { console.log(color("Connected to Redis", "green")) }) diff --git a/src/utils/functions/logtochannel.ts b/src/utils/functions/logtochannel.ts index a36a47a..bf05fdf 100644 --- a/src/utils/functions/logtochannel.ts +++ b/src/utils/functions/logtochannel.ts @@ -21,10 +21,7 @@ const channels = { type Channel = keyof typeof channels -export default async function logToChannel( - channel: Channel, - message: MessageCreateOptions -): Promise { +export default async function logToChannel(channel: Channel, message: MessageCreateOptions): Promise { const guild = Illegitimate.client.guilds.cache.get(guildid) as Guild let logChannel: TextChannel @@ -35,9 +32,7 @@ export default async function logToChannel( } if (!logChannel) { - console.log( - `[ERROR] Could not find channel used for ${channel} logging.` - ) + console.log(`[ERROR] Could not find channel used for ${channel} logging.`) return } diff --git a/src/utils/functions/rolesmanage.ts b/src/utils/functions/rolesmanage.ts index a1726be..72b49dd 100644 --- a/src/utils/functions/rolesmanage.ts +++ b/src/utils/functions/rolesmanage.ts @@ -30,63 +30,46 @@ type RoleType = | "default" | "all" -export default function roleManage(role: RoleType): { - rolesToRemove: string[] - rolesToAdd: string[] -} { +export default function roleManage(role: RoleType): { rolesToRemove: string[], rolesToAdd: string[] } { if (role === "gm") { - const rolesToRemove = roles.filter( - role => role !== gm && role !== guildStaff && role !== guildRole - ) + const rolesToRemove = roles.filter(role => role !== gm && role !== guildStaff && role !== guildRole) const rolesToAdd = [gm, guildStaff, guildRole] return { rolesToRemove, rolesToAdd } } if (role === "manager") { - const rolesToRemove = roles.filter( - role => - role !== manager && role !== guildStaff && role !== guildRole - ) + const rolesToRemove = roles.filter(role => role !== manager && role !== guildStaff && role !== guildRole) const rolesToAdd = [manager, guildStaff, guildRole] return { rolesToRemove, rolesToAdd } } if (role === "moderator") { - const rolesToRemove = roles.filter( - role => - role !== moderator && role !== guildStaff && role !== guildRole - ) + const rolesToRemove = roles.filter(role => role !== moderator && role !== guildStaff && role !== guildRole) const rolesToAdd = [moderator, guildStaff, guildRole] return { rolesToRemove, rolesToAdd } } if (role === "beast") { - const rolesToRemove = roles.filter( - role => role !== beast && role !== guildRole - ) + const rolesToRemove = roles.filter(role => role !== beast && role !== guildRole) const rolesToAdd = [beast, guildRole] return { rolesToRemove, rolesToAdd } } if (role === "elite") { - const rolesToRemove = roles.filter( - role => role !== elite && role !== guildRole - ) + const rolesToRemove = roles.filter(role => role !== elite && role !== guildRole) const rolesToAdd = [elite, guildRole] return { rolesToRemove, rolesToAdd } } if (role === "member") { - const rolesToRemove = roles.filter( - role => role !== member && role !== guildRole - ) + const rolesToRemove = roles.filter(role => role !== member && role !== guildRole) const rolesToAdd = [member, guildRole] return { rolesToRemove, rolesToAdd } } if (role === "default") { const rolesToRemove = roles - const rolesToAdd: string[] = [defaultMember] + const rolesToAdd = [defaultMember] return { rolesToRemove, rolesToAdd } } From 53179f0c2bb7fdd9d256dc6f40fb89bd35f017d4 Mon Sep 17 00:00:00 2001 From: Taken Date: Sun, 21 Jan 2024 00:35:00 +0100 Subject: [PATCH 14/15] Removed prettier files Signed-off-by: Taken --- .prettierignore | 1 - .prettierrc.js | 17 ----------------- 2 files changed, 18 deletions(-) delete mode 100644 .prettierignore delete mode 100644 .prettierrc.js diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index 152fd89..0000000 --- a/.prettierignore +++ /dev/null @@ -1 +0,0 @@ -src/config/ diff --git a/.prettierrc.js b/.prettierrc.js deleted file mode 100644 index 7b72306..0000000 --- a/.prettierrc.js +++ /dev/null @@ -1,17 +0,0 @@ -/** @type { import('prettier').Config } */ - -const config = { - printWidth: 80, - tabWidth: 4, - useTabs: false, - semi: false, - singleQuote: false, - quoteProps: "as-needed", - trailingComma: "none", - bracketSpacing: true, - arrowParens: "avoid", - parser: "typescript", - endOfLine: "crlf", -} - -module.exports = config From d69c36f89708d5a91b17a5856d3a62944e3f9efa Mon Sep 17 00:00:00 2001 From: Taken Date: Sun, 21 Jan 2024 00:36:36 +0100 Subject: [PATCH 15/15] Updated gitignore --- .dockerignore | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.dockerignore b/.dockerignore index b78b0e7..db15c59 100644 --- a/.dockerignore +++ b/.dockerignore @@ -11,9 +11,8 @@ scripts .eslintrc.js .gitignore .gitlab-ci.yml -.prettierrc.js docker-compose.yml Dockerfile Dockerfile.cache nodemon-js.json -nodemon.json \ No newline at end of file +nodemon.json