/[sudobot]/trunk/src/cli-commands/guild/GuildLeaveCommand.ts
ViewVC logotype

Contents of /trunk/src/cli-commands/guild/GuildLeaveCommand.ts

Parent Directory Parent Directory | Revision Log Revision Log


Revision 329 - (show annotations)
Mon Jul 29 17:29:34 2024 UTC (8 months, 1 week ago) by rakin
File MIME type: application/typescript
File size: 868 byte(s)
refactor(cli): remove bannedguild model
1 import { exit } from "process";
2 import DiscordClient from "../../client/Client";
3 import BaseCLICommand from "../../utils/structures/BaseCLICommand";
4
5 export default class GuildLeaveCommand extends BaseCLICommand {
6 requiredArgs = 1;
7
8 constructor() {
9 super('guildleave', 'guild');
10 }
11
12 async run(client: DiscordClient, argv: string[], args: string[]) {
13 const guild_id = args.shift()!;
14 let reason: string | null = null;
15
16 if (args.length > 0)
17 reason = args.join(' ');
18
19 const guild = await client.guilds.cache.get(guild_id);
20
21 if (!guild) {
22 console.error("Failed to find a guild with ID " + guild_id);
23 exit(-1);
24 }
25
26 await guild.leave();
27
28 console.log(`Succesfully left guild: ${guild.name} (${guild.id})`);
29
30 await exit(0);
31 }
32 }

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26