#topgg-api
1 messages ยท Page 52 of 1
@proud sphinx wrong channel?
I put a head tag in there, as I do with the footer on my website to change certaim things on the site when I need to
I dont really care if it's efficient if it works
Selamlar !
rip dblpy ๐
how to post the shardcount to dbl? i did the same as the API said but i get errors
1) Don't ask to ask
2) Provide your current code
3) Tell us your error, not just that it errors
4) Tell us the lib and lang```
okay wait a bit
listen boys, im in a bit of pickle. the webhook for dbl uses a specific port, but now that I've sharded my bot there's a conflict with the ports, what 2 do
I only run the webhook if the shard id is 0
ur a genius arent u
TypeError: Cannot read property 'Id' of undefined
i used:
setInterval(() => {
dbl.postStats(bot.guilds.size, bot.shards.Id, bot.shards.total);
}, 5000);
bot.shards is undefined
i used another way
i know but how to fix
const guildsSize = await this.client.shard.fetchClientValues("guilds.size");
const totalGuilds = await guildsSize.reduce((prev, guildCount) => prev + guildCount, 0);
this.client.dbl.postStats(totalGuilds);
He's trying to post shard count too
the server count post is working its not a problem
i never understood why you have to post shard count
You dont have to
why not? : D
It's a choice
okay
There is no shards property of the client class
There is a shard property tho
@spiral steeple @ebon dragon for sharding use Sharding Manager
i've just made a webhook code for logging votes, but it didnt log the vote...
@patent inlet did you set up the webhook in the edit page?
@plain timber what do i put in there? which url?
it's usually IP:5000/dblwebhook
Authorization is whatever you set as webhookAuth in the code
Did you save and test?
Change 0.0.0.0 to the public IP of your server
You saved it before you tested it right
yes
the testing said: Webhook tested! This may take a few seconds
@plain timber
Idk how to do that
looks good to use
def __init__(self, bot):
self.bot = bot
self.config = Config()
self.token = self.config.dbl_token
self.base_url = "https://discordbots.org/api"
self.headers = {"Authorization": self.token}
self.session = None
self.updating = self.bot.loop.create_task(self.update_stats())
def __unload(self):
self.session.close()
async def update_stats(self):
"""This will run every 5 minutes to update server count!"""
self.session = aiohttp.ClientSession()
while self == self.bot.get_cog('DBL'):
total_servers = len(self.bot.guilds)
end_url = f"/bots/{self.bot.user.id}/stats"
body = {"server_count": total_servers}
async with self.session.post(self.base_url+end_url, headers=self.headers, data=body) as response:
text = await response.text()
print(f"Posted Server Count!")
await asyncio.sleep(60*5)```
This only posts once on startup^^
Anyone knows what i am doing wrong?
how is dbl doing? Any updates for c# lib needed?
@honest root yes, it needs support for getting votes and vote webhooks
I see, nothing needed to be done 

