Implement "special games" game check for badge handling
This commit is contained in:
1 parent
7ad84d5b5f
commit
165f9eccb3
3 files changed
+21
-9
No files matched your search
@@ -981,16 +981,21 @@ class Twitch:
|
||||
"""
|
||||
Determines if the given channel qualifies as a watching candidate.
|
||||
"""
|
||||
if not self.wanted_games:
|
||||
return False
|
||||
# exit early if stream is offline or drops aren't enabled
|
||||
if not channel.online or not channel.drops_enabled:
|
||||
return False
|
||||
# check if we can progress any campaign for the played game
|
||||
if channel.game is None or channel.game not in self.wanted_games:
|
||||
# exit early if stream is offline
|
||||
if not channel.online:
|
||||
return False
|
||||
for campaign in self.inventory:
|
||||
if campaign.can_earn(channel):
|
||||
if (
|
||||
campaign.can_earn(channel) # let the campaign do the "special games" check
|
||||
and (
|
||||
# limit watching to the games the user wants
|
||||
channel.game is not None
|
||||
and channel.drops_enabled
|
||||
and channel.game in self.wanted_games
|
||||
# let the campaign ignore all channel-related checks
|
||||
or campaign.game.is_special_events()
|
||||
)
|
||||
):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
Reference in new issue
Block a user