Skip to content

Commit

Permalink
add list command
Browse files Browse the repository at this point in the history
  • Loading branch information
jmhayes3 committed Aug 23, 2024
1 parent 0123423 commit a776cef
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions commands/core/list.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const { SlashCommandBuilder } = require('discord.js');
const { OpenAI } = require("openai");

const openai = new OpenAI({
apiKey: process.env['OPENAI_API_KEY'],

Check failure on line 5 in commands/core/list.js

View workflow job for this annotation

GitHub Actions / lint

'process' is not defined

Check failure on line 5 in commands/core/list.js

View workflow job for this annotation

GitHub Actions / test (18)

'process' is not defined

Check failure on line 5 in commands/core/list.js

View workflow job for this annotation

GitHub Actions / test (20)

'process' is not defined

Check failure on line 5 in commands/core/list.js

View workflow job for this annotation

GitHub Actions / test (22)

'process' is not defined
});

const listAssistants = async () => {
console.log("Listing assistants...");

const assistants = await openai.beta.assistants.list();

console.log("Assistants:", assistants);
}

module.exports = {
data: new SlashCommandBuilder()
.setName('list')
.setDescription('List all available OpenAI assistants.'),
async execute(interaction) {
await interaction.deferReply();

await interaction.followUp("Available OpenAI assistants: ");

await listAssistants();
},
};

0 comments on commit a776cef

Please sign in to comment.