afionov/tg-bot

Telegram机器人库

dev-main 2023-12-16 11:20 UTC

This package is not auto-updated.

Last update: 2024-09-22 13:15:25 UTC


README

Telegram机器人

使用方法

$configuration = new \Bot\Configuration(
    token: '123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew1',
    httpClient: new \GuzzleHttp\Client()
)

$configuration->setCommands(
    [
        '/start' => fn (): \Bot\Command\CommandInterface => new \Bot\Command\DefaultStartCommand()
    ]
);
$configuration->setMode(\Bot\Mode\NullMode::class);

$bot = new \Bot\Bot($configuration);

*** endpoint
$bot->handleWebhook();

待办事项

  • 测试
  • 文档
  • 完全支持Telegram API