mirror of
https://github.com/danog/MadelineProto.git
synced 2024-12-02 13:57:46 +01:00
Improve examples
This commit is contained in:
parent
2c83a555fc
commit
2cb4e80620
9
bot.php
9
bot.php
@ -67,13 +67,8 @@ class EventHandler extends \danog\MadelineProto\EventHandler
|
|||||||
|
|
||||||
$settings = ['app_info' => ['api_id' => 6, 'api_hash' => 'eb06d4abfb49dc3eeb1aeb98ae0f581e'], 'updates' => ['handle_updates' => true]]; //, 'connection_settings' => ['all' => ['test_mode' => true]]];
|
$settings = ['app_info' => ['api_id' => 6, 'api_hash' => 'eb06d4abfb49dc3eeb1aeb98ae0f581e'], 'updates' => ['handle_updates' => true]]; //, 'connection_settings' => ['all' => ['test_mode' => true]]];
|
||||||
|
|
||||||
try {
|
$MadelineProto = new \danog\MadelineProto\API('bot.madeline', $settings);
|
||||||
$MadelineProto = new \danog\MadelineProto\API('bot.madeline', $settings);
|
|
||||||
} catch (\danog\MadelineProto\Exception $e) {
|
|
||||||
\danog\MadelineProto\Logger::log($e->getMessage());
|
|
||||||
unlink('bot.madeline');
|
|
||||||
$MadelineProto = new \danog\MadelineProto\API('bot.madeline', $settings);
|
|
||||||
}
|
|
||||||
$MadelineProto->start();
|
$MadelineProto->start();
|
||||||
$MadelineProto->setEventHandler('\EventHandler');
|
$MadelineProto->setEventHandler('\EventHandler');
|
||||||
$MadelineProto->loop();
|
$MadelineProto->loop();
|
||||||
|
@ -19,14 +19,7 @@ if (file_exists('web_data.php')) {
|
|||||||
|
|
||||||
echo 'Deserializing MadelineProto from session.madeline...'.PHP_EOL;
|
echo 'Deserializing MadelineProto from session.madeline...'.PHP_EOL;
|
||||||
|
|
||||||
try {
|
$MadelineProto = new \danog\MadelineProto\API('session.madeline');
|
||||||
$MadelineProto = new \danog\MadelineProto\API('session.madeline');
|
|
||||||
} catch (\danog\MadelineProto\Exception $e) {
|
|
||||||
echo $e.PHP_EOL;
|
|
||||||
unlink('session.madeline');
|
|
||||||
$MadelineProto = new \danog\MadelineProto\API('session.madeline');
|
|
||||||
}
|
|
||||||
|
|
||||||
$MadelineProto->start();
|
$MadelineProto->start();
|
||||||
|
|
||||||
if (!isset($MadelineProto->programmed_call)) {
|
if (!isset($MadelineProto->programmed_call)) {
|
||||||
|
@ -43,13 +43,7 @@ $settings = json_decode(getenv('MTPROTO_SETTINGS'), true) ?: [];
|
|||||||
*/
|
*/
|
||||||
echo 'Loading MadelineProto...'.PHP_EOL;
|
echo 'Loading MadelineProto...'.PHP_EOL;
|
||||||
|
|
||||||
try {
|
$MadelineProto = new \danog\MadelineProto\API(getcwd().'/testing.madeline', $settings);
|
||||||
$MadelineProto = new \danog\MadelineProto\API(getcwd().'/testing.madeline', $settings);
|
|
||||||
} catch (\danog\MadelineProto\Exception $e) {
|
|
||||||
echo $e.PHP_EOL;
|
|
||||||
unlink(getcwd().'/testing.madeline');
|
|
||||||
$MadelineProto = new \danog\MadelineProto\API(getcwd().'/testing.madeline', $settings);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If this session is not logged in, login
|
* If this session is not logged in, login
|
||||||
|
Loading…
Reference in New Issue
Block a user