Skip to content

Instantly share code, notes, and snippets.

@mpijierro
Created March 31, 2021 07:18
Show Gist options
  • Save mpijierro/dbf2fd224f7279e00984b01b33e875bb to your computer and use it in GitHub Desktop.
Save mpijierro/dbf2fd224f7279e00984b01b33e875bb to your computer and use it in GitHub Desktop.
New session in Telegram with MadelineProto
<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use App\Http\Controllers\MadelineTrait;
class TelegramSessionController extends Controller
{
private $madelineProto;
public function __invoke ()
{
$settings = [];
$settings['authorization']['default_temp_auth_key_expires_in'] = 86400*7;
$this->madelineProto = new \danog\MadelineProto\API('session.madeline', $settings);
$this->madelineProto->async(true);
$this->madelineProto->loop(function () {
$response = yield $this->madelineProto->start();
return;
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment