This commit is contained in:
yasirarism 2023-07-04 11:01:25 +07:00 committed by GitHub
parent bafee5a7cd
commit 44c59927be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View file

@ -12,6 +12,7 @@ def command(
group_only: typing.Union[bool, bool] = False,
self_admin: typing.Union[bool, bool] = False,
self_only: typing.Union[bool, bool] = False,
no_channel: typing.Union[bool, bool] = False,
handler: typing.Optional[list] = None,
filter: typing.Union[pyrogram.filters.Filter, pyrogram.filters.Filter] = None,
*args,
@ -80,6 +81,8 @@ def command(
async def decorator(client, message: pyrogram.types.Message):
if is_disabled:
return await message.reply_text("Sorry, this command has been disabled by owner.")
if no_channel:
return await message.reply_text("I'm cannot identify user. Use my command in private chat.")
if (
self_admin
and message.chat.type != pyrogram.enums.ChatType.SUPERGROUP

View file

@ -35,13 +35,11 @@ def rand_key():
return str(uuid4())[:8]
@app.on_cmd("ytsearch", filter=~filters.channel)
@app.on_cmd("ytsearch", no_channel=True)
@capture_err
@ratelimiter
@use_chat_lang()
async def ytsearch(self: Client, ctx: Message, strings):
if ctx.sender_chat:
return await ctx.reply_msg(strings("no_channel"))
if len(ctx.command) == 1:
return await ctx.reply_msg(strings("no_query"))
query = ctx.text.split(" ", maxsplit=1)[1]