/[sudobot]/trunk/src/queues/ScheduleMessageQueue.ts
ViewVC logotype

Contents of /trunk/src/queues/ScheduleMessageQueue.ts

Parent Directory Parent Directory | Revision Log Revision Log


Revision 430 - (show annotations)
Mon Jul 29 17:30:12 2024 UTC (8 months, 1 week ago) by rakin
File MIME type: application/typescript
File size: 792 byte(s)
refactor: use new queue handler
1 import { TextChannel } from "discord.js";
2 import { fetchEmoji } from "../utils/Emoji";
3 import Queue from "../utils/structures/Queue";
4
5 export default class ScheduleMessageQueue extends Queue {
6 async execute({ channelID, guildID, content }: { [key: string]: string }): Promise<any> {
7 const guild = this.client.guilds.cache.get(guildID);
8
9 if (!guild) {
10 return;
11 }
12
13 const channel = guild.channels.cache.get(channelID) as TextChannel;
14
15 if (!channel || !['GUILD_TEXT', 'GUILD_NEWS', 'GUILD_NEWS_THREAD', 'GUILD_PUBLIC_THREAD', 'GUILD_PRIVATE_THREAD'].includes(channel.type)) {
16 return;
17 }
18
19 try {
20 await channel.send({ content });
21 }
22 catch (e) {
23 console.log(e);
24 }
25 }
26 }

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26