Skip to content

Discord chat bot that uses OpenAI's GPT-3.5 model to generate responses to user messages

Notifications You must be signed in to change notification settings

githmin/chatgpt-discord-chat-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenAI (ChatGPT) Discord Chat Bot

This repo is a Discord chat bot that uses OpenAI's GPT-3.5-turbo model to generate responses to user messages. The bot is triggered when a message starts with the "!" character and responds with a message generated by the OpenAI API.

Installation

  1. Clone the repository to your local machine.

    git clone https://github.com/githmin/gpt-3.5-discord-chat-bot.git

  2. Install the required dependencies by running the following command

    npm install

  3. Create a .env file in the root of the project and set the following environment variables

    Discord_Token=<YOUR_DISCORD_TOKEN>

    OpenAI_API=<YOUR_OPENAI_API_KEY>

    Note: Replace the placeholders with your actual values.
    
  4. Start the bot by running the following command:

    node index.js

Dependencies

The bot uses the following dependencies:

  • dotenv - To load environment variables from the .env file.
  • discord.js - To interact with the Discord API.
  • openai - To access the OpenAI GPT-3.5-turbo model API.

Usage

The bot listens to messages in a specific Discord channel identified by Channel_ID environment variable. It generates a response to any message that starts with the "!" character. The bot generates the response using the OpenAI GPT-3.5-turbo model and sends it as a reply to the user who sent the message. The bot has access to last 20 messages to build a context.

Credits

ChatGPT and Discord.JS

#Made with 🤍 by Githmin Jayawardhana

About

Discord chat bot that uses OpenAI's GPT-3.5 model to generate responses to user messages

Topics

Resources

Stars

Watchers

Forks