-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Example for forward new messages to Telegram
- Loading branch information
1 parent
339e2e6
commit d8d2bd8
Showing
1 changed file
with
9 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,13 @@ | |
$TelegramClient = new TelegramClient('http://selenium-hub:4444/wd/hub', $capabilities); | ||
$TelegramClient->sessionStart(); | ||
|
||
// $TelegramClient->observer(); | ||
$TelegramClient->loop(function(TelegramClient $client, $messages) { | ||
foreach ($messages as $message) { | ||
$client->telegram()->sendMessage([ | ||
'chat_id' => $_ENV['TELEGRAM_CHAT_ID'], | ||
'text' => $message['body'] | ||
]); | ||
} | ||
}); | ||
// $TelegramClient->WsapiWrapper->getProfilePicFromId('[email protected]'); | ||
$TelegramClient->WsapiWrapper->sendMessage('[email protected]', '<3'); | ||
// $TelegramClient->WsapiWrapper->sendMessage('[email protected]', '<3'); |