I will take a look, I thought no one is using it
const DBL = require("dblapi.js");
const dbl = new DBL(process.env.DBLTOKEN, bot);
// Optional events
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})
const dbla = new DBL(process.env.DBLTOKEN, { webhookPort: 5000, webhookAuth: process.env.DBLAUTH });
dbla.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbla.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});```
thats my api stuff
its wierd
weird
oh, its 7 month I haven't looked here 
@digital linden what's weird?
uh'
events.js:183
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE :::5000
at Server.setupListenHandle [as _listen2] (net.js:1360:14)
at listenInCluster (net.js:1401:12)
at Server.listen (net.js:1485:7)
at DBLWebhook._startWebhook (/rbd/pnpm-volume/796e667b-22ab-4154-b10d-18c07f3647b5/node_modules/.registry.npmjs.org/dblapi.js/2.3.0/node_modules/dblapi.js/src/webhook.js:45:18)
at new DBLWebhook (/rbd/pnpm-volume/796e667b-22ab-4154-b10d-18c07f3647b5/node_modules/.registry.npmjs.org/dblapi.js/2.3.0/node_modules/dblapi.js/src/webhook.js:27:12)
at new DBLAPI (/rbd/pnpm-volume/796e667b-22ab-4154-b10d-18c07f3647b5/node_modules/.registry.npmjs.org/dblapi.js/2.3.0/node_modules/dblapi.js/src/index.js:69:22)
at Object.<anonymous> (/app/index.js:43:14)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)```
you need to use 3000 on glitch
oh ok
yeah i meant that\
^
Error: listen EADDRINUSE :::3000
at Server.setupListenHandle [as _listen2] (net.js:1360:14)
at listenInCluster (net.js:1401:12)
at Server.listen (net.js:1485:7)
at DBLWebhook._startWebhook (/rbd/pnpm-volume/796e667b-22ab-4154-b10d-18c07f3647b5/node_modules/.registry.npmjs.org/dblapi.js/2.3.0/node_modules/dblapi.js/src/webhook.js:45:18)
at new DBLWebhook (/rbd/pnpm-volume/796e667b-22ab-4154-b10d-18c07f3647b5/node_modules/.registry.npmjs.org/dblapi.js/2.3.0/node_modules/dblapi.js/src/webhook.js:27:12)
at new DBLAPI (/rbd/pnpm-volume/796e667b-22ab-4154-b10d-18c07f3647b5/node_modules/.registry.npmjs.org/dblapi.js/2.3.0/node_modules/dblapi.js/src/index.js:69:22)
at Object.<anonymous> (/app/index.js:43:14)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
๐ซ๐ Your app is listening on port 3000
Webhook running with path /dblwebhook
Listening
events.js:183
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE :::3000
at Server.setupListenHandle [as _listen2] (net.js:1360:14)
at listenInCluster (net.js:1401:12)
at Server.listen (net.js:1485:7)
at DBLWebhook._startWebhook (/rbd/pnpm-volume/796e667b-22ab-4154-b10d-18c07f3647b5/node_modules/.registry.npmjs.org/dblapi.js/2.3.0/node_modules/dblapi.js/src/webhook.js:45:18)
at new DBLWebhook (/rbd/pnpm-volume/796e667b-22ab-4154-b10d-18c07f3647b5/node_modules/.registry.npmjs.org/dblapi.js/2.3.0/node_modules/dblapi.js/src/webhook.js:27:12)
at new DBLAPI (/rbd/pnpm-volume/796e667b-22ab-4154-b10d-18c07f3647b5/node_modules/.registry.npmjs.org/dblapi.js/2.3.0/node_modules/dblapi.js/src/index.js:69:22)
at Object.<anonymous> (/app/index.js:43:14)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
now this
oops twice
@plain timber c# does have GetVotes method, did it changed?
https://github.com/mylorik/DBL-dotnet-Library/blob/master/DiscordBotsList.Api/AuthenticatedBotListApi.cs#L37
I mean the api call
@honest root i dont see it in the docs
@digital linden you are already running a webserver on port 3000
prob
i have a listener on
server.listen(5000, () => {
console.log('Listening');
});
you will need to connect it to dblapi.js by setting the webhookServer
I see, I guess no one bothered to update it, including me
another one too
const listener = app.listen(process.env.PORT, function() {
console.log('Your app is listening on port ' + listener.address().port);
});
olk
ok
wait
so listener is in server.js
and my dbl is in index.js
which should I move over
you dont need to move anything, you can just export the listener in server and require it in index
ok
If anyone need help - I can answer, or they could just read 1 small file.
Every method has comments what it does:
โข Regular calls - https://github.com/mylorik/DBL-dotnet-Library/blob/master/DiscordBotsList.Api/DiscordBotListApi.cs
โข Authorized calls - https://github.com/mylorik/DBL-dotnet-Library/blob/master/DiscordBotsList.Api/DiscordBotListApi.cs
I forgot how to do that with module.exports
wait
yeah @plain timber module.export.listener = listener; doesnt work
I required ('./server.js') in index
oof
anyone else having issues setting up the webhook for votes with js?
@patent inlet did you try making the post request with Postman yet?? That will help you figure out the issue
I sent the link here
I saw the link but didn't understand what to do. @plain timber
@patent inlet you need to download Postman and make a post request to your webhook URL, sending the data DBL would send https://discordbots.org/api/docs#webhooks
Alright. I'll try to do that later today and see how it goes!
hmm
Hey so i get this error whenever i refresh my bot project
(node:16804) UnhandledPromiseRejectionWarning: DiscordAPIError: 404: Not Found
at item.request.gen.end (/rbd/pnpm-volume/ea312467-098c-43a9-991b-9978d5747180/node_modules/.registry.npmjs.org/discord.js/11.4.2/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:79:15)
at then (/rbd/pnpm-volume/ea312467-098c-43a9-991b-9978d5747180/node_modules/.registry.npmjs.org/snekfetch/3.6.4/node_modules/snekfetch/src/index.js:215:21)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
(node:16804) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:16804) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
anyone know how to fix?
yea how do i fix that tho...
Looks like a d.js issue
and...
more details please
I've no clue what console what this console error means
and we have no clue why youre getting that error
if you only provide us the error message the best we can do is simplify the error message for you
so this is my code
dbl.webhook.on('vote', vote => {
client.channels.get('545963588251156480').send(new Discord.RichEmbed()
.addField("New vote on", `DBL for <@${vote.bot}>` )
.setColor('RANDOM')
.addField("User ID:", `${client.users.get(vote.user)}`)
.setTimestamp()
.addField(`Attempt to mention `, `<@${vote.user}>`)
.addField(`Tag`, client.users.get(vote.user).tag )
.setThumbnail(client.users.get(vote.user).displayAvatarURL)
)
});
``` and when somoene who votes isnt in the main server i get an error saying cant properly read tag of undefined
so what am i doing wrong?
xd
@plain timber
K so @patent inlet either the ip is wrong or the server isn't running
it is running and the ip is correct lol
!play abandonei a gabriela
@plain timber ^
!play bass bosted songs for car 2019
@hard moat you can't use bots here
@patent inlet well that says it isn't
@plain timber im using the server to run my bot rn lool
Well the webhook webserver probably isn't running
wdym?
Not sure, but you can just specify an endpoint for uptime robot to ping to
ok
Quantum
how do i specify an endpoint
like adding a :5000 to my link doesnt work
this also doesnt work
server.listen(5000, () => {
console.log('Listening');
});```
@clever rock
server.listen(5000, () => {
console.log('Listening');
});
const dbla = new DBL(process.env.DBLTOKEN, { webhookPort: 5000, webhookAuth: 'o', webhookServer: listener });
dbla.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbla.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});```
also doesnt work
I dont use http
oof
so I cant tell how on http
but how do u do a web hook
ok
https://github.com/Deivu/Haruna here is the example of what Im currently using
Simple webhook vote handler for Discord Bot List https://discordbots.org/ - Deivu/Haruna
thx
Do you even need to make a server tho 
for my use case I prefer a separate handler
so that on my bot I will just send a request to that server and return the cache to me
and even the bot is down, as long as that server isnt down votes will still register
@digital linden you can only use one port, 3000 (which is exposed as 443, the standard port)
I do maintenance but I dont need to turn my bot off 
You can get the port by process.env.PORT
You plan on getting 70K votes a second?
every .on message I send request on that server
I'm sure he will, he's a certified developer so he knows his stuff.
Being cert doesn't mean you know everything
it means you got 300 servers and 120+ votes in a month 
Your bot is in 300+
What isn't hard to do?
Get 300 guilds.
Can be if people don't invite it.
Then you don't have a big enough audience, or the bot isn't up to par.
I see
I know some bots that tailor toward a specific audience, which is fine.
Yeah I get you
can someone help me on https://fortniteapi.com/store .. i dont know how to start it up
@clever rock can you help me out with the issue I'm having please?
I can't get a response from the webhook even though my server is up and running as it's hosting my bot
How can I even check my ports?
.
google how to check open ports
Hi! I need some help! When I trying to post my server count I get this:
is there a reason that when i request my upvotes with _votes = await self.dblpy.get_upvote_info(days=2) (d.py-rewrite) that it would return with a 404 error?
i upvoted technically yesterday so there should be at least one upvote for the bot to pull, right?
@plain timber @clever rock hey guys
so from asking around i've found out i have to make a http server...
im sorry but i really dont know how to do this...
you can either use dbl api official library OR you can backread and take a look at the github link I sent which is my own handler for the dbl api
which I run as a separate process
In the DBL docs
dbl docs is as simple as requiring it on your bot
dbl official api I mean
give it the port to listen to tada its done
@patent inlet it's never too late to learn
const DBL = require('dblapi.js');
const express = require('express');
const http = require('http');
const app = express();
const server = http.createServer(app);
const dbl = new DBL(yourDBLTokenHere, { webhookAuth: 'password', webhookServer: server });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running with path ${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
app.get('/', (req, res) => {
// ...
});
server.listen(5000, () => {
console.log('Listening');
});
am i missing something here? lol
it's right at the bottom of https://discordbots.org/api/docs#jslib
no i have a server
ok first of all
you dont need express and http
second of all you just need to require dblapi.js
then look on examples and base it there
but this code isnt working for me:
const dbl = new DBL(dbotsKey, { webhookPort: 5000, webhookAuth: 'password' })
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
})
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`)
})
but this code isnt working for me isnt a helpful question
provide:
error message if possible
steps what you did
steps you tried
what is the log when the bot booted
Webhook running at http://0.0.0.0:5000/dblwebhook
ok 2nd, did you actually open port 5000?
ok how you did test it again?
@patent inlet TCP is great
using https://getpostman.com/
what response do u guys get from dbl website when u test the webhook in the edit page?
https://apitester.com/ try doing this
Do you know how your APIs are performing? Check your first and third party APIs for functionality and performance with our free and easy-to-use API tester.
mine says Webhook tested! This may take a few seconds
do i need to add header? or just URL?
or any post data?
@clever rock insomnia is also a great tester
oh yes my co dev uses that
if its open it should provide something like this but it woudnt be the same like in mine cause I dont use dblapi.js
seems like it cannot comunicate with your server
you dont need really a bot
a webhook
you just need a server listening for it
which is what my api handler does
i mean, i want the bot to post the logs to a channel
yeah you could do that but, lmao another bot application
i cant do it any other way?
well my handler does not support that new vote posting on it but you could just make a webhook handler for discord
when someone votes, just hook it then send it to a channel via webhooks
your choice, although I dont really see the need to make it post to a channel if someone votes but thats entirely on what you want to do
its to offer rewards for the votes...
i dont know how to just hook it or send it to a channel via webhooks
then you could just check if the user voted
if Im assuming right
you just want to check if the user voted right?
and if he/she voted you would give rewards right?
Yeah that can be done
But it would've been easier for the votes to be logged and then rewards handed out accordingly
You could try using the handler I made since you cannot use dblapi.js on your server due to some reason. I also dont know why it times out and returns 0000 on the api tester just backread to find where is the link for it
clone the code, put it on glitch
"scripts": {
"start": "node server.js"
},
add this on your package.json below the "main"
make a file named sever.js alongside the index.js
const Haruna = require('./index.js')
const Client = new Haruna(1200, 'Your Password', 7000000)
paste this then done
change the 1200 to process.env.PORT if I remember correctly
thats the port to listen to
spoonfeeding to the max level 
I only clone index.js right?
Into glitch? 
I'll have to do it manually then right?
"clone from github repo"
Glitch doesn't have git
Ah, my bad
Oh
Really
But it can't copy to a current codebase you have to create a new project
you dont need to specify anything that
Idk though
Alrighty
I'll be back on my pc in a couple of mins

