Skip to content

Commit

Permalink
Merge pull request #1462 from povargek/patch-1
Browse files Browse the repository at this point in the history
fix replyToChat
  • Loading branch information
noplanman authored May 24, 2024
2 parents 0a124a2 + ef1165f commit 8a985c8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Commands/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -418,10 +418,16 @@ protected function removeNonPrivateMessage(): bool
public function replyToChat(string $text, array $data = []): ServerResponse
{
if ($message = $this->getMessage() ?: $this->getEditedMessage() ?: $this->getChannelPost() ?: $this->getEditedChannelPost()) {
return Request::sendMessage(array_merge([
$reply = [
'chat_id' => $message->getChat()->getId(),
'text' => $text,
], $data));
];

if ($message->getIsTopicMessage()) {
$reply['message_thread_id'] = $message->getMessageThreadId();
}

return Request::sendMessage(array_merge($reply, $data));
}

return Request::emptyResponse();
Expand Down

0 comments on commit 8a985c8

Please sign in to comment.