Rolebot is a simple php bot for telegram that can be used to play role games.
Rolebot includes:
- Dice commands
- Send images, texts, sounds or gifs
- Manage automated fights
- Store and query players statistics
- Inventory
- Administration web
- Php 5 with xdebug
- Composer
- PHP Slim framework v3
- PHP Telegram Bot
- Monolog
- Angularjs
- RedbeanPHP: ORM for PHP
- /account - show account info
- /adminfight - list fights
- /adminfight on/off fightname - enable/disable fight
- /at opponentname - attacks an opponent
- /d6 - dice
- /d20 - dice
- /fight - fight status
- /heal playername hp - heals (e.g. /heal sam 1)
- /healall hp - heal all (e.g. /healall 10)
- /hello - check
- /hit playername hp - hit a player
- /hitall hp - hit all (e.g. /healall 10)
- /info name - serve media (configured in the web)
- /inventory playername - inventory of the player
- /inventory add playername quantity object (e.g. /inventory add sam 1 heal potion) - add item(s) to the inventory
- /inventory remove playername quantity object (e.g. /inventory add sam 1 heal potion) - remove item(s) to the inventory
- /pass - pass turn
- /player - show players and npc statistics
- /player playername - show detailed player info
- Write directly D to throw dices (e.g. 2D20 will throw two 20-sided dices)
- Download code
- Run
composer update
to get the dependencies - Create bot using botfather
- Set privacy mode to disabled if you want to use generic messages (allow the bot to read all messages not only the ones that start with / )
- Copy configTemplate.php to config.php and configure your settings and bot keys
- Create a new database and run the .sql script provided in the scripts folder
- Upload code to a php hosting server. The project as it is is configured for apache (make sure mod_header and mod_rewrite are enabled)
- To register the telegram web hook visit the url https://<yourhost>/<pathtobot>/telegramhook<urlKey>/sethook
- urlKey is specified in the config file
- Say /account to your bot. You should see your telegram id and you will see that you are not registered
- Login the admin web and register some users. The telegram id is the number you get on step 8
- Say /account to your bot. You should see that this time you are registered
- Say /hello to your bot. You should receive an answer with the url of the admin web
- Enjoy!
- Update composer files: composer dump-autoload
- Validate composer file: composer validate
- Visual studio code
- Atom
- Ftp simple