BingGPT-Discord-Bot: A Comprehensive Introduction
Overview
BingGPT-Discord-Bot is an innovative tool designed to bring the capabilities of Microsoft's Bing Chat directly to Discord servers. By leveraging a reverse-engineered API, it gives users the power of GPT-4 within their Discord communities. Additionally, this bot recently started supporting Text-to-Image generation, making it a versatile addition to any server.
Setup Requirements
To get started, one needs:
- Python 3.12 or higher: This version is necessary to run the bot.
- Microsoft Account: Early access to bing.com/chat is required.
- Docker (Optional): Particularly useful for Windows users to streamline the setup process.
Access Verification
Ensure access to Bing Chat by installing the latest version of Microsoft Edge or by tweaking any other browser to mimic Edge's user-agent. Log in to bing.com/chat and confirm that the chat feature is accessible.
Getting Authentication
Authentication involves snagging a cookie from Microsoft's Copilot web page. Open the developer tools in the browser, look for the right network request, and extract the cookie value. This information populates the BING_COOKIES
field in the bot's .env
file.
Installation Options
There are two primary ways to install and run BingGPT-Discord-Bot:
Option 1: Docker
-
Ensure Docker is Set Up: Install Docker and Docker Compose on your system by following the appropriate guide for Mac, Linux, or Windows.
-
Follow Initial Steps: Complete the authentication steps mentioned.
-
Build the Docker Project:
docker-compose build
-
Run the Bot: Choose from running in a shell/terminal or as a background process:
-
In terminal:
docker-compose up
-
Detached mode:
docker-compose up -d
-
Option 2: Python
-
Clone the Repository:
git clone https://github.com/ediziks/BingGPT-Discord-Bot.git cd BingGPT-Discord-Bot
-
Set Up Cookie File: Place
cookies.json
in the main directory, as detailed in the authentication steps. -
Configure Environment Variables: Adjust the
.env
file to include theBOT_TOKEN
andSERVER_ID
. -
Install Dependencies:
pip install -r requirements.txt
-
Prepare Executable Files:
chmod +x src/bot.py dcbot.sh
-
Launch the Bot: Two options are available:
-
Run directly with Python:
python src/bot.py
-
Run as a background process:
./dcbot.sh
To manage processes, check logs at
src/bot.log
and control via:ps ax | grep bot.py sudo kill -9 <process_id>
-
Inviting the Bot
To integrate the bot into a Discord server, generate an invitation URL. Ensure that the requisite permissions are configured correctly. Guidance is available here, and a permissions reference image is provided for accuracy.
Using the Bot
The bot introduces several commands for user interaction:
/ask <prompt>
: Pose a question to BingGPT./imagine <prompt>
: Request a visual concept from BingGPT./reset
: Restart the conversation's state./hardreset
: Completely reset the session.
Sample Usages
To visualize the commands in action, sample images are shared within the documentation showcasing how prompts appear and interact with the bot.
Known Issues
A known limitation is the unreliable performance of the /imagine
command. Contributions and improvements from the community are encouraged to enhance this feature.
This comprehensive setup and usage guide ensures that users can efficiently bring the sophisticated capabilities of Bing's AI Chat to their Discord experience, enabling interactive and creative engagements.