bug fix, reduce Stan speak chance, remove holidays
This commit is contained in:
+3
-2
@@ -291,7 +291,8 @@ def send_stats(message: types.Message):
|
||||
|
||||
def send_quote(after_sec, message, quote):
|
||||
""" Imitate Reading first, then imitate Typing. """
|
||||
sleep(len(message.text) * 0.13 / 4) # Reading time is quarter of the same text writing time
|
||||
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)
|
||||
@@ -311,7 +312,7 @@ def handle_msg(message: types.Message):
|
||||
else:
|
||||
s['Messages'][message.from_user.id]['Count'] += 1
|
||||
|
||||
quote = stan.speak(22)
|
||||
quote = stan.speak(25)
|
||||
if quote:
|
||||
threading.Thread(target=send_quote, args=(len(quote) * 0.13, message, quote)).start()
|
||||
|
||||
|
||||
+4
-5
@@ -4,20 +4,19 @@ import logging
|
||||
from telebot import TeleBot, logger
|
||||
from dotenv import load_dotenv
|
||||
|
||||
logging.basicConfig(level=logging.INFO, format='%(message)s')
|
||||
logging.warning('>>> PYBOT STARTED!')
|
||||
|
||||
logging.basicConfig(level=logging.INFO, format='%(asctime)s %(message)s', datefmt='%Y.%m.%d %H:%M:%S')
|
||||
logging.critical('STAN STARTED!')
|
||||
|
||||
logger.setLevel(logging.INFO)
|
||||
load_dotenv()
|
||||
|
||||
TOKEN = os.environ.get('LUTZPYBOT', 'Token not in ENVIRON')
|
||||
bot = TeleBot(TOKEN, 'HTML', disable_web_page_preview=True, allow_sending_without_reply=True,
|
||||
num_threads=3, colorful_logs=True)
|
||||
colorful_logs=True)
|
||||
|
||||
DATA = 'data/chat'
|
||||
|
||||
ADMIN_ID = 280887861 # Rykov7
|
||||
ADMIN_ID = 280887861 # Rykov7
|
||||
PYTHONCHATRU = -1001338616632 # pythonchatru
|
||||
|
||||
URL_RX = re.compile(r'\w+\.\w+/\w+')
|
||||
|
||||
Reference in New Issue
Block a user