Create the perfect ad with our AI-powered snippet! Simply input your product or service details, and let our powerful algorithms generate a compelling and effective ad for you. Save time and increase conversions with our easy-to-use snippet – try it today!
// authenticates you with the API standard library
// type `await lib.` to display API autocomplete
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
try {
// removing the prefix
let content = context.params.event.content.slice(
4,
context.params.event.content.length - 1
);
let a = await lib.openai.playground['@0.0.4'].completions.create({
model: `text-davinci-003`,
prompt: [`Write a creative ad for the following product : ${content}.`],
max_tokens: 200,
temperature: 0.7, // more temp. means more creative responses
top_p: 1,
n: 1,
echo: false,
presence_penalty: 0,
frequency_penalty: 0,
});
await lib.discord.channels['@0.3.4'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: `${a.choices[0].text}`,
});
} catch (e) {
await lib.discord.channels['@0.3.4'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: `${e}`,
});
}
/*
An example is:
!ad GFX Business
*/