-
Notifications
You must be signed in to change notification settings - Fork 1
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
Conversation
WalkthroughThe changes in this pull request focus on the Changes
Possibly related PRs
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (2)
bot/src/commands/info/question.ts (2)
Line range hint
19-26
: Remove debug console.log statements.Production code should not contain console.log statements. Use the existing logger instead.
- console.log('**************') - console.log(interaction) - console.log('**************') - console.log(interaction.token) - console.log('**************') - console.log(interaction.applicationId) - console.log('**************') + logger.debug( + { + interactionId: interaction.id, + applicationId: interaction.applicationId + }, + 'Processing question command' + )
34-39
: Consider adding type safety for RabbitMQ messages.The message structure being published to RabbitMQ lacks type definitions, which could lead to runtime errors if the expected structure changes.
Consider creating an interface for the message structure:
interface QuestionCommandMessage { interaction: { token: string; id: string; applicationId: string; // Add other required properties }; }Then use it in the publish call:
RabbitMQ.publish<QuestionCommandMessage>( RabbitMQQueue.DISCORD_HIVEMIND_ADAPTER, Event.DISCORD_HIVEMIND_ADAPTER.QUESTION_COMMAND_RECEIVED, { interaction: { // ... your properties } } )
interaction: { | ||
token: interaction.token, | ||
...interaction, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix potential token override and serialization issues.
The current implementation has two potential issues:
- Spreading
interaction
after settingtoken
could potentially override the explicit token value - 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.
Summary by CodeRabbit
Bug Fixes
token
property in thequestion
command.Chores