Skip to content

Commit

Permalink
MediaInfoCommand
Browse files Browse the repository at this point in the history
  • Loading branch information
5hojib committed Jan 1, 2025
1 parent 54db9ec commit 16e45f3
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion bot/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"YtdlCommand": "- Mirror yt-dlp supported link",
"YtdlLeechCommand": "- Leech through yt-dlp supported link",
"CloneCommand": "- Copy file/folder to Drive",
# Mediainfo command
"MediaInfoCommand": "- Get mediainfo",
"ForceStartCommand": "- Start task from queue",
"CountCommand": "- Count file/folder on Google Drive",
"ListCommand": "- Search in Drive",
Expand Down
4 changes: 4 additions & 0 deletions bot/core/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ def add_handlers():
BotCommands.RestartSessionsCommand,
CustomFilters.sudo,
),
"mediainfo": (
mediainfo,
BotCommands.MediaInfoCommand,
CustomFilters.authorized,)
}

for handler_func, command_name, custom_filter in command_filters.values():
Expand Down
1 change: 1 addition & 0 deletions bot/helper/telegram_helper/bot_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def __init__(self):
self.LeechCommand = [f"leech{i}", f"l{i}"]
self.YtdlLeechCommand = [f"ytdlleech{i}", f"yl{i}"]
self.CloneCommand = f"clone{i}"
self.MediaInfoCommand = f"mediainfo{i}"
self.CountCommand = f"count{i}"
self.DeleteCommand = f"del{i}"
self.CancelAllCommand = f"cancelall{i}"
Expand Down
2 changes: 2 additions & 0 deletions bot/modules/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
restart_notification,
restart_sessions,
)
from .mediainfo import mediainfo
from .rss import get_rss_menu, rss_listener
from .search import initiate_search_tools, torrent_search, torrent_search_update
from .services import log, ping, start
Expand All @@ -44,6 +45,7 @@
"cancel_all_update",
"cancel_multi",
"clear",
"mediainfo",
"clone_node",
"confirm_restart",
"confirm_selection",
Expand Down
13 changes: 3 additions & 10 deletions bot/modules/mediainfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
from pyrogram.filters import command
from pyrogram.handlers import MessageHandler

from bot import LOGGER, bot
from bot import LOGGER
from bot.core.aeon_client import TgClient
from bot.helper.aeon_utils.access_check import token_check
from bot.helper.aeon_utils.gen_mediainfo import parseinfo
from bot.helper.ext_utils.bot_utils import cmd_exec
Expand Down Expand Up @@ -51,7 +52,7 @@ async def gen_mediainfo(message, link=None, media=None, msg=None):
if media.file_size <= 50000000:
await msg.download(ospath.join(getcwd(), des_path))
else:
async for chunk in bot.stream_media(media, limit=5):
async for chunk in TgClient.bot.stream_media(media, limit=5):
async with aiopen(des_path, "ab") as f:
await f.write(chunk)

Expand Down Expand Up @@ -103,11 +104,3 @@ async def mediainfo(_, message):
await send_message(message, help_msg)
else:
await send_message(message, help_msg)


bot.add_handler(
MessageHandler(
mediainfo,
filters=command(BotCommands.MediaInfoCommand) & CustomFilters.authorized,
),
)

0 comments on commit 16e45f3

Please sign in to comment.