Make get_active_drop take channel game into account
This commit is contained in:
1 parent
eb1dc1356b
commit
0d990094c2
1 file changed
+9
-3
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user