Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/maybeanerd/MagiBot. MagiBot - the community building discord bot that adds joinsounds to your voice discord.gg/2Evcf4T
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950import { PermissionFlagsBits } from 'discord-api-types/v10';import { SlashCommandBuilder } from '@discordjs/builders';import { ChatInputCommandInteraction } from 'discord.js';import { MagibotAdminSlashCommand, MagibotSlashCommand,} from '../../types/command';import { salt } from './salt';import { joinsound } from './joinsound';import { config } from './config';import { adminDeferralType } from '../../shared_assets';
const adminApplicationCommandBase = new SlashCommandBuilder() .setName('admin') .setDescription('Admin only commands.') .setDMPermission(false) // only allow administrators to use these commands by default .setDefaultMemberPermissions( // eslint-disable-next-line no-bitwise PermissionFlagsBits.Administrator | PermissionFlagsBits.ManageGuild, );
export const adminApplicationCommands: { [k: string]: MagibotAdminSlashCommand;} = { salt, joinsound, config,};
Object.values(adminApplicationCommands).forEach((command) => { command.registerSlashCommand(adminApplicationCommandBase);});
async function runCommand(interaction: ChatInputCommandInteraction) { const subcommandGroup = interaction.options.getSubcommandGroup(true); const command = adminApplicationCommands[subcommandGroup]; // we assume the command exists, but just in case if (command) { command.run(interaction); }}
export const admin: MagibotSlashCommand = { permissions: [], run: runCommand, definition: adminApplicationCommandBase.toJSON(), defer: adminDeferralType,};