### pseudocoder10's blog

By pseudocoder10, 2 years ago,

Hello everyone, I'm sure many of you have been watching and enjoying the recent lockout streams organized by ecnerwala and scott_wu and would be wanting to compete with your friends in a similar format. I have made a discord bot that does exactly the same. The source code for the bot can be found here.

The bot gives a set of 5 problems with ratings from [x, x+400], where x is chosen by you and the point distribution is [100, 500]. The first person to solve a problem gets the points for it. The match ends when someone has >= 800 points or 45 minutes have been elapsed. The bot automatically updates the status when someone solves a problem but you can also do it manually.

To invite the bot to your discord server, click here. If you don't wanna go through the hassle of setting up a discord server, join this server to try the bot instantly.

#### Steps to use

First you will have to link your codeforces handle with your discord id. To do that type .handle identify <cf username>. The bot will give you a random string, which you have to set as your first name in your profile. On successfully doing that, you will be able to compete with others.

Ex

Now you can challenge your opponent by typing .match challenge <opponent discord name> <rating>. The bot will now give problems in the range [rating, rating+400] if your opponent accepts the match.

Ex

To accept a challenge, simply type .match accept and the bot will chose 5 random unsolved problems by both the participants in the rated range given.

Ex

The bot will automatically update the status of the match, but you can also manually trigger it by typing .match update.

Ex

The bot has few more features which you can try out yourself by joining this server. Any suggestions to make it better are welcomed.

UPD: If you want to report any bug or make suggestions, it will be better to comment in the support server rather than commenting here, since I will be able to respond faster and there will be better communication.

UPD: The bot has a new command .round. It is very similar to .match but now you can compete against multiple opponents (upto 5), can select time duration, number of problems (upto 6), rating for each problem and points for each problem. Additionally you can also specify whether you want a new problem to appear after someone solves a problem. You can also generate your own problemset for the round. Detailed commands usage can be found here

UPD: You can now create your own tournaments in your server using the bot. The supported tournament types are Single elimination, Double elimination and Swiss. The tournaments will be hosted on Challonge and you just need to setup a tournament using .tournament setup command and the bot will take care of setting and updating brackets. Detailed information about this command can be found here

• +506

 » 2 years ago, # |   +135 Here..
 » 2 years ago, # |   +5 Adding a music bot on the server pairs well :DLink: Octave
 » 2 years ago, # |   +57 Excellent bot; many thanks for setting it up!A few suggestions, with respect to match configuration: it'd be great if we could change the specific rating for each problem (rather than increments of 100), the number of problems in the set, the score for each problem, and the time limit. From a server administration standpoint, it'd also be helpful to have the option to disable the bot in certain channels, to limit spam. It seems likely that many servers would rather dedicate one channel to the bot, and would thus prefer to disable it everywhere else.
•  » » 2 years ago, # ^ |   +11 Yes, seconded! Please let us change time limits.
•  » » 2 years ago, # ^ |   +34 For the second point, you can do this via discord itself:Go to the channel settings/permissions and you'll be able to specify permissions for the bot, you can just disable Read Messages.
•  » » » 2 years ago, # ^ |   +10 Noted, thanks for the tip!
•  » » 2 years ago, # ^ |   +17 Thanks for the suggestions, I'll definitely try to implement them, and as Mohammad_Yasser suggested, its better to manually remove read messages permission for channels where you don't want the bot to send messages.
 » 2 years ago, # | ← Rev. 6 →   0 Is anyone at the brink of getting specialist rank (Yes, I am a noob) interested in competing with me on discord? Please check my profile. If you think you are in the same ballpark and would like to actively compete message me either on CF or Discord (username: Anoubhav). I have a server ready with the bot.Edit 1: If the bot can track the number of wrong submissions before accepted and penalize accordingly (e.g., 10% penalty) that will be more similar to competitions. Also, as mentioned earlier, if the window can be more than 45 mins, that will be more useful for beginners as solving 5 questions will take more time than that.Edit 2: I have tried it out. It's really awesome!. One more suggestion: As '.match update' keeps track of time, can you also mention the submission times of the participants for accepted solutions? We only receive the following output at the end of the game: Match over, @ABC has defeated @XYZ Final score 0 — 600 If we can get the submission times, knowing how close the loser was to getting points adds to the thrill and provides a better summary for the end of the game.Edit 3: If you can keep track of the previous matches win tally for two users. Something like Command: '.leaderboard cf-handle-1 cf-handle-2'. Output: 9-12
