Skip to main content

A python module to auto build conversation for a Telegram bot

Project description

PyPI - Python Version PyPI Code style: black GitHub

Setup

You can find the package on PyPi (pip), here.

pip3 install telegram-autoconv

Requirements

Import

from autoconv.state import State
from autoconv.conversation import Conversation
from autoconv.autoconv_handler import AutoConvHandler

Persistence

If you want to use persistence in your bot, Autoconv provides a simple persistence based on PicklePersistence. The normal PicklePersistence doesn't work, due to an instance of a Telegram.Message in the user_data, this persistence uses a workaround.

from autoconv.persistence import AutoconvPersistence
persistence = AutoconvPersistence(filename="bot_persistence", bot_token=BOT_TOKEN)
updater = Updater(BOT_TOKEN, persistence=persistence)

WARNING! This persistence will save the bot token in a pickle file.

Examples

I know you want examples, in fact there is a beautiful folder with some examples.
In the table below, you can find an example for every functions in the module.

Function Example Documentation
add_keybord keyboards.py State
add_text actions.py State
add_action actions.py State
add_dynamic_keybord keyboards.py State
add_custom_keyboard keyboards.py State
add_dynamic_routes keyboards.py State
add_dynamic_list dynamic_list.py State
add_custom_handler handlers.py State
set_long_task actions.py State
add_refresh_auth authorization.py State
Conversation conversation.py Conversation
add_routes conversation.py Conversation
set_defaults defaults.py Conversation
add_authorized_users authorization.py Conversation
restart autoconv_handler.py AutoConvHandler
force_state autoconv_handler.py AutoConvHandler

Documentation

Do you want to read? I got you cover, baby!
No more than a little documentation in the Wiki.

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

telegram-autoconv-0.0.59.tar.gz (13.6 kB view details)

Uploaded Source

File details

Details for the file telegram-autoconv-0.0.59.tar.gz.

File metadata

  • Download URL: telegram-autoconv-0.0.59.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/56.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.5

File hashes

Hashes for telegram-autoconv-0.0.59.tar.gz
Algorithm Hash digest
SHA256 7a2dd8b32b9a52130af59864933379a4f7e311c09a682b59e8db01f732167a95
MD5 57f06109094f8f89a4a2fa9bfcb5a092
BLAKE2b-256 fef5dfb16f4232e8eed07f6f79beaa0f22e05aa47455f4f5461523d7f33888fc

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