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 |
} |