From a3410caac15f11e49312953e5edd74725ba0968f Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Tue, 10 Jan 2023 20:22:29 +0700 Subject: [PATCH] Replace multiple `==` checks with `in` (#10) * Replace multiple `==` checks with `in` * Format code with black and isort Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com> Co-authored-by: yasirarism <55983182+yasirarism@users.noreply.github.com> --- misskaty/plugins/inline_search.py | 4 ++-- misskaty/plugins/stickers.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/misskaty/plugins/inline_search.py b/misskaty/plugins/inline_search.py index 8c7695c1..57dc5986 100644 --- a/misskaty/plugins/inline_search.py +++ b/misskaty/plugins/inline_search.py @@ -453,7 +453,7 @@ async def prvt_msg(_, c_q): user_id, flname, sender_id, msg = PRVT_MSGS[msg_id] - if c_q.from_user.id == user_id or c_q.from_user.id == sender_id: + if c_q.from_user.id in (user_id, sender_id): await c_q.answer(msg, show_alert=True) else: await c_q.answer(f"only {flname} can see this Private Msg!", show_alert=True) @@ -469,7 +469,7 @@ async def destroy_msg(_, c_q): user_id, flname, sender_id, msg = PRVT_MSGS[msg_id] - if c_q.from_user.id == user_id or c_q.from_user.id == sender_id: + if c_q.from_user.id in (user_id, sender_id): del PRVT_MSGS[msg_id] by = "receiver" if c_q.from_user.id == user_id else "sender" await c_q.edit_message_text(f"This secret message is ☠️destroyed☠️ by msg {by}") diff --git a/misskaty/plugins/stickers.py b/misskaty/plugins/stickers.py index dfbba402..371aca95 100644 --- a/misskaty/plugins/stickers.py +++ b/misskaty/plugins/stickers.py @@ -140,9 +140,9 @@ async def kang_sticker(c, m): if "image" in reply.document.mime_type: # mime_type: image/webp resize = True - elif ( - MessageMediaType.VIDEO == reply.document.mime_type - or MessageMediaType.ANIMATION == reply.document.mime_type + elif reply.document.mime_type in ( + MessageMediaType.VIDEO, + MessageMediaType.ANIMATION, ): # mime_type: application/video videos = True