Update bot to new discord API and add simple chatgpt module

This commit is contained in:
2023-03-21 13:35:28 +01:00
parent 136173f4de
commit b6008e0ad3
11 changed files with 6383 additions and 4183 deletions

View File

@@ -1,16 +1,17 @@
const fetch = require('node-fetch');
module.exports = function (bot, api) {
api.registerCommand('randomquote', async (args, message) => {
const data = await fetch(process.env["QDB_URL"], {
headers: {
Authorization: 'Basic ' + Buffer.from(`${process.env["QDB_USER"]}:${process.env["QDB_PASS"]}`).toString('base64')
}
});
const quotes = await data.json();
const quote = quotes[Math.floor(Math.random()*quotes.length)];
let chan=message.member.voice.channel;
api.queue.add(__dirname + "/sysmsg.wav");
api.speak(chan, `${quote.author}, on ${quote.medium}: ${quote.quote}`);
})
const fetch = require('node-fetch');
module.exports = function (bot, api) {
api.registerCommand('randomquote', async (args, message) => {
const data = await fetch(process.env["QDB_URL"], {
headers: {
Authorization: 'Basic ' + Buffer.from(`${process.env["QDB_USER"]}:${process.env["QDB_PASS"]}`).toString('base64')
}
});
const quotes = await data.json();
const quote = quotes[Math.floor(Math.random()*quotes.length)];
let chan=message.member.voice.channel;
// api.queue.add(__dirname + "/sysmsg.wav");
// api.speak(chan, `${quote.author}, on ${quote.medium}: ${quote.quote}`);
api.respond(message, `Here's your quote: ${quote.author}, on ${author.medium}: ${quote.quote}`);
})
}