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.4.tar.gz
(4.4 kB
view details)
Built Distribution
File details
Details for the file aiogram3_form-0.0.4.tar.gz
.
File metadata
- Download URL: aiogram3_form-0.0.4.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 | 99b6dae7a2153ee0f9ad47e61272044af56fa13f9a979ca628a73dfb0a2b9c39 |
|
MD5 | e7dea2546b1d72f3ffe0744166d6cf38 |
|
BLAKE2b-256 | 3f94378c726e37b1775f77599d84f4e2942cd0af7ddb6a994ab2efa5e7c12d48 |
File details
Details for the file aiogram3_form-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: aiogram3_form-0.0.4-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 | 46b1ae566e216a67a53591c6b8e09ec9a03d4693572848ace40eb1a38f5a6d0b |
|
MD5 | 00df7164c2480154a6182884030da2e5 |
|
BLAKE2b-256 | 460d3101c7852372f6f2014dd74bfa7beb9406a94cc8ece402490a57f23b65cd |