1818
1919namespace danog \MadelineProto \FileRefExtractor \Ops ;
2020
21- use danog \MadelineProto \FileRefExtractor \FieldExtractorOp ;
2221use danog \MadelineProto \FileRefExtractor \FieldTransformationOp ;
22+ use danog \MadelineProto \FileRefExtractor \Path ;
2323use danog \MadelineProto \FileRefExtractor \TLContext ;
2424use Webmozart \Assert \Assert ;
2525
2626final readonly class GetInputChannelOp implements FieldTransformationOp
2727{
28- public function __construct (private readonly FieldExtractorOp $ path )
29- {
28+ public function __construct (
29+ private Path $ path ,
30+ ) {
3031 }
3132
3233 public function normalize (array $ stack , string $ current , bool $ ignoreFlag ): ?\danog \MadelineProto \FileRefExtractor \TypedOp
@@ -48,16 +49,23 @@ public function getType(TLContext $tl): string
4849 public function build (TLContext $ tl ): array
4950 {
5051 $ type = $ this ->path ->getType ($ tl );
51- if ($ type === 'InputChannel ' ) {
52- return $ this ->path ->build ($ tl );
53- }
5452 if ($ type === 'long ' ) {
5553 return [
5654 '_ ' => 'typedOp ' ,
5755 'type ' => $ this ->getType ($ tl ),
5856 'op ' => [
5957 '_ ' => 'getInputChannelByIdOp ' ,
60- 'path ' => $ this ->path ->build ($ tl ),
58+ 'path ' => $ this ->path ->buildPath ($ tl , 'extractAndStore ' ),
59+ ],
60+ ];
61+ }
62+ if ($ type === 'InputChannel ' ) {
63+ return [
64+ '_ ' => 'typedOp ' ,
65+ 'type ' => $ this ->getType ($ tl ),
66+ 'op ' => [
67+ '_ ' => 'getInputChannelByIdOp ' ,
68+ 'path ' => $ this ->path ->buildPath ($ tl , 'extractChannelIdFromInputChannelAndStore ' ),
6169 ],
6270 ];
6371 }
@@ -66,8 +74,8 @@ public function build(TLContext $tl): array
6674 '_ ' => 'typedOp ' ,
6775 'type ' => $ this ->getType ($ tl ),
6876 'op ' => [
69- '_ ' => 'getInputChannelOp ' ,
70- 'path ' => $ this ->path ->build ($ tl ),
77+ '_ ' => 'getInputChannelByIdOp ' ,
78+ 'path ' => $ this ->path ->buildPath ($ tl, ' extractChannelIdFromChannelAndStore ' ),
7179 ],
7280 ];
7381 }
0 commit comments