AndBobsYourUncle / stable-diffusion-discord-bot

A Discord bot, written in Go, that interfaces with the Automatic 1111's API interface.
MIT License
128 stars 35 forks source link

More comprehensive install instructions #34

Open shihanqu opened 11 months ago

shihanqu commented 11 months ago

Would love to have more comprehensive install instructions for ignorant noobs such as myself. I struggled with step 2 in the usage instructions, never having made a discord bot before it took a bit to figure out how to even invite it to my server. Eventually figured out I had to make my own URL in a notepad to make it work. But now on the step 4.... how do we: "Run the bot with ./stable_diffusion_bot -token -guild -host <webui host, e.g. http://127.0.0.1:7860>"

Where do I type this line? What is guild ID? Is it a necessary parameter or can we skip it if we want it to work with any server? Do we enter the token with the or without?

glenneroo commented 11 months ago

Agreed, would help get more people running faster. I had to search around to find an article that properly explained these settings. I would recommend googling how to create a discord bot to get all that stuff setup. Regarding your guild ID (a guild is a discord server), you have to go to your User Settings > Advanced > Enable Developer mode. Then you can right click on a discord server where you are admin and click Copy ID to get your Guild ID.

Then (assuming Windows) just make a file in the stable-diffusion folder called start.bat and put the following: stable_diffusion_bot -token YOUR_TOKEN -guild YOUR_GUILD_ID -host http://127.0.0.1:7860

Save it and double-click on that to run the bot.

I invited my bot to multiple servers via the discord dev portal and, interestingly enough, I only have to start the bot once and the guild ID is for only one of my servers but it works on 2 different servers w/o issues.

shihanqu commented 11 months ago

Much thanks @glenneroo . When you say make a file in the "stable-diffusion folder", do you mean in user/stable-diffusion-webui, or in the same folder that holds stable_diffusion_bot.exe?

shihanqu commented 11 months ago

Nevermind! I made a start.bat with the correct initialization text, and it looks like it's running. Unfortunately when I try to /imagine something, I just get "I'm sorry, but I had a problem imagining your image."

Does this bot work for you?

The last for lines of the discord bot cmd window show this:

2023/07/14 16:53:20 Processing imagine #1129546200811569172: a green panda 2023/07/14 16:53:21 API URL: http://127.0.0.1:7860/sdapi/v1/txt2img 2023/07/14 16:53:21 Unexpected API response: {"detail":"Not Found"} 2023/07/14 16:53:21 Error processing image: unexpected end of JSON input

glenneroo commented 11 months ago

Yes I've had the bot running 24/7 for several months now on 2 different discord servers.

I think that error message means your stable diffusion backend isn't running. Did you get Automatic1111 webui running? I start that with the included webui-user.bat - otherwise you won't be able to generate images. This bot is only the interface between Auto1111 and Discord.

shihanqu commented 11 months ago

Yes, Automatic1111 webui was running, and with the correct commandargs. But I somehow fixed it after going on a debug chase on xformers. Once I fixed xformers, the discord script started working!