Skip to main content

Custom version of Command filter for aiogram 3

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

command_mk2-0.1.2.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

command_mk2-0.1.2-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file command_mk2-0.1.2.tar.gz.

File metadata

  • Download URL: command_mk2-0.1.2.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/6.5.0-41-generic

File hashes

Hashes for command_mk2-0.1.2.tar.gz
Algorithm Hash digest
SHA256 ce583751405b57b9c0ebf2914b9b040b9f0d44abecd1d6f8b2f552d4cfa42158
MD5 e3f84b392353f4ded6caca5163a90fe4
BLAKE2b-256 b39c7f13a4ef67d1608775782d631e8d13a933158f3d41faaba0aed3a86082d2

See more details on using hashes here.

File details

Details for the file command_mk2-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: command_mk2-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/6.5.0-41-generic

File hashes

Hashes for command_mk2-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c929efa8850784b3ff07df4143d2110d9144253482779f2194620278e3c8f6db
MD5 c99f9c3b8cc825730860281cc537d205
BLAKE2b-256 9362365e8d3fed66ab9018ae7365ebaa35e3ac94f5d04ca1194931d94f5daf58

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page