Skip to content

Commit

Permalink
v4.6.1 (breakdowns#41)
Browse files Browse the repository at this point in the history
- Tidying up
  • Loading branch information
breakdowns authored Apr 5, 2021
1 parent 98ed369 commit 174d96b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,11 @@ def getConfig(name: str):
if USE_TELEGRAPH:
sname = ''.join(random.SystemRandom().choices(string.ascii_letters, k=8))
LOGGER.info("Using Telegra.ph")
LOGGER.info("Generating TELEGRAPH_TOKEN")
LOGGER.info("Generating TELEGRAPH_TOKEN using '" + sname + "' name")
telegraph = Telegraph()
telegraph.create_account(short_name=sname)
TELEGRAPH_TOKEN = telegraph.get_access_token()
LOGGER.info("Telegraph Token Generated: '" + TELEGRAPH_TOKEN + "'")
if not USE_TELEGRAPH:
TELEGRAPH_TOKEN = None
LOGGER.info("Not Using Telegra.ph")
Expand Down
2 changes: 1 addition & 1 deletion bot/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def stats(update, context):
@run_async
def start(update, context):
start_string = f'''
Hi {update.message.chat.first_name}, This bot can mirror all your links to Google drive!
This bot can mirror all your links to Google drive!
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)
Expand Down
2 changes: 1 addition & 1 deletion bot/helper/mirror_utils/download_utils/aria2_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def __onDownloadStarted(self, api, gid):
smsg, button = gdrive.drive_list(sname)
if STOP_DUPLICATE_MIRROR:
if smsg:
dl.getListener().onDownloadError(f'File is already available in drive.\n\n')
dl.getListener().onDownloadError(f'😡 File is already available in drive. You should have search before mirror any file. You might get ban if you do this again. This download has been stopped.\n\n')
print(dl.getListener())
if button:
sendMarkup("Here are the search results:👇\n", dl.getListener().bot, dl.getListener().update, button)
Expand Down
8 changes: 4 additions & 4 deletions bot/helper/mirror_utils/upload_utils/gdriveTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def upload_file(self, file_path, file_name, mime_type, parent_id):
# File body description
file_metadata = {
'name': file_name,
'description': 'mirror',
'description': 'Uploaded by Slam Mirror Bot',
'mimeType': mime_type,
}
if parent_id is not None:
Expand Down Expand Up @@ -317,7 +317,7 @@ def clone(self, link):
if meta.get("mimeType") == self.__G_DRIVE_DIR_MIME_TYPE:
dir_id = self.create_directory(meta.get('name'), parent_id)
result = self.cloneFolder(meta.get('name'), meta.get('name'), meta.get('id'), dir_id)
msg += f'<b>Filename: </b><code>{meta.get("name")}</code>\n<b>Size: </b>{get_readable_file_size(self.transferred_size)}'
msg += f'<b>Filename: </b><code>{meta.get("name")}</code>\n<b>Size: </b><code>{get_readable_file_size(self.transferred_size)}</code>'
durl = self.__G_DRIVE_DIR_BASE_DOWNLOAD_URL.format(dir_id)
buttons = button_build.ButtonMaker()
if SHORTENER is not None and SHORTENER_API is not None:
Expand Down Expand Up @@ -478,7 +478,7 @@ def edit_telegraph(self):
content += f'<b> | <a href="https://telegra.ph/{self.path[nxt_page]}">Next</a></b>'
nxt_page += 1
Telegraph(access_token=TELEGRAPH_TOKEN).edit_page(path = self.path[prev_page],
title = 'Slam Mirror Bot Search',
title = 'Slam Mirror Bot - Search',
author_name='Slam Mirror Bot',
author_url='https://github.com/breakdowns/slam-mirrorbot',
html_content=content)
Expand Down Expand Up @@ -510,7 +510,7 @@ def drive_list(self, fileName):
if file.get(
'mimeType') == "application/vnd.google-apps.folder": # Detect Whether Current Entity is a Folder or File.
furl = f"https://drive.google.com/drive/folders/{file.get('id')}"
msg += f"⁍<code>{file.get('name')}<br>(folder📁)</code><br>"
msg += f"⁍<code>{file.get('name')}<br>(folder)📁</code><br>"
if SHORTENER is not None and SHORTENER_API is not None:
sfurl = requests.get(
'https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, furl)).text
Expand Down

0 comments on commit 174d96b

Please sign in to comment.