Git Product home page Git Product logo

kevinjycui / practice-bot Goto Github PK

View Code? Open in Web Editor NEW
51.0 6.0 13.0 2.96 MB

The all-purpose competitive programming Discord bot! Discord to online judge integration. AtCoder/CodeChef/Codeforces/CSES/DMOJ/Leetcode/Szkopuł/TopCoder/WCIPEG

Home Page: https://discord.com/api/oauth2/authorize?client_id=691416325557452861&permissions=402779152&scope=bot

License: GNU General Public License v3.0

Python 99.73% Shell 0.27%
discord-bots codeforces dmoj atcoder online-judge competitive-programming

practice-bot's Introduction

Practice-Bot

The all-purpose competitive programming Discord bot!

Discord to AtCoder/CodeChef/Codeforces/CSES/DMOJ/LeetCode/Szkopuł/TopCoder/WCIPEG integration. Handles problems, accounts, ratings, contests, and submitting. Everything for your competitive programming server needs!

Discord Bots Discord Bots

🍵 Invite me to your server!


Support this bot by voting for it here

What's New

ATTENTION: As of July 2021, this bot is indefinitely no longer maintained and the production bot will be considered unstable (may be often offline). Local setup will still work if you want to host the bot yourself to add to your server, and pull requests contributions may still be accepted to improve the bot for local users. Sorry for the inconvenience!

March 2021

February 2021

Januray 2021

  • Random problem parameters for Codeforces now refers to rating rather than points
  • LeetCode random problems now have parameters for difficulty level (1, 2, 3)

December 2020

  • CodeChef is here! Added contest support for CodeChef
  • TopCoder is here! Added contest support for TopCoder
  • Added contest support for LeetCode

November 2020

  • Added problem support for LeetCode
  • Added some new informational commands. See commands for more details

September 2020

  • Improved contest display

August 2020

  • Removed support for WCIPEG

July 2020

  • Added connection support for Codeforces
  • Added problem support for Szkopuł
  • Added suggested problems
  • Changed some command names. See commands for more details

Commands

Full list of commands here

Online Judges

Random Problems Suggested Problems Contest Notifications Rating Roles Account Link Submission
AtCoder
CodeChef
Codeforces
CSES
DMOJ
LeetCode
Szkopuł
TopCoder
WCIPEG*

*Support for WCIPEG has been discontinued as PEG Judge shut down at the end of July 2020

Tools

*Not affiliated with any of the online judges used. Sites are only used as tools for this bot.

Contributions

Contributions are welcomed and encouraged!

Icon

practice-bot's People

Contributors

arcslogger avatar dependabot[bot] avatar ds-david-shen avatar kevinjycui avatar orendon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

practice-bot's Issues

How to get the Bot online?

I successfully add this bot to the server, but the bot is offline and I am trying to connect with DMOJ but the bot does not respond.
Can anyone tell me the steps to get the bot online?

spam

spamming the same contest for more than two days
its 220 messages till now
Screen Shot 2021-06-20 at 6 08 19 PM

Command to list users in a country

Users currently store a country, so it would be helpful to list all users in a country in a server. Example of the command could be
ls <country name or iso code>

