-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
103 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
//@ts-check | ||
const { ButtonInteraction, Client, EmbedBuilder } = require("discord.js"); | ||
const sendRequest = require("../../utils/SD/sendRequest"); | ||
|
||
module.exports = { | ||
id: 'loadCheckpoint', | ||
ownerOnly: false, | ||
|
||
/** | ||
* | ||
* @param {Client} _client | ||
* @param {ButtonInteraction} interaction | ||
*/ | ||
callback: async (_client, interaction) => { | ||
const modelName = interaction.message.embeds[0].title; | ||
|
||
await interaction.message.delete(); | ||
|
||
const loadingEmbed = new EmbedBuilder() | ||
.setColor(0xfde395) | ||
.setTitle('Loading checkpoint...') | ||
.setDescription(`Loading "**${modelName}**".`) | ||
|
||
await interaction.reply({content: "", embeds: [loadingEmbed]}); | ||
|
||
let options = await sendRequest('sdapi/v1/options', {}, "get"); | ||
|
||
options["sd_model_checkpoint"] = modelName; | ||
|
||
await sendRequest('sdapi/v1/options', options, "post"); | ||
|
||
const finishedEmbed = new EmbedBuilder() | ||
.setColor(0x82d17b) | ||
.setTitle('Checkpoint loaded!') | ||
.setDescription(`Checkpoint "**${modelName}**" has successfully loaded.`) | ||
|
||
await interaction.editReply({content: "", embeds: [finishedEmbed]}); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters