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

Annotation of /trunk/src/queues/UnbanQueue.ts

Parent Directory Parent Directory | Revision Log Revision Log


Revision 428 - (hide annotations)
Mon Jul 29 17:30:11 2024 UTC (8 months, 1 week ago) by rakin
File MIME type: application/typescript
File size: 851 byte(s)
refactor: use new queue handler
1 rakin 428 import { unmute } from "../commands/moderation/UnmuteCommand";
2     import MuteRecord from "../models/MuteRecord";
3     import Queue from "../utils/structures/Queue";
4    
5     export default class UnbanQueue extends Queue {
6     cancel(): Promise<void> {
7     console.log("Canceling unban");
8     return super.cancel();
9     }
10    
11     async execute({ userID, guildID }: { [key: string]: string }): Promise<any> {
12     const guild = this.client.guilds.cache.get(guildID);
13    
14     if (!guild) {
15     return;
16     }
17    
18     try {
19     const user = await this.client.users.fetch(userID);
20    
21     if (user) {
22     await guild.bans.remove(user, 'Removed temporary ban');
23     }
24     else {
25     throw new Error();
26     }
27     }
28     catch (e) {
29     console.log(e);
30     }
31     }
32     }

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26