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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 431 - (hide annotations)
Mon Jul 29 17:30:12 2024 UTC (8 months, 1 week ago) by rakin
File MIME type: application/typescript
File size: 1465 byte(s)
style: add license comments
1 rakin 431 /**
2     * This file is part of SudoBot.
3     *
4     * Copyright (C) 2021-2022 OSN Inc.
5     *
6     * SudoBot is free software; you can redistribute it and/or modify it
7     * under the terms of the GNU Affero General Public License as published by
8     * the Free Software Foundation, either version 3 of the License, or
9     * (at your option) any later version.
10     *
11     * SudoBot is distributed in the hope that it will be useful, but
12     * WITHOUT ANY WARRANTY; without even the implied warranty of
13     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14     * GNU Affero General Public License for more details.
15     *
16     * You should have received a copy of the GNU Affero General Public License
17     * along with SudoBot. If not, see <https://www.gnu.org/licenses/>.
18     */
19    
20 rakin 428 import Queue from "../utils/structures/Queue";
21    
22     export default class UnbanQueue extends Queue {
23     cancel(): Promise<void> {
24     console.log("Canceling unban");
25     return super.cancel();
26     }
27    
28     async execute({ userID, guildID }: { [key: string]: string }): Promise<any> {
29     const guild = this.client.guilds.cache.get(guildID);
30    
31     if (!guild) {
32     return;
33     }
34    
35     try {
36     const user = await this.client.users.fetch(userID);
37    
38     if (user) {
39     await guild.bans.remove(user, 'Removed temporary ban');
40     }
41     else {
42     throw new Error();
43     }
44     }
45     catch (e) {
46     console.log(e);
47     }
48     }
49     }

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26