Which then returns (probably in embed so the users don't get pinged) the users of that country alphabetically ordered.

Future Implementation

  • Get the users in order of rank (DMOJ/Codeforces). Relates to #6.

USACO Integration

Some way to announce USACO contests when they are posted? Not sure how to do this as USACO doesn't allow access to the site without an account. If it is done, will likely require some type of web scraping

Change random problem parameter from points to rating

When the min-max parameters are given for the $r command for codeforces, please make the bot select a problem on the basis of "rating" instead of "points" which is a much better metric for determining the difficulty of a problem.

Sent anonymously via bot suggestion command

Enhance LeetCode with difficulty levels (same as the other judges)

I was trying this bot today, nice work! thanks!

Noticed the other judges support points and points ranges like $random cf POINTS
Would be nice to have something similar for LC, perhaps easy/medium/hard instead of numeric values.

what do you think? would be a desirable feature?

Repetitive Message for old Leetcode Contest

The Practice Bot has been sending the message of the same LeetCode contest (Weekly Contest 242) from 29 May 2021 (More than 20 Messages till now). This contest has already ended.

Background Info:
The bot has been set up in a channel with the command: $sub #channel-name

Screenshot:
image

Contest Repeating Issue

Users may have noticed in the past that some contest notifications are sent multiple times during maintenance. This issue has been resolved and should not occur again.

Change Nickname to Practice [prefix] when prefix is changed

This is just so that there is a way to keep track of the prefix of the bot when it is changed

  • When setprefix sets the prefix to some prefix that is not the default prefix, the nickname should be set to Display Name [prefix]. (E.g. Practice [!] or Some Nickname [&])
  • If the bot's nickname already indicates another prefix and the prefix is changed to something else, the current prefix in the name should be replaced. (E.g. Practice [!] --> !setprefix & --> Practice [&]
  • If the prefix is set back to the default, the prefix in the nickname should be removed. (E.g. Practice [&] --> &setprefix or &setprefix $ --> Practice

Optimise memory usage

Memory usage needs to be improved, more data should be stored in the database and not in the program to prevent the program from exceeding memory limits and getting force killed.

Everywhere where data from the database is stored when pulling from the database directly could work instead should be fixed.

Send random problem on repeat

Add a functionality that allows the bot to send a random problem every time a specified period of time has passed (e.g. send a random problem every day)

Leaderboard Command

Some command to get the top users in a server ranked (for DMOJ/Codeforces). Likely in a text format, possibly an embed.

DMOJ will be trivial as it has Cloudflare #4, will likely have to find a way to store user rankings or regulate how many calls can be done periodically (may have to make it an event instead of a command, where the leaderboard is posted after every contest)

Cloudflare from DMOJ

While cloudflare is prevented for problem/contest fetching due to local caching, the bot may be captcha'd by DMOJ's Cloudflare during login and submission, as submission must be done with a call to DMOJ per command and storing login data locally may be a security issue.

TODO:

  • Enable method to prevent high volume of calls
  • Figure out secure way to store logins

This issue is low for now due to small amount of users, but may need to be addressed if number of users increases significantly.

[BUG] AWS CPU Usage Causes Bot Offline

Have yet to diagnose reason, but the bot periodically uses >90% of AWS EC2 Instance CPU (about once every week) causing the instance to crash and bot to go offline until manually rebooted. Nothing is logged as the bot simply just uses too much CPU. Removing HTTP requests seems to make this time between crashes longer but doing so removes key features and only delays the crash.

Crashes from last 2 months

  • Sunday 03 January, 2021 15:38:15 UTC; 98.9% CPU Usage
  • Thursday 07 January, 2021 17:23:15 UTC; 99.2% CPU Usage
  • Monday 18 January, 2021 10:03:15 UTC; 92.4% CPU Usage
  • Monday 25 January, 2021 14:18:15 UTC; 99.2% CPU Usage
  • Wednesday 03 February, 2021 08:08:15 UTC; 99.7% CPU Usage
  • Tuesday 09 February, 2021 08:08:15 UTC; 99.3% CPU Usage

AWS CloudWatch CPU Usage Screenshot

Screenshot from 2021-02-11 14-14-31

Due to the privacy policy I have not logged any exact commands executed before each crash as doing so would require me to log every command executed by the bot at all times, so I am unsure if it is a certain command error causing these crashes. If the bot goes offline after running a command or event, please report it here.

View rating command

Get the rating (or rating history) of a DMOJ or Codeforces account linked to a user.

DMOJ may be trivial due to Cloudflare #4.

TODO:

  • API calls to get rating
  • Graph rating using matplotlib

Prefix can be invalid

The prefix can currently be changed to invalid prefixes. Need to make it so prefix can only be set to ASCII characters.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.