Merge
This commit is contained in:
commit
17e85d361c
2
schemas
2
schemas
@ -1 +1 @@
|
||||
Subproject commit 945a5ca6fb6411ddcad077d78018150983f53ede
|
||||
Subproject commit 3027150b5e9a5bb88acbfe97e7c5b0b7748c7bcf
|
@ -85,7 +85,7 @@ class MTProto extends AsyncConstruct implements TLCallback
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const V = 137;
|
||||
const V = 138;
|
||||
/**
|
||||
* String release version.
|
||||
*
|
||||
@ -1180,12 +1180,12 @@ class MTProto extends AsyncConstruct implements TLCallback
|
||||
'lang_pack' => $lang_pack,
|
||||
], 'tl_schema' => [
|
||||
// TL scheme files
|
||||
'layer' => 111,
|
||||
'layer' => 112,
|
||||
// layer version
|
||||
'src' => [
|
||||
'mtproto' => __DIR__.'/../../../schemas/TL_mtproto_v1.tl',
|
||||
// mtproto TL scheme
|
||||
'telegram' => __DIR__.'/../../../schemas/TL_telegram_v111.tl',
|
||||
'telegram' => __DIR__.'/../../../schemas/TL_telegram_v112.tl',
|
||||
// telegram TL scheme
|
||||
'secret' => __DIR__.'/../../../schemas/TL_secret.tl',
|
||||
// secret chats TL scheme
|
||||
|
@ -502,6 +502,7 @@ trait Files
|
||||
list($res) = yield \danog\MadelineProto\Tools::all([$read, $write]);
|
||||
return $res;
|
||||
}
|
||||
|
||||
private function genAllFile($media): \Generator
|
||||
{
|
||||
$res = [$this->TL->getConstructors()->findByPredicate($media['_'])['type'] => $media];
|
||||
@ -509,11 +510,45 @@ trait Files
|
||||
case 'messageMediaPoll':
|
||||
$res['Poll'] = $media['poll'];
|
||||
$res['InputMedia'] = ['_' => 'inputMediaPoll', 'poll' => $res['Poll']];
|
||||
if (isset($res['Poll']['quiz']) && $res['Poll']['quiz']) {
|
||||
if (empty($media['results']['results'])) {
|
||||
//quizzes need a correct answer
|
||||
throw new \danog\MadelineProto\Exception('No poll results');
|
||||
}
|
||||
foreach ($media['results']['results'] as $answer) {
|
||||
if ($answer['correct']) {
|
||||
$res['InputMedia']['correct_answers'][] = $answer['option'];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($media['results']['solution'])) {
|
||||
$res['InputMedia']['solution'] = $media['results']['solution'];
|
||||
}
|
||||
if (isset($media['results']['solution_entities'])) {
|
||||
$res['InputMedia']['solution_entities'] = $media['results']['solution_entities'];
|
||||
}
|
||||
break;
|
||||
case 'updateMessagePoll':
|
||||
$res['Poll'] = $media['poll'];
|
||||
$res['InputMedia'] = ['_' => 'inputMediaPoll', 'poll' => $res['Poll']];
|
||||
$res['MessageMedia'] = ['_' => 'messageMediaPoll', 'poll' => $res['Poll'], 'results' => $media['results']];
|
||||
if (isset($res['Poll']['quiz']) && $res['Poll']['quiz']) {
|
||||
if (empty($media['results']['results'])) {
|
||||
//quizzes need a correct answer
|
||||
throw new \danog\MadelineProto\Exception('No poll results');
|
||||
}
|
||||
foreach ($media['results']['results'] as $answer) {
|
||||
if ($answer['correct']) {
|
||||
$res['InputMedia']['correct_answers'][] = $answer['option'];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($media['results']['solution'])) {
|
||||
$res['InputMedia']['solution'] = $media['results']['solution'];
|
||||
}
|
||||
if (isset($media['results']['solution_entities'])) {
|
||||
$res['InputMedia']['solution_entities'] = $media['results']['solution_entities'];
|
||||
}
|
||||
break;
|
||||
case 'messageMediaPhoto':
|
||||
if (!isset($media['photo']['access_hash'])) {
|
||||
@ -538,7 +573,7 @@ trait Files
|
||||
}
|
||||
break;
|
||||
case 'messageMediaDice':
|
||||
$res['InputMedia'] = ['_' => 'inputMediaDice'];
|
||||
$res['InputMedia'] = ['_' => 'inputMediaDice', 'emoticon' => $media['emoticon']];
|
||||
break;
|
||||
case 'poll':
|
||||
$res['InputMedia'] = ['_' => 'inputMediaPoll', 'poll' => $res['Poll']];
|
||||
|
Loading…
Reference in New Issue
Block a user