This bot writes songs on a given topic! Just do !song <topic> and it will generate a song!
// authenticates you with the API standard library
// type `await lib.` to display API autocomplete
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
let content = context.params.event.content.split(' ').splice(1).join(' ');
let result = await lib.openai.playground['@0.0.4'].completions.create({
model: `text-davinci-003`,
prompt: [`Write a song on ${content}`],
max_tokens: 1000,
top_p: 1,
best_of: 1,
});
await lib.discord.channels['@0.3.2'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: '',
tts: false,
embeds: [
{
title: `Here is your song on ${content}`,
description: result.choices[0].text,
color: 0x00ffff,
},
],
});