Skip to content

Commit ef1165f

Browse files
authored
fix replyToChat
fix replyToChat func bug with reply to message in topic
1 parent 57a649c commit ef1165f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/Commands/Command.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,10 +418,16 @@ protected function removeNonPrivateMessage(): bool
418418
public function replyToChat(string $text, array $data = []): ServerResponse
419419
{
420420
if ($message = $this->getMessage() ?: $this->getEditedMessage() ?: $this->getChannelPost() ?: $this->getEditedChannelPost()) {
421-
return Request::sendMessage(array_merge([
421+
$reply = [
422422
'chat_id' => $message->getChat()->getId(),
423423
'text' => $text,
424-
], $data));
424+
];
425+
426+
if ($message->getIsTopicMessage()) {
427+
$reply['message_thread_id'] = $message->getMessageThreadId();
428+
}
429+
430+
return Request::sendMessage(array_merge($reply, $data));
425431
}
426432

427433
return Request::emptyResponse();

0 commit comments

Comments
 (0)