gurkult / gurkbot

Our community bot, used for running the server.
MIT License
18 stars 16 forks source link

New Feature Idea: Command to send random, small programming challenges from codewars.com #94

Open ShakyaMajumdar opened 3 years ago

ShakyaMajumdar commented 3 years ago

I think this could be a fun feature; if someone invokes a command like !kata the bot sends a random kata from a db.

I have made a bare-bones implementation as a personal project, you could check it out at https://github.com/ShakyaMajumdar/KataBot/blob/master/bot/exts/challenges.py.

This what it looks like currently: image

v1nam commented 3 years ago

seems good to me :+1:

v1nam commented 3 years ago

but are you storing the challenges manually?

ShakyaMajumdar commented 3 years ago

No; there's a function which I call to update the database of stored challenges.

We could just loop this to be called at specified time intervals automatically

ShakyaMajumdar commented 3 years ago

I had also wanted to include some way to test submissions from users, but unfortunately I couldn't think of any way to extract sample input and output from the API response and all katas don't have examples any way.

v1nam commented 3 years ago

So have you like stored every single challenge there is in a db, and can update with a command, wont that be slow as there are like so many katas? though if we use asyncpg with postgres i think it wouldnt be that slow, if asyncpg doesn't lie about its speed

ShakyaMajumdar commented 3 years ago

I extracted the latest 30 katas everytime I ran !update_kata_db, so I guess considering overlaps there are around 100 katas atm.

I don't think that's so large as to cause performance issues

v1nam commented 3 years ago

Ah alright, seems like a good idea to me, though we would have to wait till we get a db setup

ShakyaMajumdar commented 3 years ago

Fair enough

Maybe json could be a temporary solution?

In that case I might have to put aside my hatred for the format for the time being lol

v1nam commented 3 years ago

no no no no not json :no_good:

ShakyaMajumdar commented 3 years ago

well that's good news I think any other ideas or do we put this on hold till the db gets set up?

v1nam commented 3 years ago

i think we will have to wait for the db :((

ShakyaMajumdar commented 3 years ago

sure, no probs. I'll keep my eyes open on #93 then.

RohanJnr commented 3 years ago

You can except the DB pr by next week, a lil busy with a hackathon this weekend

Arnav-2004 commented 3 years ago

@ShakyaMajumdar would you like to start working on this?