Priler / samurai

Simple, yet effective moderator bot for telegram. With reports, logs, profanity filter and more :3

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

IsAdminFilter is incorrect

MasterGroosha opened this issue · comments

Hi there. There is an issue with your IsAdminFilter

A filter is considered passed if its check() function returns True. Let's take a look at your current implementation:

async def check(self, message: types.Message):
    member = await message.bot.get_chat_member(message.chat.id, message.from_user.id)
    return member.is_chat_admin()

See the issue? Your filter will return True if a member is admin, regardless of what you passed to it is_admin=True or is_admin=False or even is_admin=123123123. It doesn't matter since your code doesn't compare that value at all.

The fix is simple: compare is_chat_admin() result with what you passed as is_admin filter argument