Closed sallsabil closed 6 years ago
Please send me the full code.
<?php
set_time_limit(0);
ignore_user_abort(true);
@ini_set('zlib.output_compression', 0);
@ini_set('implicit_flush', 1);
ob_end_clean();
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
ob_implicit_flush(1);
require '/root/MadelineProtoBot/MadelineProto/vendor/autoload.php';
require __DIR__ . '/classes/setexpf.php';
require __DIR__ . '/classes/tg.php';
$setexpf = new setexpf();
$tg = new Tg();
require __DIR__ . '/settings.php';
$mem = new Memcached();
$mem->addServer("127.0.0.1", 11211);
$fn = htmlspecialchars('547547');
$phone = '+'.$fn;
$code = '';
$settings = [
'logger' => ['logger' => 0],
'app_info' => [
'api_id' => 1,
'api_hash' => '5gg'
],
'flood_timeout' => [
'wait_if_lt' => 90000
],
'serialization' => [
'serialization_interval' => 10
]
];
$sessionf = __DIR__ . "/tmp/sess_".str_replace('+', '', $phone);
class EventHandler extends \danog\MadelineProto\EventHandler
{
public function __construct($MadelineProto)
{
parent::__construct($MadelineProto);
}
public function onAny($update)
{
\danog\MadelineProto\Logger::log("Received an update of type ".$update['_']);
}
public function onUpdateNewChannelMessage($update)
{
$this->onUpdateNewMessage($update);
}
public function onUpdateNewMessage($update)
{
if (isset($update['message']['out']) && $update['message']['out']) {
return;
}
$res = json_encode($update, JSON_PRETTY_PRINT);
if ($res == '') {
$res = var_export($update, true);
}
try {
$this->messages->sendMessage(['peer' => "channel#1023456789", 'message' => "turu"]);
} catch (\Exception $e) {
print_r($e);
}
echo '0';
}
}
try {
$MadelineProto = new \danog\MadelineProto\API($sessionf, $settings);
} catch (\danog\MadelineProto\Exception $e) {
\danog\MadelineProto\Logger::log($e->getMessage());
unlink($sessionf);
$MadelineProto = new \danog\MadelineProto\API($sessionf, $settings);
}
$MadelineProto->start();
$MadelineProto->setEventHandler('\EventHandler');
$MadelineProto->loop();
Update to the latest version.
It is the last version.
@sallsabil Then delete the session and relogin.
In the new version and this code:
I receive this error:
What is the problem ?