From d53442f6e15f8b524452f199f211c4270ee379f9 Mon Sep 17 00:00:00 2001 From: Gabriel RF Date: Sat, 11 Nov 2023 12:54:57 -0300 Subject: [PATCH] Added azw and prc to formats to be converted --- bot.py | 8 +++++++- send.py | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/bot.py b/bot.py index 07691e0..c0fc1cf 100644 --- a/bot.py +++ b/bot.py @@ -46,6 +46,7 @@ server = Flask(__name__) rabbitmq_con = pika.BlockingConnection(pika.URLParameters(rabbitmqcon)) +#rabbitmq_con = pika.BlockingConnection(pika.ConnectionParameters('localhost')) rabbit = rabbitmq_con.channel() rabbit.queue_declare(queue='Send2KindleBotFast', durable=True) rabbit.queue_declare(queue='Send2KindleBotSlow', durable=True) @@ -69,6 +70,7 @@ def send_mail(data, subject, lang, file_name): locale=lang), parse_mode="HTML", ) rabbitmq_con = pika.BlockingConnection(pika.URLParameters(rabbitmqcon)) + #rabbitmq_con = pika.BlockingConnection(pika.ConnectionParameters('localhost')) rabbit = rabbitmq_con.channel() if ( ".mobi" in data[7] @@ -437,7 +439,9 @@ def get_file(message): message.from_user.id, i18n.t("bot.askfile", locale=user_lang), ) - + return 0 + elif '.onion' in message.text.lower(): + bot.delete_message(message.from_user.id, message.message_id) return 0 file_url = message.text @@ -622,6 +626,8 @@ def generic_msg(message): message.chat.id, i18n.t("bot.filenotfound", locale=user_lang), ) + elif '@' in message.text: + add_email(message) @bot.message_handler(content_types=["document"]) def generic_file(message): diff --git a/send.py b/send.py index 07ae4cf..cf3b1bc 100644 --- a/send.py +++ b/send.py @@ -87,6 +87,8 @@ def process_file(files, user_id): ".mobi" in files[-5:] or ".cbr" in files[-5:] or ".cbz" in files[-5:] + or ".azw" in files[-5:] + or ".prc" in files[-5:] or ".azw3" in files[-5:] ): files = convert_format(files, user_id) @@ -222,6 +224,7 @@ def send_file(rbt, method, properties, data): i18n.set("fallback", "en-us") bot = telebot.TeleBot(TOKEN) rabbitmq_con = pika.BlockingConnection(pika.URLParameters(rabbitmqcon)) + #rabbitmq_con = pika.BlockingConnection(pika.ConnectionParameters('localhost')) rabbit = rabbitmq_con.channel() rabbit.basic_qos(prefetch_count=1) rabbit.basic_consume(queue=sys.argv[1], on_message_callback=send_file)