mirror of
https://github.com/MrSedan/neuro-reply-bot-reworked.git
synced 2026-01-15 05:59:43 +03:00
Admin commands work only in private or group
This commit is contained in:
@@ -11,6 +11,8 @@ class AdminMiddleware(BaseMiddleware):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
async def __call__(self, handler: Callable[[Message, Dict[str, Any]], Awaitable[Any]], event: Message, data: Dict[str, Any]) -> Any:
|
async def __call__(self, handler: Callable[[Message, Dict[str, Any]], Awaitable[Any]], event: Message, data: Dict[str, Any]) -> Any:
|
||||||
|
if event.chat.type not in ['private', 'group']:
|
||||||
|
return None
|
||||||
await neuroapi.user.get(str(event.from_user.id), event.from_user.username)
|
await neuroapi.user.get(str(event.from_user.id), event.from_user.username)
|
||||||
isAdmin = await neuroapi.admin.is_admin(str(event.from_user.id))
|
isAdmin = await neuroapi.admin.is_admin(str(event.from_user.id))
|
||||||
if not isAdmin:
|
if not isAdmin:
|
||||||
|
|||||||
Reference in New Issue
Block a user