A Stable Diffusion XL Discord BOT Powered By OpenAI's ChatGPT.
This BOT uses ChatGPT API & Firebase Firestore Database & ComfyUI.
π₯ Use slash command /dream
to create images in the specified channel.
π₯ Uses Firestore Database for persistent prompt history storage & logs.
π« Easy Setup !
/dream
- image prompt./help
- Get Help./ping
- Check Websocket Heartbeat && Roundtrip Latency.
- Git
- Node.js v18
- OpenAI Account
- Discord Account
- Google Account For Firebase
- an Nvidia GPU to run SDXL on ComfyUI
- Create New Application (BOT) from Discord Developer Portal and invite that bot to your Discord Server with:
Scopes:bot
&application.commands
Bot Permissions:2734284602433
Privileged Gateway Intents:PRESENCE
,SERVER MEMBERS
,MESSAGE CONTENT
- Example Bot Invite URL (Replace
BOT_CLIENT_ID
with your bot's Client ID) :
https://discord.com/api/oauth2/authorize?client_id=BOT_CLIENT_ID&permissions=2734284602433&scope=bot%20applications.commands
-
βStar
this Repo to get updates. -
Clone this repo:
git clone https://github.com/cryptaralex/dreamshaper
Then navigate to the folder:
cd ChatGPT-Discord-BOT
- Install all dependencies:
npm install
-
To setup Environment Variables, Copy & Rename the
.env.example
file to.env
Then, fill the credentials. -
Setup Firebase Firestore Database by following this instruction.
-
Start the BOT:
npm run start
Or, During Development:
npm run dev
Or, In Production:
npm run prod
- Use the BOT π
-
DISCORD_CLIENT_ID
- Client ID of the bot from OAuth2 section. -
DISCORD_BOT_TOKEN
- Token of the bot from Bot section. -
OPENAI_API_KEY
- Get OpenAI API Key from here.
-
DISCORD_MAX_RESPONSE_LENGTH
- Max 2000 , recomended 1900. -
API_ENDPOINT
- Setdefault
for api.openai.com endpoint. But you can set 3rd party equivalent endpoint too. -
DEBUG
- Toggle Debug Messages. Values:true
orfalse
-
UWU
- Toggle Figlet & Gradient-String decoration. Values:true
orfalse
-
MODEL
- Name of the Model you want to use. Like,text-davinci-003
,gpt-3.5-turbo
,gpt-4
etc. -
SYSTEM_MESSAGE
- This is the Initial Prompt that is sent to the Model. You can change it to anything you want to change the bot's behaviour as your requirements. Knowledge Cutoff and Current Date is always sent.
See .env.example file for more details
-
Goto Firebase Console: console.firebase.google.com (No Card Required)
-
Click on
Create a project
orAdd project
. Give it a name and clickContinue
-
Disable Google Analytics & Click
Create Project
-
From the side-bar goto
Build
& thenFirestore Database
. -
Click
Create Database
-
Select
Start in production mode
& clickNext
-
Select a Firestore location nearest to your Server / VPS. This'll also set the Default GCP Resource Location & you can't change it later.
Then clickEnable
-
Now goto
Project settings
&Service accounts
. -
Under
Firebase Admin SDK
selectNode.js
. Then clickGenerate new private key
and then clickGenerate key
-
Important: Rename the downloaded json file to
firebaseServiceAccountKey.json
Any other name will not work here. Then put the json file in your bots directory.
Copy FileName:
firebaseServiceAccountKey.json <-- You need to base64 this and put it into the .env file for now, I'll switch it back to using the json before the release
β¨ Tip: check out these images here
- Follow the instructions on the ComfyUI github here
- Install the ComfyUI manager from here
- Open the included image in your ComfyUI and use the manager to install all the missing nodes.
- Place necessary checkpoints, lora, and upscalers in the appropriate directory. Todo: More details on this.
- Make sure you can generate images using the provided node graph.
- Edit the .env file with your installation location output path.
π License: MIT
π ChatGPT API: transitive-bullshit/chatgpt-api
π Database: Firestore
π BaaS: Firebase
--- π ---