Easy conversation handler for pyrogram mtproto library...
Project description
#Conversation in pyrogram
from pyrocon import quiz
#await quiz.ask(c,msg,ask,timeout,stop_cmd,placeholder)
client : "Client" required parameter ( Pyrogram Client )
update : Message/CallbacQuery request parameter (where to start conv..)
ask : "str" required parameter (Question to ask)
timeout : "int" optional parameter (default to 30 sec)
cquery : "bool" parameter set True when asking with inline buttons (default to False)
stop_cmd : "str" optional parameter (default to /cancel)
placeholder : "str" optional parameter (custom placeholder for Forcereply)
filter : pyrogram filters optional parameter (default to filters.text)
#using example:
handle text messages
from pyrocon import quiz
answer = await quiz.ask(c,message,ask)
if answer.text:
print(answer.text)
answer.reply("I got answer..")
handle CallbackQuery / inline buttons
from pyrocon import quiz
answer = await quiz.ask(c,CallbacQuery,ask,cquery=True)
if answer.text:
print(answer.text)
answer.reply("I got answer..")
Using pyrogram filters
single filter
from pyrocon import quiz
from pyrogram import filters
answer = await quiz.ask(c,update,ask,filter=filters.photo)
print(answer.photo)
multiple filters
from pyrocon import quiz
from pyrogram import filters
answer = await quiz.ask(c,update,ask,filter=(filters.photo & filters.group))
print(answer.photo)
#Handle any kind of errors
from pyrocon import quiz
answer = await quiz.ask(c,update,ask)
if answer.error:
print(answer.error)
#Handle timeout Errors
from pyrocon import quiz
answer = await quiz.ask(c,update,ask)
if answer.timeout:
print(answer.timeout)
#Handle cancellation Errors
from pyrocon import quiz
answer = await quiz.ask(c,update,ask)
if answer.cancel:
print(answer.cancel)
Facts:
#if successful answer is Message object otherwise an error
#answer must be in reply to orginal message and should be a text message otherwise message will be ignored
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyrocon-1.7.0.tar.gz.
File metadata
- Download URL: pyrocon-1.7.0.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6143ebdc2fa699c9fb60d0f0bb60bbcf10c60ae4169ec4d84a8794252fc03f65
|
|
| MD5 |
7b6528c286dd7e5d152f165969d09edf
|
|
| BLAKE2b-256 |
cc9c724c38adbea585c4eb9bf88c730034d70ab4ca17a31da2ac1e6d7b370a1b
|
File details
Details for the file pyrocon-1.7.0-py3-none-any.whl.
File metadata
- Download URL: pyrocon-1.7.0-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a3d5e6f1559e88c29925f6d1463746c0de8fac4448768f09d5d29c795e672798
|
|
| MD5 |
28542e9c60a25748650ee9a74e456846
|
|
| BLAKE2b-256 |
1bdc29f5269f122e048137763cf7aaf1a3e1678362b00736575a6e9be3a95fa1
|