Skip to main content

A library to create forms in aiogram3

Project description

aiogram3-form

A library to create forms in aiogram3

Example

# suppose you import here your router and bot objects
from aiogram import types

from aiogram3_form import Form, FormField


class NameForm(Form):
    first_name: str = FormField(enter_message_text="Enter your first name please")
    second_name: str = FormField(enter_message_text="Enter your second name please")


@NameForm.submit()
async def name_form_submit_handler(form: NameForm, event_chat: types.Chat):
    await bot.send_message(
        event_chat.id, f"Your full name is {form.first_name} {form.second_name}!"
    )

After submit callback call the state would be automatically cleared.

You can control this state using the following metaclass kwarg

...


class NameForm(Form, clear_state_on_submit=False):  # True by default
    ...


@NameForm.submit()
async def name_form_submit_handler(form: NameForm, state: FSMContext):
    # so you can set your exit state manually
    await state.set_state(...)

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

aiogram3_form-0.0.9.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

aiogram3_form-0.0.9-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file aiogram3_form-0.0.9.tar.gz.

File metadata

  • Download URL: aiogram3_form-0.0.9.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.0 CPython/3.10.8 Windows/10

File hashes

Hashes for aiogram3_form-0.0.9.tar.gz
Algorithm Hash digest
SHA256 a71e0d94ea86cb93382c8cf2a6ddddd1bc688a820272ae15f419b669c4a9f48e
MD5 28bc838f79989387d55e7d1aff6c879f
BLAKE2b-256 18f81a42ffaba38406e401237ba041be60897979bc137ec158177dc9a523a178

See more details on using hashes here.

File details

Details for the file aiogram3_form-0.0.9-py3-none-any.whl.

File metadata

  • Download URL: aiogram3_form-0.0.9-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.0 CPython/3.10.8 Windows/10

File hashes

Hashes for aiogram3_form-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 c9b760b7ec5022356b23e4d4eb454e24cfe57cdd61167abb957b22fe40e1af4c
MD5 79f8302a35549b92a4c73be743e9380f
BLAKE2b-256 3c4d8301775a09eb4508d8941afeefe1355022896f8b402ade8d27821b9102ad

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