Блог пользователя mblazev

Автор mblazev, история, 7 лет назад, По-английски

I would like to present to you an open-source competitive programming (primarily codeforces) discord bot written in python by meooow, algmyr, Narut, Rahul, pajenegod, aryaman, DeliciousFlatChest, Chilli, c1729, cfalas and mblazev. Source code is avaliable on github. If you would like to try the bot without having to set it up yourself, enter this server: discord.gg/2CJ6qvY. The bot is still work in progress, but it is already 4 months old so it can already do quite a few cool things. Here is a showcase of a subset of its features:

  • It can plot rating distribution of either active or all codeforces users, in either normal or log scale, who have competed at least n times. For example, ;plot cfdistrib normal active 5 gives:
Click to reveal
  • It can also place a provided list of users on a plot of the percentile distribution of codeforces. For example, ;plot centile mblazev laggy heon +zoom
Click to reveal
  • If you're curious how the entire percentile distribution looks like ;plot centile
Click to reveal
  • It can plot codeforces rating graphs for multiple users. For example, ;plot rating mblazev heon tomx +zoom
Click to reveal
  • It can plot a histogram of problems solved by a user, color-coded by submission type. For example, ;plot solved stefdasca
Click to reveal
  • Of course, it works for multiple users as well. For example ;plot solved stefdasca pikmike
Click to reveal
  • It can even plot codeforces rating overlaid on a scatter plot of problems solved along with a running average of ratings of problems solved in practice! For example ;plot scatter pikmike
Click to reveal
  • And of course, it can also plot the rating distribution of server members. ;plot distrib
Click to reveal

3 other plotting commands are still WIP so I will not showcase them yet. Some non-graph features include:

Contest forecast
Smart mashup creator
Smart virtual contest picker
Smart practice problem selector
Ranklist with rating prediction
Contest reminders to subscribed users
It's easy to control the subscription
User stalking
Even displaying cf handle of given discord user looks beautiful!
It updates roles quickly!
Emoji-interactive list of server members
Scoreboard for fastest/shortest CSES solutions
3 stars -> starboard

It also has a set of commands which we refer to as "gitgud". They are ;gitgud, ;gotgud, ;nogud, ;gudgitters and ;upsolve. They incentivize solving problems around user's rating by giving points (depending on relative difficulty) and maintaining a scoreboard. In this example, a 1900 rated user requested a 100 rating higher problem (worth 12 points):

Click to reveal

To report a solved problem, you run ;gotgud.

Click to reveal

To skip a problem (after at least 3 hours), you run ;nogud.

Click to reveal

Apart from random problems, you can also gain points for ;upsolve-ing problems you failed in a contest. For example:

Click to reveal

To display the scoreboard, run ;gudgitters

Click to reveal

It has even more features (many of which are WIP), but I've omitted them for sake of brevity. We are also planning new features and we welcome new contributors; we'd be happy to help you find your way around the codebase. It's moderately big (3.2k lines of code, not counting comments and whitespaces) but stringent code review ensures the code remains non-terrible.

If you've come this far, just enter discord.gg/2CJ6qvY and try it out! Make sure to read ;help for more details.

  • Проголосовать: нравится
  • +225
  • Проголосовать: не нравится

»
7 лет назад, скрыть # |
Rev. 5  
Проголосовать: нравится +39 Проголосовать: не нравится

Nice

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +29 Проголосовать: не нравится

great bot :D

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +26 Проголосовать: не нравится

Wow the bot looks amazing! Can't wait to try it out :)

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +43 Проголосовать: не нравится

I joined the server and the people there are really friendly. The bot's features are also very useful too.

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +23 Проголосовать: не нравится

Good Stuff

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +19 Проголосовать: не нравится

Have you considered implementing something similar to CF Predictor or perhaps even borrowing some of the public CF Predictor API to enhance the bot?

I would be very interested in working on what could be the greatest CF crossover to date. :)

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +33 Проголосовать: не нравится

Bot is amazing, great work :D

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +32 Проголосовать: не нравится

the best thing to happen to codeforces since the invention of codeforces

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

