mirror of
https://github.com/danog/MadelineProto.git
synced 2024-11-27 05:14:39 +01:00
33 lines
1.1 KiB
PHP
33 lines
1.1 KiB
PHP
|
|
<?php declare(strict_types=1);
|
|
|
|
use danog\MadelineProto\Logger;
|
|
use danog\MadelineProto\Settings;
|
|
use danog\MadelineProto\Settings\Database\Mysql;
|
|
use danog\MadelineProto\Settings\Database\Postgres;
|
|
use danog\MadelineProto\Settings\Database\Redis;
|
|
use danog\MadelineProto\SimpleEventHandler;
|
|
|
|
/** Base event handler class that only includes plugins */
|
|
class BaseHandler extends SimpleEventHandler
|
|
{
|
|
public static function getPluginPaths(): array|string|null
|
|
{
|
|
return 'plugins/';
|
|
}
|
|
}
|
|
|
|
$settings = new Settings;
|
|
$settings->getLogger()->setLevel(Logger::LEVEL_ULTRA_VERBOSE);
|
|
|
|
// You can also use Redis, MySQL or PostgreSQL
|
|
// $settings->setDb((new Redis)->setDatabase(0)->setPassword('pony'));
|
|
// $settings->setDb((new Postgres)->setDatabase('MadelineProto')->setUsername('daniil')->setPassword('pony'));
|
|
// $settings->setDb((new Mysql)->setDatabase('MadelineProto')->setUsername('daniil')->setPassword('pony'));
|
|
|
|
// For users or bots
|
|
BaseHandler::startAndLoop('bot.madeline', $settings);
|
|
|
|
// For bots only
|
|
// BaseHandler::startAndLoopBot('bot.madeline', 'bot token', $settings);
|