I've just tried twice to clone it to glitch but my browser crashed... @clever rock
Do you have a glitch project I can remix instead?
maybe but I think I havent updated that code to latest
done
when it starts it will say started up bla bla
{"statusCode":404,"error":"Not Found","message":"Not Found"}
nah just go straight to dbl
put it on webhook link and provide the credentials you set in the webhook, then save then hit test
what would the webhook link be?
you see the glitch show on top?
click that and it will open a new tab, get that link then add /vote/
read the readme for api endpoints
2nd one
it just says Webhook tested! This may take a few seconds
look on logs
if you want to know how to check for votes, look on examples client.js
awesome!
if you need more info just dm me
damn imma be late for college
lmaaoo
how can i make a webhook to post to a channel from that glitch project tho? 
you could require the webhook part of discord.js
although if we are gonna talk about that #development is the place
hmm...
will i only need glitch to get that done?
if so, i might be able to do it in college

my teachers gonna be like 'what u doing' again lmao
you can use it at your bot since that would work just fine although that would be for #development as I said now
since you said you just want to check if the user voted
that thing does that just fine
oh.... it doesnt actually hook every vote? 
sighs, it will record anyone who votes for your vote
its a handler
"handler" it does everything for keeping your dbl votes, removing them from database, and adding them on database
all you need to do is to put the right links, then request to it
thats it, it isnt hard to comprehend
I have put the examples on checking a user if the user voted for your bot as well, which is what you said you want
True true
I just thought it might hook each vote when voted. My bad
Sorry for all the trouble but thanks so much for your help!
@clever rock
Wdym hook each vote
It will run the code for every vote
You write the code that it runs
Hello, I've an error with the API, can u help me pls.
async postStats(serverCount, shardId, shardCount) {
^^^^^^^^^
SyntaxError: Unexpected identifier
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/storage/614D-AD9E/Water/node_modules/dblapi.js/index.js:1 :80)```
Yes ๐คทโโ๏ธ It's in the dblapi file
u sure bro?
client.on('ready', () => {
setInterval(() => {
dbl.postStats(client.guilds.size, client.shards.Id, client.shards.total);
}, 1800000);
});
also I suggest learning more about async await and functions as well. From your error and the way you asked I can say you arent used to them,
that isnt an error with api but an error due to your lack of knowledge in syntax I believe
oh yeah didnt notice that
With the webhook url, it it possible to use a standard home pc without having to do anything like portforwarding?
how to do @everyone not ping in discord.js?
Wrong channel. Ask in #development.
Client has an option disableEveryone
sometimes people come at me complaining that they voted but the vote wasn't recorded
what should i do?
console.log(vote.user)
when someone complains
check your console
if it logs, then it went through
If it doesnt, then well common sense
const DBL = require("dblapi.js");
const whitelist = [
]
exports.run = async (client, message, args) => {
const dbl = new DBL(process.env.DBL_TOKEN, client)
const voted = await dbl.hasVoted(message.author.id)
console.log(voted)
const whitelisted = whitelist.includes(message.author.id) || whitelist.includes(message.guild.id)
if(!voted || !whitelisted)
return message.channel.send(`you didn't vote
`)
//other code
}```
can someone at least tell me if there's anything wrong with my code?
Why do you create a new DBL every time? I think you can define that above
I use a webhook for my votes so Idk about the rest
@gray copper webhooks are more reliable
what if i don't specify a client?
Then it won't automatically post stats @gray copper
the code you have will spam dbl
@sudden rampart p sure it only runs when the command is used?
and passing the client starts a loop of posting stats
Ah
fixed i guess
Please help! I tried a lot of things, but I'm still getting this ๐ข
@trim venture can you send your code?
That looks like dblpy issue 
I used the example code.

