Git Product home page Git Product logo

discordsupergpt's Introduction

ChatGPT Discord BOT

v3.2.1

CodeQL OSSAR Dependency Review

Discord


A Discord BOT Powered By OpenAI's ChatGPT.

This BOT uses ChatGPT API & Firebase Firestore Database.

✨Features

πŸ”₯ Use slash command /ask to ask questions in any channel.

πŸ”‘ Direct Message (DM) the bot to get answer / response privately (switchable).

🧡 Continue Conversation in DM or using /ask

πŸ”„ Use /reset-chat to Start a new Conversation / Thread.

πŸ’₯ Uses Firestore Database for persistent chat history storage & logs.

✨ Chalk, Figlet & Gradient-String for decoration.

πŸ’« Easy Setup !

πŸ₯ Usage:

  • DM - Ask Anything.

  • /ask - Ask Anything.

  • /help - Get Help.

  • /ping - Check Websocket Heartbeat && Roundtrip Latency.

  • /reset-chat - Start A Fresh Chat Session/Thread.

πŸ“‘ Quick Start [Self-Hosting] :

0. Requirements:

1. Bot Setup:

  1. Create New Application (BOT) from Discord Developer Portal and invite that bot to your Discord Server with:
    Scopes: bot & application.commands
    Bot Permissions: 2734284602433
    Privileged Gateway Intents: PRESENCE, SERVER MEMBERS, MESSAGE CONTENT
  • Example Bot Invite URL (Replace BOT_CLIENT_ID with your bot's Client ID) :
https://discord.com/api/oauth2/authorize?client_id=BOT_CLIENT_ID&permissions=2734284602433&scope=bot%20applications.commands
  1. ⭐Star this Repo to get updates.

  2. Clone this repo:

git clone https://github.com/itskdhere/ChatGPT-Discord-BOT

Then navigate to the folder:

cd ChatGPT-Discord-BOT
  1. Install all dependencies:
npm install
  1. To setup Environment Variables, Copy & Rename the .env.example file to .env
cp .env.example .env
nano .env

Then, fill the credentials properly by following this instruction.

  1. Setup Firebase Firestore Database by following this instruction.

  2. Start the BOT:

npm run start

Or, During Development:

npm run dev

Or, In Production with PM2:

npm install pm2 -g
npm run prod
  1. Use the BOT πŸŽ‰

β€’ Environment Variables Setup:

(expand/collapse)
  • DISCORD_CLIENT_ID - Client ID of the bot from OAuth2 section.

  • DISCORD_BOT_TOKEN - Token of the bot from Bot section.

  • DIRECT_MESSAGES - Toggle Direct Messages. Values: true or false

  • DM_WHITELIST_ID=[ "id_1" , "id_2" ] - Set Discord user IDs of users only who can use bot from dm. You can add as many as you want in proper format.

  • OPENAI_API_KEY - Get OpenAI API Key from here.

  • HTTP_SERVER - HTTP Server (Optional). Values: true or false

  • PORT - Port for HTTP Server. Default: 7860. If you change the port, make sure to change it in the Dockerfile as well.

β€’ Advanced Settings:

  • DISCORD_MAX_RESPONSE_LENGTH - Max 2000 , recomended 1900.

  • API_ENDPOINT - Set default for api.openai.com endpoint. But you can set 3rd party equivalent endpoint too.

  • DEBUG - Toggle Debug Messages. Values: true or false

  • UWU - Toggle Figlet & Gradient-String decoration. Values: true or false

  • MODEL - Name of the Model you want to use. Like, text-davinci-003 , gpt-3.5-turbo , gpt-4 etc.

  • SYSTEM_MESSAGE - This is the Initial Prompt that is sent to the Model. You can change it to anything you want to change the bot's behaviour as your requirements. Knowledge Cutoff and Current Date is always sent.

See .env.example file for more details

β€’ Database Setup:

(expand/collapse)
  1. Goto Firebase Console: console.firebase.google.com (No Card Required)

  2. Click on Create a project or Add project. Give it a name and click Continue

  3. Disable Google Analytics & Click Create Project

  4. From the side-bar goto Build & then Firestore Database.

  5. Click Create Database

  6. Select Start in production mode & click Next

  7. Select a Firestore location nearest to your Server / VPS. This'll also set the Default GCP Resource Location & you can't change it later.
    Then click Enable

  8. Now goto Project settings & Service accounts.

  9. Under Firebase Admin SDK select Node.js. Then click Generate new private key and then click Generate key

  10. Important: Rename the downloaded json file to firebaseServiceAccountKey.json
    Any other name will not work here. Then put the json file in your bots directory.
    Copy FileName:

firebaseServiceAccountKey.json

✨ Tip: check out these images here

πŸ’¬ Support:

β›“ Others:

πŸ“ License: MIT

πŸ”‹ ChatGPT API: transitive-bullshit/chatgpt-api

πŸ“š Database: Firestore

🌐 BaaS: Firebase


--- πŸ™‚ ---

discordsupergpt's People

Contributors

davidecke avatar dependabot[bot] avatar itskdhere avatar manobharathi93 avatar masterise-plus avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.