New to javascript? Getting a error ? Don't know the reason for it? We are here. Use the snippet and when you type !play ,it will give you a random javascript error and 3 possible reasons for it. Test your skills using it. Also it will send the correct answer for the question.
// authenticates you with the API standard library
// type `await lib.` to display API autocomplete
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
// saving the prompts
let prompt = [
`You will perform the role of a Javascript teacher running a training simulation.`,
`You will create a member, giving them a name, a gender, an age and a personality.`,
`Then you will choose a error for me to solve it.`,
`You will then play the role of the memver, describe your error to me just as the member would.`,
`Be as detailed and descriptive as possible and use a conversational tone, like you are talking to a friend.`,
`Include some error that may be unrelated to your condition.`,
`Then offer me three potential fixes.`,
`One of the options should be the correct fix.`,
`The other two options should be wrong, but match at least one of the errors that you provide.`,
`Do not tell me the answer yet.`,
`Let me guess and then you can tell me the correct answer and why the answers are right or wrong.
`,
].join('\n');
try {
let a = await lib.openai.playground['@0.0.4'].completions.create({
model: `text-davinci-003`,
prompt: [prompt],
max_tokens: 512,
temperature: 0.2,
top_p: 1,
n: 1,
echo: false,
presence_penalty: 0,
frequency_penalty: 0,
best_of: 1,
});
// sending the reply to discord
await lib.discord.channels['@0.3.4'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: `${a.choices[0].text}`,
});
} catch (e) {
console.log(e);
await lib.discord.channels['@0.3.4'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: `${e}`,
});
}