-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 changed file
with
27 additions
and
0 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,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 GitHub Actions / lint
Check failure on line 5 in commands/core/list.js GitHub Actions / test (18)
Check failure on line 5 in commands/core/list.js GitHub Actions / test (20)
|
||
}); | ||
|
||
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(); | ||
}, | ||
}; |