Skip to content

wobkobi/ChatGPT-Discord-Bot

Repository files navigation

Discord ChatGPT Bot

A lightweight Discord bot using Discord.js and OpenAI’s ChatGPT. Features thread-aware memory, persona/fine-tuned modes, cooldowns, emoji replacement, LaTeX rendering, image-and-file inputs, and rotating logs.


📂 Project Layout

src/
├─ commands/         Slash commands (ask, setCooldown, stop, …)
├─ controllers/      Event handlers (messages, interactions)
├─ services/         Core logic (prompt builder, LaTeX renderer, persona)
├─ store/            In-memory + encrypted persistence (user & clone memory)
├─ utils/            Helpers (cooldown, file I/O, logging, Discord formatting)
└─ index.ts          Entry point

🚀 Quickstart

  1. Clone & install

    git clone https://github.com/wobkobi/ChatGPT-Discord-Bot.git
    cd chatgpt-x-discord
    npm install
  2. Configure

    • Copy the environment example and fill in your values:

      • On macOS/Linux:

        cp .env.example .env
      • On Windows (PowerShell or CMD):

        copy .env.example .env
    • Copy the persona template:

      • On macOS/Linux:

        cp src/config/persona.example.json src/config/persona.json
      • On Windows (PowerShell or CMD):

        copy src\config\persona.example.json src\config\persona.json
    • Edit .env and src/config/persona.json in any text editor to set your credentials, keys, and persona text.

  3. Run

    npm run dev

⚙️ Usage

  • /ask – Ask the bot privately (ephemeral reply).
  • /setCooldown – (Owner/Admin) Adjust rate limits per-guild.
  • /stop – (Owner) Gracefully shut down the bot.

Mention the bot (or wait for a random interjection) in any channel to see persona-driven replies, math rendering (\[ … \] → attached images), and image/file support.


🛠️ Configuration

  • Persona vs Fine-tune: Toggle with USE_PERSONA and USE_FINE_TUNED_MODEL in .env.
  • Memory: Threads auto-summarise every 10 messages into long-term store.
  • Logging: Daily-rotating logs in logs/, level set by LOG_LEVEL.

📄 Licence

MIT Licence

About

ChatGPT Discord Bot with personality if you want

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •