_Rob
_Rob
DIAdiscord.js - Imagine an app
Created by _Rob on 9/20/2022 in #djs-questions
Interaction (De)Serialization
Yes, that ended up working. I did move away from the implementation to something else, but it did work.
10 replies
DIAdiscord.js - Imagine an app
Created by _Rob on 8/31/2023 in #djs-questions
Unknown Interaction - @discordjs/core
Thanks! That fixed it.
16 replies
DIAdiscord.js - Imagine an app
Created by _Rob on 8/31/2023 in #djs-questions
Unknown Interaction - @discordjs/core
I've also tried interactions.followUp(...), but have the same result
16 replies
DIAdiscord.js - Imagine an app
Created by _Rob on 8/31/2023 in #djs-questions
Unknown Interaction - @discordjs/core
The defer works perfectly fine, but after the timeout, when I try to edit the reply is when I get the error
16 replies
DIAdiscord.js - Imagine an app
Created by _Rob on 8/31/2023 in #djs-questions
Unknown Interaction - @discordjs/core
Instead of posting a new question, I want to follow up here. I'm having a similar issue from before, but now I'm getting an unknown webhook error.
const mainHandler = async (
_event: APIGatewayProxyEvent,
context: InteractionContext
): Promise<APIGatewayProxyResult> => {
const rest = new REST({ version: '10' }).setToken(context.clientSecret);

const interaction = context.interaction;

const webhooksAPI = new WebhooksAPI(rest);
const interactionsAPI = new InteractionsAPI(rest, webhooksAPI);

await interactionsAPI.defer(interaction.id, interaction.token);

await new Promise((resolve) => setTimeout(resolve, 5000));

const response = await interactionsAPI.editReply(interaction.id, interaction.token, { content: 'Pong!' });

return {
statusCode: 200,
body: JSON.stringify(response)
};
};
const mainHandler = async (
_event: APIGatewayProxyEvent,
context: InteractionContext
): Promise<APIGatewayProxyResult> => {
const rest = new REST({ version: '10' }).setToken(context.clientSecret);

const interaction = context.interaction;

const webhooksAPI = new WebhooksAPI(rest);
const interactionsAPI = new InteractionsAPI(rest, webhooksAPI);

await interactionsAPI.defer(interaction.id, interaction.token);

await new Promise((resolve) => setTimeout(resolve, 5000));

const response = await interactionsAPI.editReply(interaction.id, interaction.token, { content: 'Pong!' });

return {
statusCode: 200,
body: JSON.stringify(response)
};
};
16 replies
DIAdiscord.js - Imagine an app
Created by _Rob on 8/31/2023 in #djs-questions
Unknown Interaction - @discordjs/core
Thanks for narrowing it down for me. I'll have to see what I can do to get spinup time to be lower
16 replies
DIAdiscord.js - Imagine an app
Created by _Rob on 8/31/2023 in #djs-questions
Unknown Interaction - @discordjs/core
That's probably it. I just hit the bot with 5 subsequent interactions, and the first 3 failed, but the last 2 didn't
16 replies
DIAdiscord.js - Imagine an app
Created by _Rob on 8/31/2023 in #djs-questions
Unknown Interaction - @discordjs/core
I'll have to dig into cloud trail or something to see what the response time is
16 replies
DIAdiscord.js - Imagine an app
Created by _Rob on 8/31/2023 in #djs-questions
Unknown Interaction - @discordjs/core
Hmm, that's a good point. If an interaction times out, does it not exist anymore?
16 replies
DIAdiscord.js - Imagine an app
Created by _Rob on 8/31/2023 in #djs-questions
Unknown Interaction - @discordjs/core
It's worth noting, the ping interaction verifies successfully.
16 replies
DIAdiscord.js - Imagine an app
Created by _Rob on 4/11/2023 in #djs-questions
Interaction Collector Not Firing Collect
That fixed it. Thanks for helping me out
23 replies
DIAdiscord.js - Imagine an app
Created by _Rob on 4/11/2023 in #djs-questions
Interaction Collector Not Firing Collect
Copy paste error on my part
23 replies
DIAdiscord.js - Imagine an app
Created by _Rob on 4/11/2023 in #djs-questions
Interaction Collector Not Firing Collect
facepalmpicard
23 replies
DIAdiscord.js - Imagine an app
Created by _Rob on 4/11/2023 in #djs-questions
Interaction Collector Not Firing Collect
Updated code above
23 replies
DIAdiscord.js - Imagine an app
Created by _Rob on 4/11/2023 in #djs-questions
Interaction Collector Not Firing Collect
Ah, yea, sorry
23 replies
DIAdiscord.js - Imagine an app
Created by _Rob on 4/11/2023 in #djs-questions
Interaction Collector Not Firing Collect
export const postChangeLogInteractionHandler = async (
interaction: Discord.ChatInputCommandInteraction
) => {
const reply = await interaction.deferReply({
ephemeral: true,
fetchReply: true
});

// ... do async stuff

const backButton = new Discord.ButtonBuilder()
.setCustomId('back')
.setLabel('Back')
.setStyle(Discord.ButtonStyle.Primary);

const nextButton = new Discord.ButtonBuilder()
.setCustomId('next')
.setLabel('Next')
.setStyle(Discord.ButtonStyle.Primary);

const buttonActionRow =
new Discord.ActionRowBuilder<Discord.ButtonBuilder>().addComponents(
backButton.setDisabled(currentIndex == 0),
nextButton.setDisabled(currentIndex === postEdits.length - 1)
);

await interaction.editReply({
content: `Post \`${post.postId}\` Edits`,
embeds: [editEmbed],
components: [buttonActionRow]
});

const collector = reply.createMessageComponentCollector({
filter: (submit) =>
submit.customId === 'createPost' &&
submit.user.id === interaction.user.id,
time: 300_000
});

collector.on('collect', async (interaction) => {
console.debug(interaction);
});
};
export const postChangeLogInteractionHandler = async (
interaction: Discord.ChatInputCommandInteraction
) => {
const reply = await interaction.deferReply({
ephemeral: true,
fetchReply: true
});

// ... do async stuff

const backButton = new Discord.ButtonBuilder()
.setCustomId('back')
.setLabel('Back')
.setStyle(Discord.ButtonStyle.Primary);

const nextButton = new Discord.ButtonBuilder()
.setCustomId('next')
.setLabel('Next')
.setStyle(Discord.ButtonStyle.Primary);

const buttonActionRow =
new Discord.ActionRowBuilder<Discord.ButtonBuilder>().addComponents(
backButton.setDisabled(currentIndex == 0),
nextButton.setDisabled(currentIndex === postEdits.length - 1)
);

await interaction.editReply({
content: `Post \`${post.postId}\` Edits`,
embeds: [editEmbed],
components: [buttonActionRow]
});

const collector = reply.createMessageComponentCollector({
filter: (submit) =>
submit.customId === 'createPost' &&
submit.user.id === interaction.user.id,
time: 300_000
});

collector.on('collect', async (interaction) => {
console.debug(interaction);
});
};
23 replies
DIAdiscord.js - Imagine an app
Created by _Rob on 4/11/2023 in #djs-questions
Interaction Collector Not Firing Collect
Still doesn't seem to be working. Let me get a more complete code example.
23 replies
DIAdiscord.js - Imagine an app
Created by _Rob on 4/11/2023 in #djs-questions
Interaction Collector Not Firing Collect
That will also get rid of the optionality of the collector
23 replies
DIAdiscord.js - Imagine an app
Created by _Rob on 4/11/2023 in #djs-questions
Interaction Collector Not Firing Collect
Makes sense
23 replies
DIAdiscord.js - Imagine an app
Created by _Rob on 4/11/2023 in #djs-questions
Interaction Collector Not Firing Collect
Ah, ok
23 replies