Telegram/app.py

18 lines
773 B
Python

from modules.logging import logWrite
from modules.utils import configGet
from pyrogram.client import Client
from pyrogram.errors import bad_request_400
app = Client("holochecker", bot_token=configGet("bot_token", "bot"), api_id=configGet("api_id", "bot"), api_hash=configGet("api_hash", "bot"))
async def isAnAdmin(admin_id):
if (admin_id == configGet("owner")) or (admin_id in configGet("admins")):
return True
try:
async for member in app.get_chat_members(configGet("admin_group")):
if member.user.id == admin_id:
return True
except bad_request_400.ChannelInvalid:
logWrite(f"Could not get users in admin group to answer isAnAdmin(). Bot is likely not in the group.")
return False
return False