mirror of
https://github.com/veganhacktivists/arabot.git
synced 2025-07-07 10:10:59 +02:00
fix(arabot): remove modmail listener only running once and add a second delay to send embeds
This commit is contained in:
parent
65ee043ea4
commit
4e75cffe5d
@ -20,6 +20,7 @@
|
|||||||
import { Listener } from '@sapphire/framework';
|
import { Listener } from '@sapphire/framework';
|
||||||
import { ChannelType, EmbedBuilder } from 'discord.js';
|
import { ChannelType, EmbedBuilder } from 'discord.js';
|
||||||
import type { GuildChannel } from 'discord.js';
|
import type { GuildChannel } from 'discord.js';
|
||||||
|
import { setTimeout } from 'timers/promises';
|
||||||
import IDs from '#utils/ids';
|
import IDs from '#utils/ids';
|
||||||
import { getRestrictions } from '#utils/database/restriction';
|
import { getRestrictions } from '#utils/database/restriction';
|
||||||
import { findNotes } from '#utils/database/sus';
|
import { findNotes } from '#utils/database/sus';
|
||||||
@ -28,7 +29,6 @@ export class ModMailCreateListener extends Listener {
|
|||||||
public constructor(context: Listener.Context, options: Listener.Options) {
|
public constructor(context: Listener.Context, options: Listener.Options) {
|
||||||
super(context, {
|
super(context, {
|
||||||
...options,
|
...options,
|
||||||
once: true,
|
|
||||||
event: 'channelCreate',
|
event: 'channelCreate',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -45,11 +45,11 @@ export class ModMailCreateListener extends Listener {
|
|||||||
const { guild } = channel;
|
const { guild } = channel;
|
||||||
|
|
||||||
// Get the channel topic
|
// Get the channel topic
|
||||||
const { topic } = channel;
|
if (channel.topic === null) return;
|
||||||
if (topic === null) return;
|
const topic = channel.topic.split(' ');
|
||||||
|
|
||||||
// Get the user's ID
|
// Get the user's ID
|
||||||
const userId = topic.split(' ')[2];
|
const userId = topic[2];
|
||||||
|
|
||||||
// Check if the user is restricted on the database
|
// Check if the user is restricted on the database
|
||||||
const restrictions = await getRestrictions(userId);
|
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] });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ const devIDs = {
|
|||||||
},
|
},
|
||||||
categories: {
|
categories: {
|
||||||
staff: '999431676058927253',
|
staff: '999431676058927253',
|
||||||
modMail: '999431676633563236',
|
modMail: '1095453371411996762',
|
||||||
verification: '999431677006860409',
|
verification: '999431677006860409',
|
||||||
diversity: '999431679053660185',
|
diversity: '999431679053660185',
|
||||||
private: '999431679527628818',
|
private: '999431679527628818',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user