discord_bot/util/lastfm/roast.js
SileNce5k c1f46bf174
Some checks failed
CI / CI (push) Has been cancelled
temp
2025-04-30 20:00:38 +02:00

26 lines
No EOL
930 B
JavaScript

require("dotenv").config();
module.exports = async function(topArtists, topAlbums) {
let prompt = "Roast the top artists and top albums the user has listened to most for the last year. Go as hard as possible."
let answer = "";
await fetch(`https://openrouter.ai/api/v1/chat/completions`, {
method: `POST`,
headers: {
"Authorization": `Bearer ${process.env.OPENROUTER_API_KEY}`,
"Content-Type": `application/json`
},
body: JSON.stringify({
"model": `deepseek/deepseek-chat-v3-0324:free`,
"messages": [
{
"role": `system`,
"content": prompt
}
],
"max_tokens": 250
})
}).then(response => response.json()).then(data => {
answer = data.choices[0].message.content;
}).catch(error => {
console.error(error);
});
}