mirror of
https://github.com/nexus-stc/hyperboria
synced 2024-09-12 17:06:19 +02:00
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)
|