Skip to content

Latest commit

 

History

History
149 lines (133 loc) · 4.97 KB

File metadata and controls

149 lines (133 loc) · 4.97 KB

WHAT IS DUNE BOT?

Dune Bot is an AI Discord bot that chats, remembers, and generates images/code. Uses Pollinations.ai API, switches models, and saves convos. Default model is gpt-5-nano.

KEY FEATURES

  • Remembers chats and channel notes
  • Auto-generates images
  • Formats code
  • Switches AI models per user
  • Logs activity

REQUIREMENTS

  • Python 3.8-3.11
  • Discord Bot Token
  • Pollinations.ai API Token (for backend access)
  • Internet

DEPENDENCIES

  • discord.py>=2.0.0
  • aiohttp
  • aiosqlite
  • pillow
  • apscheduler
  • langdetect
  • googletrans==4.0.0-rc1
  • aiofiles
  • python-dotenv
  • cachetools

SETUP

  1. Download files, put in one folder.
  2. Get Discord Bot Token:
    • Go to https://discord.com/developers/applications
    • Click "New Application" (top right)
    • Enter a name (e.g., "UnityBot"), click "Create"
    • Click "Bot" in left menu
    • Click "Add Bot" (under Bot section)
    • Click "Reset Token" (under Token), confirm, copy token
    • Open .env, add: DISCORD_TOKEN=your_token_here
  3. Get Pollinations.ai API Token:
    • Go to https://auth.pollinations.ai/
    • Sign in (likely with Google or email; first login auto-assigns Seed tier)
    • Click "[Re]Generate Token"
    • Copy the token (e.g., RG4FePiPdUWkk5CI)
    • Open .env, add: POLLINATIONS_TOKEN=your_token_here
    • Warnings: Never share token publicly, don't commit to Git
  4. Optional: Restrict bot to specific channels:
    • Open .env, add: ALLOWED_CHANNELS=12345,67890 (separate multiple IDs with commas or spaces)
    • Leave blank or omit to allow the bot in all channels
  5. Install dependencies:
    • Open terminal/command prompt in folder
    • Run: pip install -U pip (updates pip if needed)
    • Run: pip install -r requirements.txt
    • Run: python -m spacy download en_core_web_sm
  6. Run bot:
    • Double-click RUN_BOT.bat (Windows) or run: python bot.py

COMMANDS

  • !bothelp - Show commands/models
  • !setmodel - Pick AI model (DM)
  • !savememory - Save channel note
  • !search - Search Dune database
  • !item - Lookup item info
  • !skill - Lookup skill info
  • !contract - Lookup contract info
  • !npc - Lookup NPC info
  • !wipe - Clear chat history

NATURAL CHAT

  • "Write a Python function"
  • "Generate an image of a forest"
  • "Remember I like tea" (then !savememory)

HOW IT WORKS

  • MEMORY: Last 20 messages/user/model, 5 channel notes, saved in chat_data.json
  • IMAGES: Detects "image"/"draw", uses Pollinations.ai
  • MODELS: User-picked, defaults to "gpt-5-nano"
  • TEXT: <2000 chars = message, 2000-4096 chars = embed, >4096 chars = .txt file

FILES

  • bot.py - Main bot
  • api_client.py - API calls
  • message_handler.py - Message handling
  • memory_manager.py - Memory
  • commands.py - Commands
  • config.py - Settings (loads tokens from .env)
  • data_manager.py - Data save
  • requirements.txt - Dependencies
  • .env - Tokens (keep secret)
  • system_instructions.txt - AI rules
  • info_request_instructions.txt - info-query rules
  • RUN_BOT.bat - Start script
  • logs/ - application.log, chat_data.json

DATA FILES

Game data lives in the information/ directory. Each JSON file covers a domain:

  • items.json – full item list and details
  • weapons.json, armor.json, vehicles.json, buildings.json
  • skills.json, research.json
  • tips.json, strategies.json, gameplay.json, volumes.json

When a message arrives the bot first asks the LLM which domains it needs (using info_request_instructions.txt), then reads only the named JSON files and sends the relevant entries back with the user's text to craft a final answer. Add or update data by editing the corresponding file or dropping a new *.json into information/.

TROUBLESHOOTING

  • Won’t start? Check .env tokens, Python version, reinstall dependencies
  • No DMs? Enable "Allow DMs from server members" in Discord
  • Slow? Check logs/application.log, restart
  • No images/text? Verify tokens in .env, use "generate an image of..."

CONFIG TWEAKS

  • Edit config.py: max_history (20), max_memories (5), add code/image keywords
  • Edit system_instructions.txt for AI style
  • Edit info_request_instructions.txt for data lookup behavior

SECURITY

  • Don’t share tokens or .env
  • Chats saved in chat_data.json
  • Only Pollinations.ai gets requests

WHY UNITY?

  • Remembers your style
  • Saves channel vibes
  • Adds images/code
  • Adapts to users
  • Fits any server

Check logs or restart if stuck. More chats = better results! (makes fun images) image (can joke with you) image (will give detail requirment lists for just about anything in game) image ANY SO MuCH MORE!