Третий коммит, добавление share, share_kb, а также ADMIN_ID
This commit is contained in:
28
myenv/Lib/site-packages/aiogram/handlers/message.py
Normal file
28
myenv/Lib/site-packages/aiogram/handlers/message.py
Normal file
@@ -0,0 +1,28 @@
|
||||
from abc import ABC
|
||||
from typing import Optional, cast
|
||||
|
||||
from aiogram.filters import CommandObject
|
||||
from aiogram.handlers.base import BaseHandler, BaseHandlerMixin
|
||||
from aiogram.types import Chat, Message, User
|
||||
|
||||
|
||||
class MessageHandler(BaseHandler[Message], ABC):
|
||||
"""
|
||||
Base class for message handlers
|
||||
"""
|
||||
|
||||
@property
|
||||
def from_user(self) -> Optional[User]:
|
||||
return self.event.from_user
|
||||
|
||||
@property
|
||||
def chat(self) -> Chat:
|
||||
return self.event.chat
|
||||
|
||||
|
||||
class MessageHandlerCommandMixin(BaseHandlerMixin[Message]):
|
||||
@property
|
||||
def command(self) -> Optional[CommandObject]:
|
||||
if "command" in self.data:
|
||||
return cast(CommandObject, self.data["command"])
|
||||
return None
|
Reference in New Issue
Block a user