/**
* Initialize Telegram Bot SDK Library with Default Config.
*
* @param Application $app
*/
protected function registerTelegram(Application $app)
{
$app->singleton(Api::class, function ($app) {
$config = $app['config'];
$telegram = new Api($config->get('telegram.bot_token', false), $config->get('telegram.async_requests', false), $config->get('telegram.http_client_handler', null));
// Register Commands
$telegram->addCommands($config->get('telegram.commands', []));
// Check if DI needs to be enabled for Commands
if ($config->get('telegram.inject_command_dependencies', false)) {
$telegram->setContainer($app);
}
return $telegram;
});
$app->alias(Api::class, 'telegram');
}