Ещё исправлен баг с пустым файлом

main
none 10 months ago
parent f61780d659
commit 4cf78765c5

@ -45,14 +45,23 @@ def check(bot, own_id):
reviews = [] reviews = []
for review in soup.find_all("div", class_="content"): for review in soup.find_all("div", class_="content"):
reviews.append(review.get_text()) reviews.append(review.get_text())
try:
reviews.pop(0) reviews.pop(0)
except:
pass
# Check if new rev # Check if new rev
try:
old_reviews = read() old_reviews = read()
except:
old_reviews = []
for rev in reviews: for rev in reviews:
if rev not in old_reviews: if rev not in old_reviews:
new = f"{telebot.formatting.hcode(f'https://ss14top.404.mn/{i}')} \n\n{rev}" new = f"{telebot.formatting.hcode(f'https://ss14top.404.mn/{i}')} \n\n{rev}"
try:
bot.send_message(own_id, new, parse_mode="HTML") bot.send_message(own_id, new, parse_mode="HTML")
except:
bot.send_message(own_id, new)
# Write to reviews # Write to reviews
reviews = old_reviews + reviews reviews = old_reviews + reviews

@ -64,7 +64,7 @@ def deny(message):
@bot.message_handler(func=lambda message: True) @bot.message_handler(func=lambda message: True)
def echo_message(message): def echo_message(message):
global own_id global own_id
bot.send_message(own_id, f"Пользователь: {telebot.util.user_link(message.from_user)} \nTG: @{message.from_user.username} \nID: {telebot.formatting.hcode(str(message.chat.id))} \n\nНик: {message.text}", parse_mode="HTML") bot.send_message(own_id, f"Пользователь: {telebot.util.user_link(message.from_user)} \nTG: @{message.from_user.username} \nID: {telebot.formatting.hcode(str(message.chat.id))} \n\nНик: {telebot.formatting.hcode(message.text)}", parse_mode="HTML")
bot.reply_to(message, "Ваши данные отправлены на модерацию.\nПодождите, пожалуйста.") bot.reply_to(message, "Ваши данные отправлены на модерацию.\nПодождите, пожалуйста.")

Loading…
Cancel
Save