From 833040a51d2253b6ef943e93b8b26c60ee0696d7 Mon Sep 17 00:00:00 2001 From: tinarskii Date: Thu, 10 Nov 2022 14:36:58 +0700 Subject: [PATCH] feat(command): add moderation category * Command added... - `/ban` - Ban users - `/kick` - Kick users --- src/commands/mod/ban.ts | 29 +++++++++++++++++++++++++++++ src/commands/mod/kick.ts | 0 2 files changed, 29 insertions(+) create mode 100644 src/commands/mod/ban.ts create mode 100644 src/commands/mod/kick.ts diff --git a/src/commands/mod/ban.ts b/src/commands/mod/ban.ts new file mode 100644 index 0000000..03c364e --- /dev/null +++ b/src/commands/mod/ban.ts @@ -0,0 +1,29 @@ +import { Discord, Slash, SlashOption } from "discordx"; +import { Category } from "@discordx/utilities"; +import { ApplicationCommandOptionType, CommandInteraction, GuildMember, User } from "discord.js"; + +@Discord() +@Category("Moderation") +export class KickCommand { + @Slash({ name: "kick", description: "Kick a user" }) + async kick( + @SlashOption({ + name: "user", + description: "Select a user to kick", + required: true, + type: ApplicationCommandOptionType.User + }) + @SlashOption({ + name: "reason", + description: "Reason for kicking the user", + required: false, + type: ApplicationCommandOptionType.String + }) + user: GuildMember, + reason: string = "Not specified", + interaction: CommandInteraction + ): Promise { + await user.kick(reason); + await interaction.reply(`Successfully kicked <@${user.id}>\nReason: \`${reason}\``); + } +} \ No newline at end of file diff --git a/src/commands/mod/kick.ts b/src/commands/mod/kick.ts new file mode 100644 index 0000000..e69de29