mirror of
https://github.com/nexus-stc/hyperboria
synced 2024-12-26 03:25:49 +01:00
681817ceae
GitOrigin-RevId: 83514338be1d662518bab9fe5ab6eefef98f229f
23 lines
704 B
Python
23 lines
704 B
Python
from abc import ABC
|
|
|
|
from library.telegram.base import RequestContext
|
|
from nexus.bot.widgets.admin_widget import AdminWidget
|
|
from telethon import events
|
|
|
|
from .base import BaseHandler
|
|
|
|
|
|
class BaseAdminHandler(BaseHandler, ABC):
|
|
def _has_access(self, chat):
|
|
return chat.is_admin
|
|
|
|
|
|
class AdminHandler(BaseAdminHandler):
|
|
filter = events.NewMessage(incoming=True, pattern='^/admin$')
|
|
|
|
async def handler(self, event, request_context: RequestContext):
|
|
request_context.statbox(action='show', mode='admin')
|
|
admin_widget_view = AdminWidget(application=self.application, chat=request_context.chat)
|
|
text = await admin_widget_view.render()
|
|
await event.reply(text)
|