Skip to content
This repository was archived by the owner on Oct 12, 2025. It is now read-only.

Conversation

DarkRRb
Copy link
Collaborator

@DarkRRb DarkRRb commented Jun 3, 2025

No description provided.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses an issue where private chat replies did not have an ID by introducing separate lookup logic for group and private chats and simplifying the return path.

  • Adds conditional logic to compute or lookup the message hash based on whether the chain is a group chat.
  • Unifies the reply segment creation by defaulting missing IDs to "0".
Comments suppressed due to low confidence (2)

Lagrange.OneBot/Message/Entity/ReplySegment.cs:44

  • [nitpick] Rename local variable id to messageId or replyId to improve clarity about what this value represents.
int? id;

Lagrange.OneBot/Message/Entity/ReplySegment.cs:45

  • Add unit tests for the private chat branch (chain.IsGroup == false) to verify the new database lookup correctly retrieves or defaults the reply ID.
if (chain.IsGroup)

.FirstOrDefault(record => record.Id == MessageRecord.CalcMessageHash(forward.MessageId, forward.Sequence))?
.Id);
int? id;
if (chain.IsGroup)
Copy link

Copilot AI Jun 3, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider extracting the group vs. private chat ID resolution logic into a dedicated helper method to reduce complexity in FromEntity.

Copilot uses AI. Check for mistakes.

@DarkRRb DarkRRb merged commit 0213909 into master Jun 3, 2025
8 checks passed
@DarkRRb DarkRRb deleted the darkrrb/fix/private-chat-replies-do-not-have-an-id branch July 29, 2025 11:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug?]: 私聊无法获取引用的消息ID? [Bug?]: 私聊回复消息id为0

2 participants