The DALL-E Discord Bot is an easy way to generate images from within your Discord server.
-
Download Python 3 and Docker.
-
Clone this repository.
-
Navigate into the project directory:
$ cd dalle-discord-bot
-
Make a copy of the example environment variables file:
$ cp .env.example .env
-
Add your OpenAI API key to the
.env
file. -
Create an application and bot through the Discord developer portal.
-
Create a client secret (i.e. API key) and add to the
.env
file. -
Add the following redirect URL in the OAuth2 settings:
https://discordapp.com/oauth2/authorize?&client_id=<client_id>&scope=bot&permissions=274877910016
. The permissions integer allows your bot to read messages, send messages, and send messages in threads. Nothing more. -
Create an admin guild to invite your bot to. This is where you can test and deploy new commands using the sync command. Note that guild is the terminology used throughout the developer documentation, whereas server is the user-facing terminology.
-
Add the admin guild ID to the
.env
file. You can find this ID by opening Discord in a browser and checking the URL:https://discord.com/channels/**<guild_id>**/<channel_id>
-
Run the application via docker compose
$ docker compose up
-
Create and redeem credit vouchers via the create (hidden; ! prefix only) and redeem commands. (Feel free to tear out the voucher service in your fork. I only created it to play around with Flask, Docker networking, and EBS volumes.)
-
Add your bot to any Discord guild. Generate an image with the /generate command.