Skip to content

Commit

Permalink
Merge pull request ( #26 )
Browse files Browse the repository at this point in the history
Sourcery refactored main branch
  • Loading branch information
kalanakt authored Aug 1, 2022
2 parents dc3422d + e6ca4df commit 38fdaa7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
5 changes: 3 additions & 2 deletions Uploader/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
)




class Config(object):
# get a token from @BotFather
BOT_TOKEN = os.environ.get("BOT_TOKEN", "")
Expand Down Expand Up @@ -70,6 +72,5 @@ class Config(object):
OWNER_ID = int(os.environ.get("OWNER_ID", ""))
BOT_USERNAME = os.environ.get("BOT_USERNAME", "")
ADL_BOT_RQ = {}
AUTH_USERS = list(set(int(x)
for x in os.environ.get("AUTH_USERS", "0").split()))
AUTH_USERS = list({int(x) for x in os.environ.get("AUTH_USERS", "0").split()})
AUTH_USERS.append(OWNER_ID)
13 changes: 6 additions & 7 deletions Uploader/dl_button.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ async def ddl_call_back(bot, update):
youtube_dl_url = youtube_dl_url[o:o + l]

description = custom_file_name
if not "." + youtube_dl_ext in custom_file_name:
custom_file_name += '.' + youtube_dl_ext
if f".{youtube_dl_ext}" not in custom_file_name:
custom_file_name += f'.{youtube_dl_ext}'
logger.info(youtube_dl_url)
logger.info(custom_file_name)

Expand All @@ -93,7 +93,7 @@ async def ddl_call_back(bot, update):
"/" + str(update.from_user.id)
if not os.path.isdir(tmp_directory_for_each_user):
os.makedirs(tmp_directory_for_each_user)
download_directory = tmp_directory_for_each_user + "/" + custom_file_name
download_directory = f"{tmp_directory_for_each_user}/{custom_file_name}"
command_to_exec = []
async with aiohttp.ClientSession() as session:
c_time = time.time()
Expand Down Expand Up @@ -218,7 +218,7 @@ async def ddl_call_back(bot, update):
)

else:
logger.info("✅ " + custom_file_name)
logger.info(f"✅ {custom_file_name}")
end_two = datetime.now()
try:
os.remove(download_directory)
Expand All @@ -235,8 +235,8 @@ async def ddl_call_back(bot, update):
disable_web_page_preview=True
)

logger.info("✅ Downloaded in: " + str(time_taken_for_download))
logger.info("✅ Uploaded in: " + str(time_taken_for_upload))
logger.info(f"✅ Downloaded in: {str(time_taken_for_download)}")
logger.info(f"✅ Uploaded in: {str(time_taken_for_upload)}")
else:
await bot.edit_message_text(
text=Translation.NO_VOID_FORMAT_FOUND.format("Incorrect Link"),
Expand Down Expand Up @@ -290,5 +290,4 @@ async def download_coroutine(bot, session, url, file_name, chat_id, message_id,
display_message = current_message
except Exception as e:
logger.info(str(e))
pass
return await response.release()
2 changes: 1 addition & 1 deletion Uploader/functions/ran_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@


def random_char(y):
return ''.join(random.choice(string.ascii_letters) for x in range(y))
return ''.join(random.choice(string.ascii_letters) for _ in range(y))


ran = (random_char(5))

0 comments on commit 38fdaa7

Please sign in to comment.