Skip to content

fix(discord): remove duplicate channel_id assignment in message handler#3178

Merged
Re-bin merged 1 commit intoHKUDS:mainfrom
LeoFYH:fix/discord-duplicate-channel-id
Apr 15, 2026
Merged

fix(discord): remove duplicate channel_id assignment in message handler#3178
Re-bin merged 1 commit intoHKUDS:mainfrom
LeoFYH:fix/discord-duplicate-channel-id

Conversation

@LeoFYH
Copy link
Copy Markdown
Contributor

@LeoFYH LeoFYH commented Apr 15, 2026

Summary

In , is assigned twice with the identical expression :

  • Line 440: first assignment (used throughout the function)
  • Line 453: second assignment immediately before the reaction block (dead code)

No code modifies or between the two assignments. The duplicate is a copy-paste leftover.

Change


Test plan

  • Send a message to a Discord channel — read receipt reaction still appears correctly

channel_id is already assigned from self._channel_key(message.channel)
earlier in the same function. The second identical assignment on line 453
is dead code left over from a copy-paste.
@LeoFYH
Copy link
Copy Markdown
Contributor Author

LeoFYH commented Apr 15, 2026

@Re-bin Could you take a look? Thanks:)

Copy link
Copy Markdown
Collaborator

@Re-bin Re-bin left a comment

Choose a reason for hiding this comment

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

This is the right kind of fix.

The intent is narrow, the boundary is clear, and the implementation removes a real copy-paste leftover without changing behavior.

channel_id is already computed earlier in _handle_discord_message() and nothing mutates message.channel in between, so the second assignment is genuinely dead code.

I pulled the branch locally, checked the origin/main...HEAD diff, and reran the relevant tests:

  • python -m pytest tests/channels/test_discord_channel.py -q → 37 passed

From my side, this is clean and ready to merge.

@Re-bin Re-bin merged commit 2c0cd08 into HKUDS:main Apr 15, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants