Fixed condition causing error if not pack are available

This commit is contained in:
Pascal P. 2026-08-07 20:52:50 +02:00
parent 81bd4d0d2b
commit 4260f78d95
2 changed files with 3 additions and 2 deletions

View File

@ -1,7 +1,7 @@
TODO: TODO:
- [x] Schedule opening - [x] Schedule opening
- [ ] Notification - [x] Notification
- [ ] Complete API (for selling) - [ ] Complete API (for selling)
- [ ] Add a scoring for cards pulled - [ ] Add a scoring for cards pulled
- [ ] Multiusers - [ ] Multiusers

View File

@ -58,8 +58,9 @@ class App:
datetime.now(tz=timezone.utc) - packs_last_regen_at datetime.now(tz=timezone.utc) - packs_last_regen_at
) )
if packs_remaining == 10 or next_pack_in < timedelta(seconds=20): if packs_remaining == 10 or (packs_remaining == 9 and next_pack_in < timedelta(seconds=20)):
packs_remaining, packs_last_regen_at, cards = user.pull() packs_remaining, packs_last_regen_at, cards = user.pull()
logger.info("{} pulled {}", d.username, ", ".join([card.name for card in cards]))
content = "" content = ""
for card in cards: for card in cards:
content += "- %s [%s](%s)\n" % (card.rarity.icon, card.name, card.url) content += "- %s [%s](%s)\n" % (card.rarity.icon, card.name, card.url)