added async execute test

This commit is contained in:
fzzinchemical
2025-04-15 06:40:39 +02:00
parent 1f3090d799
commit 0473e32b39
3 changed files with 69 additions and 33 deletions

View File

@@ -1,4 +1,9 @@
import { SlashCommandBuilder } from "@discordjs";
import {
ChatInputCommandInteraction,
CommandInteractionOptionResolver,
InteractionCallback,
SlashCommandBuilder,
} from "@discordjs";
// import { drop, help, requestWorker } from "./plugin.ts";
import { logMessage } from "@root/logging.ts";
import { defaultString } from "@root/defaultString.ts";
@@ -19,7 +24,7 @@ import { defaultString } from "@root/defaultString.ts";
// }
// } else if (command === "help") {
// logMessage(message);
// bot.helpers.sendMessage(message.channelId, {
// content: defaultString(help()),
// });
@@ -29,26 +34,34 @@ import { defaultString } from "@root/defaultString.ts";
// }
export const commands = [
new SlashCommandBuilder()
.setName("rule")
.setDescription("Drops one or multiple images using the rule34 API.")
.setNSFW(true)
.addSubcommand(subcommand =>
subcommand
.setName("drop")
.setDescription("Drops one or multiple images using the rule34 API.")
),
new SlashCommandBuilder()
.setName('gif')
.setDescription('Sends a random gif!')
.addStringOption(option =>
option.setName('category')
.setDescription('The gif category')
.setRequired(true)
.addChoices(
{ name: 'Funny', value: 'gif_funny' },
{ name: 'Meme', value: 'gif_meme' },
{ name: 'Movie', value: 'gif_movie' },
))
]
{
data: new SlashCommandBuilder()
.setName("rule")
.setDescription("Drops one or multiple images using the rule34 API.")
.setNSFW(true)
.addSubcommand((subcommand) =>
subcommand
.setName("drop")
.setDescription("Drops one or multiple images using the rule34 API.")
),
},
{
data: new SlashCommandBuilder()
.setName("gif")
.setDescription("Sends a random gif!")
.addStringOption((option) =>
option.setName("category")
.setDescription("The gif category")
.setRequired(true)
.addChoices(
{ name: "Funny", value: "gif_funny" },
{ name: "Meme", value: "gif_meme" },
{ name: "Movie", value: "gif_movie" },
)
),
async execute (interaction: ChatInputCommandInteraction) {
const category = interaction.options.getString('category');
await interaction.reply(`You chose: ${category}`);
}
},
];