Skip to content

Telegram bot to track intellectual games team stats and activities

License

Notifications You must be signed in to change notification settings

L-Eugene/Ratingator_bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ratingator bot

Description

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.

Features

Rating tracking

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.

Venues

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.

Randomize

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.

Deployment

To deploy the bot you need to have AWS SAM CLI configured.

Then perform next steps:

  1. Clone this repo
  2. Create samconfig.toml file (example can be used).
  3. Update sambonfig.toml with your bot token and s3 bucket id
  4. Run sam build to prepare package
  5. Run sam deploy to start deployment. Deployment process will print API endpoint URL that can be used as WebHook if needed.
  6. WebHook is needed for bot to accept commands from usees. You can enable WebHooks using example curl command printed by deployment process.

Template parameters

Template accepts 3 parameters:

  1. TelegramBotToken - secret token you get from BotFather
  2. KeepTokensSecret - flag to choose whether you want AWS to keep your token in SecretsManager or as environment variable. Values: true/false
  3. AllowSelfRegistration - flag to choose if we want to allow users to enable team tracking manually with /watch command. Values: true/false

Author

Eugene Lapeko

License

MIT

About

Telegram bot to track intellectual games team stats and activities

Topics

Resources

License

Stars

Watchers

Forks