Please look over - not for production
diff --git a/src/events/guildMemberUpdate.ts b/src/events/guildMemberUpdate.ts
index a0acd34..41a22c1 100644
--- a/src/events/guildMemberUpdate.ts
+++ b/src/events/guildMemberUpdate.ts
@@ -111,7 +111,6 @@
timestamp: Date.now()
},
list: {
- memberId: entry(after.id, `\`${after.id}\``),
name: entry(after.user.id, renderUser(after.user)),
before: entry(before.nickname, before.nickname ? before.nickname : "*None*"),
after: entry(after.nickname, after.nickname ? after.nickname : "*None*"),
diff --git a/src/events/guildUpdate.ts b/src/events/guildUpdate.ts
index dbd747f..c48c82f 100644
--- a/src/events/guildUpdate.ts
+++ b/src/events/guildUpdate.ts
@@ -5,7 +5,7 @@
export const event = "guildUpdate";
export async function callback(client: NucleusClient, before: Guild, after: Guild) {
- await statsChannelUpdate(client, after.members.me!);
+ await statsChannelUpdate(after.members.me!.user, after);
const { getAuditLog, isLogging, log, NucleusColors, entry, renderUser, renderDelta } = client.logger;
if (!(await isLogging(after.id, "guildUpdate"))) return;
const auditLog = (await getAuditLog(after, AuditLogEvent.GuildUpdate)).filter(
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);
+ }
+ }
+ }
}
}
diff --git a/src/events/memberJoin.ts b/src/events/memberJoin.ts
index bdfd999..191ba6b 100644
--- a/src/events/memberJoin.ts
+++ b/src/events/memberJoin.ts
@@ -2,12 +2,14 @@
import { callback as statsChannelAdd } from "../reflex/statsChannelUpdate.js";
import { callback as welcome } from "../reflex/welcome.js";
import type { NucleusClient } from "../utils/client.js";
+import { doMemberChecks } from "../reflex/scanners.js";
export const event = "guildMemberAdd";
export async function callback(client: NucleusClient, member: GuildMember) {
- welcome(client, member);
- statsChannelAdd(client, member);
+ welcome(member);
+ statsChannelAdd(member.user, member.guild);
+ doMemberChecks(member, member.guild)
const { log, isLogging, NucleusColors, entry, renderUser, renderDelta } = client.logger;
if (!(await isLogging(member.guild.id, "guildMemberUpdate"))) return;
await client.database.history.create("join", member.guild.id, member.user, null, null);
diff --git a/src/events/messageCreate.ts b/src/events/messageCreate.ts
index 4c85052..0281fa1 100644
--- a/src/events/messageCreate.ts
+++ b/src/events/messageCreate.ts
@@ -30,7 +30,7 @@
if (message.author.bot) return;
if (message.channel.isDMBased()) return;
try {
- await statsChannelUpdate(client, await message.guild.members.fetch(message.author.id));
+ await statsChannelUpdate((await message.guild.members.fetch(message.author.id)).user, message.guild);
} catch (e) {
console.log(e);
}