mirror of
https://github.com/Nick80835/microbot
synced 2025-08-30 14:08:31 +00:00
actually good admin check this time
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
from re import escape, search
|
from re import escape, search
|
||||||
|
|
||||||
from telethon import events, types
|
from telethon import events, functions, types
|
||||||
|
|
||||||
from .fixes import inline_photos
|
from .fixes import inline_photos
|
||||||
|
|
||||||
@@ -204,13 +204,12 @@ class CommandHandler():
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
async def is_admin(self, event):
|
async def is_admin(self, event):
|
||||||
admin_list = await event.client.get_participants(event.chat, filter=types.ChannelParticipantsAdmins)
|
channel_participant = await event.client(functions.channels.GetParticipantRequest(event.chat, event.from_id))
|
||||||
|
|
||||||
for user in admin_list:
|
if isinstance(channel_participant.participant, (types.ChannelParticipantAdmin, types.ChannelParticipantCreator)):
|
||||||
if user.id == event.from_id:
|
return True
|
||||||
return True
|
else:
|
||||||
|
return False
|
||||||
return False
|
|
||||||
|
|
||||||
def is_blacklisted(self, event, inline=False):
|
def is_blacklisted(self, event, inline=False):
|
||||||
if inline:
|
if inline:
|
||||||
|
Reference in New Issue
Block a user