So im trying to make my discord bot catch everytime someone votes for it in discordbots.org , im using dblapi.js for this (https://discordbots.org/api/docs#jslib )
According to the following this thread,
What I do to start up my discord bot is go to the webpage. But starting a few days ago, It says that the page can’t be found. I have tried remixing the project but it still says it can’t be found. the link to the page is:
https://tubebot.glitch.me/
is there any way that I can get the webpage working again?
I have to add this to my index.js:
const http = require('http');
const express = require('express');
const app = express();
var server = require('http').createServer(app);
app.get("/", (request, response) => {
console.log(Date.now() + " Ping Received");
response.sendStatus(200);
});
const listener = server.listen(process.env.PORT, function() {
console.log('Your app is listening on port ' + listener.address().port);
});
setInterval(() => {
http.get(`http://${process.env.PROJECT_DOMAIN}.glitch.me/`);
}, 280000);
const Discord = require('discord.js')
const client = new Discord.Client();
const DBL = require('dblapi.js');
const dbl = new DBL(process.env.DBLTOKEN, { webhookServer: server, webhookAuth: //auth
}, client);
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => { //stuff });
But the logs says
“ Your app is listening on port 3000
Webhook running at http://0.0.0.0:0/dblwebhook ”
as far as I understood, 0.0.0.0:0 should be (project_name).glitch.me:3000 so the bot could catch everytime someone votes and do the dbl.webhook.on(‘vote’ thing
what am i doing wrong?
Sorry for the long explanation, im a little confused with this
Hello @koliron
Can you change the following:
To This:
const dbl = new DBL(process.env.DBLTOKEN, { webhookServer: listener, webhookAuth: //auth }, client);
And tell me how this goes for you!
2 Likes
hi @Callum-OKane !
unfortunately it did not work ):
Can you test the webhook to make sure it works, I do not know what is wrong from the code you have provided, and it might only be like that but in actual fact it could be working normally!
tested a few times, but i does not work:
nothing has appeared in the logs
1 Like
i just talked with someone who had the same problem as me, he solved it with the same thing im doing, (but with server instead of listener)
i’ve tried to test it like that and it still doesnt work
he told me he has the 0.0.0.0:0 thing and it works for him anyways
cori
March 18, 2019, 1:39am
8
Hey @koliron it would probably be helpful to be able to see your configuration. Can you share your project name?
ok, somehow the test thing does not work but when someone votes it does! it worked with the listener thing, so thank you Callum-OKane!!
2 Likes
No problem! @koliron
Just make sure to mark the response with that answer as the solution so others can easily find the answer if they are experiencing the same problem!
Happy Glitching!
2 Likes
Glad you got everything working, if you need any more help then make
sure to create a new topic and one of the community members will
respond and help you out!