A state handling extension for Pyrogram
Project description
Pyrostates
A state handling extension for Pyrogram
from pyrogram import Client, filters
from pyrostates import at_state, set_state, del_state
app = Client("my_account")
@app.on_message(at_state(None) & filters.private & filters.text)
async def home_state(_, message):
await message.reply("Hello, I'm the conversation bot. What is your name?")
set_state(message, "NAME")
@app.on_message(at_state("NAME") & filters.private & filters.text)
async def name_state(_, message):
name = message.text
await message.reply(f"Nice to meet you, {name}! How old are you?")
set_state(message, "AGE")
@app.on_message(at_state("AGE") & filters.private & filters.text)
async def age_state(_, message):
age = message.text
await message.reply(f"You are {age} years old, good for you! Have a nice day!")
del_state(message)
app.run()
Pyrostates is a ready, easy and elegant extension for the Pyrogram framework. It enables you to handle the states of your users in the most simple, efficient and reliable way.
Installing
pip3 install pyrostates
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
pyrostates-0.1.0.tar.gz
(4.1 kB
view details)
Built Distribution
File details
Details for the file pyrostates-0.1.0.tar.gz
.
File metadata
- Download URL: pyrostates-0.1.0.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 520cbccbb7b48efdf3810f1ec52d74c921ef160a7bfcda7acec24af6a84b033a |
|
MD5 | 83ab0d8f656ff5d8fdd78a6c82f0f7b4 |
|
BLAKE2b-256 | e0b2e00819a3bf8b5a1105fc5fa487caaf7bf4b67a90bdcc043a1763e8328aba |
File details
Details for the file Pyrostates-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: Pyrostates-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 85f70a866b69b2f4ebed27e7290dc416bbbf317e34f2def080bf39416b7bf3d6 |
|
MD5 | c5db09cc84217beae85a8a818af14e02 |
|
BLAKE2b-256 | e205670853e69d29dfc7ef3869652c8713c74d34f6d32021e6b3e5f53086a9fc |