Skip to content

F0RLE/Axelate-tg-bot-module

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🤖 Flux Platform Telegram Bot Module

Python License Platform Launcher


🇷🇺 Русский (нажми, чтобы развернуть)

🎯 Что это?

Это модульный Telegram‑бот для лаунчера Flux Platform:

  • 🤖 работает как отдельный сервис, которым управляет лаунчер;
  • 🧠 переписывает тексты через LLM (Ollama), создаёт промпты;
  • 🎨 генерирует изображения через Stable Diffusion;
  • 📤 делает предпросмотр, редактирование и публикацию постов в целевой канал;
  • 💬 даёт режим чата с историей и распознаванием «нарисуй…» запросов.

Лаунчер отвечает за запуск/остановку и настройки, а этот репозиторий — только за логику бота.

⚙️ Требования

  • ОС: Windows 10/11
  • Python: 3.10+
  • Зависимости: из requirements.txt:
cd modules/bot
python -m pip install -r requirements.txt

При запуске из лаунчера зависимости ставятся автоматически, если чего‑то не хватает.

🚀 Быстрый старт (standalone dev)

cd modules/bot
python -m pip install -r requirements.txt

set BOT_CONFIG_DIR=%APPDATA%\\FluxData\\data\\configs
python -m src.main

Ожидается, что в .env лаунчера (%APPDATA%/FluxData/data/configs/.env) заданы:

BOT_TOKEN=123456:ABC...
TARGET_CHANNEL_ID=-1001234567890
LANGUAGE=ru
BOT_LANGUAGE=ru   # опционально

🌐 Языки

  • Общая система переводов с лаунчером (launcher/locales).
  • Приоритет выбора языка:
    1. BOT_LANGUAGE в .env (если задан и не пустой);
    2. иначе LANGUAGE в .env.
  • Сейчас поддерживаются: en, ru, zh (другие языки добавляются аналогично).

Чтобы добавить новый язык:

  1. Создай <lang>.json в launcher/locales.
  2. Добавь код языка в SUPPORTED_LANGUAGES в core/i18n.py (в лаунчере и модуле).

🧱 Структура проекта

flux-telegram-bot-module/
├── module.json              # манифест модуля для лаунчера
├── requirements.txt         # зависимости бота
├── src/
│   ├── main.py              # точка входа
│   ├── config/
│   │   └── settings.py      # читает общий .env и JSON‑конфиги
│   ├── core/                # ядро бота
│   │   ├── animation.py
│   │   ├── bot_manager.py
│   │   ├── constants.py
│   │   ├── error_handler.py
│   │   ├── exceptions.py
│   │   ├── fsm_states.py
│   │   ├── http_client.py
│   │   ├── i18n.py
│   │   ├── monitoring.py
│   │   ├── rate_limiter.py
│   │   ├── utils.py
│   │   └── validators.py
│   ├── handlers/            # обработчики Telegram‑событий
│   │   ├── chat.py
│   │   ├── forward.py
│   │   ├── post_actions.py
│   │   ├── start.py
│   │   └── topics.py
│   ├── keyboards/           # инлайн‑клавиатуры
│   │   └── inline.py
│   └── modules/             # интеграция с LLM / SD / парсером
│       ├── llm.py
│       ├── image_gen.py
│       └── parser.py
└── README.md

🔌 Интеграция с лаунчером

  • Лаунчер ищет модуль в двух местах:
    1. launcher_modules/bot/src/main.py — установленный модуль для пользователя;
    2. modules/bot/src/main.py — dev‑копия (этот репозиторий).
  • Если модуль не найден, используется main.py, который теперь только показывает понятную ошибку и не запускает старый код.

🤝 Вклад

  • PR и форки приветствуются (когда репозиторий будет открыт).
  • При изменении протокола между лаунчером и ботом:
    • обновляй документацию и здесь, и в основном проекте;
    • по возможности сохраняй обратную совместимость и повышай версию модуля.

🇨🇳 中文 (点击展开)

🎯 这是什么?

