From 9747e00ab6bd47b53bb0faa10b1d85ed61711bf1 Mon Sep 17 00:00:00 2001 From: Rykov7 Date: Wed, 28 Dec 2022 17:49:20 +0300 Subject: [PATCH] improved naming in stan.py --- app/bot.py | 2 +- app/stan.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/bot.py b/app/bot.py index 866e012..0b777f8 100644 --- a/app/bot.py +++ b/app/bot.py @@ -314,7 +314,7 @@ def handle_msg(message: types.Message): else: s['Messages'][message.from_user.id]['Count'] += 1 - quote = stan.speak(25) + quote = stan.speak(30) if quote: threading.Thread(target=send_quote, args=(len(quote) * 0.13, message, quote)).start() diff --git a/app/stan.py b/app/stan.py index 85e59bb..e477b42 100644 --- a/app/stan.py +++ b/app/stan.py @@ -1,10 +1,10 @@ """ Stan quote generator. """ import random -stan = [i.rstrip() for i in open('Stan.txt', 'r', encoding='utf8')] +quotes = [i.rstrip() for i in open('Stan.txt', 'r', encoding='utf8')] -def speak(chance): - chance = random.randint(0, chance) - if chance == 0: - return random.choice(stan) +def speak(chance_of): + number = random.randint(0, chance_of) + if number == 0: + return random.choice(quotes)