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