PHPTeleBotWrt - Telegram bot framework written in PHP for OpenWRT
01 February 2023 -
7 mins read time
Tags:
PHPTeleBotWrt
PHP
Telegram Bot
OpenWrt
Page not found or adblock is active!
(1) Type URL correctly
(2) Enable javascript
(3) Disable adblock software, extensions, DNS, etc.
(4) Try another browser.
Then you can go to Home or go back to previous page.
Back to Previous PagePHPTeleBotWrt
Telegram bot framework written in PHP for OpenWRT
Video Preview
Features
- Support PHP7 & PHP8 hybrid installation.
- Support Long Polling and Webhook.
- Proxy List (Openclash Proxies)
- Rules List (Openclash Rules)
- Openclash Information.
- Upload file to OpenWrt.
- Update binaries from telegram.
- Simple, easy to use.
- Inline Command - like vnstat -l, etc.
- Speedtest - check OpenWrt’s internet speed.
- Sysinfo - view OpenWrt’s system information.
- Memory - check memory/RAM usage.
- Vnstat - check vnstat internet usage.
- Vnstati - check vnstati internet usage.
- My IP - get OpenWrt’s IP information.
- Aria2 - Control Aria2.
- MyXL - Check XL AXIATA number information (packages, quota, expired, etc).
Requirements
- Internet
git
openwrt package.screen
openwrt package.wget-ssl
openwrt package.curl
openwrt package.php8-cli
orphp7-cli
openwrt package.php8-mod-curl
orphp7-mod-curl
openwrt package .-
Your own private telegram bot and bot username (see from bot profile).
- Go to your bot, see bot profile to see bot username.
- Copy bot username.
-
Telegram Bot API Token.
- Chat with @BotFather.
- Send
/token
. - Select your bot.
- Copy token by tapping token line under
You can use this token to access HTTP API:
text.
-
Your own perconal account ID.
- Type
/start
to on chat with @userinfobot. - See ID line, then copy it.
- Type
Video Installation
Installation
- Open Putty/Terminal/TTYD/XTERM or similar apps like these.
-
Run commands below to download
phpbotmgr - PHPTeleBotWrt Manager
to your OpenWRT (choose one of installation method below):wget
installation:wget https://raw.githubusercontent.com/helmiau/PHPTeleBotWrt/master/phpbotmgr -O /root/phpbotmgr && chmod +x /root/phpbotmgr
curl
installation:curl -sL https://raw.githubusercontent.com/helmiau/PHPTeleBotWrt/master/phpbotmgr > /root/phpbotmgr && chmod +x /root/phpbotmgr
-
Run
./phpbotmgr i
with Putty/Terminal/TTYD/XTERM to install PHPTeleBotWrt./phpbotmgr i
- Copy Telegram Bot API Token from @BotFather, paste to terminal when
💬 Enter Your Bot Token:
appeared. Token bot example:52123745:ABeN1H9jc0I_7lIeyu_4aE8BZiV_fXt9TGk
. - Copy your Telegram Bot Username from bot profile, paste to terminal when
🤖 Enter Your Bot Username (without @):
appeared. Bot username example:mamanxwrt_bot
. - Copy your Telegram Account User ID from @userinfobot, paste to terminal when
🤖Enter Your Personal Account UID:
appeared. User ID example:234321234
.
Usage
Read usage information of phpbotmgr
command.
About databot
file inside PHPTeleBotWrt path
This file contain your Telegram Bot API Token and Bot Username. You must update this file if you want to change to another bot.
Sample contents of databot file (click to see screenshots)
Here some command previews:
Install PHPTeleBotWrt
./phpbotmgr i
Update PHPTeleBotWrt
./phpbotmgr u
Edit PHPTeleBotWrt databot
./phpbotmgr e
Run/Start PHPTeleBotWrt
./phpbotmgr r
If not work, just run
cd PHPTeleBotWrt && nohup php8-cli index.php &>/dev/null & && cd
manually
Check PHPTeleBotWrt running status (maybe not work sometimes)
./phpbotmgr c
Stop PHPTeleBotWrt
./phpbotmgr s
Full Remove/Uninstall PHPTeleBotWrt with all datas.
./phpbotmgr ra
Remove/Uninstall PHPTeleBotWrt without databot.
./phpbotmgr rx
Add/remove PHPTeleBotWrt to Auto-startup LuCI - System - Startup - Local Startup - rc.local
.
./phpbotmgr a
Add/remove PHPTeleBotWrt to Auto-startup LuCI - System - Scheduled Tasks
.
./phpbotmgr t
Command lists
📁PHPTeleBotWrt Manager
↳/botup : Update bot binaries
↳/botas : Add/remove bot to/from auto start on boot [$boot_stat]
↳/botcr : Add/remove bot to/from cron job [$cron_stat]
📁Aria2 Commands
↳/aria2add : Add task
↳/aria2stats : Aria2 status
↳/aria2pause : Pause all
↳/aria2resume : Resume all
📁OpenClash Commands
↳/oc : OC Information
↳/ocst : Start/Restart Openclash
↳/ocsp : Stop Openclash
↳/ocpr : Proxies status
↳/ocrl : Rule list
↳/ocup : Update Openclash app only
↳/ocua : Update Openclash and all cores
📁MyXL Commands
↳/myxl : Bandwidth usage
↳/setxl 087 : Set default number
📁File Manager
↳/upf : Upload a file to OpenWrt
↳/dlf : Get/retrieve a file from OpenWrt
↳/cp : Copy a file to another folder
↳/mv : Move a file to another folder
↳/rm : Delete a file
📁System
↳/sysinfo : System Information
↳/memory : Memory status
↳/sh commandSample : Run custom command in bash terminal
↳/rs ls : List of compatible app restart
↳/rs appname : Restart app in init.d
📁Power System
↳/reboot : Reboot OpenWrt
↳/turnoff : Turn off OpenWrt
📁Network Information
↳/netcl : Lists of connected client devices
↳/fwlist : Firewall lists
↳/ifcfg interface : List of device interface
↳/vnstat : Bandwidth usage
↳/vnstati : Better Bandwidth usage
↳/myip : Get ip details
↳/speedtest : Speedtest
↳/ping : Ping bot
Screenshots
start on terminal
(click to see screenshot)
/start | /cmdlist
(click to see screenshot)
/memory
(click to see screenshot)
/myip
(click to see screenshot)
/myxl number
(click to see screenshot)
number
/ping
(click to see screenshot)
/oc
(click to see screenshot)
/ocpr
(click to see screenshot)
/ocrl
(click to see screenshot)
/ocst
(click to see screenshot)
/ocsp
(click to see screenshot)
/ocup
(click to see screenshot)
/ocua
(click to see screenshot)
/speedtest (depend on what speedtest installed)
(click to see screenshot)
(depend on what speedtest installed)
/sysinfo
(click to see screenshot)
/vnstat -d
or -h
or -m
(click to see screenshot)
-d
or -h
or -m
/vnstati -d
or -h
or -m
(click to see screenshot)
-d
or -h
or -m
/upload
(click to see screenshot)
/update
(click to see screenshot)
Tested on
- Reyre Firmware OC OnLy 28.09.22 -> Speedtest bug
- Reyre Firmware OC OnLy 27.10.22 -> Speedtest Fixed (vnstat Bug)
- Reyre Firmware OC OnLy 06.11.22 -> Working Perfectly
- HelmiWrt OS PHP7, Older OpenClash -> Working Perfectly
- HelmiWrt OS PHP8, Latest OpenClash -> Working Perfectly
Known Bugs
/netcl
not support adguard dhcp.- Sometimes PHPTeleBotWrt running status checker not work.
/cp
and/mv
not work sometimes./sh
max limit message 4,096 characters./upf
upload max limit 50mb.- Read more telegram limitation here.
-
Run
opkg update && opkg install libcurl4
if error below occuredError relocating /usr/bin/curl: curl_easy_header: symbol not found Error relocating /usr/bin/curl: curl_easy_nextheader: symbol not found
Reports
Developers
- Pringgo Radianto (Radya) - PHPTeleBot Base Development.
-
Dimas Syahrul Hidayat Hacked Repo & New Repo - Implement bot and openclash features to OpenWrt.
Support Dimas on BCA : 0131630831
DANA / OVO : 087837872813
AN Dimas Syahrul Hidayat. - Helmi Amirudin - Features improvements such as installations, commands, universalize for all firmware and other many rich features. Donate Helmi.