GithubHelp home page GithubHelp logo

chatgpt-discord's Introduction

Discord Chatbot with GPT-3.5

This is a Discord chatbot that utilizes the GPT-3.5 model from OpenAI to generate responses to messages in a Discord channel.

Prerequisites

Before running the chatbot, ensure you have the following prerequisites:

  • Node.js (v14 or higher) installed on your machine.
  • Discord bot token obtained from the Discord Developer Portal.
  • OpenAI API key to access the GPT-3.5 model.

Installation

To install and set up the chatbot, follow these steps:

  1. Clone the repository:

    git clone https://github.com/Taner-Y-Banth/chatgpt-discord.git
  2. Install the dependencies:

    npm install

Usage

To use the chatbot, follow these steps:

  1. Configure the bot:

    • Open the index.js file.

    • Provide your OpenAI API key and Discord bot token:

      const argv = minimist(process.argv.slice(2));
      // ...
      const configuration = new Configuration({
        apiKey: argv.openaiKey,
      });
      
      const openai = new OpenAIApi(configuration);
      
      // ...
      client.login(argv.discordToken);
  2. Start the bot:

    node index --openaiKey=YOUR_OPENAI_API_KEY --discordToken=YOUR_DISCORD_BOT_TOKEN

    Replace YOUR_OPENAI_API_KEY with your OpenAI API key and YOUR_DISCORD_BOT_TOKEN with your Discord bot token.

  3. Invite the bot to your Discord server using the generated OAuth2 URL.

  4. In your Discord channel, use the following command to interact with the GPT-3.5 model:

    !code <your message>
    

    Replace <your message> with the text you want to send to the GPT-3.5 model.

The provided code sets up a Discord chatbot that listens for messages in a channel and responds with generated text from the GPT-3.5 model. It handles the !code command, which triggers the bot to generate a response based on the user's input.

Make sure to replace the placeholders YOUR_OPENAI_API_KEY and YOUR_DISCORD_BOT_TOKEN with your actual OpenAI API key and Discord bot token, respectively.

chatgpt-discord's People

Contributors

taner-y-banth avatar

Watchers

 avatar

Forkers

nst-t

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.