Skip to main content

Easy conversation handler for pyrogram mtproto library {for bots only}

Project description

Pyrogram-Conversation {only for bots}

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)

#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..")

#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

pyrocon-1.0.7.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyrocon-1.0.7-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file pyrocon-1.0.7.tar.gz.

File metadata

  • Download URL: pyrocon-1.0.7.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.7

File hashes

Hashes for pyrocon-1.0.7.tar.gz
Algorithm Hash digest
SHA256 45e5c59261e473385ffbd84a294e42049db722bdc186df557187d0094b3e7c5e
MD5 f1f59d3874a024323ef7126ebf661f7b
BLAKE2b-256 d207ae12c76176116e478e21b5a7e5ae874e3f85c1702d37ed4934528997df8c

See more details on using hashes here.

File details

Details for the file pyrocon-1.0.7-py3-none-any.whl.

File metadata

  • Download URL: pyrocon-1.0.7-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.7

File hashes

Hashes for pyrocon-1.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 ba561190c88fad085b13fc9d0a3c2bb92b7e55287a1d7e624254bcdf9ce851d4
MD5 a052d41cab135b179d57fbd973ac7784
BLAKE2b-256 64858787530560857d804dda5455e8537ad7be77e277628fbfffc4a8b0869882

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page