From 5661bc66bbd5a591abf5875c6e4e3c890eddd0e0 Mon Sep 17 00:00:00 2001 From: Taken Date: Tue, 16 Jan 2024 17:05:15 +0100 Subject: [PATCH] Updated imports and formating Signed-off-by: Taken --- .prettierignore | 1 + src/commands-contextmenu/updateuser.ts | 94 +++++++++++++++---- src/commands/ban.ts | 48 +++++----- src/commands/clear.ts | 34 +++---- src/commands/counting.ts | 22 +++-- src/commands/counting/setup.ts | 59 +++++++----- src/commands/dev-info.ts | 2 +- src/commands/forceunverify.ts | 40 ++++---- src/commands/forceupdate.ts | 79 ++++++++++++---- src/commands/forceverify.ts | 69 +++++++++----- src/commands/guild.ts | 3 +- src/commands/guild/info.ts | 14 +-- src/commands/guild/member.ts | 2 +- src/commands/guild/top.ts | 10 +- src/commands/kick.ts | 53 ++++++----- src/commands/ping.ts | 3 +- src/commands/remove.ts | 44 +++++---- src/commands/reqs.ts | 3 +- src/commands/send.ts | 8 +- src/commands/setnick.ts | 52 +++++----- src/commands/setup.ts | 70 +++++++++----- src/commands/slowmode.ts | 48 +++++----- src/commands/snipe.ts | 55 ++++++----- src/commands/timeout.ts | 64 ++++++++----- src/commands/unban.ts | 14 ++- src/commands/update.ts | 82 ++++++++++++---- src/commands/whois.ts | 3 +- .../buttons/guildapplicationaccept.ts | 4 +- src/events/cron/weeklyGexp.ts | 4 +- src/events/server/interactions/logBtnsCmds.ts | 44 +++++---- src/events/server/messages/snipecache.ts | 6 +- .../server/voiceStateUpdate/vcJoinLeave.ts | 15 ++- src/schemas/snipeCacheSchema.ts | 4 +- src/typings/Types.ts | 2 +- src/typings/index.ts | 2 +- src/utils/Autodeploy.ts | 12 +-- src/utils/Client.ts | 4 +- src/utils/Events/autocomplete.ts | 18 ++-- src/utils/Events/button.ts | 39 +++++--- src/utils/Events/command.ts | 39 +++++--- src/utils/Events/contextmenu.ts | 39 +++++--- src/utils/Events/events.ts | 4 +- src/utils/Events/modal.ts | 41 ++++---- src/utils/Hypixel/bedwars.ts | 16 ++-- src/utils/Hypixel/hypixel.ts | 4 +- src/utils/Hypixel/index.ts | 8 +- src/utils/functions/colors.ts | 4 +- src/utils/functions/logtochannel.ts | 23 ++++- src/utils/functions/rolesmanage.ts | 2 +- 49 files changed, 819 insertions(+), 491 deletions(-) create mode 100644 .prettierignore diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..152fd89 --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +src/config/ diff --git a/src/commands-contextmenu/updateuser.ts b/src/commands-contextmenu/updateuser.ts index 2bd5814..6c1ffd0 100644 --- a/src/commands-contextmenu/updateuser.ts +++ b/src/commands-contextmenu/updateuser.ts @@ -1,4 +1,9 @@ -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" @@ -74,13 +79,18 @@ 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.", + description: + usermentioned + + " was given the the Default Member role.", color: embedColor, thumbnail: { url: head!, @@ -97,50 +107,91 @@ export = { 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" } @@ -148,7 +199,10 @@ export = { embeds: [ { description: - usermentioned + " was given the " + replyRank + " role.", + usermentioned + + " was given the " + + replyRank + + " role.", color: embedColor, thumbnail: { url: head!, @@ -161,5 +215,5 @@ export = { ], }) } - } -} as ContextMenu \ No newline at end of file + }, +} as ContextMenu diff --git a/src/commands/ban.ts b/src/commands/ban.ts index 552bc7b..89b7bd5 100644 --- a/src/commands/ban.ts +++ b/src/commands/ban.ts @@ -112,30 +112,30 @@ export = { }) 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() || "", + color: embedColor, + thumbnail: { + url: mod.user.avatarURL() || "", + }, + footer: { + text: "ID: " + member.user.id, + icon_url: member.user.avatarURL() || undefined, + }, + timestamp: new Date().toISOString(), }, - footer: { - text: "ID: " + member.user.id, - icon_url: - member.user.avatarURL() || - undefined, - }, - timestamp: new Date().toISOString(), - }] + ], }) await interaction.editReply({ @@ -143,9 +143,15 @@ export = { { title: "Member Banned", description: - "**User:** " + userMention(member.user.id) + "\n" + - "**Reason:** " + reason + "\n" + - "**Messages Deleted:** " + messageDeletionDays + " days", + "**User:** " + + userMention(member.user.id) + + "\n" + + "**Reason:** " + + reason + + "\n" + + "**Messages Deleted:** " + + messageDeletionDays + + " days", color: embedColor, thumbnail: { url: member.user.avatarURL() || "", diff --git a/src/commands/clear.ts b/src/commands/clear.ts index 7332f11..8364c3b 100644 --- a/src/commands/clear.ts +++ b/src/commands/clear.ts @@ -60,27 +60,29 @@ export = { 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() || "", + color: embedColor, + thumbnail: { + url: interaction.user.avatarURL() || "", + }, + footer: { + text: "ID: " + channel.id, + icon_url: interaction.guild!.iconURL() || undefined, + }, + timestamp: new Date().toISOString(), }, - footer: { - text: "ID: " + channel.id, - icon_url: interaction.guild!.iconURL() || undefined, - }, - timestamp: new Date().toISOString() - }] + ], }) await interaction.editReply({ diff --git a/src/commands/counting.ts b/src/commands/counting.ts index 6f7dbfb..72cc6e7 100644 --- a/src/commands/counting.ts +++ b/src/commands/counting.ts @@ -1,4 +1,8 @@ -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" @@ -25,7 +29,10 @@ export = { .setName("channel") .setDescription("The channel to setup counting in") .setRequired(true) - .addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement) + .addChannelTypes( + ChannelType.GuildText, + ChannelType.GuildAnnouncement, + ), ), ) .addSubcommand(subcommand => @@ -36,8 +43,8 @@ export = { option .setName("user") .setDescription("The user to ban") - .setRequired(true) - ) + .setRequired(true), + ), ) .addSubcommand(subcommand => subcommand @@ -47,8 +54,8 @@ export = { option .setName("user") .setDescription("The user to ban") - .setRequired(true) - ) + .setRequired(true), + ), ) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDMPermission(false), @@ -79,8 +86,7 @@ export = { 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/counting/setup.ts b/src/commands/counting/setup.ts index 7b65e53..80e0d46 100644 --- a/src/commands/counting/setup.ts +++ b/src/commands/counting/setup.ts @@ -1,44 +1,61 @@ -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 const embedColor = Number(color.replace("#", "0x")) if (await settingsSchema.findOne({ name: "counting" })) { - await settingsSchema.findOneAndUpdate({ name: "counting" }, { name: "counting", channel: channel.id }) + await settingsSchema.findOneAndUpdate( + { name: "counting" }, + { 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, + }, + }, + ], }) } -} \ No newline at end of file +} diff --git a/src/commands/dev-info.ts b/src/commands/dev-info.ts index 87497a7..72a5356 100644 --- a/src/commands/dev-info.ts +++ b/src/commands/dev-info.ts @@ -33,4 +33,4 @@ export = { await interaction.reply({ content: "Test command.", ephemeral: true }) }, -} as Command \ No newline at end of file +} as Command diff --git a/src/commands/forceunverify.ts b/src/commands/forceunverify.ts index ecc508c..a484fac 100644 --- a/src/commands/forceunverify.ts +++ b/src/commands/forceunverify.ts @@ -50,32 +50,36 @@ export = { const uuid = verifiedUser.uuid const ign = await getIGN(uuid) await verify.findOneAndDelete({ userID: member.user.id }) - await member.roles.remove(roleManage("all").rolesToRemove, "User force unverified by " + interaction.user.username) - + await member.roles.remove( + roleManage("all").rolesToRemove, + "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() || "", + color: embedColor, + thumbnail: { + url: mod.avatarURL() || "", + }, + footer: { + icon_url: member.user.avatarURL() || undefined, + text: "ID: " + member.user.id, + }, + timestamp: new Date().toISOString(), }, - footer: { - icon_url: member.user.avatarURL() || undefined, - text: "ID: " + member.user.id, - }, - timestamp: new Date().toISOString(), - }] + ], }) await interaction.reply({ diff --git a/src/commands/forceupdate.ts b/src/commands/forceupdate.ts index b4c1845..4f8d064 100644 --- a/src/commands/forceupdate.ts +++ b/src/commands/forceupdate.ts @@ -85,7 +85,10 @@ 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({ @@ -110,50 +113,91 @@ export = { 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" } @@ -161,7 +205,10 @@ export = { embeds: [ { description: - usermentioned + " was given the the " + replyRank + " role.", + usermentioned + + " was given the the " + + replyRank + + " role.", color: embedColor, thumbnail: { url: head!, diff --git a/src/commands/forceverify.ts b/src/commands/forceverify.ts index 1730ae6..14bd1b0 100644 --- a/src/commands/forceverify.ts +++ b/src/commands/forceverify.ts @@ -143,36 +143,57 @@ export = { 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(), @@ -183,28 +204,30 @@ export = { 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() || "", + color: embedColor, + thumbnail: { + url: mod.avatarURL() || "", + }, + footer: { + icon_url: user.user.avatarURL() || undefined, + text: "ID: " + user.user.id, + }, + timestamp: new Date().toISOString(), }, - footer: { - icon_url: user.user.avatarURL() || undefined, - text: "ID: " + user.user.id - }, - timestamp: new Date().toISOString(), - }] + ], }) await interaction.editReply({ diff --git a/src/commands/guild.ts b/src/commands/guild.ts index 254fbb9..2f70801 100644 --- a/src/commands/guild.ts +++ b/src/commands/guild.ts @@ -108,8 +108,7 @@ export = { 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/info.ts b/src/commands/guild/info.ts index ed73075..3fae00b 100644 --- a/src/commands/guild/info.ts +++ b/src/commands/guild/info.ts @@ -1,10 +1,4 @@ -import { - getUUID, - getIGN, - getPlayer, - getGuild, - guildLevel, -} from "utils/Hypixel" +import { getUUID, getIGN, getPlayer, getGuild, guildLevel } from "utils/Hypixel" import { color, devMessage } from "config/options.json" import { ChatInputCommandInteraction } from "discord.js" import { GuildData } from "interfaces" @@ -234,11 +228,9 @@ export default async function guildInfo( color: embedColor, footer: { text: interaction.guild!.name + " | " + devMessage, - icon_url: - interaction.guild!.iconURL() || - undefined, + icon_url: interaction.guild!.iconURL() || undefined, }, }, ], }) -} \ No newline at end of file +} diff --git a/src/commands/guild/member.ts b/src/commands/guild/member.ts index ff47c85..071591e 100644 --- a/src/commands/guild/member.ts +++ b/src/commands/guild/member.ts @@ -205,4 +205,4 @@ export default async function guildMember( }, ], }) -} \ No newline at end of file +} diff --git a/src/commands/guild/top.ts b/src/commands/guild/top.ts index f8194f2..56a0dfb 100644 --- a/src/commands/guild/top.ts +++ b/src/commands/guild/top.ts @@ -177,8 +177,8 @@ export default async function guildTop( amount = 1 } - type GuildTopData = { ign: string, uuid: string }[] - type NewList = { name: string, value: string; inline: boolean }[] + type GuildTopData = { ign: string; uuid: string }[] + type NewList = { name: string; value: string; inline: boolean }[] let cacheStatus: boolean let guildData: GuildTopData = [] @@ -243,7 +243,9 @@ 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 @@ -291,4 +293,4 @@ export default async function guildTop( }, ], }) -} \ No newline at end of file +} diff --git a/src/commands/kick.ts b/src/commands/kick.ts index 9050365..3b6ad20 100644 --- a/src/commands/kick.ts +++ b/src/commands/kick.ts @@ -36,8 +36,9 @@ export = { async execute(interaction) { await interaction.deferReply() - const member = interaction.options.getMember( "member",) as GuildMember - const reason = interaction.options.getString("reason") ?? "No reason provided." + const member = interaction.options.getMember("member") as GuildMember + 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) @@ -79,36 +80,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() || "", + color: embedColor, + thumbnail: { + url: mod.user.avatarURL() || "", + }, + footer: { + text: "ID: " + member.user.id, + icon_url: member.user.avatarURL() || undefined, + }, + timestamp: new Date().toISOString(), }, - 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, + description: + "**User:** " + + userMention(member.user.id) + + "\n" + + "**Reason:** " + + reason + + "\n" + + "**Moderator:** " + + mod.user.username, color: embedColor, thumbnail: { url: member.user.avatarURL() || "", @@ -116,7 +125,7 @@ export = { footer: { icon_url: interaction.guild!.iconURL() || undefined, text: interaction.guild!.name + " | " + devMessage, - } + }, }, ], }) diff --git a/src/commands/ping.ts b/src/commands/ping.ts index 2367478..6838fe4 100644 --- a/src/commands/ping.ts +++ b/src/commands/ping.ts @@ -26,8 +26,7 @@ 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(), }, diff --git a/src/commands/remove.ts b/src/commands/remove.ts index 5996576..fd8a8c0 100644 --- a/src/commands/remove.ts +++ b/src/commands/remove.ts @@ -61,27 +61,29 @@ 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() || "", + color: embedColor, + thumbnail: { + url: mod.avatarURL() || "", + }, + footer: { + icon_url: user.avatarURL() || undefined, + text: "ID: " + user.id, + }, + timestamp: new Date().toISOString(), }, - footer: { - icon_url: user.avatarURL() || undefined, - text: "ID: " + user.id, - }, - timestamp: new Date().toISOString() - }] + ], }) await interaction.editReply({ @@ -89,13 +91,17 @@ export = { { title: "Waiting List - Remove User", description: - "**User:** " + userMention(user.id) + "\n" + - "**Reason:** `" + reason + "`", + "**User:** " + + userMention(user.id) + + "\n" + + "**Reason:** `" + + reason + + "`", color: embedColor, footer: { text: interaction.guild!.name + " | " + devMessage, icon_url: interaction.guild!.iconURL() || undefined, - } + }, }, ], }) diff --git a/src/commands/reqs.ts b/src/commands/reqs.ts index 42840e1..eb6656f 100644 --- a/src/commands/reqs.ts +++ b/src/commands/reqs.ts @@ -34,8 +34,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: [ { diff --git a/src/commands/send.ts b/src/commands/send.ts index 221e1f1..78aa5f3 100644 --- a/src/commands/send.ts +++ b/src/commands/send.ts @@ -27,7 +27,10 @@ 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), @@ -36,7 +39,8 @@ 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({ diff --git a/src/commands/setnick.ts b/src/commands/setnick.ts index 8b1823f..1cec5c9 100644 --- a/src/commands/setnick.ts +++ b/src/commands/setnick.ts @@ -49,38 +49,42 @@ 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() || "", + color: embedColor, + thumbnail: { + url: interaction.user.avatarURL() || "", + }, + footer: { + text: "ID: " + member.user.id, + icon_url: member.user.avatarURL() || undefined, + }, + timestamp: new Date().toISOString(), }, - 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 20228ef..1ac402d 100644 --- a/src/commands/setup.ts +++ b/src/commands/setup.ts @@ -31,7 +31,10 @@ export = { .setDescription( "The channel to send the application to.", ) - .addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement) + .addChannelTypes( + ChannelType.GuildText, + ChannelType.GuildAnnouncement, + ) .setRequired(true), ), ) @@ -45,7 +48,10 @@ export = { .setDescription( "The channel to send the application to.", ) - .addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement) + .addChannelTypes( + ChannelType.GuildText, + ChannelType.GuildAnnouncement, + ) .setRequired(true), ), ) @@ -59,7 +65,10 @@ export = { .setDescription( "The channel to send the verfiy message to.", ) - .addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement) + .addChannelTypes( + ChannelType.GuildText, + ChannelType.GuildAnnouncement, + ) .setRequired(true), ), ) @@ -73,7 +82,10 @@ export = { .setDescription( "The channel to send the waiting list message to.", ) - .addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement) + .addChannelTypes( + ChannelType.GuildText, + ChannelType.GuildAnnouncement, + ) .setRequired(true), ), ) @@ -87,7 +99,10 @@ export = { .setDescription( "The channel to send the application to.", ) - .addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement) + .addChannelTypes( + ChannelType.GuildText, + ChannelType.GuildAnnouncement, + ) .setRequired(true), ), ) @@ -106,7 +121,8 @@ 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 = "✅" @@ -114,7 +130,8 @@ 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 = "✅" @@ -122,7 +139,8 @@ 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 = "✅" @@ -138,34 +156,38 @@ export = { if (subcommand === "sendwaitinglistmessage") { title = "Waiting List" - description = "The people below were accepted into the guild\n" + "Try to invite them in order.", - customId = "waitinglistupdate" + ;(description = + "The people below were accepted into the guild\n" + + "Try to invite them in order."), + (customId = "waitinglistupdate") label = "Update" emoji = "🔄" } await channel.send({ - embeds: [{ - title: title, - description: description, - color: embedColor, - thumbnail: { - url: interaction.guild!.iconURL() || "", + embeds: [ + { + title: title, + description: description, + color: embedColor, + thumbnail: { + url: interaction.guild!.iconURL() || "", + }, + footer: { + text: interaction.guild!.name + " | " + devMessage, + icon_url: interaction.guild!.iconURL() || undefined, + }, }, - footer: { - text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL() || undefined, - } - }], + ], components: [ new ActionRowBuilder().addComponents( new ButtonBuilder() .setCustomId(customId) .setLabel(label) .setStyle(ButtonStyle.Primary) - .setEmoji({ name: emoji }) - ) - ] + .setEmoji({ name: emoji }), + ), + ], }) await interaction.reply({ diff --git a/src/commands/slowmode.ts b/src/commands/slowmode.ts index eee9a91..4e57169 100644 --- a/src/commands/slowmode.ts +++ b/src/commands/slowmode.ts @@ -31,7 +31,10 @@ 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,7 +43,8 @@ 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) { @@ -52,8 +56,7 @@ export = { color: embedColor, footer: { text: interaction.guild!.name + " | " + devMessage, - icon_url: - interaction.guild!.iconURL() || undefined, + icon_url: interaction.guild!.iconURL() || undefined, }, }, ], @@ -62,27 +65,29 @@ export = { } await logToChannel("mod", { - embeds: [{ - author: { - name: interaction.user.username, - icon_url: interaction.user.avatarURL() || undefined, - }, - title: "Slowmode Update", - description: ` + 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() || "", + color: embedColor, + thumbnail: { + url: interaction.user.avatarURL() || "", + }, + footer: { + icon_url: interaction.guild!.iconURL() || undefined, + text: " ID: " + channel.id, + }, + timestamp: new Date().toISOString(), }, - footer: { - icon_url: interaction.guild!.iconURL() || undefined, - text: " ID: " + channel.id - }, - timestamp: new Date().toISOString() - }] + ], }) await interaction.editReply({ @@ -92,8 +97,7 @@ export = { 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/snipe.ts b/src/commands/snipe.ts index 77d55a7..a8dda75 100644 --- a/src/commands/snipe.ts +++ b/src/commands/snipe.ts @@ -18,7 +18,8 @@ export = { option .setName("user") .setDescription("The user to snipe") - .setRequired(true)) + .setRequired(true), + ) .setDMPermission(false), async execute(interaction) { @@ -26,17 +27,19 @@ 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[] = [] if (!snipeCache.length) { await interaction.editReply({ - embeds: [{ - description: "No messages to snipe", - color: embedColor - }] + embeds: [ + { + description: "No messages to snipe", + color: embedColor, + }, + ], }) return } @@ -48,28 +51,32 @@ 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 + 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(), }, - 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 \ No newline at end of file + }, +} as Command diff --git a/src/commands/timeout.ts b/src/commands/timeout.ts index a398630..2f630e3 100644 --- a/src/commands/timeout.ts +++ b/src/commands/timeout.ts @@ -124,44 +124,62 @@ export = { if (target.isCommunicationDisabled()) { if (time === 0) { title = "Timeout Removed" - description = "Removed timeout of " + userMention(target.id) + " for " + reason, - timeouttime = null + ;(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, - timeouttime = time + ;(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, - timeouttime = time + ;(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() || "", + color: embedColor, + thumbnail: { + url: mod.user.avatarURL() || "", + }, + footer: { + text: "ID: " + target.id, + icon_url: target.user.avatarURL() || undefined, + }, + timestamp: new Date().toISOString(), }, - footer: { - text: "ID: " + target.id, - icon_url: target.user.avatarURL() || undefined, - }, - timestamp: new Date().toISOString() - }] + ], }) await interaction.editReply({ @@ -177,4 +195,4 @@ export = { ], }) }, -} as Command \ No newline at end of file +} as Command diff --git a/src/commands/unban.ts b/src/commands/unban.ts index a724f9b..214383f 100644 --- a/src/commands/unban.ts +++ b/src/commands/unban.ts @@ -38,7 +38,8 @@ 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 @@ -102,9 +103,14 @@ export = { { title: "User unbanned", description: - "The user " + user!.username + " has been unbanned.\n" + - "**Reason:** `" + reason + "`\n" + - "**Moderator:** " + userMention(mod.id), + "The user " + + user!.username + + " has been unbanned.\n" + + "**Reason:** `" + + reason + + "`\n" + + "**Moderator:** " + + userMention(mod.id), color: embedColor, thumbnail: { url: user!.avatarURL() || "", diff --git a/src/commands/update.ts b/src/commands/update.ts index 11ad333..9b416d0 100644 --- a/src/commands/update.ts +++ b/src/commands/update.ts @@ -62,8 +62,14 @@ 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: [ @@ -85,57 +91,99 @@ export = { 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 + "`", + description: + "Updated your roles to `" + replyRank + "`", color: embedColor, thumbnail: { url: head!, diff --git a/src/commands/whois.ts b/src/commands/whois.ts index 4d6a348..1c506da 100644 --- a/src/commands/whois.ts +++ b/src/commands/whois.ts @@ -59,8 +59,7 @@ export = { }, footer: { text: interaction.guild!.name + " | " + devMessage, - icon_url: - interaction.guild!.iconURL() || undefined, + icon_url: interaction.guild!.iconURL() || undefined, }, }, ], diff --git a/src/components/buttons/guildapplicationaccept.ts b/src/components/buttons/guildapplicationaccept.ts index b9709dc..ea73815 100644 --- a/src/components/buttons/guildapplicationaccept.ts +++ b/src/components/buttons/guildapplicationaccept.ts @@ -155,7 +155,9 @@ export = { ], }) } catch (err) { - console.log(colorLog("Error while trying to update waiting list.", "red")) + console.log( + colorLog("Error while trying to update waiting list.", "red"), + ) } }, } as Button diff --git a/src/events/cron/weeklyGexp.ts b/src/events/cron/weeklyGexp.ts index 04a0273..2a84d02 100644 --- a/src/events/cron/weeklyGexp.ts +++ b/src/events/cron/weeklyGexp.ts @@ -12,9 +12,7 @@ import { TextChannel } from "discord.js" const client = Illegitimate.client async function guildWeekly() { - const channel = client.channels.cache.get( - guildLogChannel, - ) as TextChannel + const channel = client.channels.cache.get(guildLogChannel) as TextChannel if (!channel) { console.log(colorLog("Guild log channel not found", "red")) diff --git a/src/events/server/interactions/logBtnsCmds.ts b/src/events/server/interactions/logBtnsCmds.ts index d8ffc90..2569cc1 100644 --- a/src/events/server/interactions/logBtnsCmds.ts +++ b/src/events/server/interactions/logBtnsCmds.ts @@ -11,32 +11,38 @@ export = { execute(interaction: ChatInputCommandInteraction | ButtonInteraction) { if (interaction.isCommand()) { try { - console.log(color( - interaction.user.username + - " ran " + - interaction.commandName + - " " + - interaction.options.getSubcommand(), - "pink") + console.log( + color( + interaction.user.username + + " ran " + + interaction.commandName + + " " + + interaction.options.getSubcommand(), + "pink", + ), ) } catch { - console.log(color( - interaction.user.username + - " ran " + - interaction.commandName, - "pink") + console.log( + color( + interaction.user.username + + " ran " + + interaction.commandName, + "pink", + ), ) } } if (interaction.isButton()) { - console.log(color( - interaction.user.username + - "#" + - interaction.user.discriminator + - " clicked " + - interaction.customId, - "pink") + console.log( + color( + interaction.user.username + + "#" + + interaction.user.discriminator + + " clicked " + + interaction.customId, + "pink", + ), ) return } diff --git a/src/events/server/messages/snipecache.ts b/src/events/server/messages/snipecache.ts index 45fd579..8e58641 100644 --- a/src/events/server/messages/snipecache.ts +++ b/src/events/server/messages/snipecache.ts @@ -24,12 +24,12 @@ export = { } const snipeCache = new snipeCacheSchema({ - _id: new mongoose.Types.ObjectId, + _id: new mongoose.Types.ObjectId(), userid: message.author.id, channelid: message.channel.id, data: msg, }) await snipeCache.save() - } -} as Event \ No newline at end of file + }, +} as Event diff --git a/src/events/server/voiceStateUpdate/vcJoinLeave.ts b/src/events/server/voiceStateUpdate/vcJoinLeave.ts index 236ffba..11b5556 100644 --- a/src/events/server/voiceStateUpdate/vcJoinLeave.ts +++ b/src/events/server/voiceStateUpdate/vcJoinLeave.ts @@ -1,8 +1,4 @@ -import { - userMention, - channelMention, - VoiceState, -} from "discord.js" +import { userMention, channelMention, VoiceState } from "discord.js" import { color } from "config/options.json" import { Event } from "interfaces" import logToChannel from "utils/functions/logtochannel" @@ -32,7 +28,8 @@ export = { color: embedColor, footer: { text: "ID: " + newState.member!.id, - icon_url: newState.member!.user.avatarURL() || undefined, + icon_url: + newState.member!.user.avatarURL() || undefined, }, timestamp: new Date().toISOString(), }, @@ -50,7 +47,8 @@ export = { color: embedColor, footer: { text: "ID: " + oldState.member!.id, - icon_url: oldState.member!.user.avatarURL() || undefined, + icon_url: + oldState.member!.user.avatarURL() || undefined, }, timestamp: new Date().toISOString(), }, @@ -72,7 +70,8 @@ export = { color: embedColor, footer: { text: "ID: " + oldState.member!.id, - icon_url: oldState.member!.user.avatarURL() || undefined, + icon_url: + oldState.member!.user.avatarURL() || undefined, }, timestamp: new Date().toISOString(), }, diff --git a/src/schemas/snipeCacheSchema.ts b/src/schemas/snipeCacheSchema.ts index 410e61c..abe8702 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") \ No newline at end of file +export default model("snipeCache", snipeCacheSchema, "snipeCache") diff --git a/src/typings/Types.ts b/src/typings/Types.ts index 9378e77..bf9708a 100644 --- a/src/typings/Types.ts +++ b/src/typings/Types.ts @@ -7,4 +7,4 @@ type SnipeCache = { attachments: string[] } -export default SnipeCache \ No newline at end of file +export default SnipeCache diff --git a/src/typings/index.ts b/src/typings/index.ts index adfe505..c84b166 100644 --- a/src/typings/index.ts +++ b/src/typings/index.ts @@ -1,3 +1,3 @@ import SnipeCache from "./Types" -export { SnipeCache } \ No newline at end of file +export { SnipeCache } diff --git a/src/utils/Autodeploy.ts b/src/utils/Autodeploy.ts index ff642ef..ecaf281 100644 --- a/src/utils/Autodeploy.ts +++ b/src/utils/Autodeploy.ts @@ -7,7 +7,7 @@ import { RESTPutAPIApplicationGuildCommandsJSONBody, Routes, } from "discord.js" -import fs = require("fs") +import fs from "fs" type FileType = "js" | "ts" export default async function autoDeployCommands(fileType: FileType) { @@ -17,10 +17,10 @@ export default async function autoDeployCommands(fileType: FileType) { if (fileType === "js") { commandFiles = fs - .readdirSync("./dist/src/commands/") + .readdirSync("./dist/commands/") .filter(file => file.endsWith(fileType)) contentMenuCommands = fs - .readdirSync("./dist/src/commands-contextmenu/") + .readdirSync("./dist/commands-contextmenu/") .filter(file => file.endsWith(fileType)) } else if (fileType === "ts") { commandFiles = fs @@ -93,9 +93,7 @@ export default async function autoDeployCommands(fileType: FileType) { } try { - console.log( - color("Commands are different, starting deploy.", "red"), - ) + console.log(color("Commands are different, starting deploy.", "red")) console.log(color(currentCmds, "red")) console.log( `Started refreshing ${commands.length} application (/) commands.`, @@ -114,4 +112,4 @@ export default async function autoDeployCommands(fileType: FileType) { } catch (error) { console.error(error) } -} \ No newline at end of file +} diff --git a/src/utils/Client.ts b/src/utils/Client.ts index 86fbb1f..323b607 100644 --- a/src/utils/Client.ts +++ b/src/utils/Client.ts @@ -34,7 +34,9 @@ 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")) + console.log( + color("Running in development mode. [ts-node]", "lavender"), + ) loadAllEvents(this, "ts") token = env.dev.devtoken! autoDeployCommands("ts") diff --git a/src/utils/Events/autocomplete.ts b/src/utils/Events/autocomplete.ts index 5e9efe9..db71862 100644 --- a/src/utils/Events/autocomplete.ts +++ b/src/utils/Events/autocomplete.ts @@ -3,8 +3,8 @@ import { color } from "config/options.json" import { Autocomplete } from "interfaces" import { Events } from "discord.js" import colorLog from "utils/functions/colors" -import path = require("path") -import fs = require("fs") +import path from "path" +import fs from "fs" import logToChannel from "utils/functions/logtochannel" type FileType = "js" | "ts" const embedColor = Number(color.replace("#", "0x")) @@ -32,10 +32,12 @@ export default function loadAutocompleteEvents(client: Client, ft: FileType) { ) { client.autocomplete.set(autocomplete.name, autocomplete) } else { - console.log(colorLog( - `[WARNING] The autocomplete at ${filePath} is missing a required "name", "execute" or "type" property.`, - "red" - )) + console.log( + colorLog( + `[WARNING] The autocomplete at ${filePath} is missing a required "name", "execute" or "type" property.`, + "red", + ), + ) } } @@ -55,7 +57,6 @@ export default function loadAutocompleteEvents(client: Client, ft: FileType) { await autocomplete.execute(interaction) } catch (error) { if (process.env.NODE_ENV !== "dev") { - await logToChannel("error", { embeds: [ { @@ -63,7 +64,8 @@ export default function loadAutocompleteEvents(client: Client, ft: FileType) { description: String(error), color: embedColor, footer: { - icon_url: interaction.guild!.iconURL() || undefined, + icon_url: + interaction.guild!.iconURL() || undefined, text: interaction.user.username + " | " + diff --git a/src/utils/Events/button.ts b/src/utils/Events/button.ts index 976c7ce..49736be 100644 --- a/src/utils/Events/button.ts +++ b/src/utils/Events/button.ts @@ -3,8 +3,8 @@ import colorLog from "utils/functions/colors" import { color } from "config/options.json" import { Button } from "interfaces" import { Events } from "discord.js" -import path = require("path") -import fs = require("fs") +import path from "path" +import fs from "fs" import logToChannel from "utils/functions/logtochannel" type FileType = "js" | "ts" const embedColor = Number(color.replace("#", "0x")) @@ -20,10 +20,12 @@ export default function loadButtonEvents(client: Client, ft: FileType) { if ("name" in btn && "execute" in btn && btn.type === "button") { client.buttons.set(btn.name, btn) } else { - console.log(colorLog( - `[WARNING] The button at ${filePath} is missing a required "name", "execute" or "type" property.`, - "red" - )) + console.log( + colorLog( + `[WARNING] The button at ${filePath} is missing a required "name", "execute" or "type" property.`, + "red", + ), + ) } } @@ -50,7 +52,8 @@ export default function loadButtonEvents(client: Client, ft: FileType) { description: "```" + error + "```", color: embedColor, footer: { - icon_url: interaction.guild!.iconURL() || undefined, + icon_url: + interaction.guild!.iconURL() || undefined, text: interaction.user.username + " | " + @@ -64,18 +67,24 @@ export default function loadButtonEvents(client: Client, ft: FileType) { 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 5b2297d..9df7d03 100644 --- a/src/utils/Events/command.ts +++ b/src/utils/Events/command.ts @@ -3,8 +3,8 @@ import colorLog from "utils/functions/colors" import { color } from "config/options.json" import { Command } from "interfaces" import { Events } from "discord.js" -import path = require("path") -import fs = require("fs") +import path from "path" +import fs from "fs" import logToChannel from "utils/functions/logtochannel" type FileType = "js" | "ts" const embedColor = Number(color.replace("#", "0x")) @@ -20,10 +20,12 @@ export default function loadSlashCommandsEvents(client: Client, ft: FileType) { if ("data" in cmd && "execute" in cmd && cmd.type === "slash") { client.commands.set(cmd.data.name, cmd) } else { - console.log(colorLog( - `[WARNING] The command at ${filePath} is missing a required "data", "execute" or "type" property.`, - "red" - )) + console.log( + colorLog( + `[WARNING] The command at ${filePath} is missing a required "data", "execute" or "type" property.`, + "red", + ), + ) } } @@ -51,7 +53,8 @@ export default function loadSlashCommandsEvents(client: Client, ft: FileType) { description: "```" + error + "```", color: embedColor, footer: { - icon_url: interaction.guild!.iconURL() || undefined, + icon_url: + interaction.guild!.iconURL() || undefined, text: interaction.user.username + " | " + @@ -65,18 +68,24 @@ export default function loadSlashCommandsEvents(client: Client, ft: FileType) { 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 9c06797..36a6c0b 100644 --- a/src/utils/Events/contextmenu.ts +++ b/src/utils/Events/contextmenu.ts @@ -3,8 +3,8 @@ import colorLog from "utils/functions/colors" import { ContextMenu } from "interfaces" import { color } from "config/options.json" import { Events } from "discord.js" -import path = require("path") -import fs = require("fs") +import path from "path" +import fs from "fs" import logToChannel from "utils/functions/logtochannel" type FileType = "js" | "ts" const embedColor = Number(color.replace("#", "0x")) @@ -27,10 +27,12 @@ export default function loadContextMenuEvents(client: Client, ft: FileType) { if ("data" in cmd && "execute" in cmd && cmd.type === "contextmenu") { client.contextmenus.set(cmd.data.name, cmd) } else { - console.log(colorLog( - `[WARNING] The command at ${filePath} is missing a required "data", "execute" or "type" property.`, - "red" - )) + console.log( + colorLog( + `[WARNING] The command at ${filePath} is missing a required "data", "execute" or "type" property.`, + "red", + ), + ) } } @@ -58,7 +60,8 @@ export default function loadContextMenuEvents(client: Client, ft: FileType) { description: "```" + error + "```", color: embedColor, footer: { - icon_url: interaction.guild!.iconURL() || undefined, + icon_url: + interaction.guild!.iconURL() || undefined, text: interaction.user.username + " | " + @@ -72,18 +75,24 @@ export default function loadContextMenuEvents(client: Client, ft: FileType) { 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/events.ts b/src/utils/Events/events.ts index 6c5825f..d6102c3 100644 --- a/src/utils/Events/events.ts +++ b/src/utils/Events/events.ts @@ -1,7 +1,7 @@ import { ExtendedClient as Client } from "utils/Client" import { Event } from "interfaces" -import path = require("path") -import fs = require("fs") +import path from "path" +import fs from "fs" export default function loadEvents(client: Client) { const serverDir = path.join(__dirname, "..", "..", "events", "server") diff --git a/src/utils/Events/modal.ts b/src/utils/Events/modal.ts index 046effa..d578667 100644 --- a/src/utils/Events/modal.ts +++ b/src/utils/Events/modal.ts @@ -3,8 +3,8 @@ import colorLog from "utils/functions/colors" import { color } from "config/options.json" import { Modal } from "interfaces" import { Events } from "discord.js" -import path = require("path") -import fs = require("fs") +import path from "path" +import fs from "fs" import logToChannel from "utils/functions/logtochannel" type FileType = "js" | "ts" const embedColor = Number(color.replace("#", "0x")) @@ -22,10 +22,12 @@ export default function loadModalEvents(client: Client, ft: FileType) { if ("name" in modal && "execute" in modal && modal.type === "modal") { client.modals.set(modal.name, modal) } else { - console.log(colorLog( - `[WARNING] The modal at ${filePath} is missing a required "name", "execute" or "type" property.`, - "red" - )) + console.log( + colorLog( + `[WARNING] The modal at ${filePath} is missing a required "name", "execute" or "type" property.`, + "red", + ), + ) } } @@ -52,7 +54,8 @@ export default function loadModalEvents(client: Client, ft: FileType) { description: "```" + error + "```", color: embedColor, footer: { - icon_url: interaction.guild!.iconURL() || undefined, + icon_url: + interaction.guild!.iconURL() || undefined, text: interaction.user.username + " | " + @@ -66,19 +69,25 @@ export default function loadModalEvents(client: Client, ft: FileType) { 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, + }, + ], }) } } }) -} \ No newline at end of file +} diff --git a/src/utils/Hypixel/bedwars.ts b/src/utils/Hypixel/bedwars.ts index 03d5657..c8ba341 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 } diff --git a/src/utils/Hypixel/hypixel.ts b/src/utils/Hypixel/hypixel.ts index 93465d3..6a20240 100644 --- a/src/utils/Hypixel/hypixel.ts +++ b/src/utils/Hypixel/hypixel.ts @@ -12,10 +12,10 @@ function getLevel(exp: number): number { return exp <= 1 ? 1 : Math.floor( - 1 + + 1 + REVERSE_PQ_PREFIX + Math.sqrt(REVERSE_CONST + GROWTH_DIVIDES_2 * exp), - ) + ) } function hypixelLevel(exp: number): number { diff --git a/src/utils/Hypixel/index.ts b/src/utils/Hypixel/index.ts index 3ad47bf..4d5f677 100644 --- a/src/utils/Hypixel/index.ts +++ b/src/utils/Hypixel/index.ts @@ -3,10 +3,4 @@ export { bedwarsLevel } from "./bedwars" export { hypixelLevel } from "./hypixel" export { formatUuid } from "./uuid" export { guildLevel, scaledGEXP } from "./guild" -export { - getUUID, - getIGN, - getPlayer, - getGuild, - getHeadURL, -} from "./account" +export { getUUID, getIGN, getPlayer, getGuild, getHeadURL } from "./account" diff --git a/src/utils/functions/colors.ts b/src/utils/functions/colors.ts index 8692d94..6bd44be 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) { @@ -41,4 +41,4 @@ export default function color(text: string, type: keyof typeof colors) { export default function colorize(text: string, color: keyof typeof colors) { return colors[color] + text + colors.reset -} */ \ No newline at end of file +} */ diff --git a/src/utils/functions/logtochannel.ts b/src/utils/functions/logtochannel.ts index a10cf6e..38cbf89 100644 --- a/src/utils/functions/logtochannel.ts +++ b/src/utils/functions/logtochannel.ts @@ -1,4 +1,12 @@ -import { guildid, onlineLogChannel, botLogChannel, guildLogChannel, errorLogChannel, moderationLogChannel, devLogChannel } from "config/options.json" +import { + guildid, + onlineLogChannel, + botLogChannel, + guildLogChannel, + errorLogChannel, + moderationLogChannel, + devLogChannel, +} from "config/options.json" import { Guild, MessageCreateOptions, TextChannel } from "discord.js" import Illegitimate from "utils/Illegitimate" @@ -8,12 +16,15 @@ 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): Promise { +export default async function logToChannel( + channel: Channel, + message: MessageCreateOptions, +): Promise { const guild = Illegitimate.client.guilds.cache.get(guildid) as Guild let logChannel: TextChannel @@ -24,9 +35,11 @@ export default async function logToChannel(channel: Channel, message: MessageCre } 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 } await logChannel.send(message) -} \ No newline at end of file +} diff --git a/src/utils/functions/rolesmanage.ts b/src/utils/functions/rolesmanage.ts index a168c97..321b7ab 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,