small fixes

This commit is contained in:
fzzinchemical
2025-04-15 18:24:54 +02:00
parent 001ee371d6
commit e48502c591
3 changed files with 34 additions and 48 deletions

View File

@@ -26,7 +26,6 @@ client.on(Events.ClientReady, (readyClient) => {
const commands = commandRouter(); const commands = commandRouter();
client.on(Events.InteractionCreate, async (interaction) => { client.on(Events.InteractionCreate, async (interaction) => {
// messagehandler(interaction.command)
if (!interaction.isChatInputCommand()) return; if (!interaction.isChatInputCommand()) return;
const command = commands.find((c) => c.data.name === interaction.commandName); const command = commands.find((c) => c.data.name === interaction.commandName);

View File

@@ -11,9 +11,10 @@ export const commands = [
subcommand subcommand
.setName("drop") .setName("drop")
.setDescription("Drops one or multiple images using the rule34 API.") .setDescription("Drops one or multiple images using the rule34 API.")
.addStringOption((option) => option .addStringOption((option) =>
.setName("limit") option
.setDescription("Post limitation") .setName("limit")
.setDescription("Post limitation")
) )
.addStringOption((option) => .addStringOption((option) =>
option option
@@ -24,34 +25,27 @@ export const commands = [
option option
.setName("page") .setName("page")
.setDescription("Which page to query") .setDescription("Which page to query")
) )
.addStringOption((option) => .addStringOption((option) =>
option option
.setName("pid") .setName("pid")
.setDescription("Which page to query") .setDescription("Which page to query")
) )
), ),
async execute(interaction: ChatInputCommandInteraction) { async execute(interaction: ChatInputCommandInteraction) {
const limit = interaction.options.getString("limit") const limit = interaction.options.getString("limit");
const tags = interaction.options.getString("tags") const tags = interaction.options.getString("tags");
const page = interaction.options.getString("page") const page = interaction.options.getString("page");
const pid = interaction.options.getString("pid") const pid = interaction.options.getString("pid");
if (limit === null && tags === null && page === null && pid === null) {
await interaction.reply({ await interaction.reply({
embeds: await requestWorker({ embeds: await requestWorker({
limit: "1" limit: limit ?? "1",
}) tags: tags,
}) page: page,
} else { pid: pid,
await interaction.reply({ }),
embeds: await requestWorker({ });
limit: limit,
tags: tags,
page: page,
pid: pid,
}),
})
}
}, },
}, },
]; ];

View File

@@ -13,9 +13,10 @@ export const commands = [
.setDescription( .setDescription(
"Drops one or multiple images using the yande.re API.", "Drops one or multiple images using the yande.re API.",
) )
.addStringOption((option) => option .addStringOption((option) =>
.setName("limit") option
.setDescription("Post limitation") .setName("limit")
.setDescription("Post limitation")
) )
.addStringOption((option) => .addStringOption((option) =>
option option
@@ -29,24 +30,16 @@ export const commands = [
) )
), ),
async execute(interaction: ChatInputCommandInteraction) { async execute(interaction: ChatInputCommandInteraction) {
const limit = interaction.options.getString("limit") const limit = interaction.options.getString("limit");
const tags = interaction.options.getString("tags") const tags = interaction.options.getString("tags");
const page = interaction.options.getString("page") const page = interaction.options.getString("page");
if (limit === null && tags === null && page === null) { await interaction.reply({
await interaction.reply({ embeds: await getPosts({
embeds: await getPosts({ limit: limit ?? "1",
limit: "1" tags: tags,
}) page: page,
}) }),
} else { });
await interaction.reply({
embeds: await getPosts({
limit: limit,
tags: tags,
page: page
}),
})
}
}, },
}, },
]; ];