Closed ouchJP closed 3 years ago
Hi, I'm trying to make a discord bot using your package but anytime I send the command a second time the api blocks my request and gives me a CONTIMEOUT. What am I doing wrong?
code: 'CONTIMEOUT', message: 'Connection timed out', status: 'error'
const VNDB = require('vndb-api') const vndb = new VNDB('clientname', { minConnection: 1, maxConnection: 10, }) function rand(min, max) { let randomNum = Math.random() * (max - min) + min; return Math.floor(randomNum); } client.on('message', message => { if (message.content === '!vnrandom') { let x = rand(0, 30084) vndb .query(`get vn basic (id = ${x})`) .then(response => { // Use the response console.log(response.items[0]['original']) message.channel.send("Your random VN is: " + JSON.stringify(response.items[0]['original']) + ' ' + JSON.stringify(response.items[0]['title']) + ` https://vndb.org/v${x})`); }) .catch(err => { // Handle errors console.log(err) }) .finally(() => { // Destroy the client and any connections vndb.destroy() }) }});
Hi, Just asking...., were you able to resolve this issue ?
Hi, I'm trying to make a discord bot using your package but anytime I send the command a second time the api blocks my request and gives me a CONTIMEOUT. What am I doing wrong?