Skip to main content

ITD ChatBot SDK

Поддерживаемые версии Python Версия пакета в PyPI Лицензия проекта

Python SDK для создания чат-ботов в мессенджере ИТД.

Что умеет SDK

  • Команды и обработчики. /start, /echo, обычные сообщения, фото, реакции, правки и удаления.
  • Файлы. Фото, видео, музыка и любые документы до 2 ГиБ. Фото и видео можно сжимать.
  • Красивый текст. Жирный, курсив, ссылки и спойлеры без Markdown.
  • Долгая работа без хлопот. Токен обновляется сам, курсор событий сохраняется, лимиты запросов соблюдаются.

SDK написан по клиентскому бандлу ИТД и работает от имени обычного аккаунта. Это неофициальный проект: права, лимиты и формат событий определяет сервер. Что мы проверили на живом ИТД, а что нет, честно сказано в документации.

Установка

Нужен Python 3.10 или новее (поддерживаемые версии видно по значку выше).

python -m pip install itd-chatbot-sdk

Дополнительные возможности ставятся отдельно:

python -m pip install "itd-chatbot-sdk[websocket]"  # быстрые обновления
python -m pip install "itd-chatbot-sdk[images]"     # сжатие фото

Быстрый старт

Вам понадобится refresh_token аккаунта бота. Как его получить?

import os

from itd_bot import Bot, Dispatcher

with Bot.from_refresh_token(os.environ["ITD_REFRESH_TOKEN"]) as bot:
    router = Dispatcher.from_bot(bot)

    @router.command("start")
    def start(ctx):
        ctx.reply("Привет! Я бот на ITD ChatBot SDK.")

    router.run_polling(state_path=".bot-state.json")

Запустите файл и напишите боту /start. Бот запомнит, где остановился, в файле .bot-state.json (при первом запуске старые сообщения пропускаются).

Файл сессии .itd-session.json содержит секрет в открытом виде. Не добавляйте его в Git. Подробности: авторизация.

Разбор по шагам: первый бот.

Документация

Хочу... Читать
Запустить первого бота Первый бот
Получить токен и не потерять сессию Авторизация
Отправлять сообщения, файлы, реакции Руководство
Найти нужный метод Справочник API
Понять, почему бот иногда ждёт Лимиты запросов
Посмотреть примеры Папка examples
Узнать, что изменилось История изменений
Опубликовать SDK в PyPI Публикация
Изучить маршруты ИТД Список маршрутов

Примеры

Каждый пример лежит в своей папке с коротким README. Токены задаются переменными окружения, значений по умолчанию нет.

Пример О чём
rate_limit_demo Корзины токенов и паузы после 429, без сети
formatting_bot Форматирование через Text
countdown_bot Отправка, правка и удаление своего сообщения
reactions_bot Реакции и событие reaction
media_saver Сохранение вложений
forward_bot Пересылка в служебный чат
subscribers_only Команда только для подписчиков
profile_lookup Чтение профиля

Рядом лежат простые examples/echo.py, commands.py и chat_actions.py.

Участие в разработке

Хотите помочь? Начните с CONTRIBUTING.md. Быстрая проверка перед PR:

python -m pip install -e ".[dev]"
python -m ruff check itd_bot examples tests
python -m ruff format --check itd_bot examples tests
python -m pytest -q
python -m build

Тесты идут без настоящих токенов и без подключения к ИТД. Остальное:

Лицензия

Проект распространяется по Apache License 2.0.

Metadata

Release files for itd-chatbot-sdk 1.3.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 itd-chatbot-sdk 1.3.0
File Size Uploaded Provenance Actions
itd_chatbot_sdk-1.3.0.tar.gz 490.9 kB With provenance Details for itd_chatbot_sdk-1.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for itd-chatbot-sdk 1.3.0
File Interpreter ABI Platform Actions
itd_chatbot_sdk-1.3.0-py3-none-any.whl Python 3 none any Details for itd_chatbot_sdk-1.3.0-py3-none-any.whl

Total release size: 537.0 kB

Release files / itd_chatbot_sdk-1.3.0.tar.gz

Download URL itd_chatbot_sdk-1.3.0.tar.gz
Size 490.9 kB
Tags Source
SHA-256 checksum
How to use checksums
1e174fcf3bd5376cf2d73d475d91d8c373ac04df91533149ba2d9bbc6042ed98
BLAKE2b-256 checksum
How to use checksums
208c5bba420584a9d40fbe8bff9deb1871038384982b412002d94e2c7d99e790
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / itd_chatbot_sdk-1.3.0-py3-none-any.whl

Download URL itd_chatbot_sdk-1.3.0-py3-none-any.whl
Size 46.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dba1f3d6f1ac5c6015ee76b775248e4a79ad6d761d609130d6c059a6076c690e
BLAKE2b-256 checksum
How to use checksums
64c8e13847d7bf58e1bac64e557d5b603998003b31019c13857f1ff80a4f73af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Security for itd-chatbot-sdk 1.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for itd_chatbot_sdk-1.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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