From 4e75cffe5d78caebf9d7bec1a948a7ff18e64d48 Mon Sep 17 00:00:00 2001 From: Anthony Date: Tue, 11 Apr 2023 22:15:22 +0100 Subject: [PATCH] fix(arabot): remove modmail listener only running once and add a second delay to send embeds --- src/listeners/modMail.ts | 12 +++++++----- src/utils/devIDs.ts | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/listeners/modMail.ts b/src/listeners/modMail.ts index 1fa21b8..f3fea93 100644 --- a/src/listeners/modMail.ts +++ b/src/listeners/modMail.ts @@ -20,6 +20,7 @@ import { Listener } from '@sapphire/framework'; import { ChannelType, EmbedBuilder } from 'discord.js'; import type { GuildChannel } from 'discord.js'; +import { setTimeout } from 'timers/promises'; import IDs from '#utils/ids'; import { getRestrictions } from '#utils/database/restriction'; import { findNotes } from '#utils/database/sus'; @@ -28,7 +29,6 @@ export class ModMailCreateListener extends Listener { public constructor(context: Listener.Context, options: Listener.Options) { super(context, { ...options, - once: true, event: 'channelCreate', }); } @@ -45,11 +45,11 @@ export class ModMailCreateListener extends Listener { const { guild } = channel; // Get the channel topic - const { topic } = channel; - if (topic === null) return; + if (channel.topic === null) return; + const topic = channel.topic.split(' '); // Get the user's ID - const userId = topic.split(' ')[2]; + const userId = topic[2]; // Check if the user is restricted on the database const restrictions = await getRestrictions(userId); @@ -118,6 +118,8 @@ export class ModMailCreateListener extends Listener { }); } - channel.send({ embeds: [restrictEmbed, susEmbed] }); + // Set a timeout for 1 second and then send the 2 embeds + await setTimeout(1000); + await channel.send({ embeds: [restrictEmbed, susEmbed] }); } } diff --git a/src/utils/devIDs.ts b/src/utils/devIDs.ts index f378f4f..2b34a2a 100644 --- a/src/utils/devIDs.ts +++ b/src/utils/devIDs.ts @@ -123,7 +123,7 @@ const devIDs = { }, categories: { staff: '999431676058927253', - modMail: '999431676633563236', + modMail: '1095453371411996762', verification: '999431677006860409', diversity: '999431679053660185', private: '999431679527628818',