Language: 🇷🇺 Русский | 🇺🇸 English | 🇨🇳 中文
Emperor Xi — 🀄️ AI-powered Telegram bot styled as Emperor Xi's personal assistant. A personal assistant to the great leader, ready to answer questions from the common people.
Attention: This is an entertainment project that has no relation to real political figures.
- Multimodal — processing text, voice messages, and images using AI.
- Multiple AI providers — support for OpenAI, DeepSeek, Anthropic, xAI, and OpenRouter.
- Customizable modes — various communication styles and bot behaviors.
- Contextual memory — preserves dialogue history between sessions.
- Statistics — tracking bot usage statistics.
- Pinned messages — pinning important messages.
- Management — bot and functionality management.
- Flexible permissions system — access control to bot functions.
- User management — access and permissions administration.
- Context management — clearing and configuring dialogue memory.
- Behavior modes — creating and editing personalized modes.
- Find the bot on Telegram:
@ximanager_bot - Start a conversation with the
/startcommand
- Simply write questions to the bot — it will respond considering the dialogue context
/xi <message>— address the bot/this— information about the current chat/stats— bot usage statistics
- Send a message to the bot (text, voice, or image)
- The bot processes the request through the selected AI provider
- Receive a response considering the context of previous messages
- Context is preserved between sessions for continuous dialogue
- Telegram Bot API — works in private and group chats
- Database: PostgreSQL 13+
- Cache: Redis 6.0+
- Runtime: Go 1.25+
- Deployment: Docker + Docker Compose
The easiest way to launch for development is to use Dev Containers in VS Code or similar IDEs:
- Clone the repository:
git clone https://github.com/mairwunnx/xi
cd xi- Configure required environment variables (in
.env.devfile):
# Telegram Bot
TELEGRAM_BOT_TOKEN="your_telegram_bot_token"
# AI API Keys
OPENROUTER_API_KEY="your_openrouter_api_key"
OPENAI_API_KEY="your_openai_api_key"
# Agent Prompts (base64 encoded)
AGENT_CONTEXT_SELECTION_PROMPT="base64_encoded_prompt"
AGENT_MODEL_SELECTION_PROMPT="base64_encoded_prompt"Note: Pre-made base64 agent prompts can be found in
prompt0.jsonandprompt1.jsonfiles.
You can also immediately change the default prompt in
migrations/V4__create_modes_tables.sql!
- Open the project in VS Code and select "Reopen in Container"
Everything else (PostgreSQL, Redis, Flyway migrations, dependencies) will be configured automatically. Simple and fast!
- Clone the repository:
git clone https://github.com/mairwunnx/xi
cd xi- Configure required environment variables (in
.envfile):
# Telegram Bot
TELEGRAM_BOT_TOKEN="your_telegram_bot_token"
# AI API Keys
OPENROUTER_API_KEY="your_openrouter_api_key"
OPENAI_API_KEY="your_openai_api_key"
# Agent Prompts (base64 encoded)
AGENT_CONTEXT_SELECTION_PROMPT="base64_encoded_prompt"
AGENT_MODEL_SELECTION_PROMPT="base64_encoded_prompt"Note: Configure other environment variables as needed (passwords for Redis and PostgreSQL, Prometheus/Grafana configuration).
- Start the services:
docker compose up -d- Check the status:
docker compose logs -f ximanagerIf you want to use a pre-built image and manage PostgreSQL/Redis yourself:
- Declare the ximanager service in
docker-compose.yml:
services:
ximanager:
image: ghcr.io/mairwunnx/ximanager:5.0.0
env_file: .env
environment:
REDIS_ADDRESS: ${REDIS_ADDRESS}
REDIS_PASSWORD: ${REDIS_PASSWORD}
POSTGRES_HOST: ${POSTGRES_HOST}
POSTGRES_PORT: ${POSTGRES_PORT}
POSTGRES_DATABASE: ${POSTGRES_DATABASE}
POSTGRES_USERNAME: ${POSTGRES_USERNAME}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
TELEGRAM_BOT_TOKEN: ${TELEGRAM_BOT_TOKEN}
OPENROUTER_API_KEY: ${OPENROUTER_API_KEY}
OPENAI_API_KEY: ${OPENAI_API_KEY}
AGENT_CONTEXT_SELECTION_PROMPT: ${AGENT_CONTEXT_SELECTION_PROMPT}
AGENT_MODEL_SELECTION_PROMPT: ${AGENT_MODEL_SELECTION_PROMPT}Note: You will need to pass all environment variables from the
.envfile or any other convenient way.
- Declare PostgreSQL and Redis services in
docker-compose.yml.
Important: PostgreSQL version should be
13+, and Redis should be6.0+.
-
Configure database migrations using Flyway or apply them manually from the
migrations/folder. -
Start the services:
docker compose up -dRequirements:
- Go 1.25+
go build -o ximanager program.goRequirements:
- Docker
docker build -t ximanager .- Go 1.25 — main development language
- Telegram Bot API (tgbotapi) — Telegram integration
- PostgreSQL + GORM — main database with ORM and DAO auto-generation
- Redis + go-redis — session caching and fast operations
- Flyway — database migration management
- OpenAI API — GPT models
- DeepSeek API — DeepSeek models
- Anthropic API — Claude models
- xAI API — Grok models
- OpenRouter — AI model aggregator for expanded capabilities
- Whisper — voice message recognition
- Uber-FX — dependency injection for modular architecture
- Structured Logging (slog) — JSON logging with context
- Docker + Docker Compose — containerization and orchestration
- Prometheus + Grafana — monitoring and metrics
AI was used for prompt optimization, module architecture improvement, as well as for creating part of the documentation and generating GORM models, and also for commit names.
Also, as of September 22, 2025, AI hints (prompts/rules) have been added to the .cursor/rules/ folder, which can help when implementing new features using LLM agents in the future.
Dickobrazz — 🌶️ Dickobrazz bot, aka dicobot, capable of measuring your unit size to the nearest centimeter. A modern and technological cockometer with seasons system and gamification.
Louisepizdon — 🥀 Louisepizdon, an AI Telegram bot that's more honest than your grandmother. Will evaluate you properly, breaking down the pricing of your clothes from a photo!
Mo'Bosses — 🏆 Mo'Bosses is the best RPG plugin that transforms ordinary mobs into epic bosses with an advanced player progression system. Unlike other plugins, here every fight matters, and each level opens new possibilities! ⚔
Mo'Joins — 🎉 Custom joins/quits: messages, sounds, particles, fireworks, and protection after joining. All for PaperMC.
Mo'Afks — 🛡️ Pause in online time — now possible. A plugin for PaperMC that gives players a safe AFK mode: damage immunity, no collisions, ignored by mobs, auto-detect inactivity, and neat visual effects.
McBuddy Server — 🛠️⚡ Backend for MCBuddy AI assistant with OpenRouter integration and request processing
McBuddy Telegram — 🤖📱 Telegram bot for communicating with MCBuddy outside the game
McBuddy Spigot — 💬 Spigot plugin for MCBuddy integration — adds /ask command for AI assistant questions directly in Minecraft server chat! 🎮
🇷🇺 Made in Russia with love. ❤️
Emperor Xi — is about quality Chinese AI assistant and modern technologies. For the people!
🫡 Made by Pavel Erokhin (Павел Ерохин), aka mairwunnx.