•  » » 2 years ago, # ^ |   0 u didn't invite me in yr group
 » 2 years ago, # |   +59 Great! I have a few suggestions: Maybe instead of changing the first name, it'd be better to submit a compilation error to a given problem? Don't know, it's up for you. Change "questions" to "problems"/"tasks"!!!
 » 2 years ago, # |   +82 Checked. Nice, recommended.
 » 2 years ago, # | ← Rev. 2 →   +8 Hey, I and GrandDaddy did a match but there was a problem which we had both solved earlier. Can you update it such that it won't show the problems we had solved earlier ?If you had already implemented something to prevent this, then it might be the error due to the same problem having different index in a Div1 and Div2 contest. In our case :- We both had solved https://codeforces.com/contest/1341/problem/D But the bot put the problem https://codeforces.com/contest/1340/problem/B in the match.
•  » » 2 years ago, # ^ |   +7 Thanks, fixed (hopefully)
 » 2 years ago, # | ← Rev. 2 →   +5 I have some suggestion pseudocoder10.please add some sort of tag filter for problems, for example i'd like the first problem to have tags A, B and C then i want the second problem to not to have tags X, Y and Z.Also having more freedom on problems' difficulty is appreciated. Also its nice to be able to schedule the competition, change it's length, change the scores and so on. Also being able to set a deadline for each problem sounds interesting (then solving a problem after it's deadline won't give any points).You can also add $1$ v.s. $1$ v.s. $1$ competition, $2$ v.s. $2$ competition and etc. In other words a $w_1$ v.s. $w_2$ v.s. $\ldots$ v.s. $w_k$ competition.
•  » » 2 years ago, # ^ |   +17 The idea for tag filters for each individual problem sounds a bit overkill for this format, but you can submit an issue for it. For the second part, allowing users to set time/number of problems/rating/score distribution is already on the To-Do list.
 » 2 years ago, # | ← Rev. 2 →   0 Does .handle identify < username> not work if it's sent by another bot??I created my own bot to compete with (in nodejs), but I was unable to identify the handle. Although it was working well when any other USER was trying. So, is the identifying disabled for bots??Well, I did that because I wanted to practice some mixed set of questions rather than competing directly with other users.. Basically competing with, and against myself for the time being.Please tell me if there's already a way possible to do it. Thanks.P.s. I don't know much about discord, I was just trying to implement my own thing.
•  » » 2 years ago, # ^ |   +3 No, .handle identify wont work with bots. If you really wanna do that, make a discord alt and challenge it.
•  » » » 2 years ago, # ^ |   0 I'm doing it that way but I also wanted the .accept challenge thing to be automated. Nvm I'll continue doing it like that, and thanks for the bot!
 » 2 years ago, # |   0 can many people play at same time
•  » » 2 years ago, # ^ |   0 Yes
 » 23 months ago, # | ← Rev. 2 →   0 can more than two people participate in this contest formation?? if yes,then command i should use,please clarify......
•  » » 23 months ago, # ^ |   0 You can't do that, this bot only supports 1v1 matches. You could probably clone the bot and modify the code to support different formations, though.
•  » » » 23 months ago, # ^ |   0 I have no idea about how to do all this...can u help
 » 19 months ago, # | ← Rev. 2 →   +8 very nice bot..I love this bot..I like doing duels on errichto's server..and we have this bot..which is super cool
 » 14 months ago, # |   0 Can you add the possibility of choosing a topic for problems please.