A powerful and extendable Discord bot, with it's own module system :3
thevoid.cafe/projects/voidy
1import { ChannelType, MessageFlags, PermissionFlagsBits, SlashCommandSubcommandBuilder } from "discord.js";
2import { Command, requirePermission } from "@voidy/framework";
3import { ChatbotChannel } from "../../schemas/ChatbotChannel";
4
5export default new Command({
6 id: "chatbot.channel.remove",
7 use: [requirePermission(PermissionFlagsBits.ManageGuild)],
8 data: new SlashCommandSubcommandBuilder()
9 .setName("remove")
10 .setDescription("Remove chatbot from a channel entirely.")
11 .addChannelOption((option) =>
12 option
13 .setName("channel")
14 .setDescription("Channel to remove chatbot from.")
15 .addChannelTypes(ChannelType.GuildText)
16 .setRequired(true),
17 ),
18
19 execute: async ({ interaction }) => {
20 const channel = interaction.options.getChannel("channel", true);
21
22 const doc = await ChatbotChannel.findOneAndDelete({ channelId: channel.id });
23
24 if (!doc) {
25 await interaction.reply({
26 content: `Chatbot is not set up in <#${channel.id}>.`,
27 flags: [MessageFlags.Ephemeral],
28 });
29 return;
30 }
31
32 await interaction.reply({
33 content: `Chatbot removed from <#${channel.id}>.`,
34 flags: [MessageFlags.Ephemeral],
35 });
36 },
37});