A powerful and extendable Discord bot, with it's own module system :3 thevoid.cafe/projects/voidy

✨ Add api.httpcat subcommand to test command assembler

+25
+25
packages/bot/src/modules/core/commands/api_httpcat.ts
··· 1 + import { MessageFlags, SlashCommandSubcommandBuilder } from "discord.js"; 2 + import type { Command } from "voidy-framework"; 3 + 4 + export default { 5 + id: "api.httpcat", 6 + data: new SlashCommandSubcommandBuilder() 7 + .setName("httpcat") 8 + .setDescription("Fetch a cat from the https://http.cat API.") 9 + .addStringOption(option => option 10 + .setName("code") 11 + .setDescription("The desirect HTTP status code.") 12 + .setRequired(true) 13 + ), 14 + 15 + execute: async (interaction, client) => { 16 + const { options } = interaction; 17 + 18 + const httpCode = options.getString("code"); 19 + 20 + await interaction.reply({ 21 + files: [`https://http.cat/${httpCode}.jpg`], 22 + flags: [MessageFlags.Ephemeral] 23 + }); 24 + } 25 + } as Command