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.2.tar.gz
(4.4 kB
view details)
Built Distribution
File details
Details for the file aiogram3_form-0.0.2.tar.gz
.
File metadata
- Download URL: aiogram3_form-0.0.2.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 18774b62ce1af329466c3afe5d47ce393c025fd2334205674e8a4c937900b35b |
|
MD5 | a5d42141d202cf55739dd044e9935642 |
|
BLAKE2b-256 | 2caecbc538a11ad1a0e174278dec6fb5a493b2fe627bc68609e07ac0bbef2b02 |
File details
Details for the file aiogram3_form-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: aiogram3_form-0.0.2-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ef0b1a3953f0831b70bcb24b6cc6d1264e3fadc4a6f0c41c2a563b190533a95 |
|
MD5 | 1baeb425f7794a58dae14b2f4b6943b1 |
|
BLAKE2b-256 | fcfdf589318be065d98cc57113c2444c74f92d4a8a9de72e8e7888d8d0db9dd1 |