Sync to latest pyroforok & add some minor fix..

Signed-off-by: Yasir Aris M <git@yasirdev.my.id>
This commit is contained in:
Yasir Aris M 2023-10-15 22:58:02 +07:00
parent 6f02488e88
commit 247257f7bd
6 changed files with 33 additions and 32 deletions

View file

@ -19,8 +19,16 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Notify the commit on Telegram. - name: Notify the commit on Telegram YasirPediaFeed.
uses: EverythingSuckz/github-telegram-notify@main uses: EverythingSuckz/github-telegram-notify@main
with: with:
bot_token: '${{ secrets.BOT_TOKEN }}' bot_token: '${{ secrets.BOT_TOKEN }}'
chat_id: '${{ secrets.CHAT_ID }}' 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'

View file

@ -174,7 +174,10 @@ async def kickFunc(client: Client, ctx: Message, strings) -> "Message":
return await ctx.reply_msg(strings("kick_sudo_err")) return await ctx.reply_msg(strings("kick_sudo_err"))
if user_id in (await list_admins(ctx.chat.id)): if user_id in (await list_admins(ctx.chat.id)):
return await ctx.reply_msg(strings("kick_admin_err")) 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( msg = strings("kick_msg").format(
mention=user.mention, mention=user.mention,
id=user.id, id=user.id,
@ -213,6 +216,8 @@ async def banFunc(client, message, strings):
try: try:
mention = (await app.get_users(user_id)).mention mention = (await app.get_users(user_id)).mention
except PeerIdInvalid:
return await message.reply_text(strings("user_not_found"))
except IndexError: except IndexError:
mention = ( mention = (
message.reply_to_message.sender_chat.title message.reply_to_message.sender_chat.title
@ -535,7 +540,7 @@ async def mute(client, message, strings):
if len(time_value[:-1]) < 3: if len(time_value[:-1]) < 3:
await message.chat.restrict_member( await message.chat.restrict_member(
user_id, user_id,
permissions=ChatPermissions(), permissions=ChatPermissions(all_perms=False),
until_date=temp_mute, until_date=temp_mute,
) )
await message.reply_text(msg, reply_markup=keyboard) await message.reply_text(msg, reply_markup=keyboard)
@ -546,7 +551,7 @@ async def mute(client, message, strings):
return return
if reason: if reason:
msg += strings("banned_reason").format(reas=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) await message.reply_text(msg, reply_markup=keyboard)

View file

@ -107,7 +107,7 @@ async def blacklist_filters_re(_, message):
try: try:
await message.chat.restrict_member( await message.chat.restrict_member(
user.id, user.id,
ChatPermissions(), ChatPermissions(all_perms=False),
until_date=int(time() + 3600), until_date=int(time() + 3600),
) )
except Exception: except Exception:

View file

@ -165,7 +165,7 @@ async def locks_func(_, message):
await tg_lock(message, permissions, data[parameter], state == "lock") await tg_lock(message, permissions, data[parameter], state == "lock")
elif parameter == "all" and state == "lock": elif parameter == "all" and state == "lock":
try: 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}") await message.reply_text(f"Locked Everything in {message.chat.title}")
except ChatAdminRequired: except ChatAdminRequired:
await message.reply_msg( await message.reply_msg(
@ -177,24 +177,8 @@ async def locks_func(_, message):
await app.set_chat_permissions( await app.set_chat_permissions(
chat_id, chat_id,
ChatPermissions( ChatPermissions(
can_send_messages=True, all_perms=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,
),
) )
await message.reply(f"Unlocked Everything in {message.chat.title}") await message.reply(f"Unlocked Everything in {message.chat.title}")
except ChatAdminRequired: except ChatAdminRequired:

View file

@ -16,6 +16,7 @@ from pyrogram.errors import (
ChatNotModified, ChatNotModified,
ChatRestricted, ChatRestricted,
PeerIdInvalid, PeerIdInvalid,
QueryIdInvalid
) )
from pyrogram.types import ChatPermissions, InlineKeyboardButton, InlineKeyboardMarkup 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$")) @app.on_callback_query(filters.regex(r"^nightmd$"))
@use_chat_lang() @use_chat_lang()
async def callbackanightmd(c, q, strings): async def callbackanightmd(c, q, strings):
await q.answer( try:
strings("nmd_cb").format( await q.answer(
bname=c.me.first_name, ver=__version__, pyver=platform.python_version() strings("nmd_cb").format(
), bname=c.me.first_name, ver=__version__, pyver=platform.python_version()
show_alert=True, ),
cache_time=10, show_alert=True,
) cache_time=10,
)
except QueryIdInvalid:
pass

View file

@ -271,7 +271,7 @@ async def getDataNodrakor(msg, kueri, CurrentPage, user, strings):
return None, 0, None return None, 0, None
text = BeautifulSoup(data, "lxml") text = BeautifulSoup(data, "lxml")
entry = text.find_all(class_="entry-header") entry = text.find_all(class_="entry-header")
if "Tidak Ditemukan" in entry[0].text: if "Nothing Found" in entry[0].text:
if not kueri: if not kueri:
await msg.edit_msg(strings("no_result"), del_in=5) await msg.edit_msg(strings("no_result"), del_in=5)
else: else: