A Discord bot to track users on competitive programming platforms
The goal of this Discord bot is to bring users' statistics from different competitive programming platforms right to Discord.
- Bot uses 2 text channels in your Guild to publish statistics: one (by default named
statistics) to publish global leaderboard of tracked users, ranked by their rating, and another one (by default namedcontests-statistics) to publish current tracked users standings for each contest that is going on or ended no earlier than one week before. - Bot automatically updates statistics nearly each 60 seconds and edits messages with outdated statistics
- To track new user just execute
/track <platform> <username> <track_this_user_just_for_fun_or_not?>in Discord Guild where the bot was installed
Currently supported platforms:
- CodeForces
- Running MongoDB server - you can download it on www.mongodb.com or use free cluster from MongoDB Atlas - https://cloud.mongodb.com
- Discord bot token - you can create it on https://discord.com/developers/applications. The bot needs to be installed to your Guild and need to have scopes
applications.commands,botand permissionsManage Channels,Send Messages. You also need to enable all Privileged Gateway Intents. You can set all them in your dashboard before bot installation to Guild.
- Build jars with
./gradlew buildor download already built fat jar from the last release on https://github.com/likespro/cp-programming-stats-bot/releases - Ensure you have set all necessary environment variables (see the list below)
- Run fat jar with Java 21+:
java -jar cp-programming-stats-bot-fat-<version>.jar. If you built jars manually, they will be located inbuild/libs/
- Pull image:
docker image pull ghcr.io/likespro/cp-programming-stats-bot:latest - Run the image with
docker run ghcr.io/likespro/cp-programming-stats-bot:latest. You can set environment variables (see the list below) by-e <VARIABLE>=<VALUE>, for example:docker run -e MONGODB_URL="mongodb+srv://example.com" -e MONGODB_DATABASE="stats-database" ghcr.io/likespro/cp-programming-stats-bot:latest
- Add repository with
helm repo add cp-programming-stats-bot https://likespro.github.io/cp-programming-stats-botand update it withhelm repo update - Deploy Helm Chart:
helm install <pod_name> cp-programming-stats-bot/cp-programming-stats-bot. You can set environment variables (see the list below) by--set env.<VARIABLE>=<VALUE>, for example:helm install discord-bot-pod-name cp-programming-stats-bot/cp-programming-stats-bot --set env.MONGODB_URL="mongodb+srv://example.com" --set env.MONGODB_DATABASE="stats-database"
- Set
MONGODB_URLenvironment variable to valid URL of your MongoDB server, for example:mongodb+srv://[username:password@]host[/[defaultauthdb][?options]] - [ Optional ] Set
MONGODB_DATABASEenvironment variable to valid MongoDB database name. If not specified,cp-programming-stats-botwill be used as name - [ Optional ] Set
DISCORD_BOT_TOKENenvironment variable to valid Discord bot token. If not specified, you will need to set<database>/misc/config/discordBotTokenfield manually after the first launch - [ Optional ] Set
DISCORD_GUILD_IDenvironment variable to valid Discord Guild ID. You can get ID of any guild by enabling Developer mode inDiscord/Settings/Advancedand then right-click on the Guild you want to use and copy its ID. If not specified, you will need to set<database>/misc/config/discordGuildIdfield manually after the first launch - [ Optional ] Set
DISCORD_GLOBAL_STATISTICS_CHANNEL_IDenvironment variable to valid ID of the Discord text channel where to publish global statistics. You can get ID of any text channel by enabling Developer mode inDiscord/Settings/Advancedand then right-click on the text channel you want to use and copy its ID. If not specified, bot will try to automatically find a text channel with name "statistics". If no such channels were found, bot will create a new text channel with this name - [ Optional ] Set
DISCORD_CONTESTS_STATISTICS_CHANNEL_IDenvironment variable to valid ID of the Discord text channel where to publish contests statistics. You can get ID of any text channel by enabling Developer mode inDiscord/Settings/Advancedand then right-click on the text channel you want to use and copy its ID. If not specified, bot will try to automatically find a text channel with name "contests-statistics". If no such channels were found, bot will create a new text channel with this name


