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

Alt text Welcome to Autoconv!
A Python package that help you build complex Telegram bot conversations with buttons, actions and much more.
This package is built over the awesome Python-Telegram-Bot!

Setup

You can find the package on PyPi (pip).

pip3 install telegram-autoconv

Requirements

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.
In addition to that, there is a live Telegram bot to showcase every features, @AutoBot.

Function Example Documentation
add_keybord keyboards.py State
add_text actions.py State
add_dynamic_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
add_operation_buttons keyboards.py State
Conversation conversation.py Conversation
add_routes conversation.py Conversation
set_defaults defaults.py Conversation
add_authorized_users authorization.py Conversation
state_messages texts.py Texts Guide
set_timed_function async.py AutoConvHandler
stop_timed_function async.py AutoConvHandler
send_autodestroy_message async.py AutoConvHandler
restart autoconv_handler.py AutoConvHandler
force_state autoconv_handler.py AutoConvHandler
save tdata.py TelegamData
add tdata.py TelegamData
get_or_set tdata.py TelegamData

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.utils.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.

Documentation

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

Real World Example

I have a simple movies info Telegram bot publicy available.
You can interact with the Bot (the response time it kinda high, caused by very slow connection) PopCorn (sorry for the italian).
The code (except for the config files) is in this GIST.

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.71.tar.gz (16.2 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: telegram-autoconv-0.0.71.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.26.0 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.71.tar.gz
Algorithm Hash digest
SHA256 645dfc2d23c89665c3a06b4443770f6de58ea39f7809559fe677cb06a8947504
MD5 0e1fddd2428ad3c7f18f31114b043cb5
BLAKE2b-256 25dc665fb575bfe7ad265f6bc3ff6212a9f42632c8f67e17563f9f0a6f7d1352

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