diff --git a/README.md b/README.md index 08b7f47..6e661f1 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ ![GitHub repo size](https://img.shields.io/github/repo-size/breakdowns/slam-mirrorbot?color=red) ![GitHub commit activity](https://img.shields.io/github/commit-activity/m/breakdowns/slam-mirrorbot) ![GitHub](https://img.shields.io/github/license/breakdowns/slam-mirrorbot) -[![Slam Mirror Support](https://img.shields.io/badge/slam%20mirror%20bot-support%20group-blue)](https://t.me/SlamMirrorSupport) +[![Slam Mirror Updates](https://img.shields.io/badge/slam%20mirror%20bot-channel-blue)](https://t.me/SlamMirrorUpdates) **Slam Mirror Bot** is a _multipurpose_ Telegram Bot writen in Python for mirroring files on the Internet to our beloved Google Drive. diff --git a/bot/__main__.py b/bot/__main__.py index 44f095b..b1441ce 100644 --- a/bot/__main__.py +++ b/bot/__main__.py @@ -18,7 +18,7 @@ from bot.helper.telegram_helper.message_utils import * from .helper.ext_utils.bot_utils import get_readable_file_size, get_readable_time from .helper.telegram_helper.filters import CustomFilters from bot.helper.telegram_helper import button_build -from .modules import authorize, list, cancel_mirror, mirror_status, mirror, clone, watch, shell, eval, search, delete, speedtest, usage, mediainfo, count, config, updates +from .modules import authorize, list, cancel_mirror, mirror_status, mirror, clone, watch, shell, eval, torrent_search, delete, speedtest, usage, mediainfo, count, config, updates now=datetime.now(pytz.timezone('Asia/Jakarta')) @@ -147,7 +147,9 @@ def bot_help(update, context): /{BotCommands.ShellCommand}: Run commands in Shell (Terminal) -/tshelp: Get help for Torrent search module +/{BotCommands.ExecHelpCommand}: Get help for Executor module + +/{BotCommands.TsHelpCommand}: Get help for Torrent search module ''' help_string = f''' @@ -181,7 +183,7 @@ def bot_help(update, context): /{BotCommands.MediaInfoCommand}: Get detailed info about replied media (Only for Telegram file) -/tshelp: Get help for Torrent search module +/{BotCommands.TsHelpCommand}: Get help for Torrent search module ''' if CustomFilters.sudo_user(update) or CustomFilters.owner_filter(update): @@ -209,7 +211,7 @@ BotCommand(f'{BotCommands.PingCommand}','Ping the Bot'), BotCommand(f'{BotCommands.RestartCommand}','Restart the bot [owner/sudo only]'), BotCommand(f'{BotCommands.LogCommand}','Get the Bot Log [owner/sudo only]'), BotCommand(f'{BotCommands.MediaInfoCommand}','Get detailed info about replied media'), -BotCommand(f'/tshelp','Get help for Torrent search module')] +BotCommand(f'{BotCommands.TsHelpCommand}','Get help for Torrent search module')] def main(): diff --git a/bot/helper/telegram_helper/bot_commands.py b/bot/helper/telegram_helper/bot_commands.py index 1dc82aa..15e4cfd 100644 --- a/bot/helper/telegram_helper/bot_commands.py +++ b/bot/helper/telegram_helper/bot_commands.py @@ -29,5 +29,7 @@ class _BotCommands: self.ConfigMenuCommand = 'config' self.ShellCommand = 'shell' self.UpdateCommand = 'update' + self.ExecHelpCommand = 'exechelp' + self.TsHelpCommand = 'tshelp' BotCommands = _BotCommands() diff --git a/bot/modules/config.py b/bot/modules/config.py index ad911a3..3b8dd11 100644 --- a/bot/modules/config.py +++ b/bot/modules/config.py @@ -46,6 +46,12 @@ async def del_varr(client, message, app_): await msg_.edit(f"`Sucessfully Deleted {_var} Var!`", parse_mode="markdown") del heroku_var[_var] +@app.on_message(filters.command(['reboot']) & filters.user(OWNER_ID)) +@check_heroku +async def gib_restart(client, message, hap): + msg_ = await message.reply_text("[HEROKU] - Restarting") + hap.restart() + # CONFIG LIST # __header__='📕 **Page** **{}**\n\n' diff --git a/bot/modules/eval.py b/bot/modules/eval.py index 4a5472d..5991c56 100644 --- a/bot/modules/eval.py +++ b/bot/modules/eval.py @@ -5,7 +5,8 @@ import textwrap import traceback from contextlib import redirect_stdout from bot.helper.telegram_helper.filters import CustomFilters -from bot import LOGGER, dispatcher +from bot.helper.telegram_helper.bot_commands import BotCommands +from bot import LOGGER, dispatcher, IMAGE_URL from telegram import ParseMode from telegram.ext import CommandHandler @@ -119,11 +120,21 @@ def clear(update, context): send("Cleared locals.", bot, update) -EVAL_HANDLER = CommandHandler(('e', 'ev', 'eva', 'eval'), evaluate, filters=CustomFilters.owner_filter, run_async=True) -EXEC_HANDLER = CommandHandler(('x', 'ex', 'exe', 'exec', 'py'), execute, filters=CustomFilters.owner_filter, run_async=True) +def exechelp(update, context): + help_string = ''' +• /eval Run Python Code Line | Lines +• /exec Run Commands In Exec +• /clearlocals Cleared locals +''' + update.effective_message.reply_photo(IMAGE_URL, help_string, parse_mode=ParseMode.HTML) + + +EVAL_HANDLER = CommandHandler(('eval'), evaluate, filters=CustomFilters.owner_filter, run_async=True) +EXEC_HANDLER = CommandHandler(('exec'), execute, filters=CustomFilters.owner_filter, run_async=True) CLEAR_HANDLER = CommandHandler('clearlocals', clear, filters=CustomFilters.owner_filter, run_async=True) +EXECHELP_HANDLER = CommandHandler(BotCommands.ExecHelpCommand, exechelp, filters=CustomFilters.owner_filter, run_async=True) dispatcher.add_handler(EVAL_HANDLER) dispatcher.add_handler(EXEC_HANDLER) dispatcher.add_handler(CLEAR_HANDLER) - +dispatcher.add_handler(EXECHELP_HANDLER) diff --git a/bot/modules/search.py b/bot/modules/torrent_search.py similarity index 97% rename from bot/modules/search.py rename to bot/modules/torrent_search.py index 6857a57..3f5e82e 100644 --- a/bot/modules/search.py +++ b/bot/modules/torrent_search.py @@ -20,6 +20,7 @@ from pyrogram.handlers import MessageHandler, CallbackQueryHandler from bot import app, dispatcher, IMAGE_URL from bot.helper import custom_filters +from bot.helper.telegram_helper.bot_commands import BotCommands from bot.helper.telegram_helper.filters import CustomFilters search_lock = asyncio.Lock() @@ -332,5 +333,5 @@ def searchhelp(update, context): update.effective_message.reply_photo(IMAGE_URL, help_string, parse_mode=ParseMode.HTML) -SEARCHHELP_HANDLER = CommandHandler("tshelp", searchhelp, filters=(CustomFilters.authorized_chat | CustomFilters.authorized_user) & CustomFilters.mirror_owner_filter, run_async=True) +SEARCHHELP_HANDLER = CommandHandler(BotCommands.TsHelpCommand, searchhelp, filters=(CustomFilters.authorized_chat | CustomFilters.authorized_user) & CustomFilters.mirror_owner_filter, run_async=True) dispatcher.add_handler(SEARCHHELP_HANDLER)