Skip to content

AbstractiveNord/CommandMk2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Filter CommandMk2 Aiogram 3

Python


Improved command filter

class RestrictModel(BaseModel):
    period: date
    reason: Optional[str]


@router.message(CommandMk2('ban {period} {reason}', response_model=RestrictModel, response_model_name='vars'))
async def ban_user(message: Message, period: date, reason: Optional[str]):
    ...

Diff:

  • Command arguments parsing, not just leaving single string like built-in aiogram filter
  • Command arguments separation and validation using Pydantic model.

Doc is available here

About

Advanced command filter for aiogram 3

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages