Skip to content

faizan-devs/Discord-Bot

Repository files navigation

ChatGPT Discord Bot (OpenRouter Edition)

A Discord bot that allows users to interact with ChatGPT via slash commands, using the OpenRouter API. Built using the official discord.js library with support for cooldowns and slash command handling.


🧰 Tech Stack

Layer Technology Purpose
Language Node.js JavaScript runtime environment
Bot API discord.js Interacts with the Discord API
AI API OpenRouter Access to LLMs like ChatGPT via a unified API
Server Express Lightweight web server to keep the bot alive
Env Vars dotenv Manages sensitive configuration via .env
Modules Native ECMAScript Modules (import) Modern JavaScript module system

Features

  • 🔗 Connects to OpenRouter API to access ChatGPT (gpt-3.5-turbo or any supported model)
  • ⚡ Slash command: /ask for real-time AI responses
  • 🕐 Cooldown system to prevent spam
  • 🌐 Lightweight Express server to keep the bot alive (for platforms like Replit, Railway, etc.)

🚀 Getting Started

  1. Dotenv file setup
DISCORD_BOT_TOKEN=Your_Token
CLIENT_ID=Your_ID
OPENROUTER_API_KEY=Your_API_Key
GUILD_ID=Your_ID
PORT=3000
  1. Slash Command: /ask, /history
    In Discord Server:-
    /ask question: How does AI work?
    /history Press Enter (To get 5 recent search history)

And receive an intelligent reply powered by OpenRouter's ChatGPT model.

  1. Clone the repo
git clone https://github.com/faizan-devs/Discord-Bot
cd chatgpt-discord-bot

About

A Discord bot that allows users to interact with ChatGPT.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published