diff --git a/src/commands.py b/src/commands.py index 968ed19..047f7f1 100644 --- a/src/commands.py +++ b/src/commands.py @@ -385,3 +385,10 @@ async def handle_msg(message: types.Message): """Count messages, Stan.""" update_stats(message) await act(message) + + +@bot.message_handler(content_types=["text", "sticker", "photo", "animation", "video", "audio", "document"], + chat_types=["private"]) +async def handle_all_msg(message: types.Message): + """Личка выводится в лог.""" + logging.info(LOG_COMM % ('PM', message.from_user.id, message.from_user.full_name, message.text)) diff --git a/src/webhook.py b/src/webhook.py index 1a7929e..be1f2f8 100644 --- a/src/webhook.py +++ b/src/webhook.py @@ -1,3 +1,4 @@ +import asyncio import logging import telebot @@ -15,6 +16,6 @@ async def webhook(update: dict): """Parse POST requests from Telegram.""" if update: update = telebot.types.Update.de_json(update) - await bot.process_new_updates([update]) + asyncio.ensure_future(bot.process_new_updates([update])) else: return None