Skip to content

Commit

Permalink
✨ disablable image previews
Browse files Browse the repository at this point in the history
  • Loading branch information
ImDarkTom committed Sep 7, 2023
1 parent fffc60f commit c5ffffd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ Modify the `.env` file with your bot token and configure the `botConfig.json` fi

sdConfig can but does not need to be modified if Stable Diffusion is using the default port.

To disable live image previews you can set progressUpdateInterval in botConfig to -1.

### 4. Running the bot

Once all previous steps have been completed, the bot can be ran with the `node .` command. After a few seconds you should see an output saying the bot is online.
Expand Down
14 changes: 10 additions & 4 deletions src/utils/SD/progressUpdater.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,21 @@ const botConfig = require('../../../botConfig.json');
const sendRequest = require("./sendRequest");

module.exports = async (imagePromise, interaction) => {
const interval = setInterval( async () => {
let interval;

interaction.editReply(await getProgressEmbed(interaction.user, "Generating... ", true));
if (botConfig.progressUpdateInterval !== -1) {
interval = setInterval( async () => {

}, botConfig.progressUpdateInterval);
interaction.editReply(await getProgressEmbed(interaction.user, "Generating... ", true));

}, botConfig.progressUpdateInterval);
}

const imageData = await imagePromise;

clearInterval(interval);
if (interval) {
clearInterval(interval);
}

const finishedData = await sendRequest('sdapi/v1/progress', {}, "get");

Expand Down

0 comments on commit c5ffffd

Please sign in to comment.