GithubHelp home page GithubHelp logo

amadeuswizard / discord-chatbot-using-gpt4free Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zero6992/chatgpt-discord-bot

0.0 0.0 0.0 50.5 MB

Integrate ChatGPT into your own discord bot

License: MIT License

Python 99.44% Dockerfile 0.56%

discord-chatbot-using-gpt4free's Introduction

ChatGPT Discord Bot

Build your own Discord bot using ChatGPT


Important

Major Update (2024/03):

  • Due to instability issues with GPT-4 model, we have defaulted back to GPT-3.5-turbo
  • Gemini-Pro and GPT-4 now supported for free
  • See README for details and dependency updates.

Chat

image

Setup

Prerequisites

  • Python 3.9 or later
  • Rename the file .env.example to .env
  • Running pip3 install -r requirements.txt to install the required dependencies
  • Google Chrome for Image Generation

Step 1: Create a Discord bot

  1. Go to https://discord.com/developers/applications create an application

  2. Build a Discord bot under the application

  3. Get the token from bot setting

    image

  4. Store the token to .env under the DISCORD_BOT_TOKEN

    image
  5. Turn MESSAGE CONTENT INTENT ON

    image

  6. Invite your bot to your server via OAuth2 URL Generator

    image

Step 2: Run the bot on the desktop

  1. Open a terminal or command prompt

  2. Navigate to the directory where you installed the ChatGPT Discord bot

  3. Run python3 main.py or python main.py to run the bot


Step 2: Run the bot with Docker

  1. Build the Docker image & run the Docker container with docker compose up -d

  2. Inspect whether the bot works well docker logs -t chatgpt-discord-bot

    Stop the bot:

    • docker ps to see the list of running services
    • docker stop <BOT CONTAINER ID> to stop the running bot

Have a good chat!


Image Generation

image

OpenAI DALLE3 Image Generation (Requires a GPT Plus account)

  1. Log into your openai account

  2. Go to https://chat.openai.com/api/auth/session

  3. Copy the value for access_token and paste it into .env under OPENAI_TOKEN

Microsoft Bing Image Generation

  1. Go to https://www.bing.com/chat and log in

  2. Open console with F12

  3. Open Application tab > Cookies

  4. Copy the value for _U from cookies and paste it into .env under BING_COOKIE

Google Gemini Image Generation

  1. Go to https://gemini.google.com/app and log in

  2. Open console with F12

  3. Open Application tab > Cookies

  4. Copy the value for __Secure-1PSID from cookies and paste it into .env under GOOGLE_PSID

Optional: Setup system prompt

  • A system prompt would be invoked when the bot is first started or reset

  • You can set it up by modifying the content in system_prompt.txt

  • All the text in the file will be fired as a prompt to the bot

  • Get the first message from ChatGPT in your discord channel!

  • Go Discord setting turn developer mode on

    1. Right-click the channel you want to recieve the message, Copy ID

      channel-id

    2. paste it into .env under DISCORD_CHANNEL_ID

Optional: Disable logging

  • Set the value of LOGGING in the .env to False

中文設置教學


Commands

  • /chat [message] Chat with ChatGPT/Gemeni

  • /draw [prompt] Generate an image with Gemini/OpenAI/Bing

  • /switchpersona [persona] Switch between optional chatGPT jailbreaks

    • random: Picks a random persona
    • standard: Standard chatGPT mode
    • dan: DAN 13.5 (Latest Working ChatGPT Jailbreak prompt)
    • Smart mode: AIM (Always Intelligent and Machiavellian)
    • Developer Mode: software developer who specializes in the AI's area
  • /private ChatGPT switch to private mode

  • /public ChatGPT switch to public mode

  • /replyall ChatGPT switch between replyAll mode and default mode

  • /reset Clear ChatGPT conversation history

  • /chat-model Switch different chat model

    • gpt-4: GPT-4 model
    • Gemini: Google Gemini Model

Special Features

Switch Persona

Warning

Certain personas may generate vulgar or disturbing content. Use at your own risk.

image

Mode

  • public mode (default) the bot directly reply on the channel

    image

  • private mode the bot's reply can only be seen by the person who used the command

    image

  • replyall mode the bot will reply to all messages in the channel without using slash commands (/chat will also be unavailable)

    Warning The bot will easily be triggered in replyall mode, which could cause program failures


discord-chatbot-using-gpt4free's People

Contributors

zero6992 avatar ja1e0 avatar shinysocks avatar jacky-chay avatar mcuxdaredevil avatar yungpingxu avatar amadeuswizard avatar mohamedal-nassirat avatar kkogai avatar cnrpman avatar lintangtimur avatar shahab00x avatar hvikman avatar jeanhadrien avatar spektre82 avatar prevailugah avatar kingbain avatar joaquinv98 avatar bradly0cjw avatar dovarfalcone avatar devarxify avatar danparizher avatar ziipzaaapm16a4 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.