Skip to content

Commit 7fcb416

Browse files
committed
fixes
1 parent 3dbe4a3 commit 7fcb416

4 files changed

Lines changed: 24 additions & 20 deletions

File tree

tools/FileRefExtractor/Ops/GetStickerSetFromDocumentAttributesOp.php renamed to tools/FileRefExtractor/Ops/GetInputStickerSet.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
use danog\MadelineProto\FileRefExtractor\TLContext;
2424
use Webmozart\Assert\Assert;
2525

26-
final readonly class GetStickerSetFromDocumentAttributesOp implements FieldTransformationOp
26+
final readonly class GetInputStickerSet implements FieldTransformationOp
2727
{
2828
public function __construct(
2929
private Path $path,
@@ -49,13 +49,24 @@ public function getType(TLContext $tl): string
4949

5050
public function build(TLContext $tl): array
5151
{
52-
Assert::eq($this->path->getType($tl), 'Vector<DocumentAttribute>');
52+
$t = $this->path->getType($tl);
53+
if ($t === 'StickerSet') {
54+
return [
55+
'_' => 'typedOp',
56+
'type' => 'InputStickerSet',
57+
'op' => [
58+
'_' => 'copyOp',
59+
'path' => $this->path->buildPath($tl, 'extractInputStickerSetFromStickerSetAndStore'),
60+
],
61+
];
62+
}
63+
Assert::eq($t, 'Vector<DocumentAttribute>');
5364
return [
5465
'_' => 'typedOp',
5566
'type' => $this->getType($tl),
5667
'op' => [
5768
'_' => 'copyOp',
58-
'path' => $this->path->buildPath($tl, 'extractStickerSetFromDocumentAttributesAndStore'),
69+
'path' => $this->path->buildPath($tl, 'extractInputStickerSetFromDocumentAttributesAndStore'),
5970
],
6071
];
6172
}

tools/FileRefExtractor/Path.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,12 @@ public function buildPath(TLContext $tl, string $extractor): array
124124
$type = $this->getType($tl);
125125
if ($extractor === 'extractAndStore') {
126126

127-
} elseif ($extractor === 'extractStickerSetFromDocumentAttributesAndStore') {
127+
} elseif ($extractor === 'extractInputStickerSetFromDocumentAttributesAndStore') {
128128
Assert::eq($type, 'Vector<DocumentAttribute>');
129129
$type = 'InputStickerSet';
130+
} elseif ($extractor === 'extractInputStickerSetFromStickerSetAndStore') {
131+
Assert::eq($type, 'StickerSet');
132+
$type = 'InputStickerSet';
130133
} elseif ($extractor === 'extractPeerIdFromPeerAndStore') {
131134
Assert::eq($type, 'Peer');
132135
$type = 'long';

tools/FileRefExtractor/TLWrapper.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
namespace danog\MadelineProto\FileRefExtractor;
2020

21+
use danog\MadelineProto\TL\TL;
2122
use danog\MadelineProto\TL\TLInterface;
2223
use Webmozart\Assert\Assert;
2324

@@ -27,7 +28,7 @@ final class TLWrapper
2728
private readonly array $methodsOfType;
2829

2930
public function __construct(
30-
public readonly TLInterface $tl,
31+
public readonly TL $tl,
3132
) {
3233
$constructorsOfType = [];
3334
$methodsOfType = [];

tools/gen_filerefmap.php

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use danog\MadelineProto\FileRefExtractor\Ops\CopyOp;
99
use danog\MadelineProto\FileRefExtractor\Ops\GetInputChannelOp;
1010
use danog\MadelineProto\FileRefExtractor\Ops\GetInputPeerOp;
11+
use danog\MadelineProto\FileRefExtractor\Ops\GetInputStickerSet;
1112
use danog\MadelineProto\FileRefExtractor\Ops\GetInputUserOp;
1213
use danog\MadelineProto\FileRefExtractor\Ops\GetMessageOp;
1314
use danog\MadelineProto\FileRefExtractor\Ops\GetStickerSetFromDocumentAttributesOp;
@@ -319,13 +320,7 @@
319320
$locations[$c][] = new CallOp(
320321
'messages.getStickerSet',
321322
[
322-
'stickerset' => new ConstructorOp(
323-
'inputStickerSetID',
324-
[
325-
'id' => new CopyOp([[$c, 'set'], ['stickerSet', 'id']]),
326-
'access_hash' => new CopyOp([[$c, 'set'], ['stickerSet', 'access_hash']]),
327-
],
328-
),
323+
'stickerset' => new GetInputStickerSet(new Path([[$c, 'set']])),
329324
'hash' => new PrimitiveLiteralOp('int', 0),
330325
],
331326
'fileSourceStickerSet'
@@ -334,13 +329,7 @@
334329
$locations['messages.stickerSet'][] = new CallOp(
335330
'messages.getStickerSet',
336331
[
337-
'stickerset' => new ConstructorOp(
338-
'inputStickerSetID',
339-
[
340-
'id' => new CopyOp([['messages.stickerSet', 'set'], ['stickerSet', 'id']]),
341-
'access_hash' => new CopyOp([['messages.stickerSet', 'set'], ['stickerSet', 'access_hash']]),
342-
],
343-
),
332+
'stickerset' => new GetInputStickerSet(new Path([['messages.stickerSet', 'set']])),
344333
'hash' => new PrimitiveLiteralOp('int', 0),
345334
],
346335
'fileSourceStickerSet'
@@ -431,7 +420,7 @@
431420
$locations['document'][] = new CallOp(
432421
'messages.getStickerSet',
433422
[
434-
'stickerset' => new GetStickerSetFromDocumentAttributesOp(new Path([['document', 'attributes']])),
423+
'stickerset' => new GetInputStickerSet(new Path([['document', 'attributes']])),
435424
'hash' => new PrimitiveLiteralOp('int', 0),
436425
],
437426
'fileSourceStickerSet'

0 commit comments

Comments
 (0)