-
I have this code class StuffReplyUpdateHandler extends UpdateHandler
{
public function handle()
{
$message = $this->update->message();
if (key_exists('reply_to_message', $message->toArray()) && $message->chat->type === 'supergroup') {
$matches = [];
if ( preg_match('/.*T#([0-9]*).*/', $message->reply_to_message->text, $matches)) {
$ticketId = $matches[1];
$tgClientId = TgTicketBotTickets::getTgIdByTicketId($ticketId);
} else return;
$managerMessage = $message->text;
$userNickname = $message->from->first_name ?? 'client';
$userId = $message->from->id;
$escapedNickname = Utils::escapeMarkdownV2($userNickname);
$message =
"Номер обращения: `T#$ticketId`\n"
."Вам ответил менеджер: [$escapedNickname](tg://user?id\=$userId)\n"
."Сообщение менеджера: `$managerMessage`\n"
."Можете перейти в личные сообщения кликнув по нику ответившего вам менеджера\.";
return $this->sendMessage([
'chat_id' => $tgClientId,
'text' => $message,
'parse_mode' => 'MarkdownV2'
]);
}
}
} and the method sendMessage at the end doesn't work in supergroup. If I try to use the same in default group it works fine. I have that issue :
It works only when i try to use this method on the bot instance itself. return $this->bot->sendMessage([
'chat_id' => $tgClientId,
'text' => $message,
'parse_mode' => 'MarkdownV2'
]); why it works this way ? |
Beta Was this translation helpful? Give feedback.
Answered by
punyflash
Aug 15, 2023
Replies: 1 comment
-
Before |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
punyflash
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Before
3.0
version, parametermessage_thread_id
was automatically set when callingsendMessage
onUpdateHandler
instance. It was causing unexpected behavior like this, so this feature was removed. Now, onlychat_id
is automatically injected to the arguments.