From 0d990094c2fe893f7de75f6d66486920fdb81554 Mon Sep 17 00:00:00 2001 From: DevilXD <4180725+DevilXD@users.noreply.github.com> Date: Sat, 21 Jun 2025 20:00:48 +0200 Subject: [PATCH] Make get_active_drop take channel game into account --- twitch.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/twitch.py b/twitch.py index c8cdc7e..07f908b 100644 --- a/twitch.py +++ b/twitch.py @@ -1502,11 +1502,17 @@ class Twitch: if watching_channel is None: # if we aren't watching anything, we can't earn any drops return None + watching_game: Game | None = watching_channel.game + if watching_game is None: + # if the channel isn't playing anything in particular, we can't determine the drop + return None drops: list[TimedDrop] = [] for campaign in self.inventory: - # can be earned on this channel - if (campaign.can_earn(watching_channel)): - # add only the drops we can actually earn + if ( + campaign.game == watching_game + or campaign.has_badge_or_emote + and campaign.can_earn(watching_channel) + ): drops.extend(drop for drop in campaign.drops if drop.can_earn(watching_channel)) if drops: drops.sort(key=lambda d: d.remaining_minutes)