In the ever-evolving landscape of artificial intelligence and interactive entertainment, we are thrilled to unveil a powerful and deeply engaging AI Role-Playing Companion for Telegram. This bot is more than just a chatbot; it's a sophisticated platform for immersive, dynamic, and personalized narrative experiences. Whether you're looking to co-author a creative story, engage in deep character-driven conversations, or simply explore the capabilities of modern AI, this bot is your gateway to a new world of interactive storytelling.
Designed with flexibility and user control at its core, our AI companion allows you to tailor every aspect of your role-playing adventure. From crafting unique AI personas and generating vivid scenes on the fly to maintaining long-term conversational memory, the possibilities are limited only by your imagination. For the technically inclined, the bot also includes a suite of powerful administrative tools for monitoring performance and system health, ensuring a smooth and reliable experience for all users.
This guide will walk you through the process of setting up and running your own instance of the AI Role-Playing Companion.
Before you begin, ensure you have the following:
Python 3.10 or higher.
A Telegram Bot Token: You can get one by talking to the BotFather on Telegram.
LM Studio: This bot is designed to connect to a local large language model (LLM) served via LM Studio. You will need to have LM Studio running with a loaded model.
First, you'll need to have all the project files from my Git repository in a single directory on your computer. These files include:
Directory - .f.e Telegram_AI_Bot
bot.py
config.py
handlers.py
db_utils.py
performance_monitor.py
system_monitor.py
log_utils.py
requirements.txt
.env.txt
The requirements.txt file lists all the necessary Python libraries for the bot to function correctly. Open a terminal or command prompt in your project directory and run the following command to install them:
Bash
pip install -r requirements.txt
This will install the required libraries, including python-telegram-bot, openai, python-dotenv, httpx, psutil, and gputil.
.env file
Edit the .env file and fill in the following details:
TELEGRAM_BOT_TOKEN: Your bot token obtained from BotFather.
LM_STUDIO_API_BASE: The local API endpoint provided by LM Studio (e.g., http://localhost:1234/v1).
BOT_OWNER_ID: Your personal numeric Telegram user ID. You can get this by talking to a bot like @userinfobot.
Step 4: Load a Model in LM Studio
Launch LM Studio and download a language model of your choice. Some recommended models mentioned in the configuration are arliai_mistral-small-24b-arliai-rpmax-v1.4 and llama-3.2-1b-nsfw_sex_orca. Once the model is loaded, navigate to the "Local Server" tab and start the server.
With your environment configured and LM Studio's server running, you can now start the bot. Execute the following command in your terminal:
Bash
python bot.py
If everything is set up correctly, you will see log messages in your terminal indicating that the bot has started successfully. You can now open Telegram and start interacting with your AI companion!
Here’s a closer look at how to use some of the bot's most powerful features:
The /setup command is your central hub for customizing your experience. From here, you can:
In-Conversation Commands
Admin Commands (for the Bot Owner)
If your user ID matches the BOT_OWNER_ID in the .env file, you have access to special commands: