TLE is a Discord bot centered around Competitive Programming.
The features of the bot is split into a number of cogs, each handling their own set of commands.
- Codeforces Commands that can recommend problems or contests to users, taking their rating into account.
- Contests Shows details of upcoming/running contests.
- Graphs Plots various data gathered from Codeforces, e.g. rating distributions and user problem statistics.
- Handles Gets or sets information about a specific user's Codeforces handle, or shows list of Codeforces handles.
- CSES Commands related to the CSES problemset, such as showing leaderboards.
- Starboard Commands related to the starboard, which adds messages to a specific channel when enough users react with a ⭐️.
- CacheControl Commands related to data caching.
Clone the repository
git clone https://github.com/cheran-senthil/TLE
Now all dependencies need to be installed. TLE uses Poetry to manage dependencies. After installing Poetry navigate to the root of the repo and run
poetry install
You will need to setup a bot on your server before continuing, follow the directions here. Following this you should have your bot appearing in your server and you should have the Discord bot token.
To start TLE export the token as an environment variable
export BOT_TOKEN="<BOT_TOKEN_FROM_DISCORD_CONSOLE>"
and run using Python 3.7 or later
poetry run python -m tle
- In order to run admin-only commands you need to have the
Admin
role, which needs to be created in your Discord server and assign it to yourself/other administrators. - In order to prevent the bot suggesting an author's problems to the author a python file needs to be run (since this can not be done through the Codeforces API) which will save the authors for specific contests to a file. To do this run
python extra/scrape_cf_contest_writers.py
which will generate a JSON file which should be placed in the/files
folder. - One of the bot's features is to assign roles to users based on their rating on Codeforces. In order for this functionality to work properly the following roles need to exist in your Discord server
- Newbie
- Pupil
- Specialist
- Expert
- Candidate Master
- Master
- International Master
- Grandmaster
- International Grandmaster
- Legendary Grandmaster
In order to run bot commands you can either ping the bot at the beginning of the command or prefix the command with a semicolon (;), e.g. ;handle pretty
.
In order to find available commands you can run ;help
which will bring a list of commands/groups of commands which are available. To get more details about a specific command you can type ;help <command-name>
.
Pull requests are welcome. For major changes please open an issue first to discuss what you would like to change.