Please look over - not for production
diff --git a/src/events/interactionCreate.ts b/src/events/interactionCreate.ts
index c91f8cd..4a8d941 100644
--- a/src/events/interactionCreate.ts
+++ b/src/events/interactionCreate.ts
@@ -4,13 +4,30 @@
import close from "../actions/tickets/delete.js";
import createTranscript from "../premium/createTranscript.js";
-import type { Interaction } from "discord.js";
+import type { ButtonInteraction, Interaction } from "discord.js";
import type Discord from "discord.js";
import type { NucleusClient } from "../utils/client.js";
import EmojiEmbed from "../utils/generateEmojiEmbed.js";
+import { callback as banCallback, check as banCheck } from "../commands/mod/ban.js";
+import { callback as kickCallback, check as kickCheck } from "../commands/mod/kick.js";
+import { callback as muteCallback, check as muteCheck } from "../commands/mod/mute.js";
+import { callback as nicknameCallback, check as nicknameCheck } from "../commands/mod/nick.js";
+import { callback as warnCallback, check as warnCheck } from "../commands/mod/warn.js";
+
export const event = "interactionCreate";
+async function errorMessage(interaction: ButtonInteraction, message: string) {
+ await interaction.reply({
+ embeds: [new EmojiEmbed()
+ .setDescription(message)
+ .setStatus("Danger")
+ ],
+ ephemeral: true,
+ components: []
+ });
+}
+
async function interactionCreate(interaction: Interaction) {
if (interaction.isButton()) {
switch (interaction.customId) {
@@ -36,6 +53,35 @@
return await modifySuggestion(interaction, false);
}
}
+ // Mod actions
+ if (interaction.customId.startsWith("mod:")) {
+ const action = interaction.customId.split(":")[1];
+ const memberId = interaction.customId.split(":")[2];
+ const member = await interaction.guild?.members.fetch(memberId!);
+ switch (action) {
+ case "kick": {
+ const check = await kickCheck(interaction, false, member)
+ if (check !== true) return await errorMessage(interaction, check!);
+ return await kickCallback(interaction, member);
+ } case "ban": {
+ const check = await banCheck(interaction, false, member)
+ if (check !== true) return await errorMessage(interaction, check!);
+ return await banCallback(interaction, member);
+ } case "mute": {
+ const check = await muteCheck(interaction, false, member)
+ if (check !== true) return await errorMessage(interaction, check!);
+ return await muteCallback(interaction, member);
+ } case "nickname": {
+ const check = await nicknameCheck(interaction, false, member)
+ if (check !== true) return await errorMessage(interaction, check || "Something went wrong");
+ return await nicknameCallback(interaction, member);
+ } case "warn": {
+ const check = await warnCheck(interaction, false, member)
+ if (check !== true) return await errorMessage(interaction, check!);
+ return await warnCallback(interaction, member);
+ }
+ }
+ }
}
}