{"id":13456122,"url":"https://github.com/Zero6992/chatGPT-discord-bot","last_synced_at":"2025-03-24T09:31:27.441Z","repository":{"id":64360005,"uuid":"574046356","full_name":"Zero6992/chatGPT-discord-bot","owner":"Zero6992","description":"Integrate ChatGPT into your own discord bot","archived":false,"fork":false,"pushed_at":"2024-07-22T08:10:19.000Z","size":51733,"stargazers_count":2648,"open_issues_count":21,"forks_count":698,"subscribers_count":43,"default_branch":"main","last_synced_at":"2024-10-29T15:38:04.959Z","etag":null,"topics":["bot","chatgpt","discord","discord-bot"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Zero6992.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-04T08:55:06.000Z","updated_at":"2024-10-28T21:21:54.000Z","dependencies_parsed_at":"2024-05-04T15:30:47.599Z","dependency_job_id":"86948d7f-caac-493b-bc73-c6a886757322","html_url":"https://github.com/Zero6992/chatGPT-discord-bot","commit_stats":null,"previous_names":[],"tags_count":64,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zero6992%2FchatGPT-discord-bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zero6992%2FchatGPT-discord-bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zero6992%2FchatGPT-discord-bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zero6992%2FchatGPT-discord-bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Zero6992","download_url":"https://codeload.github.com/Zero6992/chatGPT-discord-bot/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245243291,"owners_count":20583601,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bot","chatgpt","discord","discord-bot"],"created_at":"2024-07-31T08:01:16.493Z","updated_at":"2025-03-24T09:31:27.133Z","avatar_url":"https://github.com/Zero6992.png","language":"Python","funding_links":[],"categories":["Bots","A01_文本生成_文本对话","Chat bots","精选开源项目合集","Applications and Demos","Discord","Integrations","Languages","在任何地方使用 ChatGPT","Python","ChatGPT-based applications for regular users and specialized problems","Using ChatGPT in other apps"],"sub_categories":["Examples","大语言对话模型及数据","Other","第三方机器人接入","LLM (Large Language Model)","Discord","Python","聊天機器人","Other sdk/libraries"],"readme":"# ChatGPT Discord Bot\n\n\u003e ### Build your own Discord bot using ChatGPT\n\n---\n\u003e [!IMPORTANT]\n\u003e\n\u003e **Major Update (2024/03):**\n\u003e - GPT-4 now supported for free\n\u003e - Utilize OpenAI API can ensure smoother experiences, refer [Optional: Configuring OpenAI API](#optional-configuring-openai-api)\n\n### Chat\n\n![image](https://user-images.githubusercontent.com/89479282/206497774-47d960cd-1aeb-4fba-9af5-1f9d6ff41f00.gif)\n\n# Setup\n## Prerequisites\n* **Python 3.9 or later**\n* **Rename the file `.env.example` to `.env`**\n* Running `pip3 install -r requirements.txt` to install the required dependencies\n* Google Chrome for [Image Generation](https://github.com/Zero6992/chatGPT-discord-bot?tab=readme-ov-file#image-generation)\n---\n## Step 1: Create a Discord bot\n\n1. Go to https://discord.com/developers/applications create an application\n2. Build a Discord bot under the application\n3. Get the token from bot setting\n\n   ![image](https://user-images.githubusercontent.com/89479282/205949161-4b508c6d-19a7-49b6-b8ed-7525ddbef430.png)\n4. Store the token to `.env` under the `DISCORD_BOT_TOKEN`\n\n   \u003cimg height=\"190\" width=\"390\" alt=\"image\" src=\"https://user-images.githubusercontent.com/89479282/222661803-a7537ca7-88ae-4e66-9bec-384f3e83e6bd.png\"\u003e\n\n5. Turn MESSAGE CONTENT INTENT `ON`\n\n   ![image](https://user-images.githubusercontent.com/89479282/205949323-4354bd7d-9bb9-4f4b-a87e-deb9933a89b5.png)\n\n6. Invite your bot to your server via OAuth2 URL Generator\n\n   ![image](https://user-images.githubusercontent.com/89479282/205949600-0c7ddb40-7e82-47a0-b59a-b089f929d177.png)\n\n\n\n## Step 2: Run the bot on the desktop\n\n1. Open a terminal or command prompt\n\n2. Navigate to the directory where you installed the ChatGPT Discord bot\n\n3. Run `python3 main.py` or `python main.py` to run the bot\n---\n## Step 2: Run the bot with Docker\n\n1. Build the Docker image \u0026 run the Docker container with `docker compose up -d`\n\n2. Inspect whether the bot works well `docker logs -t chatgpt-discord-bot`\n\n   ### Stop the bot:\n\n   * `docker ps` to see the list of running services\n   * `docker stop \u003cBOT CONTAINER ID\u003e` to stop the running bot\n\n### Have a good chat!\n---\n\n## Optional: Configuring OpenAI API\n\n\n1. Obtain your API key by visiting https://platform.openai.com/api-keys\n2. Paste the API key under `OPENAI_KEY` in `.env`\n3. Set `OPENAI_ENABLED` to `True` in `.env`\n\n\u003e [!NOTE]\n\u003e GPT-4 API is subject to certain restrictions.\n\u003e\n\u003e Details https://help.openai.com/en/articles/7102672-how-can-i-access-gpt-4\n\n## Image Generation\n\n\u003cimg src=\"https://i.imgur.com/Eo1ZzKk.png\" width=\"300\" alt=\"image\"\u003e\n\n### Microsoft Bing Image Generation\n1. Go to https://www.bing.com/chat and log in\n\n2. Open console with `F12`\n\n3. Open `Application` tab \u003e Cookies\n\n4. Copy the value for `_U` from cookies and paste it into `.env` under `BING_COOKIE`\n\n### Google Gemini Image Generation\n1. Go to https://gemini.google.com/app and log in\n\n2. Open console with `F12`\n\n3. Open `Application` tab \u003e Cookies\n\n4. Copy the value for `__Secure-1PSID` from cookies and paste it into `.env` under `GOOGLE_PSID`\n\n## Optional: Setup system prompt\n\n* A system prompt would be invoked when the bot is first started or reset\n* You can set it up by modifying the content in `system_prompt.txt`\n* All the text in the file will be fired as a prompt to the bot\n* Get the first message from ChatGPT in your discord channel!\n* Go Discord setting turn `developer mode` on\n\n   1. Right-click the channel you want to recieve the message, `Copy  ID`\n\n        ![channel-id](https://user-images.githubusercontent.com/89479282/207697217-e03357b3-3b3d-44d0-b880-163217ed4a49.PNG)\n\n   2. paste it into `.env` under `DISCORD_CHANNEL_ID`\n\n## Optional: Disable logging\n\n* Set the value of `LOGGING` in the `.env` to False\n\n------\n\u003e  [**中文設置教學**](https://zero6992.me/2023/03/08/chatGPT-discord-bot-chinese/)\n------\n## Commands\n\n* `/chat [message]` Chat with ChatGPT/Gemini\n* `/draw [prompt]` Generate an image with Gemini/OpenAI/Bing\n* `/switchpersona [persona]` Switch between optional chatGPT jailbreaks\n   * `random`: Picks a random persona\n   * `standard`: Standard chatGPT mode\n   * `dan`: DAN 13.5 (Latest Working ChatGPT Jailbreak prompt)\n   * `Smart mode`: AIM (Always Intelligent and Machiavellian)\n   * `Developer Mode`: software developer who specializes in the AI's area\n\n* `/private` ChatGPT switch to private mode\n* `/public` ChatGPT switch to public mode\n* `/replyall` ChatGPT switch between replyAll mode and default mode\n* `/reset` Clear ChatGPT conversation history\n* `/chat-model` Switch different chat model\n   * `gpt-4`: GPT-4 model\n   * `Gemini`: Google Gemini Model\n### Special Features\n\n#### Switch Persona\n\n\u003e **Warning**\n\u003e\n\u003e Certain personas may generate vulgar or disturbing content. Use at your own risk.\n\n![image](https://user-images.githubusercontent.com/91911303/223772334-7aece61f-ead7-4119-bcd4-7274979c4702.png)\n\n\n#### Mode\n\n* `public mode (default)`  the bot directly reply on the channel\n\n  ![image](https://user-images.githubusercontent.com/89479282/206565977-d7c5d405-fdb4-4202-bbdd-715b7c8e8415.gif)\n\n* `private mode` the bot's reply can only be seen by the person who used the command\n\n  ![image](https://user-images.githubusercontent.com/89479282/206565873-b181e600-e793-4a94-a978-47f806b986da.gif)\n\n* `replyall mode` the bot will reply to all messages in the channel without using slash commands (`/chat` will also be unavailable)\n\n   \u003e **Warning**\n   \u003e The bot will easily be triggered in `replyall` mode, which could cause program failures\n ---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FZero6992%2FchatGPT-discord-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FZero6992%2FchatGPT-discord-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FZero6992%2FchatGPT-discord-bot/lists"}