/**
* @see https://core.telegram.org/bots/api
*/
protected function doSend(MessageInterface
$message): SentMessage
{ if (!
$message instanceof ChatMessage
) { throw new UnsupportedMessageTypeException(__CLASS__, ChatMessage::
class,
$message);
} $options =
$message->
getOptions()?->
toArray() ??
[];
$options['chat_id'
] ??=
$message->
getRecipientId() ?:
$this->chatChannel;
$options['text'
] =
$message->
getSubject();
if (!
isset($options['parse_mode'
]) || TelegramOptions::PARSE_MODE_MARKDOWN_V2 ===
$options['parse_mode'
]) { $options['parse_mode'
] = TelegramOptions::PARSE_MODE_MARKDOWN_V2;
$options['text'
] =
preg_replace('/([_*\[\]()~`>#+\-=|{}.!\\\\])/', '\\\\$1',
$message->
getSubject());
} if (isset($options['photo'
])) { $options['caption'
] =
$options['text'
];
unset($options['text'
]);
}