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

Contents of /trunk/src/queues/UnbanQueue.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: 741 byte(s)
style: eslint autofix
1 import Queue from "../utils/structures/Queue";
2
3 export default class UnbanQueue extends Queue {
4 cancel(): Promise<void> {
5 console.log("Canceling unban");
6 return super.cancel();
7 }
8
9 async execute({ userID, guildID }: { [key: string]: string }): Promise<any> {
10 const guild = this.client.guilds.cache.get(guildID);
11
12 if (!guild) {
13 return;
14 }
15
16 try {
17 const user = await this.client.users.fetch(userID);
18
19 if (user) {
20 await guild.bans.remove(user, 'Removed temporary ban');
21 }
22 else {
23 throw new Error();
24 }
25 }
26 catch (e) {
27 console.log(e);
28 }
29 }
30 }

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26