Skip to content

Commit

Permalink
Add sendCustomEvent API method and onUpdateCustomEvent event handler …
Browse files Browse the repository at this point in the history
…method
  • Loading branch information
danog committed Apr 26, 2023
1 parent 378a5c0 commit 382cd3f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/InternalDoc.php
Original file line number Diff line number Diff line change
Expand Up @@ -1350,6 +1350,13 @@ public function secretChatStatus(int $chat): int
{
return $this->wrapper->getAPI()->secretChatStatus($chat);
}
/**
* Sends an updateCustomEvent update to the event handler.
*/
public function sendCustomEvent(mixed $payload): void
{
$this->wrapper->getAPI()->sendCustomEvent($payload);
}
/**
* Set NOOP update handler, ignoring all updates.
*/
Expand Down
7 changes: 7 additions & 0 deletions src/MTProtoTools/UpdateHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -630,4 +630,11 @@ private function handleUpdate(array $update): void
UpdateHandlerType::GET_UPDATES => $this->signalUpdate(...),
}, $update);
}
/**
* Sends an updateCustomEvent update to the event handler.
*/
public function sendCustomEvent(mixed $payload): void
{
$this->handleUpdate(['_' => 'updateCustomEvent', 'payload' => $payload]);
}
}

0 comments on commit 382cd3f

Please sign in to comment.