Merge branch 'main' into development
diff --git a/src/commands/help.ts b/src/commands/help.ts
index 482bca2..96971e6 100644
--- a/src/commands/help.ts
+++ b/src/commands/help.ts
@@ -127,7 +127,7 @@
);
}
for (const option of options) {
- optionString += `> ${option.name} (${ApplicationCommandOptionType[option.type]})- ${
+ optionString += `> \`${option.name}\` (${ApplicationCommandOptionType[option.type]}) - ${
option.description
}\n`;
}
diff --git a/src/commands/nucleus/stats.ts b/src/commands/nucleus/stats.ts
index a7f9b3b..b2658bc 100644
--- a/src/commands/nucleus/stats.ts
+++ b/src/commands/nucleus/stats.ts
@@ -79,7 +79,7 @@
if (!("awaitMessageComponent" in channel)) return;
try {
i1 = await channel!.awaitMessageComponent<ComponentType.Button>({
- filter: (i) => i.customId === "admin" && i.user.id === interaction.user.id,
+ filter: (i) => i.customId === "admin" && i.user.id === interaction.user.id && i.message.id === m.id,
time: 300000
});
} catch (e) {
@@ -120,7 +120,7 @@
let i;
try {
i = await m.awaitMessageComponent<ComponentType.Button>({
- filter: (i) => i.user.id === interaction.user.id,
+ filter: (i) => i.user.id === interaction.user.id && i.message.id === m.id,
time: 300000
});
} catch {
diff --git a/src/commands/server/buttons.ts b/src/commands/server/buttons.ts
index 3ba9c25..74c255c 100644
--- a/src/commands/server/buttons.ts
+++ b/src/commands/server/buttons.ts
@@ -67,7 +67,11 @@
};
do {
const buttons = new ActionRowBuilder<ButtonBuilder>().addComponents(
- new ButtonBuilder().setCustomId("edit").setLabel("Edit Embed").setStyle(ButtonStyle.Secondary),
+ new ButtonBuilder()
+ .setCustomId("edit")
+ .setLabel("Edit Embed")
+ .setStyle(ButtonStyle.Secondary)
+ .setEmoji(getEmojiByName("ICONS.EDIT") as APIMessageComponentEmoji),
new ButtonBuilder()
.setCustomId("send")
.setLabel("Send")
@@ -143,7 +147,8 @@
let i: Discord.ButtonInteraction | Discord.ChannelSelectMenuInteraction | Discord.StringSelectMenuInteraction;
try {
i = (await interaction.channel!.awaitMessageComponent({
- filter: (i: Discord.Interaction) => i.user.id === interaction.user.id,
+ filter: (i: Discord.Interaction) =>
+ i.user.id === interaction.user.id && i.isMessageComponent() && i.message.id === m.id,
time: 300000
})) as
| Discord.ButtonInteraction
@@ -223,17 +228,18 @@
case "send": {
await i.deferUpdate();
const channel = interaction.guild!.channels.cache.get(data.channel!) as Discord.TextChannel;
- const components = new ActionRowBuilder<ButtonBuilder>();
+ const messageData: MessageCreateOptions = {};
for (const button of data.buttons) {
- components.addComponents(
- new ButtonBuilder()
- .setCustomId(button)
- .setLabel(buttonNames[button]!)
- .setStyle(ButtonStyle.Primary)
- );
+ messageData.components = [
+ new ActionRowBuilder<ButtonBuilder>().addComponents(
+ new ButtonBuilder()
+ .setCustomId(button)
+ .setLabel(buttonNames[button]!)
+ .setStyle(ButtonStyle.Primary)
+ )
+ ];
}
- const messageData: MessageCreateOptions = { components: [components] };
- if (data.title || data.description) {
+ if (data.title || data.description || data.color) {
const e = new EmojiEmbed();
if (data.title) e.setTitle(data.title);
if (data.description) e.setDescription(data.description);
diff --git a/src/commands/settings/autopublish.ts b/src/commands/settings/autopublish.ts
index afc4e7d..421cfb8 100644
--- a/src/commands/settings/autopublish.ts
+++ b/src/commands/settings/autopublish.ts
@@ -20,7 +20,7 @@
.setDescription("Automatically publish messages posted in announcement channels");
export const callback = async (interaction: CommandInteraction): Promise<void> => {
- await interaction.reply({
+ const m = await interaction.reply({
embeds: LoadingEmbed,
ephemeral: true,
fetchReply: true
@@ -70,7 +70,8 @@
let i: Discord.ButtonInteraction | Discord.ChannelSelectMenuInteraction;
try {
i = (await interaction.channel!.awaitMessageComponent({
- filter: (i: Discord.Interaction) => i.user.id === interaction.user.id,
+ filter: (i: Discord.Interaction) =>
+ i.user.id === interaction.user.id && i.isMessageComponent() && i.message.id === m.id,
time: 300000
})) as Discord.ButtonInteraction | Discord.ChannelSelectMenuInteraction;
} catch (e) {
diff --git a/src/commands/settings/logs/attachment.ts b/src/commands/settings/logs/attachment.ts
index 3ee7675..62abd7e 100644
--- a/src/commands/settings/logs/attachment.ts
+++ b/src/commands/settings/logs/attachment.ts
@@ -18,7 +18,7 @@
const callback = async (interaction: CommandInteraction): Promise<unknown> => {
if (interaction.guild) client.database.premium.hasPremium(interaction.guild.id).finally(() => {});
- await interaction.reply({
+ const m = await interaction.reply({
embeds: LoadingEmbed,
ephemeral: true,
fetchReply: true
@@ -79,7 +79,7 @@
let i: Discord.ButtonInteraction | Discord.SelectMenuInteraction;
try {
- i = (await interaction.channel!.awaitMessageComponent({
+ i = (await m.awaitMessageComponent({
filter: (i: Discord.Interaction) => i.user.id === interaction.user.id,
time: 300000
})) as Discord.ButtonInteraction | Discord.SelectMenuInteraction;
diff --git a/src/commands/settings/logs/events.ts b/src/commands/settings/logs/events.ts
index 4cffab7..1041409 100644
--- a/src/commands/settings/logs/events.ts
+++ b/src/commands/settings/logs/events.ts
@@ -122,7 +122,7 @@
let i: ButtonInteraction | StringSelectMenuInteraction | ChannelSelectMenuInteraction;
try {
i = (await m.awaitMessageComponent({
- filter: (i) => i.user.id === interaction.user.id,
+ filter: (i) => i.user.id === interaction.user.id && i.isMessageComponent() && i.message.id === m.id,
time: 300000
})) as ButtonInteraction | StringSelectMenuInteraction | ChannelSelectMenuInteraction;
} catch (e) {
diff --git a/src/commands/settings/logs/warnings.ts b/src/commands/settings/logs/warnings.ts
index a810560..37c5ac8 100644
--- a/src/commands/settings/logs/warnings.ts
+++ b/src/commands/settings/logs/warnings.ts
@@ -19,7 +19,7 @@
const callback = async (interaction: CommandInteraction): Promise<unknown> => {
if (!interaction.guild) return;
- await interaction.reply({
+ const m = await interaction.reply({
embeds: LoadingEmbed,
ephemeral: true,
fetchReply: true
@@ -67,7 +67,8 @@
let i: Discord.ButtonInteraction | Discord.ChannelSelectMenuInteraction;
try {
i = await interaction.channel!.awaitMessageComponent<ComponentType.Button | ComponentType.ChannelSelect>({
- filter: (i: Discord.Interaction) => i.user.id === interaction.user.id,
+ filter: (i: Discord.Interaction) =>
+ i.user.id === interaction.user.id && i.isMessageComponent() && i.message.id === m.id,
time: 300000
});
} catch (e) {
diff --git a/src/config/format.ts b/src/config/format.ts
index 0560796..b63debd 100644
--- a/src/config/format.ts
+++ b/src/config/format.ts
@@ -1,7 +1,7 @@
import fs from "fs";
import * as readLine from "node:readline/promises";
-const defaultDict: Record<string, string | string[] | boolean | Record<string, string>> = {
+const defaultDict: Record<string, string | string[] | boolean | Record<string, string | number>> = {
developmentToken: "Your development bot token (Used for testing in one server, rather than production)",
developmentGuildID: "Your development guild ID",
enableDevelopment: true,
@@ -29,7 +29,12 @@
pastebinApiKey: "An API key for pastebin (optional)",
pastebinUsername: "Your pastebin username (optional)",
pastebinPassword: "Your pastebin password (optional)",
- rapidApiKey: "Your RapidAPI key (optional), used for Unscan"
+ rapidApiKey: "Your RapidAPI key (optional), used for Unscan",
+ clamav: {
+ socket: "Your ClamAV socket file (optional)",
+ host: "Your ClamAV host (optional)",
+ port: "Your ClamAV port (optional)"
+ }
};
const readline = readLine.createInterface({
diff --git a/src/config/main.d.ts b/src/config/main.d.ts
index 419414a..8953c52 100644
--- a/src/config/main.d.ts
+++ b/src/config/main.d.ts
@@ -19,7 +19,11 @@
};
baseUrl: string;
rapidApiKey: string;
- clamavSocket: string;
+ clamav: {
+ socket?: string;
+ host?: string;
+ port?: number;
+ };
};
export default config;
diff --git a/src/reflex/scanners.ts b/src/reflex/scanners.ts
index c6a0e32..80ca150 100644
--- a/src/reflex/scanners.ts
+++ b/src/reflex/scanners.ts
@@ -26,7 +26,9 @@
const nsfw_model = await nsfwjs.load("file://dist/reflex/nsfwjs/example/nsfw_demo/public/model/", { size: 299 });
const clamscanner = await new ClamScan().init({
clamdscan: {
- socket: config.clamavSocket
+ socket: "socket" in config.clamav ? (config.clamav.socket as string) : false,
+ host: "host" in config.clamav ? (config.clamav.host as string) : false,
+ port: "port" in config.clamav ? (config.clamav.port as number) : false
}
});