这是 Flux Platform 启动器使用的 模块化 Telegram 机器人

  • 🤖 作为独立服务运行,由启动器控制生命周期;
  • 🧠 使用 LLM(Ollama)重写、优化文本并生成提示词;
  • 🎨 通过 Stable Diffusion 生成图片;
  • 📤 支持预览、编辑并发布到目标频道;
  • 💬 提供带历史记录的聊天模式,并可识别“画图”类请求。

⚙️ 环境要求

  • 系统:Windows 10/11
  • Python:3.10+
  • 依赖requirements.txt 中的所有包:
cd modules/bot
python -m pip install -r requirements.txt

set BOT_CONFIG_DIR=%APPDATA%\\FluxData\\data\\configs
python -m src.main

通过启动器启动时,如果依赖缺失会自动安装。

🚀 快速开始(开发环境)

  1. 确保启动器已经创建共享配置文件:
%APPDATA%/FluxData/data/configs/.env
  1. 安装依赖:
cd modules/bot
python -m pip install -r requirements.txt
  1. 直接运行机器人:
set BOT_CONFIG_DIR=%APPDATA%\\FluxData\\data\\configs
cd modules/bot
python -m src.main

.env 中的关键变量:

BOT_TOKEN=123456:ABC...
TARGET_CHANNEL_ID=-1001234567890
LANGUAGE=zh
BOT_LANGUAGE=zh   # 可选,仅设置机器人语言

🌐 语言

  • 使用与启动器相同的本地化文件:launcher/locales
  • 选择语言的顺序:
    1. 使用 .env 中的 BOT_LANGUAGE(如果存在且非空);
    2. 否则使用 LANGUAGE
  • 当前支持语言:en / ru / zh

要添加新语言:

  1. launcher/locales 中添加 <lang>.json
  2. core/i18n.pySUPPORTED_LANGUAGES 中加入该语言代码。

🧱 项目结构

flux-telegram-bot-module/
├── module.json              # 模块清单(给启动器用)
├── requirements.txt         # 依赖
├── src/
│   ├── main.py              # 入口
│   ├── config/
│   │   └── settings.py
│   ├── core/
│   │   ├── animation.py
│   │   ├── bot_manager.py
│   │   ├── constants.py
│   │   ├── error_handler.py
│   │   ├── exceptions.py
│   │   ├── fsm_states.py
│   │   ├── http_client.py
│   │   ├── i18n.py
│   │   ├── monitoring.py
│   │   ├── rate_limiter.py
│   │   ├── utils.py
│   │   └── validators.py
│   ├── handlers/
│   │   ├── chat.py
│   │   ├── forward.py
│   │   ├── post_actions.py
│   │   ├── start.py
│   │   └── topics.py
│   ├── keyboards/
│   │   └── inline.py
│   └── modules/
│       ├── llm.py
│       ├── image_gen.py
│       └── parser.py
└── README.md

🔌 与启动器的集成

  • 启动器按以下顺序查找模块:
    1. launcher_modules/bot/src/main.py
    2. modules/bot/src/main.py(当前仓库)。
  • 如果都不存在,则回退到 main.py,该文件只会提示错误,不再运行旧逻辑。

🤝 贡献

  • 仓库公开后欢迎 PR 和 fork。
  • 修改与启动器之间的协议时:
    • 同步更新文档(启动器 + 模块);
    • 如有破坏性变更,请显式提升模块版本。

🇪🇸 Español (haz clic para expandir)

🎯 ¿Qué es esto?

Este repositorio contiene el servicio de bot de Telegram que el lanzador ejecuta como módulo:

  • 🤖 Bot interactivo con menús y flujo de trabajo completo;
  • 🧠 Reescritura de texto y generación de prompts con LLM (Ollama);
  • 🎨 Generación de imágenes mediante Stable Diffusion;
  • 📤 Flujo de borrador → vista previa → edición → publicación en el canal;
  • 💬 Modo chat con historial y detección de solicitudes de “dibuja / genera imagen”.

El lanzador controla el ciclo de vida (start/stop) y la configuración; este repo sólo contiene la lógica del bot.

⚙️ Requisitos

  • SO: Windows 10/11
  • Python: 3.10+
  • Dependencias: listadas en requirements.txt:
cd modules/bot
python -m pip install -r requirements.txt

Si se ejecuta desde el lanzador, las dependencias se instalarán automáticamente si faltan.

