Telegram bot for tracking intellectual games team rating on rating site. It is built using AWS Serverless tools and can be easily deployed with SAM.
Once a week (schedule can be changed on deployment stage) bot is sending statistic message to chat.
To enable statistic tracking run /watch 12345
command. 12345 here is team numeric id from rating site. To disable statistic tracking run /unwatch
.
/watch
and /unwatch
commands can be disabled on deployment stage. In such case bot owner should add records to DynamoDB table on his own. Record should contain at least two attributes:
chat_id
: id of chat in Telegram where statistics will be sent. Bot has to be the member of this chat.team_id
: team numeric id on rating site
Example:
{ "chat_id": 123456789, "team_id": 88 }
Limitation: Bot will only track one team results for one chat. If you will run /watch
several times with different team ids - only the last one will be used.
Bot can track venues and send brief data about upcoming games. Information is sent once a day for games that are planned for that day.
To enable the feature use /venue 1234
command where 1234 is venue numeric id from rating site. There is no limit on the number of venues monitored by one team.
To disable venue monitoring use /venue_unwatch_1234
command.
Running /venue
command will show the list of venues you are already monitoring and instructions to manage their list.
You can use /random
command to cast the lot. Bot will parse command message for items separated by space or new line and will select one of them.
To deploy the bot you need to have AWS SAM CLI configured.
Then perform next steps:
- Clone this repo
- Create
samconfig.toml
file (example can be used). - Update
sambonfig.toml
with your bot token and s3 bucket id - Run
sam build
to prepare package - Run
sam deploy
to start deployment. Deployment process will print API endpoint URL that can be used as WebHook if needed. - WebHook is needed for bot to accept commands from usees. You can enable WebHooks using example curl command printed by deployment process.
Template accepts 3 parameters:
TelegramBotToken
- secret token you get from BotFatherKeepTokensSecret
- flag to choose whether you want AWS to keep your token in SecretsManager or as environment variable. Values:true
/false
AllowSelfRegistration
- flag to choose if we want to allow users to enable team tracking manually with/watch
command. Values:true
/false
Eugene Lapeko