A powerful and extendable Discord bot, with it's own module system :3 thevoid.cafe/projects/voidy
at develop 30 lines 1.1 kB view raw
1import { MessageFlags, PermissionFlagsBits, SlashCommandSubcommandBuilder } from "discord.js"; 2import { Command, requirePermission } from "@voidy/framework"; 3import { GuildConfig, type IGuildConfig } from "../../schemas/GuildConfig"; 4 5export default new Command({ 6 id: "guild.logging.disable", 7 use: [requirePermission(PermissionFlagsBits.ManageGuild)], 8 data: new SlashCommandSubcommandBuilder() 9 .setName("disable") 10 .setDescription("Disable member logging."), 11 12 execute: async ({ interaction, client }) => { 13 const doc = await GuildConfig.findOneAndUpdate( 14 { guildId: interaction.guildId }, 15 { $unset: { "logging.channelId": "" } }, 16 { new: true }, 17 ); 18 19 const cache = client.data.get("guildConfig") as Map<string, IGuildConfig> | undefined; 20 if (cache && interaction.guildId) { 21 if (doc) cache.set(interaction.guildId, doc.toObject()); 22 else cache.delete(interaction.guildId); 23 } 24 25 await interaction.reply({ 26 content: "Member logging has been disabled.", 27 flags: [MessageFlags.Ephemeral], 28 }); 29 }, 30});