🐛 fix: sent message to wrong topic in topic group #801
This commit is contained in:
@@ -113,7 +113,11 @@ class TelegramPlatformAdapter(Platform):
|
||||
message.type = MessageType.FRIEND_MESSAGE
|
||||
else:
|
||||
message.type = MessageType.GROUP_MESSAGE
|
||||
message.group_id = update.effective_chat.id
|
||||
message.group_id = str(update.effective_chat.id)
|
||||
if update.message.message_thread_id:
|
||||
# Topic Group
|
||||
message.group_id += "#" + str(update.message.message_thread_id)
|
||||
|
||||
message.message_id = str(update.message.message_id)
|
||||
message.session_id = str(update.effective_chat.id)
|
||||
message.sender = MessageMember(
|
||||
|
||||
@@ -32,12 +32,18 @@ class TelegramPlatformEvent(AstrMessageEvent):
|
||||
at_user_id = i.name
|
||||
|
||||
at_flag = False
|
||||
message_thread_id = None
|
||||
if "#" in user_name:
|
||||
# it's a supergroup chat with message_thread_id
|
||||
user_name, message_thread_id = user_name.split("#")
|
||||
for i in message.chain:
|
||||
payload = {
|
||||
"chat_id": user_name,
|
||||
}
|
||||
if has_reply:
|
||||
payload["reply_to_message_id"] = reply_message_id
|
||||
if message_thread_id:
|
||||
payload["reply_to_message_id"] = message_thread_id
|
||||
|
||||
if isinstance(i, Plain):
|
||||
if at_user_id and not at_flag:
|
||||
|
||||
Reference in New Issue
Block a user