decho
decho
Explore posts from servers
DIAdiscord.js - Imagine a boo! 👻
Created by decho on 8/14/2023 in #djs-questions
Getting "Unknown interaction" error even with interaction.deferReply()
discord could be laggy once in a while, might be related to that, but either way, thanks for trying to help, don't think there is much i can do about this
15 replies
DIAdiscord.js - Imagine a boo! 👻
Created by decho on 8/14/2023 in #djs-questions
Getting "Unknown interaction" error even with interaction.deferReply()
>3 seconds
15 replies
DIAdiscord.js - Imagine a boo! 👻
Created by decho on 8/14/2023 in #djs-questions
Getting "Unknown interaction" error even with interaction.deferReply()
between receiving the initial interaction request and then the discord servers receiving my bot response
15 replies
DIAdiscord.js - Imagine a boo! 👻
Created by decho on 8/14/2023 in #djs-questions
Getting "Unknown interaction" error even with interaction.deferReply()
yeah i was thinking the same
15 replies
DIAdiscord.js - Imagine a boo! 👻
Created by decho on 8/14/2023 in #djs-questions
Getting "Unknown interaction" error even with interaction.deferReply()
so all you have before the defer is these two if statements:
// 1
if (interaction.isChatInputCommand()) {
await interactionController(interaction);
}
// 2
if (isTyped.command(interaction, 'standings')) {
await standingssInteraction.interaction(interaction);
}
// 1
if (interaction.isChatInputCommand()) {
await interactionController(interaction);
}
// 2
if (isTyped.command(interaction, 'standings')) {
await standingssInteraction.interaction(interaction);
}
15 replies
DIAdiscord.js - Imagine a boo! 👻
Created by decho on 8/14/2023 in #djs-questions
Getting "Unknown interaction" error even with interaction.deferReply()
that's my entire code
15 replies
DIAdiscord.js - Imagine a boo! 👻
Created by decho on 8/14/2023 in #djs-questions
Getting "Unknown interaction" error even with interaction.deferReply()
// index.ts (interaction event start (1))
discord.on(Events.InteractionCreate, async (interaction) => {
if (interaction.isChatInputCommand()) {
await interactionController(interaction);
}
});
// controller.ts (controller (2))
export async function interactionController(interaction: ChatInputCommandInteraction) {
try {
if (isTyped.command(interaction, 'standings')) {
await standingssInteraction.interaction(interaction);
}
} catch (error) {
if (error instanceof DiscordError) {
await error.report(interaction);
}
else {
console.error(error);
}
}
}
// standings.ts (interaction handler (3))
class StandingsInteraction {
public async interaction(interaction: TypedCommands['standings']) {
await interaction.deferReply();

const { data, expired } = await standingsCache.getData();

if (!expired) {
return await interaction.editReply({
content: data
});
}

const res = await interaction.editReply({
files: [{
attachment: data,
name: 'la-liga-standings.png'
}]
});

standingsCache.revalidate(res);
}
}
// index.ts (interaction event start (1))
discord.on(Events.InteractionCreate, async (interaction) => {
if (interaction.isChatInputCommand()) {
await interactionController(interaction);
}
});
// controller.ts (controller (2))
export async function interactionController(interaction: ChatInputCommandInteraction) {
try {
if (isTyped.command(interaction, 'standings')) {
await standingssInteraction.interaction(interaction);
}
} catch (error) {
if (error instanceof DiscordError) {
await error.report(interaction);
}
else {
console.error(error);
}
}
}
// standings.ts (interaction handler (3))
class StandingsInteraction {
public async interaction(interaction: TypedCommands['standings']) {
await interaction.deferReply();

const { data, expired } = await standingsCache.getData();

if (!expired) {
return await interaction.editReply({
content: data
});
}

const res = await interaction.editReply({
files: [{
attachment: data,
name: 'la-liga-standings.png'
}]
});

standingsCache.revalidate(res);
}
}
15 replies
DIAdiscord.js - Imagine a boo! 👻
Created by decho on 8/14/2023 in #djs-questions
Getting "Unknown interaction" error even with interaction.deferReply()
this problem is on a local high end machine, ryzen 9 7900 pc so it's not slow
15 replies
DIAdiscord.js - Imagine a boo! 👻
Created by decho on 8/14/2023 in #djs-questions
Getting "Unknown interaction" error even with interaction.deferReply()
it might be taking more than 3 seconds, but only after the deferReply
15 replies
DIAdiscord.js - Imagine a boo! 👻
Created by decho on 8/14/2023 in #djs-questions
Getting "Unknown interaction" error even with interaction.deferReply()
i actually can't remember. the error seemed super random and i can't seem to be able to reproduce it right now, yesterday it was happening semi-frequently. I think this mostly occurs around startup times so maybe it's not that big of a deal. If it becomes a problem I will have to look into it again, but at the moment I don't want to spend hours on this. seems to be similar to this but there is no resolution available: https://github.com/discordjs/discord.js/issues/7005
15 replies
DIAdiscord.js - Imagine a boo! 👻
Created by decho on 8/14/2023 in #djs-questions
Getting "Unknown interaction" error even with interaction.deferReply()
before the class method gets called i mean, there is nothing that would take so long
15 replies
DIAdiscord.js - Imagine a boo! 👻
Created by decho on 8/14/2023 in #djs-questions
Getting "Unknown interaction" error even with interaction.deferReply()
i understand, but the thing is, i really have nothing that could possibly take 3 seconds until I defer. just a few if statements, but those are never going to take 3 seconds, not even 3 milliseconds.
15 replies
DIAdiscord.js - Imagine a boo! 👻
Created by decho on 7/31/2023 in #djs-questions
Looking for information about "managed" emojis.
(this is an external emoji)
8 replies
DIAdiscord.js - Imagine a boo! 👻
Created by decho on 7/31/2023 in #djs-questions
Looking for information about "managed" emojis.
8 replies
DIAdiscord.js - Imagine a boo! 👻
Created by decho on 7/31/2023 in #djs-questions
Looking for information about "managed" emojis.
but im afraid i don't have nitro on the bot
8 replies
DIAdiscord.js - Imagine a boo! 👻
Created by decho on 7/31/2023 in #djs-questions
Looking for information about "managed" emojis.
ah, so you're saying i can use my dev server to "host" my emojis there, and the bot can use those emoji ids in the production server
8 replies
DIAdiscord.js - Imagine a boo! 👻
Created by decho on 7/26/2022 in #djs-questions
Creating types for slash command options.
but I will try and see about the idea you gave with the CommandInteractionResolver, though that's probably too advanced for me
15 replies
DIAdiscord.js - Imagine a boo! 👻
Created by decho on 7/26/2022 in #djs-questions
Creating types for slash command options.
I think perhaps for now I am going to settle for something like:
interface FooOpts {
option1: string;
option2: number;
}
// ...

const opts: FooOpts = {
option1: int.options.getString('option1', true),
option2: int.options.getNumber('option2', true)
};
interface FooOpts {
option1: string;
option2: number;
}
// ...

const opts: FooOpts = {
option1: int.options.getString('option1', true),
option2: int.options.getNumber('option2', true)
};
15 replies
DIAdiscord.js - Imagine a boo! 👻
Created by decho on 7/26/2022 in #djs-questions
Creating types for slash command options.
for guild.commands.set(commandList) I mean
15 replies
DIAdiscord.js - Imagine a boo! 👻
Created by decho on 7/26/2022 in #djs-questions
Creating types for slash command options.
yeah, it becomes a question of whether or not you want to invest all that time into it for relatively little gain, and also one additional problem would be that you'd only be taking care of the interactions this way, but you'd still have a separate interface for the command builder so...
15 replies