Move Command to Telegraph

This commit is contained in:
Juan 2021-09-15 20:06:40 +07:00 committed by GitHub
parent 173ea1c98a
commit 092b67a392
Signed by untrusted user: GitHub
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,10 +6,11 @@ import asyncio
from pyrogram import idle
from sys import executable
from telegram import ParseMode
from telegram import ParseMode, InlineKeyboardMarkup
from telegram.ext import CommandHandler
from telegraph import Telegraph
from wserver import start_server_async
from bot import bot, app, dispatcher, updater, botStartTime, IGNORE_PENDING_REQUESTS, IS_VPS, PORT, alive, web, OWNER_ID, AUTHORIZED_CHATS
from bot import bot, app, dispatcher, updater, botStartTime, IGNORE_PENDING_REQUESTS, IS_VPS, PORT, alive, web, OWNER_ID, AUTHORIZED_CHATS, telegraph_token
from bot.helper.ext_utils import fs_utils
from bot.helper.telegram_helper.bot_commands import BotCommands
from bot.helper.telegram_helper.message_utils import *
@ -86,47 +87,49 @@ def log(update, context):
def bot_help(update, context):
help_string_adm = f'''
/{BotCommands.HelpCommand}: To get this message
/{BotCommands.MirrorCommand} [download_url][magnet_link]: Start mirroring the link to Google Drive.
/{BotCommands.TarMirrorCommand} [download_url][magnet_link]: Start mirroring and upload the archived (.tar) version of the download
/{BotCommands.ZipMirrorCommand} [download_url][magnet_link]: Start mirroring and upload the archived (.zip) version of the download
/{BotCommands.UnzipMirrorCommand} [download_url][magnet_link]: Starts mirroring and if downloaded file is any archive, extracts it to Google Drive
/{BotCommands.QbMirrorCommand} [download_url][magnet_link]: Start Mirroring using qBittorrent, Use /{BotCommands.QbMirrorCommand} s to select files before downloading
/{BotCommands.QbTarMirrorCommand} [download_url][magnet_link]: Start mirroring using qBittorrent and upload the archived (.tar) version of the download
/{BotCommands.QbZipMirrorCommand} [download_url][magnet_link]: Start mirroring using qBittorrent and upload the archived (.zip) version of the download
/{BotCommands.QbUnzipMirrorCommand} [download_url][magnet_link]: Starts mirroring using qBittorrent and if downloaded file is any archive, extracts it to Google Drive
/{BotCommands.CloneCommand} [drive_url]: Copy file/folder to Google Drive
/{BotCommands.CountCommand} [drive_url]: Count file/folder of Google Drive Links
/{BotCommands.DeleteCommand} [drive_url]: Delete file from Google Drive (Only Owner & Sudo)
/{BotCommands.WatchCommand} [youtube-dl supported link]: Mirror through youtube-dl. Click /{BotCommands.WatchCommand} for more help
/{BotCommands.TarWatchCommand} [youtube-dl supported link]: Mirror through youtube-dl and tar before uploading
/{BotCommands.ZipWatchCommand} [youtube-dl supported link]: Mirror through youtube-dl and zip before uploading
/{BotCommands.CancelMirror}: Reply to the message by which the download was initiated and that download will be cancelled
/{BotCommands.CancelAllCommand}: Cancel all running tasks
/{BotCommands.ListCommand} [search term]: Searches the search term in the Google Drive, If found replies with the link
/{BotCommands.StatusCommand}: Shows a status of all the downloads
/{BotCommands.StatsCommand}: Show Stats of the machine the bot is hosted on
help_string_telegraph = f'''<br>
<b>/{BotCommands.HelpCommand}</b>: To get this message
<br><br>
<b>/{BotCommands.MirrorCommand}</b> [download_url][magnet_link]: Start mirroring the link to Google Drive.
<br><br>
<b>/{BotCommands.TarMirrorCommand}</b> [download_url][magnet_link]: Start mirroring and upload the archived (.tar) version of the download
<br><br>
<b>/{BotCommands.ZipMirrorCommand}</b> [download_url][magnet_link]: Start mirroring and upload the archived (.zip) version of the download
<br><br>
<b>/{BotCommands.UnzipMirrorCommand}</b> [download_url][magnet_link]: Starts mirroring and if downloaded file is any archive, extracts it to Google Drive
<br><br>
<b>/{BotCommands.QbMirrorCommand}</b> [magnet_link]: Start Mirroring using qBittorrent, Use /{BotCommands.QbMirrorCommand} s to select files before downloading
<br><br>
<b>/{BotCommands.QbTarMirrorCommand}</b> [magnet_link]: Start mirroring using qBittorrent and upload the archived (.tar) version of the download
<br><br>
<b>/{BotCommands.QbZipMirrorCommand}</b> [magnet_link]: Start mirroring using qBittorrent and upload the archived (.zip) version of the download
<br><br>
<b>/{BotCommands.QbUnzipMirrorCommand}</b> [magnet_link]: Starts mirroring using qBittorrent and if downloaded file is any archive, extracts it to Google Drive
<br><br>
<b>/{BotCommands.CloneCommand}</b> [drive_url]: Copy file/folder to Google Drive
<br><br>
<b>/{BotCommands.CountCommand}</b> [drive_url]: Count file/folder of Google Drive Links
<br><br>
<b>/{BotCommands.DeleteCommand}</b> [drive_url]: Delete file from Google Drive (Only Owner & Sudo)
<br><br>
<b>/{BotCommands.WatchCommand}</b> [youtube-dl supported link]: Mirror through youtube-dl. Click /{BotCommands.WatchCommand} for more help
<br><br>
<b>/{BotCommands.TarWatchCommand}</b> [youtube-dl supported link]: Mirror through youtube-dl and tar before uploading
<br><br>
<b>/{BotCommands.ZipWatchCommand}</b> [youtube-dl supported link]: Mirror through youtube-dl and zip before uploading
<br><br>
<b>/{BotCommands.CancelMirror}</b>: Reply to the message by which the download was initiated and that download will be cancelled
<br><br>
<b>/{BotCommands.CancelAllCommand}</b>: Cancel all running tasks
<br><br>
<b>/{BotCommands.ListCommand}</b> [search term]: Searches the search term in the Google Drive, If found replies with the link
<br><br>
<b>/{BotCommands.StatusCommand}</b>: Shows a status of all the downloads
<br><br>
<b>/{BotCommands.StatsCommand}</b>: Show Stats of the machine the bot is hosted on
'''
help_string = f'''
/{BotCommands.PingCommand}: Check how long it takes to Ping the Bot
/{BotCommands.AuthorizeCommand}: Authorize a chat or a user to use the bot (Can only be invoked by Owner & Sudo of the bot)
@ -151,53 +154,12 @@ def bot_help(update, context):
/{BotCommands.TsHelpCommand}: Get help for Torrent search module
'''
help_string = f'''
/{BotCommands.HelpCommand}: To get this message
/{BotCommands.MirrorCommand} [download_url][magnet_link]: Start mirroring the link to Google Drive. Use /{BotCommands.MirrorCommand} qb to mirror with qBittorrent, and use /{BotCommands.MirrorCommand} qbs to select files before downloading
/{BotCommands.TarMirrorCommand} [download_url][magnet_link]: Start mirroring and upload the archived (.tar) version of the download
/{BotCommands.ZipMirrorCommand} [download_url][magnet_link]: Start mirroring and upload the archived (.zip) version of the download
/{BotCommands.UnzipMirrorCommand} [download_url][magnet_link]: Starts mirroring and if downloaded file is any archive, extracts it to Google Drive
/{BotCommands.QbMirrorCommand} [download_url][magnet_link]: Start Mirroring using qBittorrent, Use /{BotCommands.QbMirrorCommand} s to select files before downloading
/{BotCommands.QbTarMirrorCommand} [download_url][magnet_link]: Start mirroring using qBittorrent and upload the archived (.tar) version of the download
/{BotCommands.QbZipMirrorCommand} [download_url][magnet_link]: Start mirroring using qBittorrent and upload the archived (.zip) version of the download
/{BotCommands.QbUnzipMirrorCommand} [download_url][magnet_link]: Starts mirroring using qBittorrent and if downloaded file is any archive, extracts it to Google Drive
/{BotCommands.CloneCommand} [drive_url]: Copy file/folder to Google Drive
/{BotCommands.CountCommand} [drive_url]: Count file/folder of Google Drive Links
/{BotCommands.WatchCommand} [youtube-dl supported link]: Mirror through youtube-dl. Click /{BotCommands.WatchCommand} for more help
/{BotCommands.TarWatchCommand} [youtube-dl supported link]: Mirror through youtube-dl and tar before uploading
/{BotCommands.ZipWatchCommand} [youtube-dl supported link]: Mirror through youtube-dl and zip before uploading
/{BotCommands.CancelMirror}: Reply to the message by which the download was initiated and that download will be cancelled
/{BotCommands.ListCommand} [search term]: Searches the search term in the Google Drive, If found replies with the link
/{BotCommands.StatusCommand}: Shows a status of all the downloads
/{BotCommands.StatsCommand}: Show Stats of the machine the bot is hosted on
/{BotCommands.PingCommand}: Check how long it takes to Ping the Bot
/{BotCommands.TsHelpCommand}: Get help for Torrent search module
'''
if CustomFilters.sudo_user(update) or CustomFilters.owner_filter(update):
sendMessage(help_string_adm, context.bot, update)
else:
sendMessage(help_string, context.bot, update)
help = Telegraph(access_token=telegraph_token).create_page(title = 'Slam Mirrorbot Search', author_name='Slam Mirrorbot',
author_url='https://github.com/SlamDevs/slam-mirrorbot', html_content=help_string_telegraph)["path"]
button = button_build.ButtonMaker()
button.buildbutton("Other Commands", f"https://telegra.ph/{help}")
reply_markup = InlineKeyboardMarkup(button.build_menu(1))
sendMarkup(help_string, context.bot, update, reply_markup)
'''
botcmds = [