optimize code

master
Aevann 2024-06-04 13:19:36 +03:00
parent c856507dfb
commit 5ef0143375
1 changed files with 1 additions and 3 deletions

View File

@ -30,11 +30,9 @@ def check_for_treasure(from_comment, in_text):
if amount != 0:
if amount > 0:
active_lottery = get_active_lottery()
lottery_tickets_seed = random.randint(1, 100)
lottery_tickets_instead = lottery_tickets_seed <= lotterizer_rate
if active_lottery and lottery_tickets_instead:
if lottery_tickets_instead and get_active_lottery():
ticket_count = floor(amount / LOTTERY_TICKET_COST)
grant_lottery_tickets_to_user(user, ticket_count)
from_comment.treasure_amount = f'l{ticket_count}'