Fix an issue with trying to mine a completed campaign
This commit is contained in:
1 parent
6f3da7b0cc
commit
5e3e7b6f4f
1 file changed
+13
-8
@@ -695,14 +695,19 @@ class Twitch:
|
|||||||
"""
|
"""
|
||||||
if not self.wanted_games:
|
if not self.wanted_games:
|
||||||
return False
|
return False
|
||||||
return (
|
# exit early if
|
||||||
channel.online # stream online
|
if (
|
||||||
and channel.drops_enabled # drops are enabled
|
not channel.online # stream is offline
|
||||||
# it's one of the games we've selected
|
or not channel.drops_enabled # drops aren't enabled
|
||||||
and (game := channel.game) is not None and game in self.wanted_games
|
# there's no game or it's not one of the games we've selected
|
||||||
# we can progress any campaign for the selected game
|
or (game := channel.game) is None or game not in self.wanted_games
|
||||||
and any(campaign.can_earn(channel) for campaign in self.inventory)
|
):
|
||||||
)
|
return False
|
||||||
|
# check if we can progress any campaign for the played game
|
||||||
|
for campaign in self.inventory:
|
||||||
|
if campaign.game == game and campaign.can_earn(channel):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def should_switch(self, channel: Channel) -> bool:
|
def should_switch(self, channel: Channel) -> bool:
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in new issue
Block a user