{"id":17262638,"url":"https://github.com/cheran-senthil/tle","last_synced_at":"2025-04-04T12:09:02.317Z","repository":{"id":34459550,"uuid":"178477356","full_name":"cheran-senthil/TLE","owner":"cheran-senthil","description":"🤖 Discord Bot for Competitive Programming","archived":false,"fork":false,"pushed_at":"2024-04-12T00:40:28.000Z","size":1253,"stargazers_count":325,"open_issues_count":83,"forks_count":204,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-28T11:09:34.411Z","etag":null,"topics":["codeforces","discord","discord-bot","python"],"latest_commit_sha":null,"homepage":"https://discordapp.com/invite/2CJ6qvY","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cheran-senthil.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-03-29T21:25:30.000Z","updated_at":"2025-03-27T06:15:40.000Z","dependencies_parsed_at":"2023-01-15T07:13:07.910Z","dependency_job_id":"ddf00ea9-b49b-44c5-9f0a-6e11e8001dfb","html_url":"https://github.com/cheran-senthil/TLE","commit_stats":{"total_commits":531,"total_committers":47,"mean_commits":"11.297872340425531","dds":0.6572504708097928,"last_synced_commit":"fd1ec10ce0c9209253606be5091d05810e90e944"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheran-senthil%2FTLE","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheran-senthil%2FTLE/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheran-senthil%2FTLE/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheran-senthil%2FTLE/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cheran-senthil","download_url":"https://codeload.github.com/cheran-senthil/TLE/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247174423,"owners_count":20896078,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["codeforces","discord","discord-bot","python"],"created_at":"2024-10-15T07:54:21.981Z","updated_at":"2025-04-04T12:09:02.296Z","avatar_url":"https://github.com/cheran-senthil.png","language":"Python","readme":"# TLE\n\nTLE is a Discord bot centered around Competitive Programming.\n\n## Features\n\nThe features of the bot are split into a number of cogs, each handling their own set of commands.\n\n### Codeforces cogs\n\n- **Codeforces** Commands that can recommend problems or contests to users, taking their rating into account.\n- **Contests** Shows details of upcoming/running contests.\n- **Graphs** Plots various data gathered from Codeforces, e.g. rating distributions and user problem statistics.\n- **Handles** Gets or sets information about a specific user's Codeforces handle, or shows a list of Codeforces handles.\n\n### CSES cog\n\n- **CSES** Commands related to the [CSES problemset](https://cses.fi/problemset/), such as showing leaderboards.\n\n### Other cogs\n\n- **Starboard** Commands related to the starboard, which adds messages to a specific channel when enough users react with a ⭐️.\n- **CacheControl** Commands related to data caching.\n\n## Installation\n\u003e If you want to run the bot inside a docker container follow these [instructions](/Docker.md)\n\nClone the repository\n\n```bash\ngit clone https://github.com/cheran-senthil/TLE\n```\n\n### Optional: venv\n\nIf you want to isolate the TLE python environment from your system one, now would be the time to do it.\nSee the [venv documentation](https://docs.python.org/3/library/venv.html) for details.\n\nIf you decide to use a venv there is some convenience logic in the startup\nscript to automatically active your venv when running the bot.\nSee [Environment Variables](#environment-variables) for details.\n\n### Dependencies\n\nNow all dependencies need to be installed. TLE uses [Poetry](https://poetry.eustace.io/) to manage its python dependencies. After installing Poetry navigate to the root of the repo and run\n\n```bash\npoetry install\n```\n\n\u003e :warning: **TLE requires Python 3.7 or later!**\n\nIf you are using Ubuntu with older versions of python, then do the following:\n\n```bash\napt-get install python3.7-venv libpython3.7-dev\npython3.7 -m pip install poetry\npython3.7 -m poetry install\n```\n\nOn some systems, Poetry is not able to install TLE's dependencies correctly. If you are unable to run `poetry install` without errors after completing the steps below, see the note at the end of the *final steps* section.\n\n---\n\n#### Library dependencies\n\nTLE also depends on cairo and pango for graphics and text rendering, which you need to install. For Ubuntu, the relevant packages can be installed with:\n\n```bash\napt-get install libcairo2-dev libgirepository1.0-dev libpango1.0-dev pkg-config python3-dev gir1.2-pango-1.0\n```\n\nAdditionally TLE uses pillow for graphics, which requires the following packages:\n\n```bash\napt-get install libjpeg-dev zlib1g-dev\n```\n\n### Final steps\n\nYou will need to setup a bot on your server before continuing, follow the directions [here](https://github.com/reactiflux/discord-irc/wiki/Creating-a-discord-bot-\u0026-getting-a-token). Following this, you should have your bot appearing in your server and you should have the Discord bot token. Finally, go to the `Bot` settings in your App's Developer Portal (in the same page where you copied your Bot Token) and enable the `Server Members Intent`.\n\nCreate a new file `environment`.\n\n```bash\ncp environment.template environment\n```\n\nFill in appropriate variables in new \"environment\" file.\n\n#### Environment Variables\n\n- **BOT_TOKEN**: the Discord Bot Token for your bot.\n- **LOGGING_COG_CHANNEL_ID**: the [Discord Channel ID](https://support.discord.com/hc/en-us/articles/206346498-Where-can-I-find-my-User-Server-Message-ID-) of a Discord Channel where you want error messages sent to.\n- **ALLOW_DUEL_SELF_REGISTER**: boolean value indicating if self registration for duels is enabled.\n- **TLE_ADMIN**: the name of the role that can run admin commands of the bot. If this is not set, the role name will default to \"Admin\".\n- **TLE_MODERATOR**: the name of the role that can run moderator commands of the bot. If this is not set, the role name will default to \"Moderator\".\n- **VENV_DIR**: If non-empty, automatically activate this venv when running the bot.\n\nTo start TLE just run:\n\n```bash\n./run.sh\n```\n\nOn some systems, Poetry is unable to correctly install TLE's dependencies even after completing the above steps. In this case, using Pip to manage the dependencies instead may work. Note that Poetry still must be installed.\n\nTo install dependencies in a virtual environment using Pip and start TLE, just run:\n\n```bash\n./run-pip.sh\n```\n\n### Notes\n\n- 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.\n- 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 that should be placed in the `data/misc/` folder.\n- In order to display CJK (East Asian) characters for usernames, we need appropriate fonts. Their size is ~36MB, so we don't keep in the repo itself and it is gitignored. They will be downloaded automatically when the bot is run if not already present.\n- 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\n  - Newbie\n  - Pupil\n  - Specialist\n  - Expert\n  - Candidate Master\n  - Master\n  - International Master\n  - Grandmaster\n  - International Grandmaster\n  - Legendary Grandmaster\n- One of the bot's commands require problemsets to be cached. Run `;cache problemsets all` at the very first time the bot is used. The command may take around 10 minutes to run.\n\n## Usage\n\nIn 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`.\n\nIn 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 \u003ccommand-name\u003e`.\n\n## Contributing\n\nPull requests are welcome. For major changes please open an issue first to discuss what you would like to change.\n\nBefore submitting your PR, consider running some code formatter on the lines you touched or added. This will help reduce the time spent on fixing small styling issues in code review. Good options are [yapf](https://github.com/google/yapf) or [autopep8](https://github.com/hhatto/autopep8) which likely can be integrated into your favorite editor.\n\nPlease refrain from formatting the whole file if you just change some small part of it. If you feel the need to tidy up some particularly egregious code, then do that in a separate PR.\n\n## License\n\n[MIT](https://choosealicense.com/licenses/mit/)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheran-senthil%2Ftle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcheran-senthil%2Ftle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheran-senthil%2Ftle/lists"}