Socket
Book a DemoInstallSign in
Socket

command_mk2

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

command_mk2

Custom version of Command filter for aiogram 3

pipPyPI
Version
0.1.2
Maintainers
1

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

Keywords

aiogram

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts