this post was submitted on 13 Jun 2025
581 points (97.9% liked)

Lemmy Shitpost

32357 readers
3652 users here now

Welcome to Lemmy Shitpost. Here you can shitpost to your hearts content.

Anything and everything goes. Memes, Jokes, Vents and Banter. Though we still have to comply with lemmy.world instance rules. So behave!


Rules:

1. Be Respectful


Refrain from using harmful language pertaining to a protected characteristic: e.g. race, gender, sexuality, disability or religion.

Refrain from being argumentative when responding or commenting to posts/replies. Personal attacks are not welcome here.

...


2. No Illegal Content


Content that violates the law. Any post/comment found to be in breach of common law will be removed and given to the authorities if required.

That means:

-No promoting violence/threats against any individuals

-No CSA content or Revenge Porn

-No sharing private/personal information (Doxxing)

...


3. No Spam


Posting the same post, no matter the intent is against the rules.

-If you have posted content, please refrain from re-posting said content within this community.

-Do not spam posts with intent to harass, annoy, bully, advertise, scam or harm this community.

-No posting Scams/Advertisements/Phishing Links/IP Grabbers

-No Bots, Bots will be banned from the community.

...


4. No Porn/ExplicitContent


-Do not post explicit content. Lemmy.World is not the instance for NSFW content.

-Do not post Gore or Shock Content.

...


5. No Enciting Harassment,Brigading, Doxxing or Witch Hunts


-Do not Brigade other Communities

-No calls to action against other communities/users within Lemmy or outside of Lemmy.

-No Witch Hunts against users/communities.

-No content that harasses members within or outside of the community.

...


6. NSFW should be behind NSFW tags.


-Content that is NSFW should be behind NSFW tags.

-Content that might be distressing should be kept behind NSFW tags.

...

If you see content that is a breach of the rules, please flag and report the comment and a moderator will take action where they can.


Also check out:

Partnered Communities:

1.Memes

2.Lemmy Review

3.Mildly Infuriating

4.Lemmy Be Wholesome

5.No Stupid Questions

6.You Should Know

7.Comedy Heaven

8.Credible Defense

9.Ten Forward

10.LinuxMemes (Linux themed memes)


Reach out to

All communities included on the sidebar are to be made in compliance with the instance rules. Striker

founded 2 years ago
MODERATORS
 
top 50 comments
sorted by: hot top controversial new old
[โ€“] StellarSt0rm@lemmy.world 6 points 7 hours ago

The nesting is insane on that code, please use early returns ๐Ÿ˜ญ

[โ€“] Treczoks@lemmy.world 3 points 8 hours ago

For someone not knowing that game: ELI5?

[โ€“] drunkpostdisaster@lemmy.world 6 points 20 hours ago (2 children)

Good. I don't think I have seen anyout actually have fun playing that game.

[โ€“] ximtor@lemm.ee 5 points 15 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 4 points 19 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

[โ€“] Ghostalmedia@lemmy.world 161 points 2 days ago (1 children)

Needs smaller blurrier code. I can still read half of it.

[โ€“] sjmarf@sh.itjust.works 100 points 2 days ago (1 children)

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')
[โ€“] Ghostalmedia@lemmy.world 61 points 2 days ago (1 children)

Bruh. I said I wanted it worse.

[โ€“] Denvil@lemmy.ml 106 points 2 days ago (2 children)

Here's it in 1x1 resolution:

.

That's not code, that's a picture of a sheep! This code is most dark!

[โ€“] M137@lemmy.world 10 points 1 day ago

Should be: if you play LoL at all you get banned.

[โ€“] Pnut@lemm.ee 48 points 1 day ago (1 children)

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 5 points 1 day ago (1 children)

I tried playing it while unemployed. Did not click with me. At all. I just don't get it.

[โ€“] kogasa@programming.dev 5 points 15 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.

[โ€“] underscores@lemmy.zip 31 points 2 days ago (4 children)

nested lonely ifs?

someone execute this man at once

[โ€“] CannedYeet@lemmy.world -1 points 8 hours ago* (last edited 8 hours ago)

I worked with chatgpt 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)
[โ€“] Tja@programming.dev 3 points 23 hours ago* (last edited 23 hours ago)

Not only nested ifs. It's not even correct (doesn't check for activity 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.

[โ€“] Jankatarch@lemmy.world 20 points 1 day ago* (last edited 1 day ago) (5 children)

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.

[โ€“] rothaine@lemm.ee 30 points 1 day ago (1 children)
if (condition && condition1 && condition2)
[โ€“] kernelle@0d.gs 5 points 1 day ago (2 children)

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.

[โ€“] fushuan@lemmy.blahaj.zone 4 points 20 hours ago

The language is python and it has short circuiting aka in an and condition, if the first block isn't fulfilled the second one isn't tested because it's unnecessary.

Same with or and the reverse.

[โ€“] rothaine@lemm.ee 10 points 1 day ago (1 children)

Not in a language with short circuiting.

[โ€“] kernelle@0d.gs 2 points 1 day ago (1 children)

Could've sworn I've had this issue before! Maybe not with python

[โ€“] rothaine@lemm.ee 4 points 1 day ago

Yeah not all languages do it. I find it rather convenient though

[โ€“] veganpizza69@lemmy.world 2 points 1 day ago

Add the else branches to the nested version and log the failed conditions (to make it more obvious).

[โ€“] ICastFist@programming.dev 8 points 1 day ago (2 children)
// comment
if(x < 10) {
  // comment1
  if(x < 20) {
    // comment2
    if(x < 30) {
      printf("hello, world\\n");
    }
  }
}
[โ€“] Jankatarch@lemmy.world 10 points 1 day ago

"Yeah x might be less than 10 but just in case check if it's less than 30."

[โ€“] underscores@lemmy.zip 4 points 1 day ago* (last edited 1 day ago)

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

load more comments (2 replies)
load more comments (1 replies)
[โ€“] capuccino@lemmy.world 36 points 2 days ago (2 children)

lmao discord bots can be that intrusive?

[โ€“] Cenotaph@mander.xyz 91 points 2 days ago (4 children)

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 3 points 1 day ago* (last edited 1 day 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 gamed, 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 6 points 1 day ago (1 children)

I would not even let other user even know my username.

[โ€“] DaPorkchop_@lemmy.ml 7 points 1 day ago (1 children)

I think that's called Omegle.

[โ€“] whimsy@lemmy.zip 1 points 7 hours ago

Sadly, it's joever

[โ€“] thermal_shock@lemmy.world 1 points 1 day ago* (last edited 1 day ago) (1 children)

Oh, this is more people showing what they're playing than actually playing the game. Lol

[โ€“] Cenotaph@mander.xyz 2 points 1 day ago (1 children)

Yes. Discord does have a screen-sharing feature but the one I was talking about is more of a "now playing"

I fixed it. I have mine disabled to not be bothered lol.

[โ€“] Nindelofocho@lemmy.world 1 points 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 11 points 2 days ago

If the server owner gives the bot access to those permissions and the users have activity sharing enabled, yep.

[โ€“] Dicska@lemmy.world 22 points 1 day ago (1 children)

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 2 points 20 hours ago

Brawl is 15 minutes. Get it while you can.

[โ€“] ceenote@lemmy.world 31 points 2 days ago* (last edited 2 days ago) (2 children)

30 minutes? Seems lenient. Can Discord detect if League is installed?

[โ€“] pineapplelover@lemm.ee 20 points 2 days ago (5 children)

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 27 points 2 days ago (1 children)

this would also ban valorant players

Good.

load more comments (1 replies)
load more comments (4 replies)
load more comments (1 replies)
load more comments
view more: next โ€บ