Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bot: debug handleInteractionResponseEdit #237

Merged
merged 1 commit into from
Nov 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion bot/src/commands/info/question.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ export default {
RabbitMQQueue.DISCORD_HIVEMIND_ADAPTER,
Event.DISCORD_HIVEMIND_ADAPTER.QUESTION_COMMAND_RECEIVED,
{
interaction,
interaction: {
token: interaction.token,
...interaction,
},
Comment on lines +35 to +38
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix potential token override and serialization issues.

The current implementation has two potential issues:

  1. Spreading interaction after setting token could potentially override the explicit token value
  2. The full interaction object might contain circular references leading to serialization issues

Consider this safer approach:

-    interaction: {
-        token: interaction.token,
-        ...interaction,
-    },
+    interaction: {
+        token: interaction.token,
+        id: interaction.id,
+        applicationId: interaction.applicationId,
+        channelId: interaction.channelId,
+        guildId: interaction.guildId,
+        user: interaction.user,
+        // Add other specific properties you need
+    },

Committable suggestion skipped: line range outside the PR's diff.

}
)
} catch (error) {
Expand Down