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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 427 - (show annotations)
Mon Jul 29 17:30:11 2024 UTC (8 months, 1 week ago) by rakin
File MIME type: application/typescript
File size: 1279 byte(s)
refactor(muting): use new queue handler
1 import { unmute } from "../commands/moderation/UnmuteCommand";
2 import MuteRecord from "../models/MuteRecord";
3 import Queue from "../utils/structures/Queue";
4
5 export default class UnmuteQueue extends Queue {
6 async execute({ memberID, guildID }: { [key: string]: string }): Promise<any> {
7 const guild = this.client.guilds.cache.get(guildID);
8
9 if (!guild) {
10 return;
11 }
12
13 try {
14 const member = await guild.members.fetch(memberID);
15
16 if (member) {
17 await unmute(this.client, member, this.client.user!);
18 }
19 else {
20 throw new Error();
21 }
22 }
23 catch (e) {
24 console.log(e);
25
26 const muteRecord = await MuteRecord.findOne({
27 memberID,
28 guildID
29 });
30
31 if (muteRecord) {
32 await muteRecord.delete();
33 }
34 }
35
36 // try {
37 // const member = await guild.members.fetch(memberID);
38 // console.log("Unmuting", member.user.tag);
39
40 // await unmute(this.client, member, this.client.user!);
41 // }
42 // catch (e) {
43 // console.log(e);
44 // }
45 }
46 }

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26