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.8.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

aiogram3_form-0.0.8-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aiogram3_form-0.0.8.tar.gz
  • Upload date:
  • Size: 4.6 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.8.tar.gz
Algorithm Hash digest
SHA256 1d55ab73077ab4a2b21bedc35ad462b70b8b153931b610306aefbdbea530fdf6
MD5 1b507a0caabd7e2df2aa653f386230cb
BLAKE2b-256 0567a3dc4f4cdaa6b8b2ac470e740b2e7c0b3138d4fe67dc6940f178150f9c29

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aiogram3_form-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 4.8 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.8-py3-none-any.whl
Algorithm Hash digest
SHA256 cd145bf5a3a98ac28d3ebe074000d02e8d9ee11d59dad8e2175f111731c356a0
MD5 59427105748ef84ebf048224b7fcc531
BLAKE2b-256 9fdfa720d16de4ad38214334a8e0f437b897cba0a8b6520040caf6a615a3de57

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