defer reply

This commit is contained in:
Ashley Graves 2024-10-10 11:57:35 +02:00
parent 5d13801f15
commit fa1a0615da

View file

@ -110,7 +110,7 @@ module.exports = {
const booru = interaction.options.getString("booru") ?? defaultBooru;
const nsfw = interaction.options.getBoolean("nsfw") ?? false;
await interaction.reply("<:search:1293874677915320330> Searching, please wait...");
await interaction.deferReply();
const searchTags = [...(nsfw ? [] : ["-rating:explicit", "-rating:questionable"]), ...tags];
const startTime = process.hrtime.bigint();
@ -119,7 +119,7 @@ module.exports = {
while (post == null) {
var newPost = (await Booru.search(booru, searchTags, { limit: 1, random: true, credentials: credentials[booru] ?? null }))[0];
if (newPost == null) {
await interaction.editReply("<:warning:1293874152150667315> Could not find any post matching tags.");
await interaction.followUp("<:warning:1293874152150667315> Could not find any post matching tags.");
return;
}
if (/*!nsfw && isNSFWPost(newPost) || */isAIPost(newPost)) continue;
@ -160,9 +160,9 @@ module.exports = {
iconURL: `https://${post.booru.domain}/favicon.ico`,
})
await interaction.editReply({ content: "", embeds: [embed.data] });
await interaction.followUp({ content: "", embeds: [embed.data] });
} else {
await interaction.editReply(
await interaction.followUp(
'>>> ' + bold(`[Post #${post.id}](<${post.postView}>)`) + "\n" +
description + "\n" +
footerText