mirror of
https://github.com/danog/MadelineProto.git
synced 2025-01-22 22:51:11 +01:00
Fix the translate method bug
- Add phpDoc for CallbackQuery class methods
This commit is contained in:
parent
eaecbe6f7d
commit
a02074c6c5
@ -46,6 +46,12 @@ final class CallbackQuery extends Update
|
|||||||
$this->gameShortName = $rawCallback['game_short_name'] ?? '';
|
$this->gameShortName = $rawCallback['game_short_name'] ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $message Popup to show
|
||||||
|
* @param bool $alert Whether to show the message as a popup instead of a toast notification
|
||||||
|
* @param string|null $url URL to open
|
||||||
|
* @param int $cacheTime Cache validity (default set to 5 min based on telegram official docs ...)
|
||||||
|
*/
|
||||||
public function answer(
|
public function answer(
|
||||||
string $message,
|
string $message,
|
||||||
bool $alert = false,
|
bool $alert = false,
|
||||||
@ -64,6 +70,18 @@ final class CallbackQuery extends Update
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit message text.
|
||||||
|
*
|
||||||
|
* @param string $message New message
|
||||||
|
* @param array|null $replyMarkup Reply markup for inline keyboards
|
||||||
|
* @param array|null $entities Message entities for styled text
|
||||||
|
* @param ParseMode $parseMode Whether to parse HTML or Markdown markup in the message
|
||||||
|
* @param int|null $scheduleDate Scheduled message date for scheduled messages
|
||||||
|
* @param bool $noWebpage Disable webpage preview
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
public function edit(
|
public function edit(
|
||||||
?string $message,
|
?string $message,
|
||||||
?array $replyMarkup = null,
|
?array $replyMarkup = null,
|
||||||
|
@ -270,7 +270,9 @@ abstract class Message extends AbstractMessage
|
|||||||
public function translate(
|
public function translate(
|
||||||
string $toLang = 'en'
|
string $toLang = 'en'
|
||||||
): string {
|
): string {
|
||||||
Assert::notEmpty($this->message);
|
if (empty($message = $this->message)) {
|
||||||
|
return $message;
|
||||||
|
}
|
||||||
$result = $this->getClient()->methodCallAsyncRead(
|
$result = $this->getClient()->methodCallAsyncRead(
|
||||||
'messages.translateText',
|
'messages.translateText',
|
||||||
[
|
[
|
||||||
|
Loading…
x
Reference in New Issue
Block a user