import { default as log } from "../util/log.js"; import * as action from "../util/discordAction.js"; import { Configuration, OpenAIApi } from "openai"; // npm i openai import readline from "readline"; const configuration = new Configuration({ organization: "org-0nmrFWw6wSm6xIJXSbx4FpTw",// platform.openai.com/account/org-settings apiKey: "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", // platform.openai.com/account/api-keys }); // you fuckin idiots this aint my api key i found it from some random website const openai = new OpenAIApi(configuration); const prefix = process.env.PREFIX; export default { name: "notclyde", description: "ask a chatbot that is Powered by OpenAI:tm: whatever the fk you want", arguments: "message", execute(message, args) { const prompt = message.content.slice(prefix.length + this.name.length); const sent = action.reply(message, `generating response for \`${prompt}\``) message.channel.startTyping() openai .createChatCompletion({ model: "gpt-3.5-turbo", messages: [{ role: "user", content: prompt }], }) .then((res) => { action.edit(sent, res.data.choices[0].message.content); message.channel.stopTyping() }) .catch((e) => { console.log(e); }); }, };