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
Release history Release notifications | RSS feed
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.6.tar.gz
(4.6 kB
view details)
Built Distribution
File details
Details for the file aiogram3_form-0.0.6.tar.gz
.
File metadata
- Download URL: aiogram3_form-0.0.6.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c6fc045f8704abf34ad2031fdc0d2f308b8ec89bdd87546ca5a8c459b7ff2a0 |
|
MD5 | 14146da1ade8a9ae9f569edd608b6d82 |
|
BLAKE2b-256 | 6691c848494c19accd92af9fabb2f32fd89bea5290b2ded67f34f67ce8591643 |
File details
Details for the file aiogram3_form-0.0.6-py3-none-any.whl
.
File metadata
- Download URL: aiogram3_form-0.0.6-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d14f1356af4e0ce593dd4460d3790cf5dff038b0b967975e02f4cc45dca199d |
|
MD5 | ba3f609af9f56c77b8eba7b156f768ea |
|
BLAKE2b-256 | f3a368b7e7e33c1d18067b3e17e73c1e862071290f37434a580d7229864cf0cb |