#api for bdfd
32 messages · Page 1 of 1 (latest)
No, since there is no official api out yet
Their is API keys that you can use, these can most likely be implemented into your code, this depends upon what you’re trying to do though. I’m not to up to date on it yet.
What are you trying to do, could possibly be able to help even if their is no api currently.
Yes bud how is the question 🤧
haha, what are you trying to do, I'm a little slow? Is it a discord bot or am i way off
I try to build chatgpt in my discord bot like a chatbot
It stil works?
Or almost did, until chatbot went caput
Yeah, the code needs to be way different
I find a method in replit bud it didnt work
Hm
The method i was using involves using the api key found on the website
I'll see if i can figure it out again later
Api key on the website istelf or you did get it from chrome dev?
Website itself
So that's why im unsure if it was ever going to work
I stopped as i was implementing everything, since the website crashed and i was confused on one thing.
I'll test it out later and if it works i'll send the info here or dms
oh okay
I am talking about creating it from scratch
If those api keys are working how i assume they are then it should all work out. If so im going to create a chrome developer extension where you click the extension and you can ask and recieve responses from the bot in the little text square in the top of your screen and then it will have a scan page button etc. But I won't get my hopes up, I'll message you back either later or tommorow.
Yeah, if they fully release the api it will. I still don't understand what the private api's are for, so yeah hopefully its what we think. Cya!
@red patio
const OpenAI = require('openai');
const { Constants } = require('discord.js');
const Intents = Constants.Intents;
// Replace these values with your own Discord and OpenAI API keys
const discordToken = process.env.DISCORD_TOKEN;
const openaiKey = process.env.OPENAI_KEY;
// Set the intents property in the client options
// In this example, we will enable the GUILD_PRESENCES and GUILD_MEMBERS intents
const options = {
intents: Intents.FLAGS.GUILD_PRESENCES | Intents.FLAGS.GUILD_MEMBERS
};
// Create a new Discord client
const client = new Discord.Client(options);
// Configure OpenAI client
OpenAI.apiKey = openaiKey;
// This event will run when the bot is ready to start working
client.on('ready', () => {
console.log(Logged in as ${client.user.tag}!);
});
// This event will run when the bot receives a message
client.on('message', async message => {
// Ignore messages that are sent by the bot itself
if (message.author.bot) return;
// Check if the message starts with /ai
if (message.content.startsWith('/ai')) {
// Get the text after /ai and send it to chat.openai.com
const query = message.content.replace('/ai', '');
// Send the query to OpenAI and get the response
const response = await OpenAI.query(query);
// Send the response to the Discord channel
message.channel.send(response.data.replies);
}
});
// Log the bot in
client.login(discordToken);