From e48502c591c3e394a61a65d941a489528873892c Mon Sep 17 00:00:00 2001 From: fzzinchemical Date: Tue, 15 Apr 2025 18:24:54 +0200 Subject: [PATCH] small fixes --- src/bot.ts | 1 - src/plugins/rule34/commands.ts | 46 ++++++++++++++------------------- src/plugins/yandere/commands.ts | 35 ++++++++++--------------- 3 files changed, 34 insertions(+), 48 deletions(-) diff --git a/src/bot.ts b/src/bot.ts index 1865fdc..ba878e3 100755 --- a/src/bot.ts +++ b/src/bot.ts @@ -26,7 +26,6 @@ client.on(Events.ClientReady, (readyClient) => { const commands = commandRouter(); client.on(Events.InteractionCreate, async (interaction) => { - // messagehandler(interaction.command) if (!interaction.isChatInputCommand()) return; const command = commands.find((c) => c.data.name === interaction.commandName); diff --git a/src/plugins/rule34/commands.ts b/src/plugins/rule34/commands.ts index 2b518d3..3a18e05 100644 --- a/src/plugins/rule34/commands.ts +++ b/src/plugins/rule34/commands.ts @@ -11,9 +11,10 @@ export const commands = [ subcommand .setName("drop") .setDescription("Drops one or multiple images using the rule34 API.") - .addStringOption((option) => option - .setName("limit") - .setDescription("Post limitation") + .addStringOption((option) => + option + .setName("limit") + .setDescription("Post limitation") ) .addStringOption((option) => option @@ -24,34 +25,27 @@ export const commands = [ option .setName("page") .setDescription("Which page to query") - ) + ) .addStringOption((option) => option .setName("pid") .setDescription("Which page to query") - ) - ), + ) + ), async execute(interaction: ChatInputCommandInteraction) { - const limit = interaction.options.getString("limit") - const tags = interaction.options.getString("tags") - const page = interaction.options.getString("page") - const pid = interaction.options.getString("pid") - if (limit === null && tags === null && page === null && pid === null) { - await interaction.reply({ - embeds: await requestWorker({ - limit: "1" - }) - }) - } else { - await interaction.reply({ - embeds: await requestWorker({ - limit: limit, - tags: tags, - page: page, - pid: pid, - }), - }) - } + const limit = interaction.options.getString("limit"); + const tags = interaction.options.getString("tags"); + const page = interaction.options.getString("page"); + const pid = interaction.options.getString("pid"); + + await interaction.reply({ + embeds: await requestWorker({ + limit: limit ?? "1", + tags: tags, + page: page, + pid: pid, + }), + }); }, }, ]; diff --git a/src/plugins/yandere/commands.ts b/src/plugins/yandere/commands.ts index 9500dae..ed9535b 100644 --- a/src/plugins/yandere/commands.ts +++ b/src/plugins/yandere/commands.ts @@ -13,9 +13,10 @@ export const commands = [ .setDescription( "Drops one or multiple images using the yande.re API.", ) - .addStringOption((option) => option - .setName("limit") - .setDescription("Post limitation") + .addStringOption((option) => + option + .setName("limit") + .setDescription("Post limitation") ) .addStringOption((option) => option @@ -29,24 +30,16 @@ export const commands = [ ) ), async execute(interaction: ChatInputCommandInteraction) { - const limit = interaction.options.getString("limit") - const tags = interaction.options.getString("tags") - const page = interaction.options.getString("page") - if (limit === null && tags === null && page === null) { - await interaction.reply({ - embeds: await getPosts({ - limit: "1" - }) - }) - } else { - await interaction.reply({ - embeds: await getPosts({ - limit: limit, - tags: tags, - page: page - }), - }) - } + const limit = interaction.options.getString("limit"); + const tags = interaction.options.getString("tags"); + const page = interaction.options.getString("page"); + await interaction.reply({ + embeds: await getPosts({ + limit: limit ?? "1", + tags: tags, + page: page, + }), + }); }, }, ];