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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: aiogram3_form-0.0.7.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.7.tar.gz
Algorithm Hash digest
SHA256 31f76b527818ae69a4014aa277882d581a549391b2fbf83850155e2396c3e5cd
MD5 e5d271448873e13ff31e384ad231c24d
BLAKE2b-256 6902062c5a1d43160cc018dfd277996018075e5dd94adabd8a565bfe9296a52d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aiogram3_form-0.0.7-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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 23cfa7875aaf783d57f6146fbf001f7b2759027cbe166a04de4e582904cab2ce
MD5 a71fbd5a5a24ab633d7d53b6ead009ee
BLAKE2b-256 8a1b86573057c7dec813bca72d58f2dfaee1671b5dca2c5f8117bbb852bb8aa0

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