i think you have forgotten to put kkbb in the credits list, mblazev

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +19 Проголосовать: не нравится

I wish I could've contributed to this amazing bot!

»
7 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится +22 Проголосовать: не нравится

rip link isnt working
upd: working now

»
7 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится +3 Проголосовать: не нравится

why Codeforces handle for @handle not found in database shows for green even i set my handle cp community discord ?? is it a bug ? UPD : got that.

»
7 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Thanks for crediting my two commits

»
7 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится +9 Проголосовать: не нравится

Good bot!

»
7 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I'm pretty sure this bot will help CP become more fun as a sport.

»
7 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

why discord link is not working?

»
6 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

the link is not working :(

»
6 лет назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

This bot's just amazing and I seriously want to have it in one of my servers, but I can't cuz I have some weird issue with my PATH and Python and Poetry can't work.... So when would the bot be on https://top.gg ?

  • »
    »
    6 лет назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    Same .. poetry pycairo issues

    • »
      »
      »
      6 лет назад, скрыть # ^ |
       
      Проголосовать: нравится 0 Проголосовать: не нравится

      The pycairo stuff requires you to install some libraries. Recently we updated the README to better describe the setup and dependencies needed. So if you use some recent ubuntu version it should be fairly easy to get it going.

      Be aware that we pretty much assume you're on a linux machine, I don't think we have tested how feasible it is to get it running on windows since we added the cairo dependencies. It should be possible, but might be hard.

»
6 лет назад, скрыть # |
 
Проголосовать: нравится +13 Проголосовать: не нравится

This is just brilliant. How come I get to know only 9 months later?:(

»
6 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

What a nice thingy.

»
6 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Because of the new formula causing some problems to become unreasonable for their labeled rating right now, could you allow for skips in ;gitgud

»
6 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Maybe a phone app one day? Or a chrome extension? Cuz if TLE will never be on top.gg that would be sad to have all this functionality limited to one Discord server...

»
6 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Does the bot automatically update my rating if the rating changes?

»
6 лет назад, скрыть # |
Rev. 3  
Проголосовать: нравится 0 Проголосовать: не нравится

When plotting histogram of problems solved by multiple users, 2 consecutive difficulties get merged, e.g. here pikmike's 2400 and 2500 solved have been merged (separately: here).

Is it possible to avoid this merging?

»
6 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

hello, sorry the bot it's simply amazing, but i need some help with the installation on a mac, if someone can help me I will really appreciates that, sorry for the problems and thanks in advance

»
6 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Is anyone able to deploy this on heroku?

»
6 лет назад, скрыть # |
Rev. 3  
Проголосовать: нравится 0 Проголосовать: не нравится

Hello mblazev

when i try to run this command :

export BOT_TOKEN="XXXXXXXXXXXXXXXXXXXXXXXX.XXXXXX.XXXXXXXXXXXXXXXXXXXXXXXXXXX" poetry run python -m tle

I get this error : — bash: export: `-m': not a valid identifier

Please help me fix this.

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +28 Проголосовать: не нравится

Copy-paste directly to your terminal

After a lot of struggle, finally...
»
5 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

Can't we use it for another server?

»
5 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

I am getting this error please help me fix this!

./run.sh

Already up to date.

Installing dependencies from lock file

No dependencies to install or update

Installing the current project: TLE (0.1.0)

ujson module not found, using json

msgpack not installed, MsgPackSerializer unavailable

ERROR:root:Token required

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +10 Проголосовать: не нравится

Hello aryanc403, what could i do with this?

»
5 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

When I do ./run.sh then it works but after some time it stops working and goes offline. How to solve this ?

»
5 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Such an amazing bot ;_;

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

how can i register in duel list??

»
4 года назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

How do we update the ratings of handle so it will synced to user's latest rating?

»
4 года назад, скрыть # |
Rev. 4  
Проголосовать: нравится +8 Проголосовать: не нравится

[deleted]

»
3 года назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

Thank you for creating this!

»
2 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Do I have to link my codeforces account with it, or it can search on the basis of my discord username? I am getting @username not found prompt!