mirror of
https://github.com/danog/MadelineProto.git
synced 2024-11-27 01:34:40 +01:00
Add support for emojis with <emoji id="1234">, <tg-emoji emoji-id="1234> HTML tags and tg://emoji?id=1234 links, in addition to the pre-existing emoji:id links
This commit is contained in:
parent
2217a8160f
commit
115497e4f6
2
docs
2
docs
@ -1 +1 @@
|
|||||||
Subproject commit 07bd633b113f1fdc690914f152395c7defe6b530
|
Subproject commit 470028c79ab5b01af7447f24d6a0b8905b727cfe
|
@ -152,7 +152,7 @@ class MyEventHandler extends EventHandler
|
|||||||
*/
|
*/
|
||||||
public function onUpdateNewMessage(array $update): void
|
public function onUpdateNewMessage(array $update): void
|
||||||
{
|
{
|
||||||
if ($update['message']['_'] === 'messageEmpty' || $update['message']['out'] ?? false) {
|
if ($update['message']['_'] === 'messageEmpty') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ trait Constructors
|
|||||||
if ($param['name'] === 'reply_markup') {
|
if ($param['name'] === 'reply_markup') {
|
||||||
$hasreplymarkup = true;
|
$hasreplymarkup = true;
|
||||||
}
|
}
|
||||||
if ($param['name'] === 'entities' && $constructor === 'inputSingleMedia') {
|
if ($param['name'] === 'entities') {
|
||||||
$hasentities = true;
|
$hasentities = true;
|
||||||
$table .= '|parse\\_mode| [string](/API_docs/types/string.md) | Whether to parse HTML or Markdown markup in the message| Optional |
|
$table .= '|parse\\_mode| [string](/API_docs/types/string.md) | Whether to parse HTML or Markdown markup in the message| Optional |
|
||||||
';
|
';
|
||||||
|
@ -1823,12 +1823,6 @@ final class MTProto implements TLCallback, LoggerGetter
|
|||||||
public function getTypeMismatchCallbacks(): array
|
public function getTypeMismatchCallbacks(): array
|
||||||
{
|
{
|
||||||
return \array_merge(
|
return \array_merge(
|
||||||
\array_fill_keys(
|
|
||||||
[
|
|
||||||
'InputPeer',
|
|
||||||
],
|
|
||||||
$this->getInputPeer(...),
|
|
||||||
),
|
|
||||||
\array_fill_keys(
|
\array_fill_keys(
|
||||||
[
|
[
|
||||||
'InputUser',
|
'InputUser',
|
||||||
@ -1854,16 +1848,13 @@ final class MTProto implements TLCallback, LoggerGetter
|
|||||||
],
|
],
|
||||||
$this->getFileInfo(...),
|
$this->getFileInfo(...),
|
||||||
),
|
),
|
||||||
\array_fill_keys(
|
[
|
||||||
['InputFileLocation'],
|
'InputFileLocation' => $this->getDownloadInfo(...),
|
||||||
$this->getDownloadInfo(...),
|
'InputPeer' => $this->getInputPeer(...),
|
||||||
),
|
'InputCheckPasswordSRP' => function (string $password): array {
|
||||||
\array_fill_keys(
|
|
||||||
['InputCheckPasswordSRP'],
|
|
||||||
function (string $password): array {
|
|
||||||
return (new PasswordCalculator($this->methodCallAsyncRead('account.getPassword', [])))->getCheckPassword($password);
|
return (new PasswordCalculator($this->methodCallAsyncRead('account.getPassword', [])))->getCheckPassword($password);
|
||||||
}
|
},
|
||||||
),
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -56,6 +56,8 @@ final class DOMEntities
|
|||||||
'code' => ['_' => 'messageEntityCode'],
|
'code' => ['_' => 'messageEntityCode'],
|
||||||
'spoiler', 'tg-spoiler' => ['_' => 'messageEntitySpoiler'],
|
'spoiler', 'tg-spoiler' => ['_' => 'messageEntitySpoiler'],
|
||||||
'pre' => ['_' => 'messageEntityPre', 'language' => $node->getAttribute('language') ?? ''],
|
'pre' => ['_' => 'messageEntityPre', 'language' => $node->getAttribute('language') ?? ''],
|
||||||
|
'tg-emoji' => ['_' => 'messageEntityCustomEmoji', 'document_id' => (int) $node->getAttribute('emoji-id')],
|
||||||
|
'emoji' => ['_' => 'messageEntityCustomEmoji', 'document_id' => (int) $node->getAttribute('id')],
|
||||||
'a' => $this->handleA($node),
|
'a' => $this->handleA($node),
|
||||||
default => null,
|
default => null,
|
||||||
};
|
};
|
||||||
@ -90,7 +92,7 @@ final class DOMEntities
|
|||||||
if (\preg_match('|^mention:(.+)|', $href, $matches) || \preg_match('|^tg://user\\?id=(.+)|', $href, $matches)) {
|
if (\preg_match('|^mention:(.+)|', $href, $matches) || \preg_match('|^tg://user\\?id=(.+)|', $href, $matches)) {
|
||||||
return ['_' => 'inputMessageEntityMentionName', 'user_id' => $matches[1]];
|
return ['_' => 'inputMessageEntityMentionName', 'user_id' => $matches[1]];
|
||||||
}
|
}
|
||||||
if (\preg_match('|^emoji:(\d+)$|', $href, $matches)) {
|
if (\preg_match('|^emoji:(\d+)$|', $href, $matches) || \preg_match('|^tg://emoji\\?id=(.+)|', $href, $matches)) {
|
||||||
return ['_' => 'messageEntityCustomEmoji', 'document_id' => (int) $matches[1]];
|
return ['_' => 'messageEntityCustomEmoji', 'document_id' => (int) $matches[1]];
|
||||||
}
|
}
|
||||||
return ['_' => 'messageEntityTextUrl', 'url' => $href];
|
return ['_' => 'messageEntityTextUrl', 'url' => $href];
|
||||||
|
Loading…
Reference in New Issue
Block a user