Needs smaller blurrier code. I can still read half of it.
For your viewing pleasure:
for entry in entries: if entry['time'] + 1800 < time(): guild = self._bot.get_guild(int(entry['guild_id'])) member = guild.get_member(int(entry['user_id'])) if member is not None: if member.activity.name is not None: if member.activity.name.lower() == "league of legends": await member.send("The 30 minutes has elapsed and you are still playing league, get banned.") await member.ban(delete_message_days=0, reason='playing league')
Bruh. I said I wanted it worse.
Here’s it in 1x1 resolution:
.
Better
That’s not code, that’s a picture of a sheep! This code is most dark!
nested lonely ifs?
someone execute this man at once
There are two types of programmers.
// comment if(condition) { // comment1 if(condition1) { // comment2 if(condition2) { printf("hello, world\\n"); } } }
and
// comment if(!condition) { return; } // comment1 if(!condition1) { return; } // comment2 if(!condition2) { return; } printf("hello, world\\n");
And one is objectively correct.
// comment if(x < 10) { // comment1 if(x < 20) { // comment2 if(x < 30) { printf("hello, world\\n"); } } }
“Yeah x might be less than 10 but just in case check if it’s less than 30.”
This is the cursed case when you case the forbidden scroll of the ancients: switch (true) { }
edit: on second thought I’m not sure now I’ll have to think about how fall through cases work
if (condition && condition1 && condition2)
The problem with this in the OP is the first ‘if’ checks if the object exists and the second gets a property of said object only if the original object exists.
I’m not saying the OP is good code, but chaining them like this would result in exceptions.
Not in a language with short circuiting.
Correct me if I’m wrong, but the script works faster with nested IFs since if it fails at the first one, it won’t bother reading next ones, unless you kill/return from function.
All in all, this feels like readibility argument, not correctness or efficienty argument
I had a roomie that played lol. After a month of not having a job and looking very scruffy he emerged from his filthy bedroom and gave me a grocery list. We were on good terms until I told him he had an addiction.
I tried playing it while unemployed. Did not click with me. At all. I just don’t get it.
It’s got a very high barrier to entry. You kinda have to suffer through it for a while before you get it. And then you unlock a totally different kind of suffering.
30 minutes? Seems lenient. Can Discord detect if League is installed?
No but maybe it can detect if >0 minutes are played or if there’s a Riot Games account installed (but this would also ban valorant players)
this would also ban valorant players
Good.
lmao discord bots can be that intrusive?
Discord has a feature that broadcasts games you play to your friends at all times, and many people leave the feature on.