Improved embed style.
This commit is contained in:
parent
4e2e8bc702
commit
2c75ff09d9
24
functions.js
24
functions.js
@ -377,13 +377,27 @@ const functions = {
|
|||||||
|
|
||||||
interaction.reply({ embeds: [ strainEmbed ]});
|
interaction.reply({ embeds: [ strainEmbed ]});
|
||||||
},
|
},
|
||||||
dalle(prompt, imageUrl) {
|
dalle(user, prompt, imageUrl) {
|
||||||
const dalleEmbed = new Discord.MessageEmbed()
|
const dalleEmbed = new Discord.MessageEmbed()
|
||||||
.setAuthor({ name: "NodDraw" })
|
.setAuthor({ name: "NodBot powered by DALL-E", iconURL: "https://assets.vfsh.dev/openai-logos/PNGs/openai-logomark.png" })
|
||||||
.setTimestamp()
|
.addFields(
|
||||||
|
{ name: "Prompt", value: prompt }
|
||||||
|
)
|
||||||
.setImage(imageUrl)
|
.setImage(imageUrl)
|
||||||
.setFooter({ text: prompt });
|
.setFooter({ text: user.username, iconURL: user.avatarURL() })
|
||||||
|
.setTimestamp();
|
||||||
return { embeds: [dalleEmbed] };
|
return { embeds: [dalleEmbed] };
|
||||||
|
},
|
||||||
|
gpt(user, prompt, response) {
|
||||||
|
const gptEmbed = new Discord.MessageEmbed()
|
||||||
|
.setAuthor({ name: "NodBot powered by GPT-3", iconURL: "https://assets.vfsh.dev/openai-logos/PNGs/openai-logomark.png" })
|
||||||
|
.addFields(
|
||||||
|
{ name: "Prompt", value: prompt },
|
||||||
|
{ name: "Response", value: response }
|
||||||
|
)
|
||||||
|
.setFooter({ text: user.username, iconURL: user.avatarURL() })
|
||||||
|
.setTimestamp();
|
||||||
|
return { embeds: [gptEmbed] };
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
collect: {
|
collect: {
|
||||||
@ -566,7 +580,7 @@ const functions = {
|
|||||||
reject(e);
|
reject(e);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
resolve(response);
|
resolve(response.data.choices[0].text);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
imagePrompt(userPrompt, size, userId) {
|
imagePrompt(userPrompt, size, userId) {
|
||||||
|
@ -14,7 +14,7 @@ module.exports = {
|
|||||||
await interaction.deferReply();
|
await interaction.deferReply();
|
||||||
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.data.choices[0].text;
|
const gptEmbed = fn.embeds.gpt(interaction.user, userPrompt, response);
|
||||||
await interaction.editReply(`${responseText}`);
|
await interaction.editReply(gptEmbed);
|
||||||
},
|
},
|
||||||
};
|
};
|
@ -26,7 +26,7 @@ module.exports = {
|
|||||||
const size = interaction.options.getString("size") ? interaction.options.getString("size") : "512x512";
|
const size = interaction.options.getString("size") ? interaction.options.getString("size") : "512x512";
|
||||||
|
|
||||||
const imageUrl = await fn.openAI.imagePrompt(userPrompt, size);
|
const imageUrl = await fn.openAI.imagePrompt(userPrompt, size);
|
||||||
const dalleEmbed = fn.embeds.dalle(userPrompt, imageUrl);
|
const dalleEmbed = fn.embeds.dalle(interaction.user, userPrompt, imageUrl);
|
||||||
await interaction.editReply(dalleEmbed);
|
await interaction.editReply(dalleEmbed);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
const errorId = fn.generateErrorId();
|
const errorId = fn.generateErrorId();
|
||||||
|
Loading…
Reference in New Issue
Block a user