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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 429 - (show annotations)
Mon Jul 29 17:30:11 2024 UTC (8 months, 1 week ago) by rakin
File MIME type: application/typescript
File size: 830 byte(s)
style: eslint autofix
1 import Queue from "../utils/structures/Queue";
2
3 export default class SendMessageQueue extends Queue {
4 async execute(data: { [key: string]: string }): Promise<any> {
5 console.log(data);
6 const { messageID, channelID, guildID } = data;
7
8 console.log("Queue works!");
9 console.log("Sending message...");
10
11 const guild = this.client.guilds.cache.get(guildID);
12
13 if (!guild) {
14 return;
15 }
16
17 const channel = guild.channels.cache.get(channelID);
18
19 if (!channel || channel.type !== 'GUILD_TEXT') {
20 return;
21 }
22
23 try {
24 const message = await channel.messages.fetch(messageID);
25 await message?.reply({ content: "Awesome stuff!" });
26 }
27 catch (e) {
28 console.log(e);
29 }
30 }
31 }

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26