possibly finished current features
diff --git a/src/utils/calculate.ts b/src/utils/calculate.ts
index 0bd5a9f..fde1340 100644
--- a/src/utils/calculate.ts
+++ b/src/utils/calculate.ts
@@ -17,16 +17,14 @@
"webhookUpdate",
"guildMemberVerify",
"autoModeratorDeleted",
- "nucleusSettingsUpdated",
- "ticketUpdate"
+ "ticketUpdate",
+ // "nucleusSettingsUpdated"
];
const tickets = ["support", "report", "question", "issue", "suggestion", "other"];
const toHexInteger = (permissions: string[], array?: string[]): string => {
- if (!array) {
- array = logs;
- }
+ if (!array) { array = logs; }
let int = 0n;
for (const perm of permissions) {
diff --git a/src/utils/commandRegistration/register.ts b/src/utils/commandRegistration/register.ts
index 50c8e78..6805019 100644
--- a/src/utils/commandRegistration/register.ts
+++ b/src/utils/commandRegistration/register.ts
@@ -56,7 +56,7 @@
}
}
- console.log(`${colours.green}Processed ${processed.length} commands`)
+ console.log(`${colours.green}Processed ${processed.length} commands${colours.none}`)
return processed;
};
diff --git a/src/utils/confirmationMessage.ts b/src/utils/confirmationMessage.ts
index 43a0c8f..f7cccaf 100644
--- a/src/utils/confirmationMessage.ts
+++ b/src/utils/confirmationMessage.ts
@@ -1,11 +1,9 @@
import { TextInputBuilder } from "discord.js";
import Discord, {
CommandInteraction,
- Interaction,
Message,
ActionRowBuilder,
ButtonBuilder,
- MessageComponentInteraction,
ModalSubmitInteraction,
ButtonStyle,
TextInputStyle
@@ -246,12 +244,7 @@
});
let out;
try {
- out = await modalInteractionCollector(
- m,
- (m: Interaction) =>
- (m as MessageComponentInteraction | ModalSubmitInteraction).channelId === this.interaction.channelId,
- (m) => m.customId === "reason"
- );
+ out = await modalInteractionCollector(m, this.interaction.user) as Discord.ModalSubmitInteraction | null;
} catch (e) {
cancelled = true;
continue;
diff --git a/src/utils/dualCollector.ts b/src/utils/dualCollector.ts
index f55716e..072f73f 100644
--- a/src/utils/dualCollector.ts
+++ b/src/utils/dualCollector.ts
@@ -1,4 +1,4 @@
-import { ButtonInteraction, Client, Interaction, InteractionCollector, Message, MessageComponentInteraction, ModalSubmitInteraction } from "discord.js";
+import { ButtonInteraction, Client, User, Interaction, InteractionCollector, Message, MessageComponentInteraction, ModalSubmitInteraction } from "discord.js";
import client from "./client.js";
export default async function (
@@ -45,17 +45,25 @@
return out;
}
+function defaultInteractionFilter(i: MessageComponentInteraction, user: User, m: Message) {
+ return i.channel!.id === m.channel!.id && i.user.id === user.id
+}
+function defaultModalFilter(i: ModalSubmitInteraction, user: User, m: Message) {
+ return i.channel!.id === m.channel!.id && i.user.id === user.id
+}
+
+
export async function modalInteractionCollector(
- m: Message,
- modalFilter: (i: Interaction) => boolean | Promise<boolean>,
- interactionFilter: (i: MessageComponentInteraction) => boolean | Promise<boolean>
+ m: Message, user: User,
+ modalFilter?: (i: Interaction) => boolean | Promise<boolean>,
+ interactionFilter?: (i: MessageComponentInteraction) => boolean | Promise<boolean>
): Promise<null | ButtonInteraction | ModalSubmitInteraction> {
let out: ButtonInteraction | ModalSubmitInteraction;
try {
out = await new Promise((resolve, _reject) => {
const int = m
.createMessageComponentCollector({
- filter: (i: MessageComponentInteraction) => interactionFilter(i),
+ filter: (i: MessageComponentInteraction) => (interactionFilter ? interactionFilter(i) : true) && defaultInteractionFilter(i, user, m),
time: 300000
})
.on("collect", async (i: ButtonInteraction) => {
@@ -65,7 +73,7 @@
resolve(i);
});
const mod = new InteractionCollector(client as Client, {
- filter: (i: Interaction) => modalFilter(i) && i.isModalSubmit(),
+ filter: (i: Interaction) => (modalFilter ? modalFilter(i) : true) && i.isModalSubmit() && defaultModalFilter(i, user, m),
time: 300000
}).on("collect", async (i: ModalSubmitInteraction) => {
int.stop();
@@ -75,6 +83,7 @@
});
});
} catch (e) {
+ console.log(e);
return null;
}
return out;