TeleBot is a PHP library for telegram bots development. Rich Laravel support out of the box. Has an easy, clean, and extendable way to handle telegram Updates.
Русский военный корабль, иди нах*й!
Glory to Ukraine! 🇺🇦
Documentation for the library can be found on the website.
Work easily with multiple bots using BotManager
:
$manager->getMe(); // Fired by default bot specified in BotManager
$manager->bot('bot2')->getMe(); // Fired by `bot2` specified in BotManager
Library provides a Facade, artisan commands and notification channel to simplify the development process of your bot, if you are using Laravel:
TeleBot::getMe();
TeleBot::bot('bot2')->getMe();
After you insert your bot token, to create a webhook you need only to fire the following command:
$ php artisan telebot:webhook --setup
Route for handling updates is generated automaticaly for your APP_URL
If you are not using webhook, or want to use bot in local or test environment, you may start long polling by only firyng this command:
$ php artisan telebot:polling
The following command will automaticaly setup autocompletion for all registered bot commands on Telegram servers:
$ php artisan telebot:commands --setup
<?php
namespace App\Notifications;
use Illuminate\Notifications\Notification;
use WeStacks\TeleBot\Laravel\TelegramNotification;
class TelegramNotification extends Notification
{
public function via($notifiable)
{
return ['telegram'];
}
public function toTelegram($notifiable)
{
return (new TelegramNotification)->bot('bot')
->sendMessage([
'chat_id' => $notifiable->telegram_chat_id,
'text' => 'Hello, from Laravel\'s notifications!'
])
->sendMessage([
'chat_id' => $notifiable->telegram_chat_id,
'text' => 'Second message'
]);
}
}
You may log your application errors by sending them to some Telegram chat. Simply add new log driver to a config/logging.php
:
'telegram' => [
'driver' => 'custom',
'via' => \WeStacks\TeleBot\Laravel\Log\TelegramLogger::class,
'level' => 'debug',
'bot' => 'bot',
'chat_id' => env('TELEGRAM_LOG_CHAT_ID') // Any chat where bot can write messages.
]
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
Support this project by sending us a tip.
Currency | Wallet |
---|---|
BTC | bc1qfqn93hczerczjj76kcn62nv0c5kt2xqar355g7 |
ETH | 0xf3762Fdaf4dC0FD623433070F34c2eDC5224724b |
BCH | qz23y9vjn8xzgz5j9ztllv6pxflal4p94s87e47edc |
LTC | ltc1qu9pdvvh4u5z6a97mevhnueszcu6m5zmx2lsplp |
The MIT License (MIT). Please see License File for more information.