This project is a local AI powered Discord bot that uses a self hosted model through Ollama. The bot reads user messages, sends them to a local model, and replies in a dark, poetic, glitch themed narrative style. The bot maintains conversation history per user and follows a structured narrative arc that evolves over time.
- Local AI inference using Ollama
- Message based command system using the !ask prefix
- Per user conversation memory
- System prompt with a narrative arc and atmospheric tone
- Safe and simple Python code structure
- No external API keys required
- Python 3.10 or newer
- Ollama installed and running locally
- A Discord bot token
- The following Python packages:
- discord.py
- requests
- Install dependencies inside your virtual environment:
pip install discord.py requests
- Make sure Ollama is installed and that you have pulled a model:
olama pull llama3
-
Place your Discord bot token inside the
client.run()call inbot.py. -
Run the bot:
python ai__bot.py
The bot listens for messages that begin with !ask. When a message is received, the bot builds a prompt using a system instruction block, the user's conversation history, and the new message. The prompt is sent to the local model through Ollama's HTTP API. The model response is then returned to the user in Discord.
-
ai_test.py
Contains theask_aifunction that communicates with the local model. -
ai__bot.py
Contains the Discord bot logic, message handling, memory system, and prompt building.
This bot is designed for local experimentation and creative narrative interactions. It does not use cloud services and does not require any external API keys. All AI processing is performed on the user's machine.