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