diff --git a/README.md b/README.md index 4ecd325a..38bce777 100644 --- a/README.md +++ b/README.md @@ -11,11 +11,12 @@ A simple telegram bot to download, upload files or folders from [Mega.nz](https: # Features -- Download, Upload files/folders easily ⚡ -- No login required 🙅‍♂️ -- Support for Mega.nz user account 🗃️ -- Support for both private and public content 🤝 -- DDL to mega.nz upload 🖇 +- ⚡ Download, Upload files/folders easily +- 🙅‍♂️ No login required* +- 🗃️ Support for Mega.nz user account +- 🤝 Support for both private and public content +- 🛡 Can be used as either private or public bot +- 🖇 Direct download link to mega.nz upload # Deploy diff --git a/megadl/helpers/crypt.py b/megadl/helpers/crypt.py index 9e575961..1385d3ed 100644 --- a/megadl/helpers/crypt.py +++ b/megadl/helpers/crypt.py @@ -1,7 +1,7 @@ # Copyright (c) 2023 Itz-fork # Author: https://github.com/Itz-fork # Project: https://github.com/Itz-fork/Mega.nz-Bot -# Description: Contains code related to decryption functions +# Description: Decryption functions # Ported from: https://github.com/Itz-fork/pyro-mega.py/blob/master/src/mega/crypto.py diff --git a/megadl/helpers/database.py b/megadl/helpers/database.py index c3fa094b..cc42b05e 100644 --- a/megadl/helpers/database.py +++ b/megadl/helpers/database.py @@ -1,3 +1,8 @@ +# Copyright (c) 2023 Itz-fork +# Author: https://github.com/Itz-fork +# Project: https://github.com/Itz-fork/Mega.nz-Bot +# Description: Database functions + from megadl.lib.aiomongo import AioMongo class Users: diff --git a/megadl/helpers/files.py b/megadl/helpers/files.py index 84c540c7..df0eaace 100644 --- a/megadl/helpers/files.py +++ b/megadl/helpers/files.py @@ -1,7 +1,7 @@ # Copyright (c) 2023 Itz-fork # Author: https://github.com/Itz-fork # Project: https://github.com/Itz-fork/Mega.nz-Bot -# Description: Contains code related to fs functions +# Description: File system functions from time import time from shutil import rmtree diff --git a/megadl/helpers/mclient.py b/megadl/helpers/mclient.py index b7887fc7..25453648 100644 --- a/megadl/helpers/mclient.py +++ b/megadl/helpers/mclient.py @@ -1,7 +1,7 @@ # Copyright (c) 2023 Itz-fork # Author: https://github.com/Itz-fork # Project: https://github.com/Itz-fork/Mega.nz-Bot -# Description: Contains code related to custom pyrogram.Client +# Description: Custom pyrogram client useful methods import os import asyncio @@ -131,7 +131,9 @@ async def fn_run(client: Client, msg: Message): can_use = uid in self.auth_users if not can_use: - await msg.reply("You're not authorized to use this bot 😬") + await msg.reply( + "You're not authorized to use this bot 🙅‍♂️ \n\n**Join @NexaBotsUpdates ❤️**" + ) return msg.stop_propagation() return await func(client, msg) @@ -163,7 +165,7 @@ async def ask(self, chat_id: int, text: str, *args, **kwargs): return await asyncio.wait_for(futr, 60.0) except asyncio.TimeoutError: await self.send_message( - chat_id, "Task was cancelled as you haven't answered for 1 minute" + chat_id, "Task was cancelled as you haven't answered for 1 minute 🥱" ) self.listening.pop(chat_id, None) return None diff --git a/megadl/helpers/sysfncs.py b/megadl/helpers/sysfncs.py index 8f0f2bfb..d5d8a0cd 100644 --- a/megadl/helpers/sysfncs.py +++ b/megadl/helpers/sysfncs.py @@ -1,7 +1,7 @@ # Copyright (c) 2023 Itz-fork # Author: https://github.com/Itz-fork # Project: https://github.com/Itz-fork/Mega.nz-Bot -# Description: Contains functions related to shell, async execution +# Description: Shell, loops and other sys functions from functools import partial diff --git a/megadl/lib/README.md b/megadl/lib/README.md index 6454d8e9..9337103c 100644 --- a/megadl/lib/README.md +++ b/megadl/lib/README.md @@ -1,8 +1,9 @@ # About -Helper extensions for Mega.nz-Bot +Helper libraries for Mega.nz-Bot # Extensions -1. [`megatools`](megatools.py) - Extension for pyrogram bots to interact with megatools cli -2. [`pyros`](pyros.py) - Helper tools for pyrogram -3. [`ddl`](ddl.py) - Download files using direct download links \ No newline at end of file +- [`megatools`](megatools.py) - Wrapper for megatools cli with extended features +- [`aiomongo`](aiomongo.py) - Async wrapper for pymongo's insert, find, update and delete operations +- [`pyros`](pyros.py) - Tools and helper functions related to pyrogram +- [`ddl`](ddl.py) - Downloader for direct download links and gdrive \ No newline at end of file diff --git a/megadl/lib/aiomongo.py b/megadl/lib/aiomongo.py index 4bf79d7a..bd628160 100644 --- a/megadl/lib/aiomongo.py +++ b/megadl/lib/aiomongo.py @@ -1,3 +1,8 @@ +# Copyright (c) 2023 Itz-fork +# Author: https://github.com/Itz-fork +# Project: https://github.com/Itz-fork/Mega.nz-Bot +# Description: Async wrapper for pymongo's insert, find, update and delete operations + from os import getenv from typing import Any from bson.codec_options import TypeRegistry diff --git a/megadl/lib/ddl.py b/megadl/lib/ddl.py index e528ac47..25c29da8 100644 --- a/megadl/lib/ddl.py +++ b/megadl/lib/ddl.py @@ -1,7 +1,7 @@ # Copyright (c) 2023 Itz-fork # Author: https://github.com/Itz-fork # Project: https://github.com/Itz-fork/Mega.nz-Bot -# Description: Helper class for downloading direct download links +# Description: Downloader for direct download links and gdrive import os diff --git a/megadl/lib/megatools.py b/megadl/lib/megatools.py index eb96c9a4..68724fa8 100644 --- a/megadl/lib/megatools.py +++ b/megadl/lib/megatools.py @@ -1,7 +1,7 @@ # Copyright (c) 2023 Itz-fork # Author: https://github.com/Itz-fork # Project: https://github.com/Itz-fork/Mega.nz-Bot -# Description: Helper class for pyrogram bots to interact with megatools cli +# Description: Wrapper for megatools cli with extended features import os import subprocess diff --git a/megadl/lib/pyros.py b/megadl/lib/pyros.py index a45877d0..fb1de874 100644 --- a/megadl/lib/pyros.py +++ b/megadl/lib/pyros.py @@ -1,7 +1,7 @@ # Copyright (c) 2023 Itz-fork # Author: https://github.com/Itz-fork # Project: https://github.com/Itz-fork/Mega.nz-Bot -# Description: Contains pyrogram tools +# Description: Tools and helper functions related to pyrogram from time import time from math import floor diff --git a/megadl/modules/auth.py b/megadl/modules/auth.py index 7131433c..49aa4473 100644 --- a/megadl/modules/auth.py +++ b/megadl/modules/auth.py @@ -1,7 +1,7 @@ # Copyright (c) 2023 Itz-fork # Author: https://github.com/Itz-fork # Project: https://github.com/Itz-fork/Mega.nz-Bot -# Description: Contains commands related to mega auth +# Description: Authorize mega account of users from pyrogram import filters diff --git a/megadl/modules/callbacks.py b/megadl/modules/callbacks.py index 29ba58a7..1b5cb58c 100644 --- a/megadl/modules/callbacks.py +++ b/megadl/modules/callbacks.py @@ -1,7 +1,7 @@ # Copyright (c) 2023 Itz-fork # Author: https://github.com/Itz-fork # Project: https://github.com/Itz-fork/Mega.nz-Bot -# Description: Contains global callbacks +# Description: Callbacks that can be used globally from pyrogram import filters from pyrogram.types import CallbackQuery diff --git a/megadl/modules/generals.py b/megadl/modules/generals.py index c8db2b07..464ed62d 100644 --- a/megadl/modules/generals.py +++ b/megadl/modules/generals.py @@ -1,7 +1,7 @@ # Copyright (c) 2023 Itz-fork # Author: https://github.com/Itz-fork # Project: https://github.com/Itz-fork/Mega.nz-Bot -# Description: Contains all the general commands of the bot +# Description: General commands of the bot from pyrogram import filters @@ -17,7 +17,11 @@ async def start_msg(_: MeganzClient, msg: Message): f""" Hi `{msg.from_user.first_name}` 👋, I'm [Mega.nz-Bot](https://github.com/Itz-fork/Mega.nz-Bot)! -I can help you download, upload files or folders from telegram. Not sure what to do? Check /help for more info 😇 +I can help you download, upload files or folders from telegram. +Not sure what to do? Check /help for more info 😇 + + +**Made with ❤️ by @NexaBotsUpdates** """, disable_web_page_preview=True, ) diff --git a/megadl/modules/mega_dl.py b/megadl/modules/mega_dl.py index 162f1479..e630e76c 100644 --- a/megadl/modules/mega_dl.py +++ b/megadl/modules/mega_dl.py @@ -1,7 +1,7 @@ # Copyright (c) 2023 Itz-fork # Author: https://github.com/Itz-fork # Project: https://github.com/Itz-fork/Mega.nz-Bot -# Description: Responsible for download function +# Description: Handle mega.nz download function import re @@ -58,7 +58,7 @@ async def dl_from_cb(client: MeganzClient, query: CallbackQuery): udoc = await client.database.is_there(qcid, True) if not udoc and re.match(prv_rgx, url): return await query.edit_message_text( - "You need to be logged in first to download this file 😑" + "You must be logged in first to download this file 😑" ) if udoc: conf = f"--username {client.cipher.decrypt(udoc[0]).decode()} --password {client.cipher.decrypt(udoc[1]).decode()}" diff --git a/megadl/modules/mega_up.py b/megadl/modules/mega_up.py index 02390c2f..e927f20d 100644 --- a/megadl/modules/mega_up.py +++ b/megadl/modules/mega_up.py @@ -1,7 +1,7 @@ # Copyright (c) 2023 Itz-fork # Author: https://github.com/Itz-fork # Project: https://github.com/Itz-fork/Mega.nz-Bot -# Description: Responsible for upload function +# Description: Handle mega.nz upload function from time import time from pyrogram import filters @@ -36,7 +36,7 @@ async def to_up(_: MeganzClient, msg: Message): "Select what you want to do 🤗", reply_markup=InlineKeyboardMarkup( [ - [InlineKeyboardButton("Download 💾", callback_data=f"up_tgdl-{_mid}")], + [InlineKeyboardButton("Upload 🗃", callback_data=f"up_tgdl-{_mid}")], [InlineKeyboardButton("Cancel ❌", callback_data=f"cancelqcb-{_mid}")], ] ), @@ -57,7 +57,7 @@ async def to_up_cb(client: MeganzClient, query: CallbackQuery): udoc = await client.database.is_there(qcid, True) if not udoc: return await query.edit_message_text( - "You need to be logged in first to download this file 😑" + "You must be logged in first to download this file 😑" ) if udoc: conf = f"--username {client.cipher.decrypt(udoc['email']).decode()} --password {client.cipher.decrypt(udoc['password']).decode()}" @@ -66,7 +66,7 @@ async def to_up_cb(client: MeganzClient, query: CallbackQuery): msg = await client.get_messages(qcid, _mid) # Status msg await client.edit_message_text( - qcid, qmid, "Trying to download the file 📬", reply_markup=None + qcid, qmid, "Trying to download the file 📥", reply_markup=None ) # Download files accordingly @@ -86,7 +86,7 @@ async def to_up_cb(client: MeganzClient, query: CallbackQuery): await client.edit_message_text( qcid, qmid, - "Your file has been uploaded to Mega.nz ✅", + f"Your file has been uploaded to Mega.nz ✅ \n\nLink 🔗: `{limk}`", reply_markup=InlineKeyboardMarkup( [[InlineKeyboardButton("Visit 🔗", url=limk)]] ),