UniUI is an intelligent Discord bot that can communicate, store memories, and even execute terminal commands on Windows.
UniUI is a Discord bot that integrates with OpenAI's GPT models to generate interactive responses to user messages, while maintaining a per-user memory of past interactions. It detects certain phrases to switch into a terminal mode, where it translates user requests into Windows Cmd/PowerShell commands, executes them on the server, and returns the output or explanations back to the user. Additionally, the bot includes safeguards against prompt manipulation attempts and provides witty responses when such attempts are detected.
- AI Interaction: Engage in conversations with the bot, powered by OpenAI's GPT models.
- Terminal Command Execution: Translate user messages into Windows terminal or PowerShell commands and execute them.
- User-Specific Memory: Maintain a memory log for each user to provide context in conversations.
- Customizable Prompts: Modify the system prompt to change the bot's behavior.
- Command Logging: Logs all user interactions and bot responses.
- Configurable AI Settings: Adjust model parameters like temperature and max tokens.
- User Friendly: Once the bot is running in Python, you won't need to modify the code. Simply adjust the .ini and .csv to your preferences.
- Python 3.7 or higher
- Discord bot token
- OpenAI API key
- Required Python packages:
openai
discord
-
Clone the Repository
git clone https://github.com/calinux-py/UniUI.git cd UniUI
-
Install Required Packages
pip install -r requirements.txt
-
Set Up Configuration Files
Edit the following configuration files inside a
config
directory. See the Configuration section for details.config/prompt.ini
config/openaikey.ini
config/token.ini
config/ai_config.ini
config/memory_limit.ini
config/name.ini
config/terminal.csv
config/man.csv
config/straw.csv
-
Run the Bot
python UniUI.py
The bot relies on several configuration files located in the config
directory. Here's what each file does:
Defines the system prompt that sets the initial behavior of the AI.
[PROMPT]
content = Your custom system prompt here.
Stores your OpenAI API key.
[openai]
key = YOUR_OPENAI_API_KEY
Contains your Discord bot token.
[discord]
token = YOUR_DISCORD_BOT_TOKEN
Configures the AI model settings.
[AI_SETTINGS]
model = gpt-3.5-turbo
temperature = 0.7
max_tokens = 150
Sets the number of past messages to retain in the user's memory log.
[LIMIT]
count = 20
Specifies the bot's display name and Discord command name.
[app name]
name = UniUI
[discord command name]
name_must_be_lowercase = uniui
A CSV file containing phrases that trigger terminal command execution mode.
run command
execute
terminal
Contains phrases that the bot uses to detect manipulation attempts.
change prompt
ignore previous
alter behavior
Includes phrases to trigger a specific Easter egg response about the word "Strawberry."
how many rs in strawberry
strawberry has how many rs
Once the bot is running, you can interact with it on your Discord server using the slash command defined in config/name.ini
.
-
Command Format:
/uniui <message>
-
Example:
/uniui Hello, how are you?
If your message includes any phrases from config/terminal.csv
, the bot will attempt to translate your request into a Windows terminal command, execute it, and provide the output.
-
Example:
/uniui Using the terminal, list all files in the current directory.
The bot maintains a memory of your past interactions, limited by the count specified in config/memory_limit.ini
. It uses this memory to provide context in conversations.
- Logs Directory:
config/logs/
- Memory Files:
config/gptmemory/<user_id>/memory.ini
All interactions are logged with timestamps, user IDs, and messages.
MIT