defer reply
This commit is contained in:
parent
5d13801f15
commit
fa1a0615da
1 changed files with 4 additions and 4 deletions
|
@ -110,7 +110,7 @@ module.exports = {
|
||||||
const booru = interaction.options.getString("booru") ?? defaultBooru;
|
const booru = interaction.options.getString("booru") ?? defaultBooru;
|
||||||
const nsfw = interaction.options.getBoolean("nsfw") ?? false;
|
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 searchTags = [...(nsfw ? [] : ["-rating:explicit", "-rating:questionable"]), ...tags];
|
||||||
|
|
||||||
const startTime = process.hrtime.bigint();
|
const startTime = process.hrtime.bigint();
|
||||||
|
@ -119,7 +119,7 @@ module.exports = {
|
||||||
while (post == null) {
|
while (post == null) {
|
||||||
var newPost = (await Booru.search(booru, searchTags, { limit: 1, random: true, credentials: credentials[booru] ?? null }))[0];
|
var newPost = (await Booru.search(booru, searchTags, { limit: 1, random: true, credentials: credentials[booru] ?? null }))[0];
|
||||||
if (newPost == null) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
if (/*!nsfw && isNSFWPost(newPost) || */isAIPost(newPost)) continue;
|
if (/*!nsfw && isNSFWPost(newPost) || */isAIPost(newPost)) continue;
|
||||||
|
@ -160,9 +160,9 @@ module.exports = {
|
||||||
iconURL: `https://${post.booru.domain}/favicon.ico`,
|
iconURL: `https://${post.booru.domain}/favicon.ico`,
|
||||||
})
|
})
|
||||||
|
|
||||||
await interaction.editReply({ content: "", embeds: [embed.data] });
|
await interaction.followUp({ content: "", embeds: [embed.data] });
|
||||||
} else {
|
} else {
|
||||||
await interaction.editReply(
|
await interaction.followUp(
|
||||||
'>>> ' + bold(`[Post #${post.id}](<${post.postView}>)`) + "\n" +
|
'>>> ' + bold(`[Post #${post.id}](<${post.postView}>)`) + "\n" +
|
||||||
description + "\n" +
|
description + "\n" +
|
||||||
footerText
|
footerText
|
||||||
|
|
Loading…
Reference in a new issue