Attempt to prevent "service error"s
This commit is contained in:
1 parent
9a6a420835
commit
21ad099696
1 file changed
+9
-2
+9
-2
@@ -4,7 +4,7 @@ import re
|
|||||||
from itertools import chain
|
from itertools import chain
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
from functools import cached_property
|
from functools import cached_property
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timedelta, timezone
|
||||||
|
|
||||||
from channel import Channel
|
from channel import Channel
|
||||||
from constants import GQL_OPERATIONS, URLType
|
from constants import GQL_OPERATIONS, URLType
|
||||||
@@ -116,7 +116,14 @@ class BaseDrop:
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def can_claim(self) -> bool:
|
def can_claim(self) -> bool:
|
||||||
return self.claim_id is not None
|
# https://help.twitch.tv/s/article/mission-based-drops?language=en_US#claiming
|
||||||
|
# "If you are unable to claim the Drop in time, you will be able to claim it
|
||||||
|
# from the Drops Inventory page until 24 hours after the Drops campaign has ended."
|
||||||
|
return (
|
||||||
|
self.claim_id is not None
|
||||||
|
and not self.is_claimed
|
||||||
|
and datetime.now(timezone.utc) < self.campaign.ends_at + timedelta(hours=24)
|
||||||
|
)
|
||||||
|
|
||||||
def _on_claim(self) -> None:
|
def _on_claim(self) -> None:
|
||||||
invalidate_cache(self, "preconditions_met")
|
invalidate_cache(self, "preconditions_met")
|
||||||
|
|||||||
Reference in new issue
Block a user