A powerful and extendable Discord bot, with it's own module system :3 thevoid.cafe/projects/voidy
at develop 40 lines 1.3 kB view raw
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.disable", 7 use: [requirePermission(PermissionFlagsBits.ManageGuild)], 8 data: new SlashCommandSubcommandBuilder() 9 .setName("disable") 10 .setDescription("Disable chatbot in a channel.") 11 .addChannelOption((option) => 12 option 13 .setName("channel") 14 .setDescription("Channel to disable.") 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.findOneAndUpdate( 23 { channelId: channel.id }, 24 { $set: { enabled: false } }, 25 ); 26 27 if (!doc) { 28 await interaction.reply({ 29 content: `Chatbot is not set up in <#${channel.id}>.`, 30 flags: [MessageFlags.Ephemeral], 31 }); 32 return; 33 } 34 35 await interaction.reply({ 36 content: `Chatbot disabled in <#${channel.id}>.`, 37 flags: [MessageFlags.Ephemeral], 38 }); 39 }, 40});