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, }) },