Ещё исправлен баг с пустым файлом
This commit is contained in:
parent
f61780d659
commit
4cf78765c5
15
check_new.py
15
check_new.py
@ -45,14 +45,23 @@ def check(bot, own_id):
|
||||
reviews = []
|
||||
for review in soup.find_all("div", class_="content"):
|
||||
reviews.append(review.get_text())
|
||||
reviews.pop(0)
|
||||
try:
|
||||
reviews.pop(0)
|
||||
except:
|
||||
pass
|
||||
|
||||
# Check if new rev
|
||||
old_reviews = read()
|
||||
try:
|
||||
old_reviews = read()
|
||||
except:
|
||||
old_reviews = []
|
||||
for rev in reviews:
|
||||
if rev not in old_reviews:
|
||||
new = f"{telebot.formatting.hcode(f'https://ss14top.404.mn/{i}')} \n\n{rev}"
|
||||
bot.send_message(own_id, new, parse_mode="HTML")
|
||||
try:
|
||||
bot.send_message(own_id, new, parse_mode="HTML")
|
||||
except:
|
||||
bot.send_message(own_id, new)
|
||||
|
||||
# Write to reviews
|
||||
reviews = old_reviews + reviews
|
||||
|
@ -64,7 +64,7 @@ def deny(message):
|
||||
@bot.message_handler(func=lambda message: True)
|
||||
def echo_message(message):
|
||||
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Подождите, пожалуйста.")
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user