Skip to content

Commit

Permalink
Added azw and prc to formats to be converted
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielRF committed Nov 11, 2023
1 parent cfbfe11 commit d53442f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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]
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down
3 changes: 3 additions & 0 deletions send.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit d53442f

Please sign in to comment.