mirror of
https://github.com/danog/MadelineProto.git
synced 2024-11-26 23:14:38 +01:00
fix EmojiTap
This commit is contained in:
parent
c3398c7b76
commit
9f576a4efc
@ -46,16 +46,7 @@ abstract class Action implements JsonSerializable
|
||||
/** @internal */
|
||||
public static function fromRawAction(array $rawAction): Action
|
||||
{
|
||||
$type = $rawAction['_'];
|
||||
if ($type === 'sendMessageEmojiInteraction') {
|
||||
return new EmojiTap(
|
||||
$rawAction['emoticon'],
|
||||
$rawAction['interaction']['a']['t'],
|
||||
$rawAction['interaction']['a']['i'],
|
||||
$rawAction['msg_id'],
|
||||
);
|
||||
}
|
||||
return match ($type) {
|
||||
return match ($rawAction['_']) {
|
||||
'sendMessageTypingAction' => new Typing,
|
||||
'sendMessageCancelAction' => new Cancel,
|
||||
'sendMessageGamePlayAction' => new GamePlay,
|
||||
@ -73,6 +64,11 @@ abstract class Action implements JsonSerializable
|
||||
'sendMessageUploadDocumentAction' => new UploadDocument($rawAction['progress']),
|
||||
'sendMessageHistoryImportAction' => new HistoryImport($rawAction['progress']),
|
||||
'sendMessageEmojiInteractionSeen' => new EmojiSeen($rawAction['emoticon']),
|
||||
'sendMessageEmojiInteraction' => new EmojiTap(
|
||||
$rawAction['emoticon'],
|
||||
$rawAction['msg_id'],
|
||||
$rawAction['interaction']['a']
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -27,14 +27,15 @@ final class EmojiTap extends Action
|
||||
/** @var string Emoji */
|
||||
public readonly string $emoticon,
|
||||
|
||||
/** @var float number of seconds that passed since the previous tap in the array, the first tap uses a value of `0.0`. */
|
||||
public readonly float $tapTime,
|
||||
|
||||
/** @var int 1-based index of the randomly chosen animation for the tap (equivalent to the index of a specific emoji-related animation in [stickerPack](https://core.telegram.org/constructor/stickerPack) + 1). */
|
||||
public readonly int $animation,
|
||||
|
||||
/** @var int Message ID of the animated emoji that was clicked */
|
||||
public readonly ?int $id,
|
||||
|
||||
/**
|
||||
* t: number of seconds that passed since the previous tap in the array, the first tap uses a value of `0.0`.
|
||||
* i: 1-based index of the randomly chosen animation for the tap (equivalent to the index of a specific emoji-related animation in [stickerPack](https://core.telegram.org/constructor/stickerPack) + 1).
|
||||
* @var list<array{t:float,i:int}>
|
||||
*/
|
||||
public readonly array $animation,
|
||||
) {
|
||||
}
|
||||
|
||||
@ -44,10 +45,7 @@ final class EmojiTap extends Action
|
||||
'emoticon' => $this->emoticon,
|
||||
'interaction' => [
|
||||
'v' => 1,
|
||||
'a' => [
|
||||
't' => $this->tapTime,
|
||||
'a' => $this->animation,
|
||||
]
|
||||
'a' => $this->animation
|
||||
]
|
||||
];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user