Experimental generating content embed
This commit is contained in:
parent
200468ac10
commit
08618e2be2
@ -393,6 +393,14 @@ const functions = {
|
|||||||
.setDescription(`**Prompt**\n${prompt}\n\n**Response**\n${response}`)
|
.setDescription(`**Prompt**\n${prompt}\n\n**Response**\n${response}`)
|
||||||
.setFooter({ text: `This prompt used ${usage.tokens} tokens for a cost of ${usage.usdc}¢` })
|
.setFooter({ text: `This prompt used ${usage.tokens} tokens for a cost of ${usage.usdc}¢` })
|
||||||
return { embeds: [gptEmbed] };
|
return { embeds: [gptEmbed] };
|
||||||
|
},
|
||||||
|
generatingResponse() {
|
||||||
|
const embed = new Discord.MessageEmbed()
|
||||||
|
.setAuthor({ name: "NodBot powered by OpenAI", iconURL: "https://assets.vfsh.dev/openai-logos/PNGs/openai-logomark.png" })
|
||||||
|
.setImage("https://tenor.com/view/sucks-gif-4499658")
|
||||||
|
.setDescription("Generating a response, please stand by.")
|
||||||
|
.setFooter({ text: "Ligma balls" });
|
||||||
|
return { embeds: [embed] };
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
collect: {
|
collect: {
|
||||||
|
@ -12,6 +12,7 @@ module.exports = {
|
|||||||
),
|
),
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
await interaction.deferReply();
|
await interaction.deferReply();
|
||||||
|
await interaction.editReply(fn.embeds.generatingResponse());
|
||||||
const userPrompt = interaction.options.getString("prompt");
|
const userPrompt = interaction.options.getString("prompt");
|
||||||
const response = await fn.openAI.chatPrompt(userPrompt).catch(e => console.error(e));
|
const response = await fn.openAI.chatPrompt(userPrompt).catch(e => console.error(e));
|
||||||
const responseText = response.choices[0].text.slice(2);
|
const responseText = response.choices[0].text.slice(2);
|
||||||
|
@ -23,6 +23,7 @@ module.exports = {
|
|||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
try {
|
try {
|
||||||
await interaction.deferReply();
|
await interaction.deferReply();
|
||||||
|
await interaction.editReply(fn.embeds.generatingResponse());
|
||||||
const userPrompt = interaction.options.getString("prompt");
|
const userPrompt = interaction.options.getString("prompt");
|
||||||
const size = interaction.options.getString("size") ? interaction.options.getString("size") : "512x512";
|
const size = interaction.options.getString("size") ? interaction.options.getString("size") : "512x512";
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user