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