From b278e0222db617f858f15accfa849e301bc1b8ac Mon Sep 17 00:00:00 2001 From: Taken Date: Sun, 7 Jan 2024 13:53:02 +0100 Subject: [PATCH 1/4] Added mod logs to mod commands --- src/commands/ban.ts | 60 ++++++++++++++++++++++----------- src/commands/clear.ts | 31 +++++++++++++++-- src/commands/forceunverify.ts | 33 +++++++++++++++++- src/commands/forceverify.ts | 27 +++++++++++++++ src/commands/kick.ts | 63 ++++++++++++++++++++--------------- src/commands/slowmode.ts | 27 +++++++++++++++ src/commands/timeout.ts | 43 ++++++++++++++++++------ src/commands/unban.ts | 51 +++++++++++++++++++--------- 8 files changed, 262 insertions(+), 73 deletions(-) diff --git a/src/commands/ban.ts b/src/commands/ban.ts index 8f34f39..f3749cc 100644 --- a/src/commands/ban.ts +++ b/src/commands/ban.ts @@ -5,8 +5,9 @@ import { GuildMember, } from "discord.js" import { admin, helper } from "../../config/roles.json" -import { color } from "../../config/options.json" +import { color, devMessage } from "../../config/options.json" import { Command } from "../interfaces" +import logToChannel from "../utils/functions/logtochannel" export = { name: "ban", @@ -110,31 +111,52 @@ export = { deleteMessageDays: messageDeletionDays, }) + await logToChannel("mod", { + embeds: [{ + author: { + name: mod.user.username, + icon_url: mod.user.avatarURL({ forceStatic: false })!, + }, + 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({ forceStatic: false })!, + }, + footer: { + text: "ID: " + member.user.id, + icon_url: + member.user.avatarURL({ forceStatic: false }) || + undefined, + }, + timestamp: new Date().toISOString(), + }] + }) + await interaction.editReply({ embeds: [ { title: "Member Banned", description: - "**User:** " + - userMention(member.user.id) + - "\n" + - "**Reason:** " + - reason + - "\n" + - "**Moderator:** " + - mod.user.username + - "\n" + - "**Messages Deleted:** " + - messageDeletionDays + - " days", + "**User:** " + userMention(member.user.id) + "\n" + + "**Reason:** " + reason + "\n" + + "**Moderator:** " + mod.user.username + "\n" + + "**Messages Deleted:** " + messageDeletionDays + " days", color: embedColor, - footer: { - text: "ID: " + member.user.id, - icon_url: - member.user.avatarURL({ forceStatic: false }) || - undefined, + thumbnail: { + url: member.user.avatarURL({ forceStatic: false }) || interaction.guild!.iconURL({ forceStatic: false })!, + }, + footer: { + icon_url: interaction.guild!.iconURL({ + forceStatic: false, + })!, + text: interaction.guild!.name + " | " + devMessage, }, - timestamp: new Date().toISOString(), }, ], }) diff --git a/src/commands/clear.ts b/src/commands/clear.ts index db92a92..83124f5 100644 --- a/src/commands/clear.ts +++ b/src/commands/clear.ts @@ -2,9 +2,12 @@ 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" export = { name: "clear", @@ -32,12 +35,12 @@ export = { const channel = interaction.channel as TextChannel const embedColor = Number(color.replace("#", "0x")) - if (!amount || amount < 1 || amount > 100) { + if (amount < 1 || amount > 100) { await interaction.editReply({ embeds: [ { description: - "Please provide an amount of messages to clear", + "Please provide an amount of messages to clear between 1 and 100.", color: embedColor, }, ], @@ -56,6 +59,30 @@ export = { await channel.bulkDelete(messagesToDelete, true) + await logToChannel("mod", { + embeds: [{ + author: { + name: interaction.user.username, + icon_url: interaction.user.avatarURL({ forceStatic: false }) || undefined, + }, + title: "Messages Cleared", + description: ` + **Channel:** ${channelMention(channel.id)} + **Amount:** \`${messages.size}\` messages + **Mod:** ${userMention(interaction.user.id)} + `, + color: embedColor, + thumbnail: { + url: interaction.guild!.iconURL({ forceStatic: false }) || "", + }, + footer: { + text: "ID: " + channel.id, + icon_url: interaction.guild!.iconURL({ forceStatic: false }) || undefined, + }, + timestamp: new Date().toISOString() + }] + }) + await interaction.editReply({ embeds: [ { diff --git a/src/commands/forceunverify.ts b/src/commands/forceunverify.ts index f8d85cb..0675e15 100644 --- a/src/commands/forceunverify.ts +++ b/src/commands/forceunverify.ts @@ -8,6 +8,8 @@ import { color, devMessage } from "../../config/options.json" import verify = require("../schemas/verifySchema") import { Command } from "../interfaces" import roleManage from "../utils/functions/rolesmanage" +import logToChannel from "../utils/functions/logtochannel" +import { getIGN } from "../utils/Hypixel" export = { name: "forceunverify", @@ -32,6 +34,7 @@ export = { const member = interaction.options.getMember("user") as GuildMember const embedColor = Number(color.replace("#", "0x")) const verifiedUser = await verify.findOne({ userID: member.user.id }) + const mod = interaction.user if (!verifiedUser) { return interaction.reply({ @@ -43,10 +46,38 @@ export = { ], }) } - await verify.findOneAndDelete({ userID: member.user.id }) + 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 logToChannel("mod", { + embeds: [{ + title: "Force Unverified", + author: { + name: mod.username, + icon_url: mod.avatarURL({ forceStatic: false })!, + }, + description: ` + **User:** ${userMention(member.user.id)} + **Mod:** ${userMention(mod.id)} + **IGN:** \`${ign}\` + **UUID:** \`${uuid}\` + `, + color: embedColor, + thumbnail: { + url: mod.avatarURL({ forceStatic: false })!, + }, + footer: { + icon_url: member.user.avatarURL({ forceStatic: false }) || undefined, + text: "ID: " + member.user.id, + }, + timestamp: new Date().toISOString(), + }] + }) + await interaction.reply({ embeds: [ { diff --git a/src/commands/forceverify.ts b/src/commands/forceverify.ts index e68c6c1..bcf56f8 100644 --- a/src/commands/forceverify.ts +++ b/src/commands/forceverify.ts @@ -2,6 +2,7 @@ import { SlashCommandBuilder, PermissionFlagsBits, GuildMember, + userMention, } from "discord.js" import { getUUID, getPlayer, getGuild, getHeadURL } from "../utils/Hypixel" import { color, hypixelGuildID, devMessage } from "../../config/options.json" @@ -9,6 +10,7 @@ import verify = require("../schemas/verifySchema") import mongoose from "mongoose" import roleManage from "../utils/functions/rolesmanage" import { Command } from "../interfaces" +import logToChannel from "../utils/functions/logtochannel" export = { name: "forceverify", @@ -180,6 +182,31 @@ export = { await newVerify.save() + await logToChannel("mod", { + embeds: [{ + author: { + name: modName, + icon_url: mod.avatarURL({ forceStatic: false })!, + }, + title: "Force Verified", + description: ` + **User:** ${userMention(user.id)} + **Mod:** ${userMention(mod.id)} + **IGN:** \`${player.displayname}\` + **UUID:** \`${uuid}\` + `, + color: embedColor, + thumbnail: { + url: mod.avatarURL({ forceStatic: false })!, + }, + footer: { + icon_url: user.user.avatarURL({ forceStatic: false }) || undefined, + text: "ID: " + user.user.id + }, + timestamp: new Date().toISOString(), + }] + }) + await interaction.editReply({ embeds: [ { diff --git a/src/commands/kick.ts b/src/commands/kick.ts index b0bddd6..384ddbe 100644 --- a/src/commands/kick.ts +++ b/src/commands/kick.ts @@ -5,8 +5,9 @@ import { GuildMember, } from "discord.js" import { admin, helper } from "../../config/roles.json" -import { color } from "../../config/options.json" +import { color, devMessage } from "../../config/options.json" import { Command } from "../interfaces" +import logToChannel from "../utils/functions/logtochannel" export = { name: "kick", @@ -35,18 +36,10 @@ export = { async execute(interaction) { await interaction.deferReply() - const member = interaction.options.getMember( - "member", - ) as GuildMember | null - 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")) - if (!member) { - await interaction.editReply("You must specify a member.") - return - } - const mod = await interaction.guild!.members.fetch(interaction.user.id) const memberRoles = member.roles.cache.map(role => role.id) const modRoles = mod.roles.cache.map(role => role.id) @@ -85,27 +78,45 @@ export = { await member.kick(reason + ` - ${mod.user.username}`) + await logToChannel("mod", { + embeds: [{ + author: { + name: mod.user.username, + icon_url: mod.user.avatarURL({ forceStatic: false })!, + }, + title: "Member Kicked", + description: ` + **User:** ${userMention(member.user.id)} + **Mod:** ${userMention(mod.user.id)} + **Reason:** ${reason} + `, + color: embedColor, + thumbnail: { + url: mod.user.avatarURL({ forceStatic: false })!, + }, + footer: { + text: "ID: " + member.user.id, + icon_url: member.user.avatarURL({ forceStatic: false }) || 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, - footer: { - text: "ID: " + member.user.id, - icon_url: - member.user.avatarURL({ forceStatic: false }) || - undefined, + thumbnail: { + url: member.user.avatarURL({ forceStatic: false }) || interaction.guild!.iconURL({ forceStatic: false, })!, }, - timestamp: new Date().toISOString(), + footer: { + icon_url: interaction.guild!.iconURL({ forceStatic: false, })!, + text: interaction.guild!.name + " | " + devMessage, + } }, ], }) diff --git a/src/commands/slowmode.ts b/src/commands/slowmode.ts index 9b2a639..75b6976 100644 --- a/src/commands/slowmode.ts +++ b/src/commands/slowmode.ts @@ -3,9 +3,12 @@ import { PermissionFlagsBits, ChannelType, TextChannel, + channelMention, + userMention, } from "discord.js" import { color, devMessage } from "../../config/options.json" import { Command } from "../interfaces" +import logToChannel from "../utils/functions/logtochannel" export = { name: "slowmode", @@ -60,6 +63,30 @@ export = { return } + await logToChannel("mod", { + embeds: [{ + author: { + name: interaction.user.username, + icon_url: interaction.user.avatarURL({ forceStatic: false }) || undefined, + }, + title: "Slowmode Update", + description: ` + **Channel:** ${channelMention(channel.id)} + **Slowmode:** ${seconds} seconds + **Mod:** ${userMention(interaction.user.id)} + `, + color: embedColor, + thumbnail: { + url: interaction.user.avatarURL({ forceStatic: false }) || "", + }, + footer: { + icon_url: interaction.guild!.iconURL({ forceStatic: false }) || undefined, + text: " ID: " + channel.id + }, + timestamp: new Date().toISOString() + }] + }) + await interaction.editReply({ embeds: [ { diff --git a/src/commands/timeout.ts b/src/commands/timeout.ts index aaf6b6e..ac0109b 100644 --- a/src/commands/timeout.ts +++ b/src/commands/timeout.ts @@ -5,9 +5,10 @@ import { ChatInputCommandInteraction, GuildMember, } from "discord.js" -import { color } from "../../config/options.json" +import { color, devMessage } from "../../config/options.json" import { Command } from "../interfaces" import ms from "ms" +import logToChannel from "../utils/functions/logtochannel" const command: Command = { name: "timeout", @@ -164,22 +165,44 @@ const command: Command = { } await target.timeout(time, reason) + + await logToChannel("mod", { + embeds: [{ + author: { + name: mod.user.username, + icon_url: mod.user.avatarURL({ forceStatic: false }) || undefined, + }, + title: "Member Timed Out", + description: ` + **User:** ${userMention(target.id)} + **Time:** ${prettyTime} + **Reason:** ${reason} + **Mod:** ${userMention(mod.id)} + `, + color: embedColor, + thumbnail: { + url: mod.user.avatarURL({ forceStatic: false }) || "", + }, + footer: { + text: "ID: " + target.id, + icon_url: target.user.avatarURL({ forceStatic: false }) || undefined, + }, + timestamp: new Date().toISOString() + }] + }) + await interaction.editReply({ embeds: [ { description: - "Timed out " + - userMention(target.id) + - " for " + - prettyTime + - " for " + - reason, + "Timed out " + userMention(target.id) + + " for " + prettyTime + + " for " + reason, color: embedColor, footer: { - text: "ID: " + target.id, - icon_url: target.avatarURL() || undefined, + text: interaction.guild!.name + " | " + devMessage, + icon_url: interaction.guild!.iconURL({ forceStatic: false }) || undefined, }, - timestamp: new Date().toISOString(), }, ], }) diff --git a/src/commands/unban.ts b/src/commands/unban.ts index 78e33b5..1f1992e 100644 --- a/src/commands/unban.ts +++ b/src/commands/unban.ts @@ -4,8 +4,9 @@ import { userMention, User, } from "discord.js" -import { color } from "../../config/options.json" +import { color, devMessage } from "../../config/options.json" import { Command } from "../interfaces" +import logToChannel from "../utils/functions/logtochannel" export = { name: "unban", @@ -37,11 +38,10 @@ 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 | null + let user: User if (userid === "none") { await interaction.editReply({ @@ -66,34 +66,55 @@ export = { }, ], }) + return } - await interaction.guild!.members.unban(user!.id, reason) + await interaction.guild!.members.unban(user.id, reason) + + await logToChannel("mod", { + embeds: [ + { + author: { + name: mod.username, + icon_url: mod.avatarURL({ forceStatic: false })!, + }, + title: "Member Unbanned", + description: ` + **User:** ${userMention(user!.id)} + **Mod:** ${userMention(mod.id)} + **Reason:** ${reason} + `, + color: embedColor, + thumbnail: { + url: mod.avatarURL({ forceStatic: false })!, + }, + footer: { + text: "ID: " + user!.id, + icon_url: user.avatarURL({ forceStatic: false}) || undefined, + }, + timestamp: new Date().toISOString(), + }, + ], + }) await interaction.editReply({ embeds: [ { title: "User unbanned", description: - "The user " + - user!.username + - " has been unbanned.\n" + - "**Reason:** `" + - reason + - "`\n" + - "**Moderator:** " + - userMention(mod.id), + "The user " + user!.username + " has been unbanned.\n" + + "**Reason:** `" + reason + "`\n" + + "**Moderator:** " + userMention(mod.id), color: embedColor, thumbnail: { url: user!.avatarURL({ forceStatic: false }) || "", }, footer: { - text: "ID: " + user!.id, icon_url: interaction.guild!.iconURL({ forceStatic: false, })!, + text: interaction.guild!.name + " | " + devMessage, }, - timestamp: new Date().toISOString(), }, ], }) From a90c9994e3493233f739851a8470c17d0bc659af Mon Sep 17 00:00:00 2001 From: Taken Date: Sun, 7 Jan 2024 15:11:39 +0100 Subject: [PATCH 2/4] Added more command to use mod logs --- src/commands/clear.ts | 2 +- src/commands/remove.ts | 50 ++++++++++++++++++++++++++++------------- src/commands/setnick.ts | 44 ++++++++++++++++++++++++++++++------ 3 files changed, 73 insertions(+), 23 deletions(-) diff --git a/src/commands/clear.ts b/src/commands/clear.ts index 83124f5..aead802 100644 --- a/src/commands/clear.ts +++ b/src/commands/clear.ts @@ -73,7 +73,7 @@ export = { `, color: embedColor, thumbnail: { - url: interaction.guild!.iconURL({ forceStatic: false }) || "", + url: interaction.user.avatarURL({ forceStatic: false }) || "", }, footer: { text: "ID: " + channel.id, diff --git a/src/commands/remove.ts b/src/commands/remove.ts index 6c022f3..cb1d601 100644 --- a/src/commands/remove.ts +++ b/src/commands/remove.ts @@ -3,15 +3,16 @@ import { PermissionFlagsBits, userMention, } from "discord.js" -import { color } from "../../config/options.json" +import { color, devMessage } from "../../config/options.json" import waitinglistSchema = require("../schemas/waitinglistSchema") import { Command } from "../interfaces" +import logToChannel from "../utils/functions/logtochannel" export = { name: "remove", description: "Remove a person on the waiting list.", type: "slash", - dev: false, + false: true, public: false, data: new SlashCommandBuilder() @@ -41,7 +42,7 @@ export = { const mod = interaction.user! const embedColor = Number(color.replace("#", "0x")) - const waitinglist = await waitinglistSchema.findOne({ UserID: user.id }) + const waitinglist = await waitinglistSchema.findOne({ userID: user.id }) if (!waitinglist) { await interaction.editReply({ @@ -57,25 +58,44 @@ export = { return } - await waitinglistSchema.findOneAndDelete({ UserID: user.id }) + await waitinglistSchema.findOneAndDelete({ userID: user.id }) + + await logToChannel("mod", { + embeds: [{ + author: { + name: mod.username, + icon_url: mod.avatarURL({ forceStatic: false }) || undefined, + }, + title: "Waiting List - Remove User", + description: ` + **User:** ${userMention(user.id)} + **Reason:** ${reason} + **Mod:** ${userMention(mod.id)} + `, + color: embedColor, + thumbnail: { + url: mod.avatarURL({ forceStatic: false }) || "", + }, + footer: { + icon_url: user.avatarURL({ forceStatic: false }) || undefined, + text: "ID: " + user.id, + }, + timestamp: new Date().toISOString() + }] + }) await interaction.editReply({ embeds: [ { + title: "Waiting List - Remove User", description: - userMention(user.id) + - " has been removed from the waiting list.\n" + - "**Reason:** `" + - reason + - "`\n" + - "**Moderator:** " + - userMention(mod.id), + "**User:** " + userMention(user.id) + "\n" + + "**Reason:** `" + reason + "`", color: embedColor, footer: { - text: "User ID: " + user.id, - icon_url: user.displayAvatarURL({ forceStatic: false }), - }, - timestamp: new Date().toISOString(), + text: interaction.guild!.name + " | " + devMessage, + icon_url: interaction.guild!.iconURL({ forceStatic: false }) || "", + } }, ], }) diff --git a/src/commands/setnick.ts b/src/commands/setnick.ts index cd9d12d..3887184 100644 --- a/src/commands/setnick.ts +++ b/src/commands/setnick.ts @@ -2,8 +2,11 @@ import { SlashCommandBuilder, PermissionFlagsBits, userMention, + GuildMember, } from "discord.js" +import { color, devMessage } from "../../config/options.json" import { Command } from "../interfaces" +import logToChannel from "../utils/functions/logtochannel" export = { name: "setnick", @@ -31,9 +34,9 @@ export = { .setDMPermission(false), async execute(interaction) { - const user = interaction.options.getUser("user")! + const member = interaction.options.getMember("user") as GuildMember const nickname = interaction.options.getString("nickname") - const member = await interaction.guild!.members.fetch(user.id) + const embedColor = Number(color.replace("#", "0x")) if (!member.manageable) { interaction.reply({ @@ -45,12 +48,39 @@ export = { await member.setNickname(nickname, `Set by ${interaction.user.tag}`) + await logToChannel("mod", { + embeds: [{ + author: { + name: interaction.user.username, + icon_url: interaction.user.avatarURL({ forceStatic: false }) || undefined, + }, + title: "Nickname", + description: ` + **User:** ${userMention(member.id)} + **Nickname:** ${nickname} + **Moderator:** ${userMention(interaction.user.id)} + `, + color: embedColor, + thumbnail: { + url: interaction.user.avatarURL({ forceStatic: false }) || "", + }, + footer: { + text: "ID: " + member.user.id, + icon_url: member.user.avatarURL({ forceStatic: false }) || undefined, + }, + timestamp: new Date().toISOString() + }] + }) + await interaction.reply({ - content: - "Set the nickname of " + - userMention(member.id) + - " to " + - nickname, + 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({ forceStatic: false }) || undefined, + } + }], ephemeral: true, }) }, From c18a5f703fdd0594f9cfadcd6f13b3b7bf111333 Mon Sep 17 00:00:00 2001 From: Taken Date: Sun, 7 Jan 2024 15:25:29 +0100 Subject: [PATCH 3/4] Updated embed props --- src/commands/ban.ts | 7 ++----- src/commands/forceunverify.ts | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/commands/ban.ts b/src/commands/ban.ts index f3749cc..8d3ae32 100644 --- a/src/commands/ban.ts +++ b/src/commands/ban.ts @@ -145,16 +145,13 @@ export = { description: "**User:** " + userMention(member.user.id) + "\n" + "**Reason:** " + reason + "\n" + - "**Moderator:** " + mod.user.username + "\n" + "**Messages Deleted:** " + messageDeletionDays + " days", color: embedColor, thumbnail: { - url: member.user.avatarURL({ forceStatic: false }) || interaction.guild!.iconURL({ forceStatic: false })!, + url: member.user.avatarURL({ forceStatic: false }) || "", }, footer: { - icon_url: interaction.guild!.iconURL({ - forceStatic: false, - })!, + icon_url: interaction.guild!.iconURL({ forceStatic: false, })!, text: interaction.guild!.name + " | " + devMessage, }, }, diff --git a/src/commands/forceunverify.ts b/src/commands/forceunverify.ts index 0675e15..cea2b0b 100644 --- a/src/commands/forceunverify.ts +++ b/src/commands/forceunverify.ts @@ -58,7 +58,7 @@ export = { title: "Force Unverified", author: { name: mod.username, - icon_url: mod.avatarURL({ forceStatic: false })!, + icon_url: mod.avatarURL({ forceStatic: false }) || undefined, }, description: ` **User:** ${userMention(member.user.id)} @@ -68,7 +68,7 @@ export = { `, color: embedColor, thumbnail: { - url: mod.avatarURL({ forceStatic: false })!, + url: mod.avatarURL({ forceStatic: false }) || "", }, footer: { icon_url: member.user.avatarURL({ forceStatic: false }) || undefined, From 199e5e69550503c5733c57b3fb9aa2119cd5066b Mon Sep 17 00:00:00 2001 From: Taken Date: Sun, 7 Jan 2024 17:04:37 +0100 Subject: [PATCH 4/4] Updated embed props + more --- src/commands/ban.ts | 6 +- src/commands/check.ts | 4 +- src/commands/forceunverify.ts | 4 +- src/commands/forceupdate.ts | 172 ++++-------------------- src/commands/forceverify.ts | 9 +- src/commands/help.ts | 6 +- src/commands/instructions.ts | 4 +- src/commands/kick.ts | 8 +- src/commands/remove.ts | 2 +- src/commands/reqs.ts | 9 +- src/commands/send.ts | 13 +- src/commands/setup.ts | 245 +++++++++------------------------- src/commands/staff.ts | 11 +- src/commands/timeout.ts | 68 +++------- src/commands/unban.ts | 8 +- src/commands/update.ts | 165 ++++------------------- src/commands/uuid.ts | 5 +- src/commands/verify.ts | 2 +- src/commands/whoami.ts | 4 +- 19 files changed, 157 insertions(+), 588 deletions(-) diff --git a/src/commands/ban.ts b/src/commands/ban.ts index 8d3ae32..ee2d064 100644 --- a/src/commands/ban.ts +++ b/src/commands/ban.ts @@ -115,7 +115,7 @@ export = { embeds: [{ author: { name: mod.user.username, - icon_url: mod.user.avatarURL({ forceStatic: false })!, + icon_url: mod.user.avatarURL({ forceStatic: false }) || undefined, }, title: "Member Banned", description: ` @@ -126,7 +126,7 @@ export = { `, color: embedColor, thumbnail: { - url: mod.user.avatarURL({ forceStatic: false })!, + url: mod.user.avatarURL({ forceStatic: false }) || "", }, footer: { text: "ID: " + member.user.id, @@ -151,7 +151,7 @@ export = { url: member.user.avatarURL({ forceStatic: false }) || "", }, footer: { - icon_url: interaction.guild!.iconURL({ forceStatic: false, })!, + icon_url: interaction.guild!.iconURL({ forceStatic: false, }) || undefined, text: interaction.guild!.name + " | " + devMessage, }, }, diff --git a/src/commands/check.ts b/src/commands/check.ts index 533dbb5..59080f2 100644 --- a/src/commands/check.ts +++ b/src/commands/check.ts @@ -306,9 +306,7 @@ export = { }, footer: { text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL({ - forceStatic: true, - })!, + icon_url: interaction.guild!.iconURL({ forceStatic: true, }) || undefined, }, fields: statsFields, }, diff --git a/src/commands/forceunverify.ts b/src/commands/forceunverify.ts index cea2b0b..bb4d2f8 100644 --- a/src/commands/forceunverify.ts +++ b/src/commands/forceunverify.ts @@ -87,9 +87,7 @@ export = { color: embedColor, footer: { text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL({ - forceStatic: false, - })!, + icon_url: interaction.guild!.iconURL({ forceStatic: false, }) || undefined, }, }, ], diff --git a/src/commands/forceupdate.ts b/src/commands/forceupdate.ts index b40e22c..67d6a9b 100644 --- a/src/commands/forceupdate.ts +++ b/src/commands/forceupdate.ts @@ -114,9 +114,8 @@ 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.") @@ -124,181 +123,60 @@ export = { 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 interaction.editReply({ - embeds: [ - { - description: - usermentioned + - "'s rank has been updated to `Guild Master`", - color: embedColor, - thumbnail: { - url: head!, - }, - footer: { - text: - interaction.guild!.name + - " | " + - devMessage, - icon_url: interaction.guild!.iconURL({ - forceStatic: false, - })!, - }, - }, - ], - }) - return + 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 interaction.editReply({ - embeds: [ - { - description: - usermentioned + - "'s rank has been updated to `Manager`", - color: embedColor, - thumbnail: { - url: head!, - }, - footer: { - text: - interaction.guild!.name + - " | " + - devMessage, - icon_url: interaction.guild!.iconURL({ - forceStatic: false, - })!, - }, - }, - ], - }) - return + 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 interaction.editReply({ - embeds: [ - { - description: - usermentioned + - "'s rank has been updated to `Moderator`", - color: embedColor, - thumbnail: { - url: head!, - }, - footer: { - text: - interaction.guild!.name + - " | " + - devMessage, - icon_url: interaction.guild!.iconURL({ - forceStatic: false, - })!, - }, - }, - ], - }) - return + 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 interaction.editReply({ - embeds: [ - { - description: - usermentioned + - "'s rank has been updated to `Beast`.", - color: embedColor, - thumbnail: { - url: head!, - }, - footer: { - text: - interaction.guild!.name + - " | " + - devMessage, - icon_url: interaction.guild!.iconURL({ - forceStatic: false, - })!, - }, - }, - ], - }) - return + 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 interaction.editReply({ - embeds: [ - { - description: - usermentioned + - "'s rank has been updated to `Elite`.", - color: embedColor, - thumbnail: { - url: head!, - }, - footer: { - text: - interaction.guild!.name + - " | " + - devMessage, - icon_url: interaction.guild!.iconURL({ - forceStatic: false, - })!, - }, - }, - ], - }) - return + 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 interaction.editReply({ - embeds: [ - { - description: - usermentioned + - "'s rank has been updated to `Member`.", - color: embedColor, - thumbnail: { - url: head!, - }, - footer: { - text: - interaction.guild!.name + - " | " + - devMessage, - icon_url: interaction.guild!.iconURL({ - forceStatic: false, - })!, - }, - }, - ], - }) - return + 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({ forceStatic: false, }) || undefined, + }, + }, + ], + }) } }, } as Command diff --git a/src/commands/forceverify.ts b/src/commands/forceverify.ts index bcf56f8..58c3347 100644 --- a/src/commands/forceverify.ts +++ b/src/commands/forceverify.ts @@ -186,7 +186,7 @@ export = { embeds: [{ author: { name: modName, - icon_url: mod.avatarURL({ forceStatic: false })!, + icon_url: mod.avatarURL({ forceStatic: false }) || undefined, }, title: "Force Verified", description: ` @@ -197,7 +197,7 @@ export = { `, color: embedColor, thumbnail: { - url: mod.avatarURL({ forceStatic: false })!, + url: mod.avatarURL({ forceStatic: false }) || "", }, footer: { icon_url: user.user.avatarURL({ forceStatic: false }) || undefined, @@ -222,10 +222,7 @@ export = { url: head!, }, footer: { - icon_url: - interaction.guild!.iconURL({ - forceStatic: false, - }) || undefined, + icon_url: interaction.guild!.iconURL({ forceStatic: false, }) || undefined, text: interaction.guild!.name + " | " + devMessage, }, }, diff --git a/src/commands/help.ts b/src/commands/help.ts index 03fb21e..e98382b 100644 --- a/src/commands/help.ts +++ b/src/commands/help.ts @@ -66,12 +66,10 @@ export = { fields: commandList, color: embedColor, thumbnail: { - url: interaction.guild!.iconURL({ forceStatic: true })!, + url: interaction.guild!.iconURL({ forceStatic: true }) || "", }, footer: { - icon_url: interaction.guild!.iconURL({ - forceStatic: false, - })!, + icon_url: interaction.guild!.iconURL({ forceStatic: false, }) || undefined, text: interaction.guild!.name + " | " + devMessage, }, }, diff --git a/src/commands/instructions.ts b/src/commands/instructions.ts index ae9316b..af85d54 100644 --- a/src/commands/instructions.ts +++ b/src/commands/instructions.ts @@ -32,9 +32,7 @@ export = { color: embedColor, footer: { text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL({ - forceStatic: false, - })!, + icon_url: interaction.guild!.iconURL({ forceStatic: false, }) || undefined, }, image: { url: instructionsgif, diff --git a/src/commands/kick.ts b/src/commands/kick.ts index 384ddbe..52c5731 100644 --- a/src/commands/kick.ts +++ b/src/commands/kick.ts @@ -82,7 +82,7 @@ export = { embeds: [{ author: { name: mod.user.username, - icon_url: mod.user.avatarURL({ forceStatic: false })!, + icon_url: mod.user.avatarURL({ forceStatic: false }) || undefined, }, title: "Member Kicked", description: ` @@ -92,7 +92,7 @@ export = { `, color: embedColor, thumbnail: { - url: mod.user.avatarURL({ forceStatic: false })!, + url: mod.user.avatarURL({ forceStatic: false }) || "", }, footer: { text: "ID: " + member.user.id, @@ -111,10 +111,10 @@ export = { "**Moderator:** " + mod.user.username, color: embedColor, thumbnail: { - url: member.user.avatarURL({ forceStatic: false }) || interaction.guild!.iconURL({ forceStatic: false, })!, + url: member.user.avatarURL({ forceStatic: false }) || "", }, footer: { - icon_url: interaction.guild!.iconURL({ forceStatic: false, })!, + icon_url: interaction.guild!.iconURL({ forceStatic: false, }) || undefined, text: interaction.guild!.name + " | " + devMessage, } }, diff --git a/src/commands/remove.ts b/src/commands/remove.ts index cb1d601..b182bb9 100644 --- a/src/commands/remove.ts +++ b/src/commands/remove.ts @@ -94,7 +94,7 @@ export = { color: embedColor, footer: { text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL({ forceStatic: false }) || "", + icon_url: interaction.guild!.iconURL({ forceStatic: false }) || undefined, } }, ], diff --git a/src/commands/reqs.ts b/src/commands/reqs.ts index e4c9122..6710eac 100644 --- a/src/commands/reqs.ts +++ b/src/commands/reqs.ts @@ -35,9 +35,7 @@ export = { color: embedColor, thumbnail: { url: - interaction?.guild?.iconURL({ - forceStatic: false, - }) || "", + interaction.guild!.iconURL({ forceStatic: false, }) || "", }, fields: [ { @@ -72,10 +70,7 @@ export = { ], footer: { text: interaction.guild!.name + " | " + devMessage, - icon_url: - interaction.guild!.iconURL({ - forceStatic: false, - }) || undefined, + icon_url: interaction.guild!.iconURL({ forceStatic: false, }) || undefined, }, }, ], diff --git a/src/commands/send.ts b/src/commands/send.ts index bf38d18..b5d2e55 100644 --- a/src/commands/send.ts +++ b/src/commands/send.ts @@ -46,15 +46,11 @@ export = { description: message, color: embedColor, thumbnail: { - url: interaction.guild!.iconURL({ - forceStatic: false, - })!, + url: interaction.guild!.iconURL({ forceStatic: false, }) || "", }, footer: { text: interaction.guild!.id + " | " + devMessage, - icon_url: - interaction.guild!.iconURL({ forceStatic: true }) || - undefined, + icon_url: interaction.guild!.iconURL({ forceStatic: true }) || undefined, }, }, ], @@ -67,10 +63,7 @@ export = { color: embedColor, footer: { text: interaction.guild!.name + " | " + devMessage, - icon_url: - interaction.guild!.iconURL({ - forceStatic: false, - }) || undefined, + icon_url: interaction.guild!.iconURL({ forceStatic: false, }) || undefined, }, }, ], diff --git a/src/commands/setup.ts b/src/commands/setup.ts index 36d1d23..f3e66c3 100644 --- a/src/commands/setup.ts +++ b/src/commands/setup.ts @@ -96,206 +96,81 @@ export = { async execute(interaction) { const subcommand = interaction.options.getSubcommand() + const channel = interaction.options.getChannel("channel") as TextChannel const embedColor = Number(color.replace("#", "0x")) + let title: string = "" + let description: string = "" + let customId: string = "" + let label: string = "" + let emoji: string = "" if (subcommand === "sendguildapplication") { - const channel = interaction.options.getChannel("channel") as TextChannel - - await channel.send({ - embeds: [ - { - title: "Guild Application", - description: - "You can apply for the guild by clicking the button below.", - color: embedColor, - footer: { - text: interaction.guild!.name + " | " + devMessage, - icon_url: - interaction.guild!.iconURL({ - forceStatic: false, - }) || undefined, - }, - thumbnail: { - url: - interaction.guild!.iconURL({ - forceStatic: false, - }) || "", - }, - }, - ], - components: [ - new ActionRowBuilder().addComponents( - new ButtonBuilder() - .setCustomId("guildapply") - .setLabel("Apply") - .setStyle(ButtonStyle.Primary) - .setEmoji({ name: "✅" }), - ), - ], - }) - await interaction.reply({ - content: "Message sent", - ephemeral: true, - }) + title = "Guild Application" + description = "You can apply for the guild by clicking the button below." + customId = "guildapply" + label = "Apply" + emoji = "✅" } if (subcommand === "sendstaffapplication") { - const channel = interaction.options.getChannel("channel") as TextChannel - - await channel.send({ - embeds: [ - { - title: "Staff Application", - description: - "You can apply for the staff team by clicking the button below.", - color: embedColor, - footer: { - text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL({ - forceStatic: false, - })!, - }, - thumbnail: { - url: interaction.guild!.iconURL({ - forceStatic: false, - })!, - }, - }, - ], - components: [ - new ActionRowBuilder().addComponents( - new ButtonBuilder() - .setCustomId("staffapply") - .setLabel("Apply") - .setStyle(ButtonStyle.Primary) - .setEmoji({ name: "✅" }), - ), - ], - }) - - await interaction.reply({ - content: "Message sent", - ephemeral: true, - }) + title = "Staff Application" + description = "You can apply for the staff team by clicking the button below." + customId = "staffapply" + label = "Apply" + emoji = "✅" } if (subcommand === "sendinactivityapplication") { - const channel = interaction.options.getChannel("channel") as TextChannel - - await channel.send({ - embeds: [ - { - title: "Inactivity Log", - description: - "You can send an inactivity log by clicking the button below.", - color: embedColor, - footer: { - text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL({ - forceStatic: false, - })!, - }, - thumbnail: { - url: interaction.guild!.iconURL({ - forceStatic: false, - })!, - }, - }, - ], - components: [ - new ActionRowBuilder().addComponents( - new ButtonBuilder() - .setCustomId("guildinactivitylog") - .setLabel("Submit") - .setStyle(ButtonStyle.Primary) - .setEmoji({ name: "✅" }), - ), - ], - }) - - await interaction.reply({ - content: "Message sent", - ephemeral: true, - }) + title = "Inactivity Log" + description = "You can send an inactivity log by clicking the button below." + customId = "guildinactivitylog" + label = "Submit" + emoji = "✅" } if (subcommand === "sendverfiymessage") { - const channel = interaction.options.getChannel("channel") as TextChannel - - await channel.send({ - embeds: [ - { - title: "Verification", - description: - "You can verify by clicking the button below.", - color: embedColor, - footer: { - text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL({ - forceStatic: false, - })!, - }, - thumbnail: { - url: interaction.guild!.iconURL({ - forceStatic: false, - })!, - }, - }, - ], - components: [ - new ActionRowBuilder().addComponents( - new ButtonBuilder() - .setCustomId("verify") - .setLabel("Verify") - .setStyle(ButtonStyle.Primary) - .setEmoji({ name: "✅" }), - ), - ], - }) - await interaction.reply({ - content: "Message sent", - ephemeral: true, - }) + title = "Verification" + description = "You can verify by clicking the button below." + customId = "verify" + label = "Verify" + emoji = "✅" } if (subcommand === "sendwaitinglistmessage") { - const channel = interaction.options.getChannel("channel") as TextChannel - - await channel.send({ - embeds: [ - { - title: "Waiting List", - description: - "The people below were accepted into the guild\n" + - "Try to invite them in order.", - color: embedColor, - footer: { - text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL({ - forceStatic: false, - })!, - }, - thumbnail: { - url: interaction.guild!.iconURL({ - forceStatic: false, - })!, - }, - }, - ], - components: [ - new ActionRowBuilder().addComponents( - new ButtonBuilder() - .setCustomId("waitinglistupdate") - .setLabel("Update") - .setStyle(ButtonStyle.Primary) - .setEmoji({ name: "🔄" }), - ), - ], - }) - await interaction.reply({ - content: "Message sent", - ephemeral: true, - }) + title = "Waiting List" + 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({ forceStatic: false }) || "", + }, + footer: { + text: interaction.guild!.name + " | " + devMessage, + icon_url: interaction.guild!.iconURL({ forceStatic: false }) || undefined, + } + }], + components: [ + new ActionRowBuilder().addComponents( + new ButtonBuilder() + .setCustomId(customId) + .setLabel(label) + .setStyle(ButtonStyle.Primary) + .setEmoji({ name: emoji }) + ) + ] + }) + + await interaction.reply({ + content: "Message sent", + ephemeral: true, + }) }, } as Command diff --git a/src/commands/staff.ts b/src/commands/staff.ts index b7fd962..d39db4e 100644 --- a/src/commands/staff.ts +++ b/src/commands/staff.ts @@ -61,21 +61,14 @@ export = { return } - const footerText = interaction.guild - ? interaction.guild.name - : interaction.user.username - const footerIcon = interaction.guild - ? interaction.guild.iconURL({ forceStatic: false }) - : interaction.user.avatarURL({ forceStatic: false }) - await interaction.reply({ embeds: [ { description: "This command is currently under development", color: embedColor, footer: { - text: footerText + " | " + devMessage, - icon_url: footerIcon!, + text: interaction.guild!.name + " | " + devMessage, + icon_url: interaction.guild!.iconURL({ forceStatic: false }) || undefined, }, }, ], diff --git a/src/commands/timeout.ts b/src/commands/timeout.ts index ac0109b..1755e55 100644 --- a/src/commands/timeout.ts +++ b/src/commands/timeout.ts @@ -118,53 +118,26 @@ const command: Command = { return } + let title: string = "" + let description: string = "" + let timeouttime: number | null = 0 if (target.isCommunicationDisabled()) { if (time === 0) { - await target.timeout(null, reason) - await interaction.editReply({ - embeds: [ - { - description: - "Removed timeout of " + - userMention(target.id) + - " for " + - reason, - color: embedColor, - footer: { - text: "ID: " + target.id, - icon_url: target.avatarURL() || undefined, - }, - timestamp: new Date().toISOString(), - }, - ], - }) - return + title = "Timeout Removed" + 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 } - - await target.timeout(time, reason) - await interaction.editReply({ - embeds: [ - { - description: - "Updated timeout of " + - userMention(target.id) + - " to " + - prettyTime + - " for " + - reason, - color: embedColor, - footer: { - text: "ID: " + target.id, - icon_url: target.avatarURL() || undefined, - }, - timestamp: new Date().toISOString(), - }, - ], - }) - return + } else { + title = "Member Timed Out" + description = "Timed out " + userMention(target.id) + " for " + prettyTime + " for " + reason, + timeouttime = time } - await target.timeout(time, reason) + await target.timeout(timeouttime, reason) await logToChannel("mod", { embeds: [{ @@ -172,11 +145,11 @@ const command: Command = { name: mod.user.username, icon_url: mod.user.avatarURL({ forceStatic: false }) || undefined, }, - title: "Member Timed Out", + title: title, description: ` **User:** ${userMention(target.id)} - **Time:** ${prettyTime} - **Reason:** ${reason} + ${timeouttime === null ? "**Time:** `None`" : "**Time:** `" + prettyTime + "`"} + **Reason:** \`${reason}\` **Mod:** ${userMention(mod.id)} `, color: embedColor, @@ -194,10 +167,7 @@ const command: Command = { await interaction.editReply({ embeds: [ { - description: - "Timed out " + userMention(target.id) + - " for " + prettyTime + - " for " + reason, + description: description, color: embedColor, footer: { text: interaction.guild!.name + " | " + devMessage, diff --git a/src/commands/unban.ts b/src/commands/unban.ts index 1f1992e..9fc9aaa 100644 --- a/src/commands/unban.ts +++ b/src/commands/unban.ts @@ -76,7 +76,7 @@ export = { { author: { name: mod.username, - icon_url: mod.avatarURL({ forceStatic: false })!, + icon_url: mod.avatarURL({ forceStatic: false }) || undefined, }, title: "Member Unbanned", description: ` @@ -86,7 +86,7 @@ export = { `, color: embedColor, thumbnail: { - url: mod.avatarURL({ forceStatic: false })!, + url: mod.avatarURL({ forceStatic: false }) || "", }, footer: { text: "ID: " + user!.id, @@ -110,9 +110,7 @@ export = { url: user!.avatarURL({ forceStatic: false }) || "", }, footer: { - icon_url: interaction.guild!.iconURL({ - forceStatic: false, - })!, + icon_url: interaction.guild!.iconURL({ forceStatic: false, }) || undefined, text: interaction.guild!.name + " | " + devMessage, }, }, diff --git a/src/commands/update.ts b/src/commands/update.ts index 4645416..7828bfe 100644 --- a/src/commands/update.ts +++ b/src/commands/update.ts @@ -89,9 +89,8 @@ 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") @@ -99,175 +98,59 @@ export = { 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 interaction.editReply({ - embeds: [ - { - description: - "Your rank has been updated to `Guild Master`", - color: embedColor, - thumbnail: { - url: head!, - }, - footer: { - text: - interaction.guild!.name + - " | " + - devMessage, - icon_url: interaction.guild!.iconURL({ - forceStatic: false, - })!, - }, - }, - ], - }) - return + 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 interaction.editReply({ - embeds: [ - { - description: - "Your rank has been updated to `Manager`", - color: embedColor, - thumbnail: { - url: head!, - }, - footer: { - text: - interaction.guild!.name + - " | " + - devMessage, - icon_url: interaction.guild!.iconURL({ - forceStatic: false, - })!, - }, - }, - ], - }) - return + 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 interaction.editReply({ - embeds: [ - { - description: - "Your rank has been updated to `Moderator`", - color: embedColor, - thumbnail: { - url: head!, - }, - footer: { - text: - interaction.guild!.name + - " | " + - devMessage, - icon_url: interaction.guild!.iconURL({ - forceStatic: false, - })!, - }, - }, - ], - }) - return + 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 interaction.editReply({ - embeds: [ - { - description: - "Your rank has been updated to `Beast`.", - color: embedColor, - thumbnail: { - url: head!, - }, - footer: { - text: - interaction.guild!.name + - " | " + - devMessage, - icon_url: interaction.guild!.iconURL({ - forceStatic: false, - })!, - }, - }, - ], - }) - return + 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 interaction.editReply({ - embeds: [ - { - description: - "Your rank has been updated to `Elite`.", - color: embedColor, - thumbnail: { - url: head!, - }, - footer: { - text: - interaction.guild!.name + - " | " + - devMessage, - icon_url: interaction.guild!.iconURL({ - forceStatic: false, - })!, - }, - }, - ], - }) - return + 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 interaction.editReply({ - embeds: [ - { - description: - "Your rank has been updated to `Member`.", - color: embedColor, - thumbnail: { - url: head!, - }, - footer: { - text: - interaction.guild!.name + - " | " + - devMessage, - icon_url: interaction.guild!.iconURL({ - forceStatic: false, - })!, - }, - }, - ], - }) - return + replyRank = "Member" } + + await interaction.editReply({ + embeds: [ + { + description: "Updated your roles to `" + replyRank + "`", + color: embedColor, + thumbnail: { + url: head!, + }, + footer: { + text: interaction.guild!.name + " | " + devMessage, + icon_url: interaction.guild!.iconURL({ forceStatic: false, }) || undefined, + }, + }, + ], + }) } }, } as Command diff --git a/src/commands/uuid.ts b/src/commands/uuid.ts index bdd7ca1..dc97a7e 100644 --- a/src/commands/uuid.ts +++ b/src/commands/uuid.ts @@ -60,10 +60,7 @@ export = { }, footer: { text: interaction.guild!.name + " | " + devMessage, - icon_url: - interaction.guild?.iconURL({ - forceStatic: false, - }) || undefined, + icon_url: interaction.guild!.iconURL({ forceStatic: false, }) || undefined, }, }, ], diff --git a/src/commands/verify.ts b/src/commands/verify.ts index aaf583b..2131761 100644 --- a/src/commands/verify.ts +++ b/src/commands/verify.ts @@ -233,7 +233,7 @@ export = { "`.", color: embedColor, thumbnail: { - url: head || "", + url: head!, }, footer: { icon_url: interaction.guild!.iconURL() || undefined, diff --git a/src/commands/whoami.ts b/src/commands/whoami.ts index 374f4f2..75233a6 100644 --- a/src/commands/whoami.ts +++ b/src/commands/whoami.ts @@ -54,9 +54,7 @@ export = { }, footer: { text: interaction.guild!.name + " | " + devMessage, - icon_url: interaction.guild!.iconURL({ - forceStatic: true, - })!, + icon_url: interaction.guild!.iconURL({ forceStatic: true, }) || undefined, }, }, ],