Important
This project was originally created not for the purpose of making money, only for research and learning purposes
Major Update (2024/11):
- 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.
- Python 3.9 or later
- Rename the file
.env.exampleto.env - Running
pip3 install -r requirements.txtto install the required dependencies - Google Chrome for Image Generation
-
Go to https://discord.com/developers/applications create an application
-
Build a Discord bot under the application
-
Get the token from bot setting
-
Store the token to
.envunder theDISCORD_BOT_TOKEN
-
Turn MESSAGE CONTENT INTENT
ON -
Invite your bot to your server via OAuth2 URL Generator
If you possess an OpenAI Plus account, utilizing the OpenAI provider is recommended for a smoother experience.
-
Navigate to https://chat.openai.com/ and log in with your account credentials.
-
Launch the Developer Tools in your browser.
-
In the Developer Tools, navigate to the
Networktab. -
Refresh the page to record the network activity.
-
Chat whth the bot one time.
-
In the Network tab, right-click on any item in the list of network activities and choose
Save all as HAR with content. Save the file with the namea.har. -
place the
a.harfile in the./hardirdirectory.
- You can change
MODELin.envtogpt-4also
Caution
Ensure that your a.har file is stored securely, as it may contain sensitive information.
This code except src.py is not my code, This project was originally created not for the purpose of making money, only for research and learning purposes
This is not OpenAI API. For API access, refer Optional: Configuring OpenAI API
-
Open a terminal or command prompt
-
Navigate to the directory where you installed the ChatGPT Discord bot
-
Run
python3 main.pyorpython main.pyto run the bot
-
Build the Docker image & run the Docker container with
docker compose up -d -
Inspect whether the bot works well
docker logs -t chatgpt-discord-botdocker psto see the list of running servicesdocker stop <BOT CONTAINER ID>to stop the running bot
-
Log into your openai account
-
Copy the value for
access_tokenand paste it into.envunderOPENAI_TOKEN
-
Go to https://www.bing.com/chat and log in
-
Open console with
F12 -
Open
Applicationtab > Cookies -
Copy the value for
_Ufrom cookies and paste it into.envunderBING_COOKIE
-
Go to https://gemini.google.com/app and log in
-
Open console with
F12 -
Open
Applicationtab > Cookies -
Copy the value for
__Secure-1PSIDfrom cookies and paste it into.envunderGOOGLE_PSID
To use the OpenAI API features, follow these steps:
- Obtain your API key by visiting https://platform.openai.com/api-keys
- Paste the API key under
OPENAI_KEYin.env - Set
OPENAI_ENABLEDtoTruein.env
Note
GPT-4 API is subject to certain restrictions.
For more details, please visit https://help.openai.com/en/articles/7102672-how-can-i-access-gpt-4
-
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 modeon
- Set the value of
LOGGINGin the.envto False
-
/chat [message]Chat với AI/Gemini -
/draw [prompt][model]Tạo ảnh vẽ theo lệnh với cấu trúc (Prompt:Lệnh) (Model:Bot) -
/switchpersona [persona]Chuyển đổi chế độ
random: Picks a random personastandard: Standard chatGPT modedan: 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
-
/privateChat AI với chế độ Riêng tư -
/publicChat AI với chế độ Công Khai -
/replyallChat AI chuyển qua chế độ trả lời tất cả -
/resetXóa lịch sự trò chuyện -
/chat-modelChuyển đổi qua các Model Botgpt-4: GPT-4 modelGemini: Google Gemini Model
/start_topBắt đầu tính giờ học/end_topThời gian kết thúc giờ học/tao_phongĐể phòng học thoại mới/joinBot vào phòng thoại/start_timeĐếm ngược thời gian làm bài/start_studyBắt đầu đếm thời gian làm bài ( Đi cùng với lệnh /end )/end_studyKết thúc thời gian làm bài ( Đi cùng với lệnh /start )
Warning
Certain personas may generate vulgar or disturbing content. Use at your own risk.
-
public mode (default)the bot directly reply on the channel -
private modethe bot's reply can only be seen by the person who used the command -
replyall modethe bot will reply to all messages in the channel without using slash commands (/chatwill also be unavailable)Warning This Bot is currently only in a trial phase, so it may encounter some errors and is being updated now and will continue to be updated in the future.







