/[sudobot]/branches/2.x/src/cli-commands/guild/BanGuildCommand.ts
ViewVC logotype

Contents of /branches/2.x/src/cli-commands/guild/BanGuildCommand.ts

Parent Directory Parent Directory | Revision Log Revision Log


Revision 577 - (show annotations)
Mon Jul 29 18:52:37 2024 UTC (8 months ago) by rakinar2
File MIME type: application/typescript
File size: 1016 byte(s)
chore: add old version archive branches (2.x to 9.x-dev)
1 import { exit } from "process";
2 import DiscordClient from "../../client/Client";
3 import BannedGuild from "../../models/BannedGuild";
4 import BaseCLICommand from "../../utils/structures/BaseCLICommand";
5
6 export default class BanGuildCommand extends BaseCLICommand {
7 requiredArgs = 1;
8
9 constructor() {
10 super('banguild', 'guild');
11 }
12
13 async run(client: DiscordClient, argv: string[], args: string[]) {
14 const guild_id = args.shift()!;
15 let reason: string | null = null;
16
17 if (args.length > 0)
18 reason = args.join(' ');
19
20 const guild = await client.guilds.cache.get(guild_id);
21
22 if (!guild) {
23 console.error("Failed to find a guild with ID " + guild_id);
24 exit(-1);
25 }
26
27 await BannedGuild.create({
28 guild_id,
29 reason
30 });
31
32 await guild.leave();
33
34 console.log(`Succesfully banned and left guild: ${guild.name} (${guild.id})`);
35
36 await exit(0);
37 }
38 }

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26