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

Uploaded Source

Built Distribution

aiogram3_form-0.0.3-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aiogram3_form-0.0.3.tar.gz
  • Upload date:
  • Size: 4.4 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.3.tar.gz
Algorithm Hash digest
SHA256 d5889b50b0791b70b9cbd84d7f57dc7930c719afab2c1f3490458c38f11cbe9c
MD5 a800635716c8fda1cfeca007c601c020
BLAKE2b-256 9af5ee8db96314a7df49533b155b15d1800969b760ed78ec88be9b8b349841a8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aiogram3_form-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.6 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e26cbbb80e36a2c7cf135fc265b53d0491863da73ddf9522b8aabe88a0294506
MD5 bf8fe2bc880b54db2524979bef040df6
BLAKE2b-256 51d0ad79b5f174276982e0ea3f65ea08a43483db16d73b49647be87849a895e9

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