From 0311d961f26b4210aa122d344ba8578b6d107bcc Mon Sep 17 00:00:00 2001 From: lulzette Date: Wed, 1 May 2024 14:38:52 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A2=D0=B5=D0=BF=D0=B5=D1=80=D1=8C=20=D0=B2?= =?UTF-8?q?=20=D0=BA=D0=BE=D0=BD=D1=84=D0=B8=D0=B3=D0=B5=20=D0=B5=D1=81?= =?UTF-8?q?=D1=82=D1=8C=20=D0=BF=D0=B0=D1=80=D0=B0=D0=BC=D0=B5=D1=82=D1=80?= =?UTF-8?q?=20-=20=D1=83=D0=B4=D0=B0=D0=BB=D1=8F=D1=82=D1=8C=20=D0=B8?= =?UTF-8?q?=D0=BB=D0=B8=20=D0=BD=D0=B5=20=D1=83=D0=B4=D0=B0=D0=BB=D1=8F?= =?UTF-8?q?=D1=82=D1=8C=20=D0=BE=D0=BF=D0=BE=D0=B2=D0=B5=D1=89=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 ++- main.py | 13 +++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 204b81c..80d3cc4 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ venv-pg output.log* msgid tmppic.jpg -venv \ No newline at end of file +venv +__pycache__/ diff --git a/main.py b/main.py index 3114621..45b49f6 100755 --- a/main.py +++ b/main.py @@ -102,12 +102,13 @@ def no_stream_msg_worker(): # Если пустой - удаляем os.remove('msgid') else: - # Если не пустой, то удаляем сообщение по айдишнику - try: - # Удаляем сообщение - edit_msg = bot.delete_message(config_python.tgchat, int(msgid)) - except telebot.apihelper.ApiTelegramException as e: - log.error(e) + if config_python.delete_msg: + # Если не пустой, то удаляем сообщение по айдишнику + try: + # Удаляем сообщение + edit_msg = bot.delete_message(config_python.tgchat, int(msgid)) + except telebot.apihelper.ApiTelegramException as e: + log.error(e) # В конце удаляем айди сообщения os.remove('msgid')