A discord bot for Stable Diffusion
Node (tested with 18.15.0)
NPM (tested with 9.6.1, comes with Node)
Install NPM packages (run npm install
inside SD-Discord-bot root directory)
Automatic1111 installation of Stable Diffusion, launch with the following arguments:
--no-half-vae --api
optionally the --xformers
argument can be used, this will automatically install xformers and enable it, to improve efficiency and lower VRAM usage.
You can either manually input the launch arguments each time when running webui-user.bat
or just edit the file and change the line:
set COMMANDLINE_ARGS=
to set COMMANDLINE_ARGS= --xformers --no-half-vae --api
In config.json
(which you most likely still have to make) in the root directory of the repo you should put your configuration like so:
{
"token": "<discord bot token here>",
"clientId": "<discord application id here>",
"guildId": "<guild id here (also known as discord server id)>",
"sd_api_url": "<Stable Diffusion url (usually: http://127.0.0.1:7860)>"
}
Where token is referring to the bot token found in the discord developer portal in your application
Where clientId is referring to the client id found in the discord developer portal in your application
Where guildId is referring to the id of the Discord server, acquired by right clicking the drop-down menu of the server at the top left and then clicking copy server id
(note that developer mode has to be enabled for this to work (settings > app settings > advanced > developer mode))
Where sd_api_url is referring to the url that Stable Diffusion is running on, including port, Stable Diffusion ouputs this url in the terminal on launch
The commands can be deployed to the discord server by running node deploy-commands.js
, run this every time you change the files in the commands
directory
After the commands have been deployed the bot can be brought online and running by running node index.js
, (mind that Stable Diffusion has to be running, or else the bot commands won't work).