2021-12-12 00:20:42 +01:00
|
|
|
<?php
|
|
|
|
use danog\MadelineProto\API;
|
2021-12-12 14:39:55 +01:00
|
|
|
use danog\MadelineProto\Settings;
|
2021-12-12 00:20:42 +01:00
|
|
|
|
2021-12-12 14:39:55 +01:00
|
|
|
/*
|
2021-12-12 00:20:42 +01:00
|
|
|
* load MadelineProto in Your Project
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
if (\file_exists('vendor/autoload.php')) {
|
|
|
|
include 'vendor/autoload.php';
|
|
|
|
} else {
|
|
|
|
if (!\file_exists('madeline.php')) {
|
|
|
|
\copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php');
|
|
|
|
}
|
|
|
|
include 'madeline.php';
|
|
|
|
}
|
|
|
|
|
2021-12-12 14:39:55 +01:00
|
|
|
/*
|
2021-12-12 00:20:42 +01:00
|
|
|
* create default Memory object
|
|
|
|
*/
|
|
|
|
$database = new \danog\MadelineProto\Settings\Database\Memory;
|
|
|
|
|
2021-12-12 14:39:55 +01:00
|
|
|
/*
|
2021-12-12 00:20:42 +01:00
|
|
|
config and set auth information
|
|
|
|
*/
|
|
|
|
|
|
|
|
$database->setCleanup(true); // set clean up befor serialize session
|
|
|
|
$database->setEnableFullPeerDb(false);// madeline proto could fetch peers full information ??
|
|
|
|
$database->setEnablePeerInfoDb(true); // enable peer basic info option
|
|
|
|
|
2021-12-12 14:39:55 +01:00
|
|
|
/*
|
2021-12-12 00:20:42 +01:00
|
|
|
create default settings object
|
|
|
|
*/
|
|
|
|
|
|
|
|
$settings = new Settings;
|
|
|
|
|
2021-12-12 14:39:55 +01:00
|
|
|
/*
|
2021-12-12 00:20:42 +01:00
|
|
|
set and merge database settings to main settings
|
|
|
|
*/
|
|
|
|
|
|
|
|
$settings->setDb($database);
|
|
|
|
|
|
|
|
|
2021-12-12 14:39:55 +01:00
|
|
|
/*
|
2021-12-12 00:20:42 +01:00
|
|
|
create madeline proto session
|
|
|
|
*/
|
|
|
|
|
2021-12-12 14:39:55 +01:00
|
|
|
$MadelineProto = new API('madeline.session', $settings);
|
2021-12-12 00:20:42 +01:00
|
|
|
|
2021-12-12 14:39:55 +01:00
|
|
|
/*
|
2021-12-12 00:20:42 +01:00
|
|
|
start madeline proto workers
|
|
|
|
*/
|
|
|
|
$MadelineProto->start();
|