From 6851e057456f1b92635452916f9b19627bca1e25 Mon Sep 17 00:00:00 2001 From: yasirarism <55983182+yasirarism@users.noreply.github.com> Date: Tue, 10 Jan 2023 20:52:17 +0700 Subject: [PATCH] Beta (#16) * Beta * Move append items to list definition (#15) * Move append items to list definition * Format code with black and isort Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com> * Remove commented out code (#14) Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com> * Use identity check for comparison to a singleton (#13) Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com> * Convert string with anomalous backslash into a raw string (#12) Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com> Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com> --- config.env.sample | 2 +- misskaty/helper/pyro_progress.py | 1 - misskaty/plugins/admin.py | 4 ++-- misskaty/plugins/broadcast.py | 2 +- misskaty/plugins/nightmode.py | 5 ----- misskaty/plugins/paste.py | 16 ++++++++-------- misskaty/plugins/scrapwebsite.py | 1 - 7 files changed, 12 insertions(+), 19 deletions(-) diff --git a/config.env.sample b/config.env.sample index fac7aa6f..63f927a0 100644 --- a/config.env.sample +++ b/config.env.sample @@ -4,4 +4,4 @@ API_ID= SUPPORT_CHAT=YasirPediaChannel DATABASE_URI=mongodb+srv:// BOT_TOKEN= -LOG_CHANNEL=- +LOG_CHANNEL=-100 diff --git a/misskaty/helper/pyro_progress.py b/misskaty/helper/pyro_progress.py index c46610ca..117f93cf 100644 --- a/misskaty/helper/pyro_progress.py +++ b/misskaty/helper/pyro_progress.py @@ -36,7 +36,6 @@ async def progress_for_pyrogram(current, total, ud_type, message, start): humanbytes(current), humanbytes(total), humanbytes(speed), - # elapsed_time if elapsed_time != "" else "0 s", estimated_total_time if estimated_total_time != "" else "0 s", ) try: diff --git a/misskaty/plugins/admin.py b/misskaty/plugins/admin.py index cdc4a94f..a72cb3ca 100644 --- a/misskaty/plugins/admin.py +++ b/misskaty/plugins/admin.py @@ -276,7 +276,7 @@ async def list_ban_(c, message): ) try: msgtext = (await app.get_messages(uname, mid)).text - gusernames = re.findall("@\w+", msgtext) + gusernames = re.findall(r"@\w+", msgtext) except: return await m.edit_text("Could not get group usernames") count = 0 @@ -325,7 +325,7 @@ async def list_unban_(c, message): ) try: msgtext = (await app.get_messages(uname, mid)).text - gusernames = re.findall("@\w+", msgtext) + gusernames = re.findall(r"@\w+", msgtext) except: return await m.edit_text("Could not get the group usernames") count = 0 diff --git a/misskaty/plugins/broadcast.py b/misskaty/plugins/broadcast.py index 9639dce0..c14fdb01 100644 --- a/misskaty/plugins/broadcast.py +++ b/misskaty/plugins/broadcast.py @@ -27,7 +27,7 @@ async def broadcast(bot, message): pti, sh = await broadcast_messages(int(user["id"]), b_msg) if pti: success += 1 - elif pti == False: + elif pti is False: if sh == "Bocked": blocked += 1 elif sh == "Deleted": diff --git a/misskaty/plugins/nightmode.py b/misskaty/plugins/nightmode.py index 6eb951a1..b4b93ca7 100644 --- a/misskaty/plugins/nightmode.py +++ b/misskaty/plugins/nightmode.py @@ -52,7 +52,6 @@ async def job_close(): tahun = now.strftime("%Y") jam = now.strftime("%H:%M") try: - # version = check_output(["git log -1 --date=format:v%y.%m%d.%H%M --pretty=format:%cd"], shell=True).decode() reply_markup = InlineKeyboardMarkup( [[InlineKeyboardButton(text="❤️", callback_data="nightmd")]] ) @@ -92,7 +91,6 @@ async def job_close_ymoviez(): tahun = now.strftime("%Y") jam = now.strftime("%H:%M") try: - # version = check_output(["git log -1 --date=format:v%y.%m%d.%H%M --pretty=format:%cd"], shell=True).decode() reply_markup = InlineKeyboardMarkup( [[InlineKeyboardButton(text="❤️", callback_data="nightmd")]] ) @@ -131,7 +129,6 @@ async def job_open(): tahun = now.strftime("%Y") jam = now.strftime("%H:%M") try: - # version = check_output(["git log -1 --date=format:v%y.%m%d.%H%M --pretty=format:%cd"], shell=True).decode() reply_markup = InlineKeyboardMarkup( [[InlineKeyboardButton(text="❤️", callback_data="nightmd")]] ) @@ -177,7 +174,6 @@ async def job_open_ymoviez(): tahun = now.strftime("%Y") jam = now.strftime("%H:%M") try: - # version = check_output(["git log -1 --date=format:v%y.%m%d.%H%M --pretty=format:%cd"], shell=True).decode() reply_markup = InlineKeyboardMarkup( [[InlineKeyboardButton(text="❤️", callback_data="nightmd")]] ) @@ -203,7 +199,6 @@ async def job_open_ymoviez(): @app.on_callback_query(filters.regex(r"^nightmd$")) async def _callbackanightmd(c: Client, q: CallbackQuery): - # version = check_output(["git log -1 --date=format:v%y.%m%d.%H%M --pretty=format:%cd"], shell=True).decode() await q.answer( f"🔖 Hai, Aku {BOT_USERNAME} dibuat menggunakan Framework Pyrogram v{__version__} dan Python 3.10.\n\nMau buat bot seperti ini? Yuuk belajar di @botindonesia\nOwner: @YasirArisM", show_alert=True, diff --git a/misskaty/plugins/paste.py b/misskaty/plugins/paste.py index a32c2e87..c71627db 100644 --- a/misskaty/plugins/paste.py +++ b/misskaty/plugins/paste.py @@ -114,14 +114,14 @@ async def create(_, message): if not url: return await msg.edit("Text Too Short Or File Problems") - button = [[InlineKeyboardButton("Open Link", url=url)]] - button.append( + button = [ + [InlineKeyboardButton("Open Link", url=url)], [ InlineKeyboardButton( "Share Link", url=f"https://telegram.me/share/url?url={url}" ) - ] - ) + ], + ] pasted = f"**Successfully pasted your data to Rentry.\n\nPaste by {uname}**" await msg.edit(pasted, reply_markup=InlineKeyboardMarkup(button)) @@ -191,14 +191,14 @@ async def create(_, message): if not url: return await msg.edit("Text Too Short Or File Problems") - button = [[InlineKeyboardButton("Open Link", url=url)]] - button.append( + button = [ + [InlineKeyboardButton("Open Link", url=url)], [ InlineKeyboardButton( "Share Link", url=f"https://telegram.me/share/url?url={url}" ) - ] - ) + ], + ] pasted = f"**Successfully pasted your data to Tempaste.\n\nPaste by {uname}**" await msg.edit(pasted, reply_markup=InlineKeyboardMarkup(button)) diff --git a/misskaty/plugins/scrapwebsite.py b/misskaty/plugins/scrapwebsite.py index fd299ed3..b3cbf35a 100644 --- a/misskaty/plugins/scrapwebsite.py +++ b/misskaty/plugins/scrapwebsite.py @@ -197,7 +197,6 @@ async def ngefilm21(_, message): judul = a.find_all(class_="r-snippetized") b = i.find_all("a")[0]["href"] data.append({"judul": judul[0].text, "link": b}) - # print(f"{judul[0].text}{b}\n") if not data: return await msg.edit("Oops, data film tidak ditemukan.") res = "".join(f"{i['judul']}\n{i['link']}\n" for i in data)