Skip to content

Commit

Permalink
Tes fix perm for channel
Browse files Browse the repository at this point in the history
Signed-off-by: Yasir Aris M <[email protected]>
  • Loading branch information
yasirarism committed Oct 23, 2023
1 parent 8d9e111 commit 49f7ea6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion misskaty/core/misskaty_patch/decorators/adminsOnly.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ def adminsOnly(
self,
permission: typing.Union[str, list],
TRUST_ANON_ADMINS: typing.Union[bool, bool] = False,
ALLOW_CHANNEL: typing.Union[bool, bool] = False,
):
"""
# `tgEasy.tgClient.adminsOnly`
Expand Down Expand Up @@ -148,7 +149,7 @@ async def decorator(client, message):
return await message.reply_text(
"This command can be used in supergroups only.",
)
if message.sender_chat and not TRUST_ANON_ADMINS:
if message.sender_chat and (not TRUST_ANON_ADMINS or ALLOW_CHANNEL):
ANON[int(f"{message.chat.id}{message.id}")] = (
message,
func,
Expand Down
8 changes: 4 additions & 4 deletions misskaty/plugins/inkick_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
@app.on_message(
filters.incoming & ~filters.private & filters.command(["inkick"], COMMAND_HANDLER)
)
@app.adminsOnly("can_restrict_members")
@app.adminsOnly("can_restrict_members", ALLOW_CHANNEL=True)
async def inkick(_, message):
user = await app.get_chat_member(message.chat.id, message.from_user.id)
if user.status.value in ("administrator", "owner"):
Expand Down Expand Up @@ -77,7 +77,7 @@ async def inkick(_, message):
@app.on_message(
filters.incoming & ~filters.private & filters.command(["uname"], COMMAND_HANDLER)
)
@app.adminsOnly("can_restrict_members")
@app.adminsOnly("can_restrict_members", ALLOW_CHANNEL=True)
async def uname(_, message):
user = await app.get_chat_member(message.chat.id, message.from_user.id)
if user.status.value in ("administrator", "owner"):
Expand Down Expand Up @@ -125,7 +125,7 @@ async def uname(_, message):
& ~filters.private
& filters.command(["ban_ghosts"], COMMAND_HANDLER)
)
@app.adminsOnly("can_restrict_members")
@app.adminsOnly("can_restrict_members", ALLOW_CHANNEL=True)
async def rm_delacc(_, message):
user = await app.get_chat_member(message.chat.id, message.from_user.id)
if user.status.value in ("administrator", "owner"):
Expand Down Expand Up @@ -168,7 +168,7 @@ async def rm_delacc(_, message):
@app.on_message(
filters.incoming & ~filters.private & filters.command(["instatus"], COMMAND_HANDLER)
)
@app.adminsOnly("can_restrict_members")
@app.adminsOnly("can_restrict_members", ALLOW_CHANNEL=True)
async def instatus(client, message):
bstat = await app.get_chat_member(message.chat.id, client.me.id)
if bstat.status.value != "administrator":
Expand Down

0 comments on commit 49f7ea6

Please sign in to comment.