From 6849a5c8010b0406bffe5f627053c3f34834f5ee Mon Sep 17 00:00:00 2001 From: lulzette Date: Wed, 1 May 2024 16:22:12 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D1=89=D0=B0=D0=B9,=20=D0=BC?= =?UTF-8?q?=D0=B5=D1=80=D0=B7=D0=BA=D0=B8=D0=B9=20config=5Fpython.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/twitch-tgbot | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/twitch-tgbot b/src/twitch-tgbot index 8bfa450..fee310c 100755 --- a/src/twitch-tgbot +++ b/src/twitch-tgbot @@ -50,7 +50,7 @@ def stream_message_worker(data: dict): "Длительность: " + str(stream_duration) # Готовим кнопку - stream_button = types.InlineKeyboardButton('Открыть стрим', url='https://twitch.tv/'+streamer) + stream_button = types.InlineKeyboardButton('Открыть стрим', url='https://twitch.tv/'+config_python.streamer) keyboard = types.InlineKeyboardMarkup() keyboard.add(stream_button) @@ -66,7 +66,7 @@ def stream_message_worker(data: dict): if msgid == 0: # Отправляем новое сообщение - send_message = bot.send_photo(config_python.tgchat, InputFile('tmppic.jpg'), message, reply_markup=keyboard, + send_message = bot.send_photo(config_python.target_tg_chat, InputFile('tmppic.jpg'), message, reply_markup=keyboard, parse_mode='MarkdownV2') print(send_message) msgid = send_message.message_id @@ -77,9 +77,9 @@ def stream_message_worker(data: dict): # Готовим медиа для отправки media = telebot.types.InputMediaPhoto(InputFile('tmppic.jpg')) # Редактируем фотку - edit_msg_media = bot.edit_message_media(media, config_python.tgchat, msgid, reply_markup=keyboard) + edit_msg_media = bot.edit_message_media(media, config_python.target_tg_chat, msgid, reply_markup=keyboard) # Редактируем текст - edit_msg_caption = bot.edit_message_caption(message, config_python.tgchat, msgid, reply_markup=keyboard, + edit_msg_caption = bot.edit_message_caption(message, config_python.target_tg_chat, msgid, reply_markup=keyboard, parse_mode='MarkdownV2') except telebot.apihelper.ApiTelegramException as e: log.error(e) @@ -97,11 +97,11 @@ def no_stream_msg_worker(): # Если пустой - удаляем os.remove('msgid') else: - if config_python.delete_msg: + if config_python.cleanup_msg: # Если не пустой, то удаляем сообщение по айдишнику try: # Удаляем сообщение - edit_msg = bot.delete_message(config_python.tgchat, int(msgid)) + edit_msg = bot.delete_message(config_python.target_tg_chat, int(msgid)) except telebot.apihelper.ApiTelegramException as e: log.error(e) # В конце удаляем айди сообщения @@ -162,8 +162,8 @@ if __name__ == '__main__': log.info("Запущен") config_python = load_config() twitch_client = Twitch(config_python.app_id, config_python.app_secret) - bot = telebot.TeleBot(config_python.tgtoken) + bot = telebot.TeleBot(config_python.tg_token) while True: check_alive() - time.sleep(config_python.period) \ No newline at end of file + time.sleep(config_python.check_period) \ No newline at end of file