Archived
interaction defering
This commit is contained in:
1 parent
452114e2af
commit
b43fa1f320
1 file changed
+6
-12
+6
-12
@@ -110,14 +110,10 @@ export class Command {
|
|||||||
? memberPermissions.has(this.permissions, true)
|
? memberPermissions.has(this.permissions, true)
|
||||||
: memberPermissions.any(this.permissions, true))
|
: memberPermissions.any(this.permissions, true))
|
||||||
) {
|
) {
|
||||||
let placeholdingReply: boolean = false;
|
|
||||||
if (interaction instanceof CommandInteraction) {
|
if (interaction instanceof CommandInteraction) {
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
if (!interaction.replied) {
|
if (!interaction.replied) {
|
||||||
await interaction.reply({
|
await interaction.deferReply();
|
||||||
content: "🔄",
|
|
||||||
});
|
|
||||||
placeholdingReply = true;
|
|
||||||
}
|
}
|
||||||
}, 1500);
|
}, 1500);
|
||||||
}
|
}
|
||||||
@@ -137,7 +133,7 @@ export class Command {
|
|||||||
if (interaction instanceof Message)
|
if (interaction instanceof Message)
|
||||||
await interaction.reply(fnResult as ReplyMessageOptions);
|
await interaction.reply(fnResult as ReplyMessageOptions);
|
||||||
else if (interaction instanceof CommandInteraction)
|
else if (interaction instanceof CommandInteraction)
|
||||||
interaction.replied
|
interaction.replied || interaction.deferred
|
||||||
? await interaction.editReply(
|
? await interaction.editReply(
|
||||||
fnResult as ReplyMessageOptions
|
fnResult as ReplyMessageOptions
|
||||||
)
|
)
|
||||||
@@ -146,27 +142,25 @@ export class Command {
|
|||||||
);
|
);
|
||||||
} else if (typeof fnResult == "string") {
|
} else if (typeof fnResult == "string") {
|
||||||
if (interaction instanceof Message)
|
if (interaction instanceof Message)
|
||||||
await interaction?.reply({ content: fnResult, embeds: [] });
|
await interaction?.reply({ content: fnResult });
|
||||||
else if (interaction instanceof CommandInteraction)
|
else if (interaction instanceof CommandInteraction)
|
||||||
interaction.replied
|
interaction.replied || interaction.deferred
|
||||||
? await interaction.editReply({
|
? await interaction.editReply({
|
||||||
content: fnResult,
|
content: fnResult,
|
||||||
embeds: [],
|
|
||||||
})
|
})
|
||||||
: await interaction.reply({
|
: await interaction.reply({
|
||||||
content: fnResult,
|
content: fnResult,
|
||||||
embeds: [],
|
|
||||||
});
|
});
|
||||||
} else if (fnResult instanceof MessageEmbed) {
|
} else if (fnResult instanceof MessageEmbed) {
|
||||||
if (interaction instanceof Message)
|
if (interaction instanceof Message)
|
||||||
await interaction?.channel.send({ embeds: [fnResult] });
|
await interaction?.channel.send({ embeds: [fnResult] });
|
||||||
else if (interaction instanceof CommandInteraction)
|
else if (interaction instanceof CommandInteraction)
|
||||||
interaction.replied
|
interaction.replied || interaction.deferred
|
||||||
? await interaction.editReply({ embeds: [fnResult] })
|
? await interaction.editReply({ embeds: [fnResult] })
|
||||||
: await interaction.reply({ embeds: [fnResult] });
|
: await interaction.reply({ embeds: [fnResult] });
|
||||||
} else if (
|
} else if (
|
||||||
interaction instanceof CommandInteraction &&
|
interaction instanceof CommandInteraction &&
|
||||||
(!interaction.replied || placeholdingReply)
|
!interaction.replied
|
||||||
) {
|
) {
|
||||||
await interaction.deleteReply();
|
await interaction.deleteReply();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user