🚀 Inicio rápido (dev)

cd modules/bot
python -m pip install -r requirements.txt

set BOT_CONFIG_DIR=%APPDATA%\\FluxData\\data\\configs
python -m src.main

Se espera que el lanzador haya creado .env en:

%APPDATA%/FluxData/data/configs/.env

Variables clave:

BOT_TOKEN=123456:ABC...
TARGET_CHANNEL_ID=-1001234567890
LANGUAGE=es
BOT_LANGUAGE=es   # opcional

🌐 Idiomas

  • Comparte el sistema de i18n con el lanzador (launcher/locales).
  • Orden de resolución:
    1. BOT_LANGUAGE en .env (si está definido y no vacío);
    2. en caso contrario, LANGUAGE.
  • Idiomas actuales: en / ru / zh (es, hi, ar previstos como futuros).

Para añadir un idioma:

  1. Añade <lang>.json en launcher/locales.
  2. Incluye el código en SUPPORTED_LANGUAGES dentro de core/i18n.py.

🧱 Estructura

flux-telegram-bot-module/
├── module.json
├── requirements.txt
├── src/
│   ├── main.py
│   ├── config/
│   │   └── settings.py
│   ├── core/
│   │   ├── animation.py
│   │   ├── bot_manager.py
│   │   ├── constants.py
│   │   ├── error_handler.py
│   │   ├── exceptions.py
│   │   ├── fsm_states.py
│   │   ├── http_client.py
│   │   ├── i18n.py
│   │   ├── monitoring.py
│   │   ├── rate_limiter.py
│   │   ├── utils.py
│   │   └── validators.py
│   ├── handlers/
│   │   ├── chat.py
│   │   ├── forward.py
│   │   ├── post_actions.py
│   │   ├── start.py
│   │   └── topics.py
│   ├── keyboards/
│   │   └── inline.py
│   └── modules/
│       ├── llm.py
│       ├── image_gen.py
│       └── parser.py
└── README.md

🔌 Integración con el lanzador

  • El lanzador busca el módulo en:
    1. launcher_modules/bot/src/main.py;
    2. modules/bot/src/main.py.
  • Si no encuentra ninguno, usa main.py, que ahora sólo muestra un error en lugar de ejecutar código antiguo.

🤝 Contribución

  • Se aceptarán PR y forks cuando el proyecto sea público;
  • Al cambiar el protocolo entre lanzador y bot, actualiza la documentación en ambos repositorios y sube la versión del módulo si hay cambios incompatibles.

🇮🇳 हिंदी (विस्तार करने के लिए क्लिक करें)

🎯 यह क्या है?

यह वह Telegram बॉट सर्विस है जिसे लॉन्चर एक मॉड्यूल के रूप में चलाता है:

  • 🤖 मेनू और टॉपिक के साथ इंटरैक्टिव बॉट;
  • 🧠 LLM (Ollama) से टेक्स्ट री‑राइट और प्रॉम्प्ट जनरेशन;
  • 🎨 Stable Diffusion से इमेज जेनरेशन;
  • 📤 ड्राफ्ट → प्रीव्यू → एडिट → पब्लिश की पूरी पाइपलाइन;
  • 💬 हिस्ट्री के साथ चैट मोड और “इमेज बनाओ” जैसे रिक्वेस्ट की डिटेक्शन।

लॉन्चर लाइफसायकल और कन्फ़िग मैनेज करता है, यह repo सिर्फ बॉट‑लॉजिक रखता है।

⚙️ आवश्यकताएँ

  • Windows 10/11
  • Python 3.10+
  • requirements.txt में दी गई डिपेंडेंसी:
cd modules/bot
python -m pip install -r requirements.txt

लॉन्चर से चलाने पर ज़रूरी पैकेज अपने‑आप इंस्टॉल हो जाते हैं (अगर नहीं हैं)।

🚀 जल्दी शुरू करें (dev)

cd modules/bot
python -m pip install -r requirements.txt

set BOT_CONFIG_DIR=%APPDATA%\\FluxData\\data\\configs
python -m src.main

कन्फ़िग .env फाइल से पढ़ा जाता है:

%APPDATA%/FluxData/data/configs/.env

