laraxgram/laraquest

发送请求并接收Telegram更新。

v0.8.0 2024-09-06 14:23 UTC

README

安装

composer require laraxgram/laraquest

用法

使用方法

只需在您的类中使用 trait Method!

use LaraGram\Laraquest\Methode;

class MyBotClass {
    use Methode;
}

$bot = new MyBotClass();
$bot->sendMessage(123456789, 'hello!');

只需在您的类中使用 trait Updates!

使用 Updates

use LaraGram\Laraquest\Updates;

class MyBotClass {
    use Updates;
}

$bot = new MyBotClass();
$chatID = $bot->message->chat->id;

两者都使用

只需在您的类中使用 trait Method 和 Updates!

use LaraGram\Laraquest\Methode;
use LaraGram\Laraquest\Updates;

class MyBotClass {
    use Methode, Updates;
}

$bot = new MyBotClass();
$bot->sendMessage($bot->message->chat->id, 'hello!');

长轮询

Laraquest::polling(function(){
    // ...
});

Laraquest::polling(function(Laraquest $request){
    // ...
});