Source code of the Code Hunting Games Telegram bot, refreshed and updated for Code Week 2020. Visit the official website for further information on how to play the game and how to create your own Code Hunting Game sessions.
Archived version of the original bot source code.
Developed at the University of Urbino (Italy) and DIGIT srl.
Source code pull requests are welcome. Please also check out issues to give feedback on errors, possible bugs, or improvements.
A Code Hunting Game session can very easily be organized using our main instance of the Telegram bot, @treasurehuntbot.
If you want to deploy the bot on your own, requirements are as follows:
- A Telegram bot,
- Server with a public IP,
- PHP 7,
- MySQL.
In order to install the bot, please proceed as follows:
- Get the code from this repository and ensure that your Web server correctly serves the source files at directory
/src
through the PHP interpreter. - Copy the
/src/config-template.php
file to/src/config.php
and edit if as follows:- Set
TELEGRAM_BOT_TOKEN
to your Telegram bot's token, - Set all
DATABASE
constants to point to your local MySQL and ensure that the database user you are setting has read/write access, - Update
BOT_DEEPLINK_START_ROOT
, replacingBOTNAME
with your Telegram bot's nickname.
- Set
- Install the database schema, running the
/sql/treasurehuntbot.sql
script, - Check whether the bot works, by running
php pull.php
(in directory/src
): this will attempt to process Telegram messages you send to your bot in pull mode. - If everything works correctly, setup a webhook to your bot through the Telegram bot API:
curl -F "url=https://YOURDOMAIN/PATH-TO-BOT/src/hook.php" https://api.telegram.org/botBOTTOKEN/setWebhook
(Make sure to replace the URL with the correct path to your server and the TOKEN
with your Telegram bot's token.)
That is all: the bot should now respond to your messages automatically. You're all set and ready to create your own Code Hunting Games.