Giter Club home page Giter Club logo

gpt-chat-bot's Introduction

OpenAI Discord Bot

This repo contains a simple Discord bot that uses OpenAI's GPT-3.5-turbo model to act as a chatbot while assuming a character. You can modify the code to use GPT-4 if you have access to it, but I have found that the turbo model is more than sufficient for this task.

Setup

  1. Create a Discord bot and invite it to your server. You can find a guide here. Make sure to enable the Message Content and Server Members intents.
  2. Create an OpenAI API key for the bot. You can find the API page here.
  3. Create a .env file in the root directory of the project and add the following lines:
OPENAI_API_KEY=<your openai api key>
DISCORD_BOT_TOKEN=<your discord bot token>
  1. Run pip install -r requirements.txt to install the dependencies.
  2. Run python bot.py to start the bot.

Features

  • Summon the bot by mentioning it
  • Follows a conversation via replies
  • Each user has their own self-contained conversation
  • User can reset the conversation by typing forget me

Usage

The bot will automatically join the server and start listening for messages. To start a conversation, simply mention the bot then type your message. The bot will respond with a message that is generated by the API. You can then reply to the bot's message and the conversation will continue.

To make the bot reset the conversation, simply mention the bot and type forget me.

For example: @GPTbot forget me

Modification

You can modify the code to use a different model or to change the character that the bot is acting as. To change the model, simply change the system_model variable in bot.py to the name of the model you want to use (e.g. gpt-4).

To change the character, modify the system_prompt variable in bot.py to the name of the character you want the bot to act as.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

If you fork this repo, please follow the license, but more importantly, let me know what you're doing with it. I'd love to see what you come up with!

License

This project is licensed under the MIT License - see the LICENSE file for details

gpt-chat-bot's People

Contributors

simonerlic avatar

Stargazers

Martin Erlic 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.