v4.5 (#39)
- Added /repo command - Added some emoji - Remove Encryption - Cleanup code
This commit is contained in:
parent
9d2c365339
commit
eefcef0495
1
aria.sh
1
aria.sh
|
|
@ -12,5 +12,4 @@ aria2c --enable-rpc --rpc-listen-all=false --rpc-listen-port 6800 --check-certif
|
||||||
--disk-cache=64M --file-allocation=prealloc --continue=true \
|
--disk-cache=64M --file-allocation=prealloc --continue=true \
|
||||||
--max-file-not-found=5 --max-tries=20 --auto-file-renaming=true \
|
--max-file-not-found=5 --max-tries=20 --auto-file-renaming=true \
|
||||||
--bt-enable-lpd=true --seed-time=0.01 --seed-ratio=1.0 \
|
--bt-enable-lpd=true --seed-time=0.01 --seed-ratio=1.0 \
|
||||||
--bt-force-encryption=true --bt-require-crypto=true --bt-min-crypto-level=arc4 \
|
|
||||||
--content-disposition-default-utf8=true --http-accept-gzip=true --reuse-uri=true
|
--content-disposition-default-utf8=true --http-accept-gzip=true --reuse-uri=true
|
||||||
|
|
|
||||||
|
|
@ -210,7 +210,6 @@ except KeyError:
|
||||||
SHORTENER = None
|
SHORTENER = None
|
||||||
SHORTENER_API = None
|
SHORTENER_API = None
|
||||||
|
|
||||||
app = Client('slam', api_id=TELEGRAM_API, api_hash=TELEGRAM_HASH, bot_token=BOT_TOKEN)
|
|
||||||
updater = tg.Updater(token=BOT_TOKEN,use_context=True)
|
updater = tg.Updater(token=BOT_TOKEN,use_context=True)
|
||||||
bot = updater.bot
|
bot = updater.bot
|
||||||
dispatcher = updater.dispatcher
|
dispatcher = updater.dispatcher
|
||||||
|
|
|
||||||
|
|
@ -44,12 +44,19 @@ def stats(update, context):
|
||||||
@run_async
|
@run_async
|
||||||
def start(update, context):
|
def start(update, context):
|
||||||
start_string = f'''
|
start_string = f'''
|
||||||
Hi, I'm [Slam](https://github.com/breakdowns/slam-mirrorbot), a multipurpose bot for [hafitz](t.me/hafitzXD)
|
Hi {update.message.chat.first_name}, This bot can mirror all your links to Google drive!
|
||||||
Type /{BotCommands.HelpCommand} to get a list of available commands
|
Type /{BotCommands.HelpCommand} to get a list of available commands
|
||||||
'''
|
'''
|
||||||
update.effective_message.reply_photo("https://telegra.ph/file/db03910496f06094f1f7a.jpg", start_string, parse_mode=ParseMode.MARKDOWN)
|
update.effective_message.reply_photo("https://telegra.ph/file/db03910496f06094f1f7a.jpg", start_string, parse_mode=ParseMode.MARKDOWN)
|
||||||
|
|
||||||
|
|
||||||
|
@run_async
|
||||||
|
def repo(update, context):
|
||||||
|
bot.send_message(update.message.chat_id,
|
||||||
|
reply_to_message_id=update.message.message_id,
|
||||||
|
text="Repo: `https://github.com/breakdowns/slam-mirrorbot`", parse_mode="Markdown")
|
||||||
|
|
||||||
|
|
||||||
@run_async
|
@run_async
|
||||||
def restart(update, context):
|
def restart(update, context):
|
||||||
restart_message = sendMessage("Restarting, Please wait!", context.bot, update)
|
restart_message = sendMessage("Restarting, Please wait!", context.bot, update)
|
||||||
|
|
@ -102,9 +109,11 @@ def bot_help(update, context):
|
||||||
|
|
||||||
/{BotCommands.LogCommand}: Get a log file of the bot. Handy for getting crash reports
|
/{BotCommands.LogCommand}: Get a log file of the bot. Handy for getting crash reports
|
||||||
|
|
||||||
|
/{BotCommands.UsageCommand}: To see Heroku Dyno Stats (Owner only).
|
||||||
|
|
||||||
/{BotCommands.SpeedCommand}: Check Internet Speed of the Host
|
/{BotCommands.SpeedCommand}: Check Internet Speed of the Host
|
||||||
|
|
||||||
/{BotCommands.UsageCommand}: To see Heroku Dyno Stats (Owner only).
|
/{BotCommands.RepoCommand}: Get the bot repo.
|
||||||
|
|
||||||
/tshelp: Get help for torrent search module.
|
/tshelp: Get help for torrent search module.
|
||||||
|
|
||||||
|
|
@ -135,12 +144,15 @@ def main():
|
||||||
stats_handler = CommandHandler(BotCommands.StatsCommand,
|
stats_handler = CommandHandler(BotCommands.StatsCommand,
|
||||||
stats, filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
|
stats, filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
|
||||||
log_handler = CommandHandler(BotCommands.LogCommand, log, filters=CustomFilters.owner_filter)
|
log_handler = CommandHandler(BotCommands.LogCommand, log, filters=CustomFilters.owner_filter)
|
||||||
|
repo_handler = CommandHandler(BotCommands.RepoCommand, repo,
|
||||||
|
filters=CustomFilters.authorized_chat | CustomFilters.authorized_user)
|
||||||
dispatcher.add_handler(start_handler)
|
dispatcher.add_handler(start_handler)
|
||||||
dispatcher.add_handler(ping_handler)
|
dispatcher.add_handler(ping_handler)
|
||||||
dispatcher.add_handler(restart_handler)
|
dispatcher.add_handler(restart_handler)
|
||||||
dispatcher.add_handler(help_handler)
|
dispatcher.add_handler(help_handler)
|
||||||
dispatcher.add_handler(stats_handler)
|
dispatcher.add_handler(stats_handler)
|
||||||
dispatcher.add_handler(log_handler)
|
dispatcher.add_handler(log_handler)
|
||||||
|
dispatcher.add_handler(repo_handler)
|
||||||
updater.start_polling()
|
updater.start_polling()
|
||||||
LOGGER.info("Bot Started!")
|
LOGGER.info("Bot Started!")
|
||||||
signal.signal(signal.SIGINT, fs_utils.exit_clean_up)
|
signal.signal(signal.SIGINT, fs_utils.exit_clean_up)
|
||||||
|
|
|
||||||
|
|
@ -14,13 +14,13 @@ URL_REGEX = r"(?:(?:https?|ftp):\/\/)?[\w/\-?=%.]+\.[\w/\-?=%.]+"
|
||||||
|
|
||||||
|
|
||||||
class MirrorStatus:
|
class MirrorStatus:
|
||||||
STATUS_UPLOADING = "Uploading"
|
STATUS_UPLOADING = "Uploading...📤"
|
||||||
STATUS_DOWNLOADING = "Downloading"
|
STATUS_DOWNLOADING = "Downloading...📥"
|
||||||
STATUS_WAITING = "Queued"
|
STATUS_WAITING = "Queued...📝"
|
||||||
STATUS_FAILED = "Failed. Cleaning download"
|
STATUS_FAILED = "Failed 🚫. Cleaning download"
|
||||||
STATUS_CANCELLED = "Cancelled"
|
STATUS_CANCELLED = "Cancelled...❌"
|
||||||
STATUS_ARCHIVING = "Archiving"
|
STATUS_ARCHIVING = "Archiving...🔐"
|
||||||
STATUS_EXTRACTING = "Extracting"
|
STATUS_EXTRACTING = "Extracting...📂"
|
||||||
|
|
||||||
|
|
||||||
PROGRESS_MAX_SIZE = 100 // 8
|
PROGRESS_MAX_SIZE = 100 // 8
|
||||||
|
|
|
||||||
|
|
@ -329,9 +329,9 @@ class GoogleDriveHelper:
|
||||||
url = requests.utils.requote_uri(f'{INDEX_URL}/{meta.get("name")}/')
|
url = requests.utils.requote_uri(f'{INDEX_URL}/{meta.get("name")}/')
|
||||||
if SHORTENER is not None and SHORTENER_API is not None:
|
if SHORTENER is not None and SHORTENER_API is not None:
|
||||||
siurl = requests.get('https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, url)).text
|
siurl = requests.get('https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, url)).text
|
||||||
buttons.buildbutton("🔥Index Link🔥", siurl)
|
buttons.buildbutton("🚀Index Link🚀", siurl)
|
||||||
else:
|
else:
|
||||||
buttons.buildbutton("🔥Index Link🔥", url)
|
buttons.buildbutton("🚀Index Link🚀", url)
|
||||||
if BUTTON_THREE_NAME is not None and BUTTON_THREE_URL is not None:
|
if BUTTON_THREE_NAME is not None and BUTTON_THREE_URL is not None:
|
||||||
buttons.buildbutton(f"{BUTTON_THREE_NAME}", f"{BUTTON_THREE_URL}")
|
buttons.buildbutton(f"{BUTTON_THREE_NAME}", f"{BUTTON_THREE_URL}")
|
||||||
if BUTTON_FOUR_NAME is not None and BUTTON_FOUR_URL is not None:
|
if BUTTON_FOUR_NAME is not None and BUTTON_FOUR_URL is not None:
|
||||||
|
|
@ -356,9 +356,9 @@ class GoogleDriveHelper:
|
||||||
url = requests.utils.requote_uri(f'{INDEX_URL}/{file.get("name")}')
|
url = requests.utils.requote_uri(f'{INDEX_URL}/{file.get("name")}')
|
||||||
if SHORTENER is not None and SHORTENER_API is not None:
|
if SHORTENER is not None and SHORTENER_API is not None:
|
||||||
siurl = requests.get('https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, url)).text
|
siurl = requests.get('https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, url)).text
|
||||||
buttons.buildbutton("🔥Index Link🔥", siurl)
|
buttons.buildbutton("🚀Index Link🚀", siurl)
|
||||||
else:
|
else:
|
||||||
buttons.buildbutton("🔥Index Link🔥", url)
|
buttons.buildbutton("🚀Index Link🚀", url)
|
||||||
if BUTTON_THREE_NAME is not None and BUTTON_THREE_URL is not None:
|
if BUTTON_THREE_NAME is not None and BUTTON_THREE_URL is not None:
|
||||||
buttons.buildbutton(f"{BUTTON_THREE_NAME}", f"{BUTTON_THREE_URL}")
|
buttons.buildbutton(f"{BUTTON_THREE_NAME}", f"{BUTTON_THREE_URL}")
|
||||||
if BUTTON_FOUR_NAME is not None and BUTTON_FOUR_URL is not None:
|
if BUTTON_FOUR_NAME is not None and BUTTON_FOUR_URL is not None:
|
||||||
|
|
|
||||||
|
|
@ -21,5 +21,6 @@ class _BotCommands:
|
||||||
self.TarWatchCommand = 'tarwatch'
|
self.TarWatchCommand = 'tarwatch'
|
||||||
self.DeleteCommand = 'del'
|
self.DeleteCommand = 'del'
|
||||||
self.UsageCommand = 'usage'
|
self.UsageCommand = 'usage'
|
||||||
|
self.RepoCommand = "repo"
|
||||||
|
|
||||||
BotCommands = _BotCommands()
|
BotCommands = _BotCommands()
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ def update_all_messages():
|
||||||
uldl_bytes += float(speedy.split('M')[0]) * 1048576
|
uldl_bytes += float(speedy.split('M')[0]) * 1048576
|
||||||
dlspeed = get_readable_file_size(dlspeed_bytes)
|
dlspeed = get_readable_file_size(dlspeed_bytes)
|
||||||
ulspeed = get_readable_file_size(uldl_bytes)
|
ulspeed = get_readable_file_size(uldl_bytes)
|
||||||
msg += f"\n<b>DL:</b> {dlspeed}ps | <b>UL:</b> {ulspeed}ps \n"
|
msg += f"\n<b>DL:</b> {dlspeed}ps 🔻| <b>UL:</b> {ulspeed}ps 🔺\n"
|
||||||
with status_reply_dict_lock:
|
with status_reply_dict_lock:
|
||||||
for chat_id in list(status_reply_dict.keys()):
|
for chat_id in list(status_reply_dict.keys()):
|
||||||
if status_reply_dict[chat_id] and msg != status_reply_dict[chat_id].text:
|
if status_reply_dict[chat_id] and msg != status_reply_dict[chat_id].text:
|
||||||
|
|
@ -124,7 +124,7 @@ def sendStatusMessage(msg, bot):
|
||||||
uldl_bytes += float(speedy.split('M')[0]) * 1048576
|
uldl_bytes += float(speedy.split('M')[0]) * 1048576
|
||||||
dlspeed = get_readable_file_size(dlspeed_bytes)
|
dlspeed = get_readable_file_size(dlspeed_bytes)
|
||||||
ulspeed = get_readable_file_size(uldl_bytes)
|
ulspeed = get_readable_file_size(uldl_bytes)
|
||||||
progress += f"\n<b>DL: </b>{dlspeed}ps | <b>UL: </b>{ulspeed}ps \n"
|
progress += f"\n<b>DL: </b>{dlspeed}ps 🔻| <b>UL: </b>{ulspeed}ps 🔺\n"
|
||||||
with status_reply_dict_lock:
|
with status_reply_dict_lock:
|
||||||
if msg.message.chat.id in list(status_reply_dict.keys()):
|
if msg.message.chat.id in list(status_reply_dict.keys()):
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
|
|
@ -159,9 +159,9 @@ class MirrorListener(listeners.MirrorListeners):
|
||||||
share_url += '/'
|
share_url += '/'
|
||||||
if SHORTENER is not None and SHORTENER_API is not None:
|
if SHORTENER is not None and SHORTENER_API is not None:
|
||||||
siurl = requests.get('https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, share_url)).text
|
siurl = requests.get('https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, share_url)).text
|
||||||
buttons.buildbutton("🔥Index Link🔥", siurl)
|
buttons.buildbutton("🚀Index Link🚀", siurl)
|
||||||
else:
|
else:
|
||||||
buttons.buildbutton("🔥Index Link🔥", share_url)
|
buttons.buildbutton("🚀Index Link🚀", share_url)
|
||||||
if BUTTON_THREE_NAME is not None and BUTTON_THREE_URL is not None:
|
if BUTTON_THREE_NAME is not None and BUTTON_THREE_URL is not None:
|
||||||
buttons.buildbutton(f"{BUTTON_THREE_NAME}", f"{BUTTON_THREE_URL}")
|
buttons.buildbutton(f"{BUTTON_THREE_NAME}", f"{BUTTON_THREE_URL}")
|
||||||
if BUTTON_FOUR_NAME is not None and BUTTON_FOUR_URL is not None:
|
if BUTTON_FOUR_NAME is not None and BUTTON_FOUR_URL is not None:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue