Skip to main content

textode

Textode is a simple tool to create text bots with only one handler. You can use it for Telegram, VK or any other social network.

What is it for

Textode helps you build static text bots.

Static text bots are bots that has concrete structure, like instruction on the pill bottle or a movie script. So, perfect examples of what you can do with this library is instruction bots, text quests, and so on.

What is it not for

It is not designed to build bots that use data provided by user (e.g. store user age).

What is the idea

In textode the main part of the bot is Node. It used to build bot structure.

For example, this is the basic bot in textode:

Keyboard(
    "Hello! Here is your keyboard.",
    buttons={
        "About bot": Text("*about*"),
        "Bot logo": Image("logo.png"),
    },
)

With this structure bot handles "/start" message, responses with "Hello! Here is your keyboard." text and keyboard of two buttons - "About bot" that sends text about bot and "Bot logo" that sends image of bot logo.

The main advantage of this approach is that your bot is now defined by concrete schema. Instead of making handlers you are designing Node structure.

Another advantage is that instead of many handlers you now have one. It works because of Node identity, they all have the same basic fields:

  • title (by parent) - message text that triggers node.
  • text - text that sends back.

Because of that, you need to make only one handler that picking right node (depends on user input), handles if there is no node with this text, or handles node type (sends keyboard for Keyboard, image for ImageNode etc.).

Installation

via pip:

pip install textode

or poetry:

poetry add textode

Examples

Look here for usage examples (aiogram and vkbottle are presented) with schemas (built by Graphviz with JetBrains Mono font).

Metadata

Release files for textode 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for textode 2.0.0
File Size Uploaded
textode-2.0.0.tar.gz 4.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for textode 2.0.0
File Interpreter ABI Platform
textode-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.2 kB

Release files / textode-2.0.0.tar.gz

Download URL textode-2.0.0.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
95b17f826a0161873bd0d5112cea215de78d84e41a950051d1704476a7296630
BLAKE2b-256 checksum
How to use checksums
cef414701d376927032518ddf9ccfb6f5f59fd9979a02f01bcef2a9a262d8a9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

Release files / textode-2.0.0-py3-none-any.whl

Download URL textode-2.0.0-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
634419d6ecc47b45db7deb5f202cf8079fb725c68c09edd89b401e2e022e76d6
BLAKE2b-256 checksum
How to use checksums
c578cfce2fa70bf2e9a306edcd4a39b693222164948a37ff458b4070d10eb381
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page