A Stable Diffusion Discord bot.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
Bob Bregant 20e3e06606 Initial Happy Trees Bot commit. 3 years ago
.gitignore Initial Happy Trees Bot commit. 3 years ago
README.md Initial Happy Trees Bot commit. 3 years ago
bot.py Initial Happy Trees Bot commit. 3 years ago
happytrees.service Initial Happy Trees Bot commit. 3 years ago
requirements.txt Initial Happy Trees Bot commit. 3 years ago

README.md

Happy Trees Discord Bot

Description

This is a Discord bot for taking Stable Diffusion image requests and running them on a local GPU.

Setup

Clone this repository to the system where you have setup Stable Diffusion, with the optimizations from Basu Jindal's fork. We're not covering how to run Stable Diffusion here, so you're on your own there. By default, we're assuming that you're installing both of these to your user's home directory on a linux system.

Create a new Discord application in the Discord Developer Portal, with a name, description, and icon of your choosing. Then head over to the Bot link on the lefthand panel. Here you'll want to create a bot (yes, you're sure) and enable the "Message Content Intent" under "Privileged Gateway Intents". Once you do that, you can grab the bot token via the Reset Token button and store it in a .token file within the cloned repository folder.

Edit any paths in the bot.py file that you need for your specific system setup and then go ahead and run python3 bot.py from within the cloned directory to test it out. If everything worked and it can connect to Discord, it should print an invite link to your system console. You can use that link to invite your bot to servers where you have the "Manage Server" permission. (If you flip the "Public Bot" toggle in the Discord bot interface to "Off", from the default of "On", then only you will be able to use the invite link. If you leave it public, then anyone with the link can use the invite link. Unless you're feeling generous with your GPU cycles, you probably want to leave this private unless and only briefly toggle it off for specific periods of time when you know people should be adding the bot to other servers.)

If that all worked and you want to make this a regular thing, you can update your username in the happytrees.service file and copy it to /etc/systemd/system/. After that, you'll just need to run sudo systemctl daemon-reload to let systemd see your new file, then sudo systemctl enable happytrees.service to start the service on boot, and (optionally) sudo systemctl start happytrees.service to run a copy from the service file right now.