Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/arashabedii/telebot
a PHP framework for creating telegram bots
https://github.com/arashabedii/telebot
bot framework php telebot telegram telegram-api telegram-bot telegram-bot-api telegram-bots
Last synced: 22 days ago
JSON representation
a PHP framework for creating telegram bots
- Host: GitHub
- URL: https://github.com/arashabedii/telebot
- Owner: ArashAbedii
- License: mit
- Created: 2021-04-04T18:35:14.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-11-26T10:41:30.000Z (12 months ago)
- Last Synced: 2024-04-26T19:46:23.249Z (6 months ago)
- Topics: bot, framework, php, telebot, telegram, telegram-api, telegram-bot, telegram-bot-api, telegram-bots
- Language: PHP
- Homepage:
- Size: 148 KB
- Stars: 8
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TELEGRAM BOT FRAMEWORK
### Create Everything## Installition & Configration
#### composer
```
composer create-project arashabedii/telebot
```go to the [@botfather](https://t.me/botfather) in telegram and create a new bot
then copy your api token.
at first you need to configure your bot settings. so go to the config/env.php file.
In the env.php you can define and setup every options on your bot that you want.
## necessary config fields
#### You should fill these settings
```PHP
'BOT_TOKEN', //PUT YOUR BOT TOKEN HERE
'ADMIN_CHAT_ID'=>'CHAT_ID', //PUT YOUR CHAT_ID HERE
'host'=>$host,
'bot_url'=>$botUrl,
'request_handler_path'=>$botUrl.'/requestsHandler.php',
'bot_main_path'=>$botUrl.'/bootstrap/bot.php',
'DB_CONNECTION'=>'mysql', //or sqlite
'DB_HOST'=>'localhost',
'DB_NAME'=>'telebot', //database name
'DB_USERNAME'=>'root', //database username
'DB_PASSWORD'=>'', //database password
'DB_CHARSET'=>'utf8',
'DB_COLLATION'=>'utf8_unicode_ci',
'APP_BASE_PATH'=>dirname(__DIR__),
];```
## Run bots
### Long Polling
with long polling way you can run bots without any domain and ssl and so on
you can run the bot everywhere like: on your server or local machine
open terminal in your bot directory and run this command:
```
php artisan run:bot --long-polling```
### webhook
you can use webhook too for running your bots#### You can set webhook simply by running this command:
```
php artisan set:webhook```
or run
```
YOUR_DOMAIN/webhookHandler.php?set=1```
in your browser
### Create a simple bot
go to the app/Controllers/MessageHandler.php file :
```php
sendMessage(['text'=>$this->getText()]); //insert this code
}
}```
Now start your bot in telegram, then this bot send you every text message that you send to bot. Yes you did it. good job :)
### Now you can read [Documentions](https://arashabedii.github.io/TeleBot) for creating every type of telegram bot.