मुख्य वैरिएबल उदाहरण:

BOT_TOKEN=123456:ABC...
TARGET_CHANNEL_ID=-1001234567890
LANGUAGE=hi
BOT_LANGUAGE=hi   # वैकल्पिक

🌐 भाषाएँ

  • i18n सिस्टम लॉन्चर के साथ साझा है (launcher/locales)।
  • भाषा चुने जाने का क्रम:
    1. .env में BOT_LANGUAGE;
    2. नहीं होने पर LANGUAGE
  • इस समय सपोर्टेड: en / ru / zh (hi आगे के लिए)।

🧱 संरचना (संक्षेप में)

flux-telegram-bot-module/
├── module.json
├── requirements.txt
├── src/
│   ├── main.py
│   ├── config/
│   │   └── settings.py
│   ├── core/
│   │   ├── animation.py
│   │   ├── bot_manager.py
│   │   ├── constants.py
│   │   ├── error_handler.py
│   │   ├── exceptions.py
│   │   ├── fsm_states.py
│   │   ├── http_client.py
│   │   ├── i18n.py
│   │   ├── monitoring.py
│   │   ├── rate_limiter.py
│   │   ├── utils.py
│   │   └── validators.py
│   ├── handlers/
│   │   ├── chat.py
│   │   ├── forward.py
│   │   ├── post_actions.py
│   │   ├── start.py
│   │   └── topics.py
│   ├── keyboards/
│   │   └── inline.py
│   └── modules/
│       ├── llm.py
│       ├── image_gen.py
│       └── parser.py
└── README.md

🇸🇦 العربية (اضغط للتوسيع)

🎯 ما هو هذا المشروع؟

هذه هي خدمة بوت تيليجرام التي يقوم المشغّل بتشغيلها كوحدة مستقلة:

  • 🤖 بوت تفاعلي مع قوائم ومواضيع عمل متعددة؛
  • 🧠 إعادة صياغة النصوص وإنشاء الـ prompts عبر LLM (Ollama)؛
  • 🎨 توليد الصور عن طريق Stable Diffusion؛
  • 📤 مسار كامل من المسودة → المعاينة → التعديل → النشر في القناة؛
  • 💬 وضع محادثة مع سجل ودعم طلبات “ارسم / أنشئ صورة”.

المشغّل يتحكم في التشغيل والإيقاف والإعدادات، وهذا المستودع يحتوي فقط على منطق البوت.

⚙️ المتطلبات

  • Windows 10/11
  • Python 3.10+
  • الحزم الموجودة في requirements.txt:
cd modules/bot
python -m pip install -r requirements.txt

عند التشغيل من خلال المشغّل سيتم تثبيت الحزم الناقصة تلقائياً.

🚀 تشغيل سريع (بيئة تطوير)

cd modules/bot
python -m pip install -r requirements.txt

set BOT_CONFIG_DIR=%APPDATA%\\FluxData\\data\\configs
python -m src.main

يتم قراءة الإعدادات من ملف .env الخاص بالمشغّل:

%APPDATA%/FluxData/data/configs/.env

متغيّرات مهمة:

BOT_TOKEN=123456:ABC...
TARGET_CHANNEL_ID=-1001234567890
LANGUAGE=ar
BOT_LANGUAGE=ar   # اختياري

