refactor stan
This commit is contained in:
+10
@@ -1,5 +1,6 @@
|
||||
""" Stan's commands and reactions. """
|
||||
import random
|
||||
from time import sleep
|
||||
from .config import bot, types
|
||||
from .filters import is_white, is_nongrata
|
||||
|
||||
@@ -10,6 +11,15 @@ def speak(chance_of):
|
||||
return random.choice([i.rstrip() for i in open('Stan.txt', 'r', encoding='utf8') if i])
|
||||
|
||||
|
||||
def send_quote(after_sec, message, quote):
|
||||
""" Pretend Reading, pretend Typing, send. """
|
||||
if message.text:
|
||||
sleep(len(message.text) * 0.13 / 4) # Reading time is quarter of the same text writing time
|
||||
bot.send_chat_action(message.chat.id, action='typing')
|
||||
sleep(after_sec) # Typing time
|
||||
bot.send_message(message.chat.id, quote)
|
||||
|
||||
|
||||
@bot.message_handler(func=is_white, commands=['add'])
|
||||
def add_stan_quote(message):
|
||||
if message.reply_to_message and message.reply_to_message.text:
|
||||
|
||||
Reference in New Issue
Block a user