Skip to content

Instantly share code, notes, and snippets.

@mpijierro
Last active April 2, 2021 06:14
Show Gist options
  • Save mpijierro/05620548d2754cd408c0c485c239dd96 to your computer and use it in GitHub Desktop.
Save mpijierro/05620548d2754cd408c0c485c239dd96 to your computer and use it in GitHub Desktop.
Get your own information from Telegram API with MadelineProto in Laravel
<?php
namespace App\Http\Controllers\Telegram;
use App\Http\Controllers\Controller;
use danog\MadelineProto\API;
class MeController extends Controller
{
private $madelineProto;
public function __invoke (){
$settings = [];
$this->madelineProto = new API('session.madeline', $settings);
$this->madelineProto->async(true);
return $this->madelineProto->loop(function () {
return yield $this->madelineProto->getSelf();
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment