2023-05-28 00:41:08 +00:00
|
|
|
const { SlashCommandBuilder } = require('@discordjs/builders');
|
|
|
|
const fn = require('../functions.js');
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
data: new SlashCommandBuilder()
|
|
|
|
.setName('chat')
|
|
|
|
.setDescription('Send a message to ChatGPT')
|
|
|
|
.addStringOption(o =>
|
|
|
|
o.setName("prompt")
|
|
|
|
.setDescription("Prompt to send to ChatGPT")
|
|
|
|
.setRequired(true)
|
|
|
|
),
|
|
|
|
async execute(interaction) {
|
|
|
|
await interaction.deferReply();
|
|
|
|
const userPrompt = interaction.options.getString("prompt");
|
|
|
|
const response = await fn.openAI.chatPrompt(userPrompt).catch(e => console.error(e));
|
2023-05-29 13:22:11 +00:00
|
|
|
const gptEmbed = fn.embeds.gpt(interaction.user, userPrompt, response);
|
|
|
|
await interaction.editReply(gptEmbed);
|
2023-05-28 00:41:08 +00:00
|
|
|
},
|
|
|
|
};
|