making a request to post the server count yourself is easy instead of relying on libs
dblpy is outdated anyway
Ok, I will give a try.
I'm trying a lot of thing, but how can I do it??
I'm getting that error over and over again.
hmm
I got some interesting error, while I'm tried to upgrade discord.py using pip. I can't upgrade aiohttp, because it says that it is already up to date. What can I do?
how would i get a discord.js bot send a message to more than one server it is in, discord.js (any ideas)
Pretty sure that's api abuse
If you want to just make an announcement do so in your bot support server or smth
Nice edit of your message.
you know you can sent message to specific channels what about specific servers
Well with your Client, it has a guilds property which is a collection of all the guilds your bot is in mapped by the guild id.
guilds have channels, and you would pick a channel to send a message in.
when i use guild it says guild is not defined
We should probably move to #development
A
๐ข ๐ข ๐ข Help me! Please! I don't have any idea. I didn't find any .license file ๐ข
(macos)
So check line 64
@trim venture check the last line in the error. It says it can connect to the website. Make sure you have a stable internet connection that can access the website
I have a stable internet, I know it because my bot is running on my mac.
cannot connect to [...] discordbots.org [...] ssl:None 
I tried it a lot of times. And I added an ssl thing in the http.py but it didn't work.
I tried this setting in the dblpy http.py file but nothing ๐ข ๐ข
aiohttp >>
Raw http request >>
packet send >>
how can i put servers counter on my bot's html page?
I've read the page relating to the API, but although I have entered the code in my program, I still don't see it
im using python 3
Any errors?
nope, program works fine
how do I make it shows my sever count in the widget
@crisp veldt do you post the server count to DBL?
I used this but it wont work XD
๐ฆ
const dbl = new DBL('Your discordbots.org token', client);
// Optional events
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})```
instead of playing roblox why dont you try to create the request yourself
ok
LMFAO
dbl.postStats(bot.guilds.size, bot.shards.total);
^
TypeError: Cannot read property 'total' of undefined
is your bot sharded?
hmm?
and this too:
dbl.postStats(bot.guilds.size, bot.shards.Id, bot.shards.total);
^
TypeError: Cannot read property 'Id' of undefined
if your bot aint sharded it aint gonna have shards
and how to shard it?
you only need dbl.postStats(bot.guilds.size)
you put a capital
Cannot read property 'Id' ***of undefined***
I know, I was just pointing that out for when he later shards
How can I make a system when it's time to vote for the bot to notify me on PV?
My bot is now sharding using 2 running processes, I was wondering if anyone could tell me how to post my combined server count since it is currently only posting the count from 1 shard?
Broadcast eval, in d.js anyways
hi
Is it possible to detect when someone vote for my bot but without having to check every player?
Yes @hexed glade but I still dont know yet
Like EnderBot or Discord Miner they use that method
Yeah
You need to use https://discordbots.org/api/docs#webhooks
console.log(`User with ID ${vote.user} just voted!`);
});
@restive otter ๐
Just a bit of recommendation, is it possible for the webhook api to return the username as well? this would be useful for users that runs the webhook listener on a separate server so that at least we can know the user who voted without making our own request to get the data from d.api
read the api docs
I dont find it. 
it was linked 3 messages before but ok
Then you didnt read the bot reference
How to get webhook with java library?
@hexed glade set up the http server yourself, you can use spark: https://goo.gl/TJ1IU1
Spark Framework - Create web applications in Java rapidly. Spark is a micro web framework that lets you focus on writing your code, not boilerplate code.
You need to receive the POST request DBL sends to you
Sorry bit new to webhooks and such, I noticed it says I need the dbltoken for posting server count and get votes and such, which works and i can access dbl.getVotes() etc, but then I realised I need the webhook ones to be more efficient, aka dbl.webhook.on('vote', vote => {}) so Im going about setting up the webhook and such, but im wonder if I even need to? or does the dblapi.js handle all that? and I just need to do dbl.webhook.on('vote', vote => {})
@mossy yacht you need to include the webhook settings when you are making the dbl client
Ohhh ok, so if I supply that and give the necessary ports open on the server etc, DBL handles the actual webhook part for me?
well you'll also need to set the URL and auth in the edit page
but yeah pretty much
yeah done that, ok awesome thank you ๐
yw ๐
Halp Error: listen EACCES: permission denied 0.0.0.0:80
I tried adding webhookServer: server ip like i saw in another example
and got this Error: The server is not an instance of http.Server
@plain timber i need yo wisdom
Think I fixed it
Ok it stopped erroring but the ready event wont trigger
@mossy yacht dont use webhookServer unless you want dblapi.js to run the webhook on an existing nodejs webserver
Don't put an IP in it
Ok then what do I do about this error Error: listen EACCES: permission denied 0.0.0.0:80
use other port
huh, okie dokie will give it a try
also just fyi I added this from the example for the server bit of it
const app = express();
const http = require('http');
const server = http.createServer(app);```
also do I add the port to the URL on DBL page serverip:5000/dblwebhook
hey umj
@plain timber is this my webhook link http://0.0.0.0:5000/dblwebhook
0.0.0.0 is localhost
ik
so whatever the localhost ip is
im using glitch to vps\
ahh ok I see
ยฏ_(ใ)_/ยฏ
im on google cloud console
but it worked Webhook running at http://0.0.0.0:5000/dblwebhook ๐
?
Thanks guys
i mean I guess it works
BUT THERE IS NOT A web i can redirect tio
GLITCH DOESNT HAVE AN IP
and https://lololol no project name.glitch.me:5000/dblwebhook
doesnt work
@plain timber
I think glitch has predefined ports that you can you
process.env.PORT
I think
I dont think that they have all ports open tho
ik
I am already using port 300
0
I need to be able to open a new one
Any idea how to use httpproxy
What should I expect once I click this
nvm found out
hmm im testing the webhook but not getting any logs, yes im logging vote event
@digital linden you need to set webhookServer to the express server listener, and remove webhookPort, also it's just project.glitch.me no :5000 or :3000
What
like
If you set webhookServer to the express listener then they'll both run on the same server
It shouldn't screw anything up
ok
Yeah
should i send req to my project.glitch.me?
@plain timber im getting Webhook running at http://0.0.0.0:5000/dblwebhook on ready event but testing the webhook does nothing :/
https://project.glitch.me/dblwebhook
ok
@mossy yacht did you set the URL (with the correct ip instead of 0.0.0.0) and auth in the bot edit page, and save?
yes on DBL page its serverip:5000/dblwebhook and auth is the same
@mossy yacht what if you use https://getpostman.com and try sending a post request to the URL
That should give you details on what happens
okie dokie
How do I use this? im trying to send post request but its just sitting there saying its sending
@plain timber
Maybe the server isn't responding?
maybe its blocking it idk, im not amazing at google vm instances lol
you can try to host your vote api on glitch although you need an handler for it
yeah but my database is on google cloud and can only be access by VM's inside the project
you can store the votes on something like an sqlite database
for ease of setup and access
that still doesnt help me
then my bot is seperated and i then need a way to send all the info to google cloud still
it would because you can just make it "api like"
and since its api like
it do support sharded bots
to give you an insight instead of
https://discordbots.org/api/bots/{bot.id?}/check
you just make your own api that does something / mimics that
- that links just an error
- this already sounds more complicated
- I fixed it, just had to open the port whoops
ofc it would
its just an example
and it is not complicated if theres a ready made one already 
its complicated to me because i have no idea what your on about
api
I'd rather just open a port and then have it on the same server as the whole bot
dont tell me you dont know an api?
I know what an API is
thats what Im talking about
you can host the api along side your bot as well l
eitherways
you would understand it if you get big enough to shard
uh huh okie dokie
welp postman can now connect, and give 403 forbidden but still wont work with testing it
just google 403
I know what 403 is its literally in the title
forbidden
meaning authorization didnt work
then just fix it if you know that ๐
but idk how to add auth to postman
Do you have to have such a dickish attitude?
Im not trying to be dikish
I have been, thats literally what ive said the past 2 times
this is who I am
i run the bot and ready event works, i test the vote thing with test button and get nothing\
ok so you said it connects on postman
you already tried the test after you verified it conects with postman?
yes
they adding authorization in headers
well connects, but still no auth
id assume so idk I dont control the dbl test button
ok then whyd you ask?
ah fairo
how do I add the auth to headers
ive never touched any of this so thats meant nothing to me
except all I see is a place to put key value and drop down for authorizations
I personally use node-fetch so about postman I cant tell but maybe on docs theres a way on adding headers to the req
does that tell you whats going wrong etc?
If you're using the dbl lib, it shouldnt be that hard.
he is using postman
const fetch = require('node-fetch')
fetch('http://{hostname}:{port}/hasVoted/', {
headers: { 'authorization': 'Your Password', 'user_id': '1234567890' }
}).then((response) => {
if (response.ok) {
response.json().then(console.log) // Logs False if user didn't vote, TRUE if user did vote.
}
})
in nodefetch appending headers is like this
I hope that would help
huh.. Idk what I changed but its working now .-.
managed to get a bad syntax error from postman since auth was correct now, and then yeah just restarted the bot and tried again lol
good for ya
bot.on('message', message => {
let votechannel = message.guild.channels.find(`name`, "chaosbotvotes");
dbl.webhook.on('vote', vote => {
votechannel.send(`User with ID ${vote.user} just voted!`);
});```
at Client.bot.on.message (/app/index.js:284:13)
wat
TypeError: Cannot read property 'on' of undefined
wat
@junior cloud which line is line 284?
that
Which
You sent multiple lines
You didn't include the webhook settings in the new dbl
i should get some sleep
Same it's 2 am

In DBL api, have a way to execute some code when some user votes? In the same moment
webhooks
Will it take some time when i upvote the bot and it will send a log to my channel?
And i thought of doing with the webhook, but how to define the webhook token?
Okay so I put ```py
import dbl
import aiohttp
import logging
class DiscordBotsOrgAPI:
"""Handles interactions with the discordbots.org API"""
def __init__(self, bot):
self.bot = bot
self.token = 'I put my token here' # set this to your DBL token
self.dblpy = dbl.Client(self.bot, self.token)
self.bot.loop.create_task(self.update_stats())
async def update_stats(self):
"""This function runs every 30 minutes to automatically update your server count"""
while True:
logger.info('attempting to post server count')
try:
await self.dblpy.post_server_count()
logger.info('posted server count ({})'.format(len(self.bot.guilds)))
except Exception as e:
logger.exception('Failed to post server count\n{}: {}'.format(type(e).__name__, e))
await asyncio.sleep(1800)``` but it isn't sending the guild count to the site (yes I also have the thing in `def setup`)
@restive otter js?
python
Okey
You should make a HTTP request yourself. Dblpy is outdated.
...
Is this an API abouse that my bot edits a message 5 times with 3 second delay per edit?
No, this channel if for questions regarding the dbl api @trim venture
const DBL = require('dblapi.js');
const path = require('path')
const fs = require('fs')
const { Client } = require('discord.js')
const bot = new Client({ disableEveryone: true })
const Discord = require('discord.js')
const client = new Discord.Client();
const dbl = new DBL('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjQ3OTk4MzIwNjkzMDU3OTQ1NiIsImJvdCI6dHJ1ZSwiaWF0IjoxNTUxODg2OTIyfQ.uyA7r1DpyjD55mNXuNqaBbxRGsfG9xJ0Nsbiv-DMZJg', { webhookPort: 5000, webhookAuth: 'AppleIsTasty' });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at https://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
// Optional events
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})```
My code!
Its not working
Ping me when you have a answer!
Well thats one nice token
Token and auth
Damn I could send 1 billion servers
but I wont thats mean
So... what exactly isn't working? How is it borked?
@royal fiber one, regen your token
Two you need to provide a client to post stats with the lib
And three, dont copy paste examples
Can't you abuse the servercount using the dbl api? Like posting an int instead of the number of servers
i think you can, but if youre caught youre gone
@royal fiber
You can, if they catch it they remove the bot
Which is why you need to regen your token
legend says you'll be banned from dbl if you abuse server count
@foggy harness yea?
You said tag me when there's an answer. Tarpergon gave you 3, so I tagged you
so, with the JS dblAPI is there a upvote event?
nvm
whats a webhook Port
and Auth
I literally just want a Discord Webhook on my server to run when theres an upvote. I've never heard of webhookPort or auth
@cerulean token DBL will send a post request to your server, you will have to send it to discord
I have no idea how
The port is the port you want the webhook webserver to run on, 5000 should be fine
whats a port tho
The auth can be any password you want, but it has to be the same in your code and your bot's edit page
In computer networking, a port is an endpoint of communication. Physical as well as wireless connections are terminated at ports of hardware devices. At the software level, within an operating system, a port is a logical construct that identifies a specific process or a type ...
bot's edit page? The discordapp.com/developers page under my bot?
oooh
At the bottom you can set the webhook URL and auth
ok. How do I make it send it to a Discord webhook?
You'll need to handle that in your code
Is it anything special, or just like a normal Discord webhook
In the dbl.webhook.on('vote' , ...) function
Change the highlighted line to whatever you want to do
Yw
BTW the URL is http://IP:PORT/dblwebhook (change IP to your IP and PORT to the set port)
why does it need the IP
It will probably log a URL with 0.0.0.0, change that to the servers ip
public IP, right?
aah
If it's a public IP doesn't that mean any IP could technically work? Or am I wrong lol
can it be a VPN ip?
on the edit page, it says URL
what is this
The url to the Discord webhook?
please help me i can't set my vote logs in my discord server!
Any possibility for hmac payload in the future? Patreon's system is a good example of this.
i only get this nothing else!
@ocean shell can you help me please?
No. 1) I don't use js 2) No idea what that is 3) Zero context
const dbl = new DBL(process.env.DBL_TOKEN, { webhookPort: 5000 webhookAuth: 'AppleIsTasty' });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at https://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});```
my code!
its not running
Don't know, ask one of the mod
they just don't reply!
do you even know how to open port?
did you test if that port is open?
a lot of factors contribute on that
if you want to us to help you better a simple its not running or why my code dont work will not enable me to help you
for glitch the port is set on process.env.PORT
then it means you cannot make your own webhook on that port because you already use it
so you may ask how then?
my answer is, simply you cant. You may need a new server, or remove the keep alive ping
if i remove the keep alive ping then how will my bot stay online?
either hope someone votes for your bot once per 12 hours
https://uptimerobot.com/ or learn to use this
grab the user via its id from client.users
i ususally have a bot hosted in heroku but i am getting this error!
i can't use?
how to do it??
by paying with credit card?
i already did it
ya
Yes
in the config vers i need to add something??
Are you setting up webhooks
yaa
If so I guess the auth you will use
And put it as an env var instead
the webhooks are working but with this error
@royal fiber https://discord.js.org/#/docs/main/stable/class/Client?scrollTo=e-error you didn't implement a listener for this event, that question should've gone in #development either way as it's not dbl api related
Comparing a pile of shit with another pile of shit
how can i create a webhook and get her auth code and this things for the votes log
?
Assuming your webhooks gender are we?
you have the dblapi lib? Well js's lib actually works idk about the others
Also what lang
Offtopic but ok
aye
I want to host my bot in glitch, so if i do that then to run the bot i need to use the process.env.PORT to the listener, but go run the vote logs with dbl api i also need to use process.env.PORT i tryed but glitch cannot use thir port for both the events.
Any Fix? Mention me when you have an answer!
I get this error when i use process.env.PORT two times.
No u
How to get discord bot key
Your dbl api key will be on the "Edit" page
@royal fiber you already have a webserver running, you will need to tell dblapi.js to it it by removing webhookPort and setting webhookServer to the express listener
THANKS
const DBL = require('dblapi.js');
const server = http.createServer(app);
const dbl = new DBL(process.env.DBL_TOKEN, { webhookAuth: process.env.DBL_PASSWORD, webhookServer: server });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running with path ${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});```
This is my code, i host my bot in glitch, but my webhook never comes to ''ready''
Have i did any mistake?
xd
Thts not the solution..

Jst tell me why its not working..
He told me to do and you are telling dont use glitch..
then follow what he said
i said dont use glitch as it's full of problems but
can you give me an error if there is one?
have you tried removing server?
Removeing server?
๐ ok
const DBL = require('dblapi.js');
const dbl = new DBL(process.env.DBL_TOKEN, { webhookAuth: process.env.DBL_PASSWORD, webhookServer: 8080 });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running with path ${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
try this?
coding on mobile
error?
@runic grove
This server is not an instance of http.Server
link it urself
that the server is not an instance of http.Server
smh
Saya has one it's pretty nice ๐
@spiral steeple what you are talking about?
@clever rock that is what your thing does right?
https://github.com/Deivu/Haruna this thing
Simple webhook vote handler for Discord Bot List https://discordbots.org/ - Deivu/Haruna
Ah that desc clarifies
yes
@plain timber