🌐 اللغات

  • نظام الترجمة (i18n) مشترك مع المشغّل (launcher/locales
  • ترتيب اختيار اللغة:
    1. استخدام BOT_LANGUAGE من .env (إن وُجد وغير فارغ)؛
    2. وإلا استخدام LANGUAGE؛
  • اللغات المتوفرة حالياً: en / ru / zh.

🧱 البنية (مختصرة)

flux-telegram-bot-module/
├── module.json
├── requirements.txt
├── src/
│   ├── main.py
│   ├── config/
│   │   └── settings.py
│   ├── core/
│   │   ├── animation.py
│   │   ├── bot_manager.py
│   │   ├── constants.py
│   │   ├── error_handler.py
│   │   ├── exceptions.py
│   │   ├── fsm_states.py
│   │   ├── http_client.py
│   │   ├── i18n.py
│   │   ├── monitoring.py
│   │   ├── rate_limiter.py
│   │   ├── utils.py
│   │   └── validators.py
│   ├── handlers/
│   │   ├── chat.py
│   │   ├── forward.py
│   │   ├── post_actions.py
│   │   ├── start.py
│   │   └── topics.py
│   ├── keyboards/
│   │   └── inline.py
│   └── modules/
│       ├── llm.py
│       ├── image_gen.py
│       └── parser.py
└── README.md

Modular Telegram bot used by the Flux Platform launcher.
Handles text rewriting (LLM), image generation (SD) and channel posting.


🎯 What is this?

This repo contains the Telegram bot service that the launcher runs as a separate module:

  • 🤖 Telegram bot with menus, topics and rich workflows.
  • 🧠 Text rewrite & prompts through the LLM (Ollama).
  • 🎨 Image generation via Stable Diffusion.
  • 📤 Draft / preview / edit / publish pipeline for channel posts.
  • 💬 Chat mode with history + image‑prompt detection.

The launcher controls lifecycle (start/stop) and configuration; this repo focuses only on bot logic.


⚙️ Requirements

  • OS: Windows 10/11 (same as launcher).
  • Python: 3.10+.
  • Deps: see requirements.txt:
cd modules/bot
python -m pip install -r requirements.txt

When started from the launcher, it will install these dependencies automatically if needed.


🚀 Quick start (standalone dev)

  1. Make sure the launcher already created its config folder and .env:
%APPDATA%/FluxData/data/configs/.env
  1. Install dependencies:
cd modules/bot
python -m pip install -r requirements.txt
  1. Run the bot directly:
set BOT_CONFIG_DIR=%APPDATA%\\FluxData\\data\\configs
cd modules/bot
python -m src.main

Required variables in .env:

BOT_TOKEN=123456:ABC...
TARGET_CHANNEL_ID=-1001234567890
LANGUAGE=en           # launcher UI language (en / ru / zh)
BOT_LANGUAGE=en       # optional, overrides LANGUAGE for the bot only

The module does not keep its own config copies – it always reads shared settings from the launcher.


🌐 Languages

  • Shared i18n with the launcher (launcher/locales).
  • Resolution order:
    1. BOT_LANGUAGE in .env (if set and non‑empty),
    2. otherwise LANGUAGE in .env.
  • Supported languages: en, ru, zh (with Spanish, Hindi, Arabic planned).

To add a language:

  1. Add <lang>.json to launcher/locales.
  2. Add "<lang>" to SUPPORTED_LANGUAGES in core/i18n.py (launcher + bot).

🧱 Project structure

flux-telegram-bot-module/
├── module.json              # Module manifest for the launcher
├── requirements.txt         # Bot dependencies
├── src/
│   ├── main.py              # Bot entry point
│   ├── config/
│   │   └── settings.py      # Reads shared .env & JSON configs
│   ├── core/                # Core bot logic
│   │   ├── animation.py
│   │   ├── bot_manager.py
│   │   ├── constants.py
│   │   ├── error_handler.py
│   │   ├── exceptions.py
│   │   ├── fsm_states.py
│   │   ├── http_client.py
│   │   ├── i18n.py
│   │   ├── monitoring.py
│   │   ├── rate_limiter.py
│   │   ├── utils.py
│   │   └── validators.py
│   ├── handlers/            # Telegram handlers
│   │   ├── chat.py
│   │   ├── forward.py
│   │   ├── post_actions.py
│   │   ├── start.py
│   │   └── topics.py
│   ├── keyboards/
│   │   └── inline.py
│   └── modules/             # LLM / SD / parser integration
│       ├── llm.py
│       ├── image_gen.py
│       └── parser.py
└── README.md

🔌 Integration with launcher

The launcher looks for the bot module in this order:

  1. launcher_modules/bot/src/main.py – installed module (user‑side).
  2. modules/bot/src/main.py – dev copy (this repo).

If both are missing, the launcher falls back to the legacy main.py stub, which only shows an error so the old bot is never run silently.


🤝 Contribution

  • PRs & forks are welcome once the module is public.
  • When changing the API/protocol between launcher and bot:
    • update documentation here and in the main project;
    • bump the module version and keep backward compatibility where possible.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published