🇷🇺 Русский (нажми, чтобы развернуть)
Это модульный 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При запуске из лаунчера зависимости ставятся автоматически, если чего‑то не хватает.
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). - Приоритет выбора языка:
BOT_LANGUAGEв.env(если задан и не пустой);- иначе
LANGUAGEв.env.
- Сейчас поддерживаются: en, ru, zh (другие языки добавляются аналогично).
Чтобы добавить новый язык:
- Создай
<lang>.jsonвlauncher/locales. - Добавь код языка в
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
- Лаунчер ищет модуль в двух местах:
launcher_modules/bot/src/main.py— установленный модуль для пользователя;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通过启动器启动时,如果依赖缺失会自动安装。
- 确保启动器已经创建共享配置文件:
%APPDATA%/FluxData/data/configs/.env
- 安装依赖:
cd modules/bot
python -m pip install -r requirements.txt- 直接运行机器人:
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; - 选择语言的顺序:
- 使用
.env中的BOT_LANGUAGE(如果存在且非空); - 否则使用
LANGUAGE;
- 使用
- 当前支持语言:en / ru / zh。
要添加新语言:
- 在
launcher/locales中添加<lang>.json; - 在
core/i18n.py的SUPPORTED_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
- 启动器按以下顺序查找模块:
launcher_modules/bot/src/main.py;modules/bot/src/main.py(当前仓库)。
- 如果都不存在,则回退到
main.py,该文件只会提示错误,不再运行旧逻辑。
- 仓库公开后欢迎 PR 和 fork。
- 修改与启动器之间的协议时:
- 同步更新文档(启动器 + 模块);
- 如有破坏性变更,请显式提升模块版本。
🇪🇸 Español (haz clic para expandir)
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.
- SO: Windows 10/11
- Python: 3.10+
- Dependencias: listadas en
requirements.txt:
cd modules/bot
python -m pip install -r requirements.txtSi se ejecuta desde el lanzador, las dependencias se instalarán automáticamente si faltan.
cd modules/bot
python -m pip install -r requirements.txt
set BOT_CONFIG_DIR=%APPDATA%\\FluxData\\data\\configs
python -m src.mainSe 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- Comparte el sistema de i18n con el lanzador (
launcher/locales). - Orden de resolución:
BOT_LANGUAGEen.env(si está definido y no vacío);- en caso contrario,
LANGUAGE.
- Idiomas actuales: en / ru / zh (es, hi, ar previstos como futuros).
Para añadir un idioma:
- Añade
<lang>.jsonenlauncher/locales. - Incluye el código en
SUPPORTED_LANGUAGESdentro decore/i18n.py.
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
- El lanzador busca el módulo en:
launcher_modules/bot/src/main.py;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.
- 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लॉन्चर से चलाने पर ज़रूरी पैकेज अपने‑आप इंस्टॉल हो जाते हैं (अगर नहीं हैं)।
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)। - भाषा चुने जाने का क्रम:
.envमेंBOT_LANGUAGE;- नहीं होने पर
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)؛ - ترتيب اختيار اللغة:
- استخدام
BOT_LANGUAGEمن.env(إن وُجد وغير فارغ)؛ - وإلا استخدام
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.
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.
- OS: Windows 10/11 (same as launcher).
- Python: 3.10+.
- Deps: see
requirements.txt:
cd modules/bot
python -m pip install -r requirements.txtWhen started from the launcher, it will install these dependencies automatically if needed.
- Make sure the launcher already created its config folder and
.env:
%APPDATA%/FluxData/data/configs/.env
- Install dependencies:
cd modules/bot
python -m pip install -r requirements.txt- Run the bot directly:
set BOT_CONFIG_DIR=%APPDATA%\\FluxData\\data\\configs
cd modules/bot
python -m src.mainRequired 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 onlyThe module does not keep its own config copies – it always reads shared settings from the launcher.
- Shared i18n with the launcher (
launcher/locales). - Resolution order:
BOT_LANGUAGEin.env(if set and non‑empty),- otherwise
LANGUAGEin.env.
- Supported languages: en, ru, zh (with Spanish, Hindi, Arabic planned).
To add a language:
- Add
<lang>.jsontolauncher/locales. - Add
"<lang>"toSUPPORTED_LANGUAGESincore/i18n.py(launcher + bot).
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
The launcher looks for the bot module in this order:
launcher_modules/bot/src/main.py– installed module (user‑side).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.
- 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.