add readme && update for stable
This commit is contained in:
+2
-2
@@ -115,7 +115,7 @@ class Admin:
|
||||
|
||||
return wrapper
|
||||
|
||||
@bot.message_handler(commands=["admin"])
|
||||
@bot.message_handler(commands=["admin_reg"])
|
||||
def add_admin_command(message):
|
||||
bot.send_message(message.chat.id, "Введите unique_key")
|
||||
bot.register_next_step_handler(message, Admin.add_admin_step)
|
||||
@@ -346,7 +346,7 @@ class AdminMessages:
|
||||
ADMIN_HELP = (
|
||||
"Вы администратор! Вот что вы можете сделать:\n"
|
||||
"/remove_admin - удалить админа\n"
|
||||
"/generate_key - сгенерировать уникальный ключ\n"
|
||||
"/generate_key - сгенерировать уникальный ключ (<code>admin_red</code> - чтобы админ добавился)\n"
|
||||
"/delete_user - удалить пользователя\n"
|
||||
"/stats - статистика\n"
|
||||
"/send_message - отправить всем сообщение\n"
|
||||
|
||||
@@ -1,13 +1,34 @@
|
||||
import telebot
|
||||
from config import config
|
||||
import threading
|
||||
import time
|
||||
|
||||
|
||||
class BotCommands:
|
||||
Start = ["start", "s"]
|
||||
Help = ["help", "h"]
|
||||
Help = ["help", "h", "помощь"]
|
||||
Source = ["source"]
|
||||
|
||||
|
||||
original_send_message = telebot.TeleBot.send_message
|
||||
|
||||
|
||||
def send_message_with_try_catch(self, chat_id, text, *args, **kwargs):
|
||||
try:
|
||||
return original_send_message(self, chat_id, text, *args, **kwargs)
|
||||
except Exception as e:
|
||||
print(f"Error sending message: {e}. Retrying in 5 seconds...")
|
||||
|
||||
try:
|
||||
time.sleep(5)
|
||||
|
||||
return original_send_message(self, chat_id, text, *args, **kwargs)
|
||||
except Exception as e:
|
||||
print(f"Second attempt failed: {e}")
|
||||
|
||||
|
||||
telebot.TeleBot.send_message = send_message_with_try_catch
|
||||
|
||||
bot = telebot.TeleBot(
|
||||
config.API_TOKEN,
|
||||
colorful_logs=True,
|
||||
|
||||
@@ -176,10 +176,12 @@ def show_result(message: types.Message):
|
||||
message.chat.id,
|
||||
open(image_path, "rb"),
|
||||
caption=text,
|
||||
show_caption_above_media=True,
|
||||
)
|
||||
else:
|
||||
print("Image not found")
|
||||
|
||||
bot.send_message(message.chat.id, TestMessages.TEST_FINISH)
|
||||
bot.send_message(message.chat.id, Messages.START_DATE)
|
||||
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user