For someone not knowing that game: ELI5?
The Legends is among us
Submitted 1 day ago by Stamets@lemmy.world to [deleted]
https://lemmy.world/pictrs/image/62b784c4-6b13-46f8-acb1-2548bcd02fd2.png
Comments
Treczoks@lemmy.world 1 hour ago
Ghostalmedia@lemmy.world 1 day ago
Needs smaller blurrier code. I can still read half of it.
sjmarf@sh.itjust.works 1 day ago
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')
Pnut@lemm.ee 1 day ago
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.
Alteon@lemmy.world 19 hours ago
I tried playing it while unemployed. Did not click with me. At all. I just don’t get it.
kogasa@programming.dev 8 hours ago
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.
drunkpostdisaster@lemmy.world 13 hours ago
Good. I don’t think I have seen anyout actually have fun playing that game.
ximtor@lemm.ee 8 hours ago
Thats not true!! I used to have fun! At least 4 games in 2000+ over 12 years were definitely fun!!
Baguette@lemmy.blahaj.zone 13 hours ago
Arenas was fun because it took the worst parts of league out and is a 2 player team gamemode
Too bad they took it away
capuccino@lemmy.world 1 day ago
lmao discord bots can be that intrusive?
Cenotaph@mander.xyz 1 day ago
Discord has a feature that broadcasts games you play to your friends at all times, and many people leave the feature on.
chatokun@lemmy.dbzer0.com 18 hours ago
I turned em off when my boss at the time noticed I was always playing FFXIV. I wasn’t always actually playing, I used to leave it open almost all the time. Why was my boss and I in the same discord? This was early COVID and we used a discord to shoot the shit. Also almost all of us games, including said boss, and I probably wouldn’t have really gotten in trouble anyway, but I just explained I leave it open a lot and he accepted that without qualm.
interdimensionalmeme@lemmy.ml 1 day ago
I would not even let other user even know my username.
thermal_shock@lemmy.world 22 hours ago
Oh, this is more people sharing what they’re playing than actually playing the game. Lol
Nindelofocho@lemmy.world 1 day ago
I think its called Discord Rich Presence? If anyone is looking to turn it off. I think you can turn it off for specific games too
TheSambassador@lemmy.world 1 day ago
If the server owner gives the bot access to those permissions and the users have activity sharing enabled, yep.
ceenote@lemmy.world 1 day ago
30 minutes? Seems lenient. Can discord detect if League is installed?
pineapplelover@lemm.ee 1 day ago
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)
msage@programming.dev 1 day ago
this would also ban valorant players
Good.
RandomVideos@programming.dev 1 day ago
if theres a Riot Games account installed
How?
arudesalad@sh.itjust.works 1 day ago
It can but I think it’s only client side (for their buggy overlay). Not something bots can access
underscores@lemmy.zip 1 day ago
nested lonely ifs?
someone execute this man at once
CannedYeet@lemmy.world 2 hours ago
I worked with chatgpt to since I’m not a python dev, and this is what I came up with
from time import time class PlaySession: def __init__(self, data: dict): self.guild_id = int(data['guild_id']) self.user_id = int(data['user_id']) self.timestamp = data['time'] def is_longer_than_half_hour(self) -> bool: return self.timestamp + 1800 < time() async def resolve_member(self, bot) -> "discord.Member | None": guild = bot.get_guild(self.guild_id) return guild.get_member(self.user_id) if guild else None @staticmethod def is_playing_league(member) -> bool: activity = getattr(member, 'activity', None) name = getattr(activity, 'name', None) return name and name.lower() == "league of legends" async def ban_for_league(member): 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") async def process_entries(bot, entry_dicts): sessions = [PlaySession(d) for d in entry_dicts if PlaySession(d).is_longer_than_half_hour()] for session in sessions: member = await session.resolve_member(bot) if member and PlaySession.is_playing_league(member): await ban_for_league(member)
Jankatarch@lemmy.world 1 day ago
There are two types of programmers.
// comment1 if(condition1) { // comment2 if(condition2) { // comment3 if(condition3) { printf("hello, world\n"); } } }
and
// comment1 if(!condition!) { return; } // comment2 if(!condition2) { return; } // comment3 if(!condition3) { return; } printf("hello, world\n");
rothaine@lemm.ee 1 day ago
if (condition && condition1 && condition2)
ICastFist@programming.dev 1 day ago
// comment if(x < 10) { // comment1 if(x < 20) { // comment2 if(x < 30) { printf("hello, world\\n"); } } }
veganpizza69@lemmy.world 20 hours ago
Add the
else
branches to the nested version and log the failed conditions (to make it more obvious).undefined@lemmy.hogru.ch 1 day ago
I’m so the latter. The former drives me fucking crazy.
interdimensionalmeme@lemmy.ml 1 day ago
if(!condition) { return;}: If(!condition1) {return;}; if(!condition2) {return;};
Tja@programming.dev 16 hours ago
Not only nested ifs. It’s not even correct (doesn’t check for activities existing). And it’s not even pythonic (ask for forgiveness, not for permission). Just access the thing, catch the exception and be done with it.
REDACTED@infosec.pub 1 day ago
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
Dicska@lemmy.world 1 day ago
It’s especially spicy when you consider that one single normal League match can easily extend beyond 30 minutes. Hell, even a lighter mode (ARAM) can be 30-35+ minutes at times.
Lemminary@lemmy.world 13 hours ago
Brawl is 15 minutes. Get it while you can.
M137@lemmy.world 1 day ago
Should be: if you play LoL at all you get banned.
IDew@lemm.ee 1 day ago
AMONG US
NONE_dc@lemmy.world 1 day ago
Is that GDScript (Godot Engine) or Python?
felsiq@lemmy.zip 1 day ago
It seems to match the discord bot api from python and that’d be a more logical choice for a bot lol
NONE_dc@lemmy.world 1 day ago
That bot can recognize GDScript? Or can confuse it with Python? (Since both languages are very similar in some respects)
OsrsNeedsF2P@lemmy.ml 1 day ago
GDScript is heavily inspired by Python’s syntax, but has a few differences with typing and string formatting. This code is Python but tbh would probably run on Godot
RandomVideos@programming.dev 1 day ago
Unless you are using gdscript in a different code editor than godot, it would look different
CommanderCloon@lemmy.ml 1 day ago
GDScript really does read like Python haha
StellarSt0rm@lemmy.world 1 hour ago
The nesting is insane on that code, please use early returns 😭