From 247257f7bd590f276674420e1b44fe7eaeff1b13 Mon Sep 17 00:00:00 2001 From: Yasir Aris M Date: Sun, 15 Oct 2023 22:58:02 +0700 Subject: [PATCH] Sync to latest pyroforok & add some minor fix.. Signed-off-by: Yasir Aris M --- .github/workflows/notify.yml | 10 +++++++++- misskaty/plugins/admin.py | 11 ++++++++--- misskaty/plugins/blacklist_chat.py | 2 +- misskaty/plugins/locks.py | 22 +++------------------- misskaty/plugins/nightmodev2.py | 18 +++++++++++------- misskaty/plugins/web_scraper.py | 2 +- 6 files changed, 33 insertions(+), 32 deletions(-) diff --git a/.github/workflows/notify.yml b/.github/workflows/notify.yml index cea9f59a..576f77d3 100644 --- a/.github/workflows/notify.yml +++ b/.github/workflows/notify.yml @@ -19,8 +19,16 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Notify the commit on Telegram. + - name: Notify the commit on Telegram YasirPediaFeed. uses: EverythingSuckz/github-telegram-notify@main with: bot_token: '${{ secrets.BOT_TOKEN }}' chat_id: '${{ secrets.CHAT_ID }}' + steps: + - uses: actions/checkout@v3 + - name: Notify the commit on Telegram SecretGrup. + uses: EverythingSuckz/github-telegram-notify@main + with: + bot_token: '${{ secrets.BOT_TOKEN }}' + chat_id: '-1001777794636' + thread_id: '436403' \ No newline at end of file diff --git a/misskaty/plugins/admin.py b/misskaty/plugins/admin.py index cd6a6bda..7a829113 100644 --- a/misskaty/plugins/admin.py +++ b/misskaty/plugins/admin.py @@ -174,7 +174,10 @@ async def kickFunc(client: Client, ctx: Message, strings) -> "Message": return await ctx.reply_msg(strings("kick_sudo_err")) if user_id in (await list_admins(ctx.chat.id)): return await ctx.reply_msg(strings("kick_admin_err")) - user = await app.get_users(user_id) + try: + user = await app.get_users(user_id) + except PeerIdInvalid: + return await ctx.reply_msg(strings("user_not_found")) msg = strings("kick_msg").format( mention=user.mention, id=user.id, @@ -213,6 +216,8 @@ async def banFunc(client, message, strings): try: mention = (await app.get_users(user_id)).mention + except PeerIdInvalid: + return await message.reply_text(strings("user_not_found")) except IndexError: mention = ( message.reply_to_message.sender_chat.title @@ -535,7 +540,7 @@ async def mute(client, message, strings): if len(time_value[:-1]) < 3: await message.chat.restrict_member( user_id, - permissions=ChatPermissions(), + permissions=ChatPermissions(all_perms=False), until_date=temp_mute, ) await message.reply_text(msg, reply_markup=keyboard) @@ -546,7 +551,7 @@ async def mute(client, message, strings): return if reason: msg += strings("banned_reason").format(reas=reason) - await message.chat.restrict_member(user_id, permissions=ChatPermissions()) + await message.chat.restrict_member(user_id, permissions=ChatPermissions(all_perms=False)) await message.reply_text(msg, reply_markup=keyboard) diff --git a/misskaty/plugins/blacklist_chat.py b/misskaty/plugins/blacklist_chat.py index 3ccd63f6..cabc0bf3 100644 --- a/misskaty/plugins/blacklist_chat.py +++ b/misskaty/plugins/blacklist_chat.py @@ -107,7 +107,7 @@ async def blacklist_filters_re(_, message): try: await message.chat.restrict_member( user.id, - ChatPermissions(), + ChatPermissions(all_perms=False), until_date=int(time() + 3600), ) except Exception: diff --git a/misskaty/plugins/locks.py b/misskaty/plugins/locks.py index 1d14d8c7..664382b1 100644 --- a/misskaty/plugins/locks.py +++ b/misskaty/plugins/locks.py @@ -165,7 +165,7 @@ async def locks_func(_, message): await tg_lock(message, permissions, data[parameter], state == "lock") elif parameter == "all" and state == "lock": try: - await app.set_chat_permissions(chat_id, ChatPermissions()) + await app.set_chat_permissions(chat_id, ChatPermissions(all_perms=True)) await message.reply_text(f"Locked Everything in {message.chat.title}") except ChatAdminRequired: await message.reply_msg( @@ -177,24 +177,8 @@ async def locks_func(_, message): await app.set_chat_permissions( chat_id, ChatPermissions( - can_send_messages=True, - can_send_plain=True, - can_send_media_messages=True, - can_send_docs=True, - can_send_inline=True, - can_send_photos=True, - can_send_videos=True, - can_send_roundvideos=True, - can_send_audios=True, - can_send_voices=True, - can_send_stickers=True, - can_send_gifs=True, - can_add_web_page_previews=True, - can_send_polls=True, - can_change_info=False, - can_invite_users=True, - can_pin_messages=False, - ), + all_perms=True, + ) ) await message.reply(f"Unlocked Everything in {message.chat.title}") except ChatAdminRequired: diff --git a/misskaty/plugins/nightmodev2.py b/misskaty/plugins/nightmodev2.py index 5f367137..d9a8ce58 100644 --- a/misskaty/plugins/nightmodev2.py +++ b/misskaty/plugins/nightmodev2.py @@ -16,6 +16,7 @@ from pyrogram.errors import ( ChatNotModified, ChatRestricted, PeerIdInvalid, + QueryIdInvalid ) from pyrogram.types import ChatPermissions, InlineKeyboardButton, InlineKeyboardMarkup @@ -257,10 +258,13 @@ async def nightmode_handler(_, msg, strings): @app.on_callback_query(filters.regex(r"^nightmd$")) @use_chat_lang() async def callbackanightmd(c, q, strings): - await q.answer( - strings("nmd_cb").format( - bname=c.me.first_name, ver=__version__, pyver=platform.python_version() - ), - show_alert=True, - cache_time=10, - ) + try: + await q.answer( + strings("nmd_cb").format( + bname=c.me.first_name, ver=__version__, pyver=platform.python_version() + ), + show_alert=True, + cache_time=10, + ) + except QueryIdInvalid: + pass diff --git a/misskaty/plugins/web_scraper.py b/misskaty/plugins/web_scraper.py index 0d26d680..626c12ec 100644 --- a/misskaty/plugins/web_scraper.py +++ b/misskaty/plugins/web_scraper.py @@ -271,7 +271,7 @@ async def getDataNodrakor(msg, kueri, CurrentPage, user, strings): return None, 0, None text = BeautifulSoup(data, "lxml") entry = text.find_all(class_="entry-header") - if "Tidak Ditemukan" in entry[0].text: + if "Nothing Found" in entry[0].text: if not kueri: await msg.edit_msg(strings("no_result"), del_in=5) else: