#topgg-api
1 messages · Page 30 of 1
Idk why my webhook don't detect vote event
dbl.webhook.on('vote', vote => {
console.log(vote);
});
don't work
have you
- saved your webhook details
- checked that the url is valid
- made sure the port is open to the public
Idk for the 2 last
"- checked that the url is valid" i put the url given by discord
also what need i to do ?
you need the url to point to the machine your bot is running on
with the port 5000 ?
yes
okay
or whichever port you choose
i'll test
i set my url but i still have http://0.0.0.0:5000/dblwebhook for link, is it normal ?
yeah, you just need to replace the 0.0.0.0 with your public ip
Until today, my vote check command worked perfectly, but it isn't working anymore. Were there API changes?
yes everytime
So could I get an ELI5 on what exactly webhooks are for Discord?
You can post messages to a discord server with http requests
Can people use them to post other servers?
you can use ifttt for webhooks and discord
I didn’t know what that was before but that’s pretty legit
So you cannot use webhooks to post links for other servers? I just want to make sure I'm understanding correctly.
You can use them to post links yes. They can pretty much post whatever a bot can post. You can’t post in other servers
a webhook doesn't have a target channel or server, it will post only to a specific channel where the webhook's url leads to
which is the channel where the webhook was created by having manage webhooks permission in the server
is it just me or the webhook is stucc
postman can post to it fine as dbl has been stucc for 5 hours since last post recieved
yeah ive gotten 3 reports of broken webhooks
what does {bot.id?} mean? I mean the ? at the end
optional
so I can just do /bots/stats and it will work?
it probs uses your token to get bot
yes, but I need to know if bots/stats is what I should use then
you can do either
Webhooks are dead right?
So I am a little confused about how the webhooks work. And by little I mean very.
I am using the example give by Tonkku in pinned messages but I am having no luck.
const config = require('./config.json');
const DBL = require('dblapi.js');
const dbl = new DBL(config.webhook_secret, { webhookPort: 5000, webhookAuth: 'Not_For_Your_Eyes' });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(vote);
// Do what you need to do
});
I got it to log the running part, but when someone votes, it doesn't log it in the console. Any ideas?
P.S. I am new to this webhook stuff and google isn't helping.
there seem to be problems with webhooks on our side again right now
Okay. Thank you.
finally
👍🏻
To my understanding, lets say I want to use a Discord Webhook to send whoever voted for my bot into a channel, the URL option on DBL would be the discord webhook, correct?
@charred portal here is an example I made on GitHub for webhooks https://github.com/realSaddy/DBL-Webhook-Example
DBL-Webhook-Example - An example on how to use webhooks to get votes for discordbots.org
If you are still having problems
Thank you Saddy.
yourhostname I have a friend who is hosting my bot sooo what would this be?
So what kind of IP. The IPv4 or the IPv6?
And it would go to the url field of the webhook settings?
yes
So the entire webhook url would be someiphere/dblwebhook?
So what would the port be? So sorry if I sound noobish
what you set it to
So the port can be anything, as long as it matches in the code?
Okay. In my url I have the following:http://IPv4Address:port/dblwebhook
And as dbl in my code, I have: const dbl = new DBL(client.config.dbltoken, { webhookPort: 25300, webhookAuth: 'lolno' });
And when the bot starts, it says Connected to http://0.0.0.0:port/dblwebhook
Here is the code:
fffs
const DBL = require('dblapi.js');
module.exports = client => {
const dbl = new DBL(client.config.dbltoken, { webhookPort: 25300, webhookAuth: 'lolno' });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(vote);
});
}
It says that for some reason
Try testing it to see if it sends
Also make sure the port is enabled
Anyone having issues with discord webhooks, dm me
@hollow wraith you fr
Wym?
I get shamed for trying to help people get upvote webhooks for discord working until they can get their own server set up.
So instead of having a 10 minute fight with turtle, if they are having trouble they can dm me if theyd like
We've made our stance on your "solution" clear in the past. "anyone having issues DM me" isn't how things work or how they will work
K and so when turtle starts a fit over me posting, only when people ask about discord webhooks, i should..?
We've talked about this. If someone explicitly asks for what your service does, post webhooks to a Discord textchannel, you can tell them about it.
Turtle "starting a fit" is a different matter
Understood
Welp, aside from all of this. Anyone know what the issue is with my inquiry?
well if you're sending your webhooks to 5000 and listening to 25300, you won't get anything
it has to be the same value
Okay. And also to confirm, I should be using the IPv4 Address?
Do I have to enable port forwarding?
if you're hosting on a home computer, probably
if you're hosting on a cloud machine and you pick a free port, no need
Well, its a friend's server. So not sure.
if it's a cloud server you're probably good, yeah
Okay. I'll ask him about that. And the port can be any number, is what I am understanding. As long as they match
So how do I know if it is occupied or not?
Savitar. If you dont get it figured out, i have a service for the discord webhooks u mentioned. Ping me if u try all u can
Dude you gonna get banned.
?
To my understanding, lets say I want to use a Discord Webhook to send whoever voted for my bot into a channel, the URL option on DBL would be the discord webhook, correct?
he didnt ask for specific Webhook setup help
he doesn't want to send it into a channel
he wanted help setting up the url/port
^^
i have been mentioned
Consider it your last warning, I've had enough of it @hollow wraith
unless someone EXPLICITLY asks for a service to send vote webhooks into a DISCORD TEXTCHANNEL
you don't have to shill it
@charred portal in your code, if you specify an occupied port it'll throw an error
at least it should
it'll probably throw an EADDRINUSE
Okay. Here is what I know:
The
URLfield needs to behttp://IPv4Address:port/dblwebhook
TheAuthorizationcan be like a optional password, and has to match the code withwebhookAuth
Port can be any series of numbers, as long as they match and are available.
Port Forwarding may have to be enabled.
Now, my final question: Where would the dbl code go? In my app file or under the ready event?
i dont think it has to be /dblwebhook
@dapper copper that is the default defined in the bot edit page
some dbl code goes into ready
Okay. Thank you all!
-bots @scenic trail
@wary dove 
@daring citrus
@plush echo
@eternal egret
@thorn oracle
@sullen raptor boi https://i.imgur.com/JbEmjg9.png
I couldn't think of a better channel lmao
-bots @blissful lake
@unkempt kiln
@shell galleon
thx
ù
URL Field: Check
Authorization same: Check
Port the same and open: check
Port Forwarding enabled: check
Still not working
How do you generate a token for the bot on the site? ^^ '
Oki thank you :3
np

I do not understand ;-;bay Une exception s'est produite : Error SyntaxError: Unexpected identifier c:\Users\Sarah\node_modules\dblapi.js\src\index.js:79 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> (c:\Users\Sarah\node_modules\dblapi.js\index.js:1:80)
show code
const Discord = require('discord.js');
const fs = require("fs");
const Client = new Discord.Client();
const experience = new Set();
const DBL = require("dblapi.js");
const dbl = new DBL('token', client);
// ...
@restive otter the error means your code is baaaaaad
Xd Jk
;-;
it met me this error when I add that js const DBL = require("dblapi.js"); const dbl = new DBL('token', client);
update node to version 8 or higher
how ? ;-;
download it from nodejs.org
.
Savitar, you get helped?
Its not even working with the test
how is hook defined in that code? that lib just knows the webhook is a vote?
its defined in the webhook.on event
It logs everything and such. But when I test it, it doesnt log
not even an incoming request.. perhaps a firewall issue?
Port forwarding is open
when i ran my webserver, i have to do portforwarding through my router and allow it through my firewall seperately
tried all of that for these webhooks and never worked. but its worth a shot for you
Okay, how would i go about doing that? Windows 10 computer that is
any firewalls other than default windows firewall?
Nope
When you install the BizTalk Adapter Service (BAS) Runtime, it creates an IIS web site that is bound to TCP port 8080. In most computers, port 8080 isn’t opened on the firewall. When you install BAS, you can set any port you like but keep in mind that port 80 is reserved fo...
ofc do port 5000 instead.. iirc u used 5000 yesterday
It changed but nonetheless
So lets say my bot is running through visual studio code, what would be the app to allow through the firewall
should just be an inbound TCP rule for port xxxx
Aha. So it should be TCP instead of both.
both may not hurt, if u have that option. mine only lets me select either or
hmm no.. i confused myself.. wouldnt a webhook be coming from port 80 or 8080?
doesn't matter what port
how does the webhook know to use the port specified by your server
oh i see, so you dont even need portforwarding just make sure that port is open
if you're behind cloudflare you need to use a supported port
port forwarding opens the port
just specified port to specified port though
How do I do with the API to get the number of votes my bot has on the site?
Please
I have a lot of trouble with the API ^^'
I do not understand
Sorry I'm French and I'm bad with that
I do not know if it's possible but I would like to put on my bot the number of votes he has on the site. My bot is in js.
And I do not understand anything at the API
D:
The api wont post the stats i dont think.. seems people have been using snekfetch to send requests
is there something on dbl api that lets u fetch the user id of votes instead of has voted
Most people use webhooks for that
I think the 2 methods in the api for upvotes are depreciated, well 1 is, and the other is supposed to get all votes in the last 24 hours. But it doesnt clear after 24 hours.
@clever rock what language are you writing kn
In*
js
Tonkku pinned a webhook listener example in this channel, id would recommend going that route
clarification do webhook need a 3rd party server or nope? cause Im pretty still confused on it
is it like a a websocket or not really
It would be running along side your bot
So your bot code would technically be the server
will that not cause issues? on sharded bot?
actually that would
you'd have to start the server from the master process
so you don't start multiple servers on the same port
so inshort, in the sharding file itself? the one that manages the shards
yes and then you'd need to communicate to the shards the data of the webhooks from the master
if you're using d.js
(actually d.js v12 has internal sharding though so it's not neccessary)
yep d.js so I need to pass the data to shards or just specify the port per shard to listen
it would be better to only start one server
That wouldnt work. Because you can only put one link into dbl.. right?
oh
What are u planning to do with the user id Saya?
imitate the has voted
why
w/o the use of api req
o
receive the data of userid
check if any of the shards has access to that user
well
idk
But like. U want to dm them? Or just give them something? Is it something that can be handled in a database?
Im not familiar with sharding, so i may not be the best person to answer. I set the user id in my database with a bool of hasVoted and a time stamp of when it was recieved, then check their hasVoted status vs any commands available to users whove voted
using a database would work
just give them stuff
if the database supports multiple connections that is
02
@bot.command(pass_context=True)
async def serverinvite(ctx):
invitelinknew = await bot.create_invite(destination = ctx.message.channel, xkcd = True, max_uses = 100)
await bot.send_message(ctx.message.channel , "Here is a Invite Link For {}\nMax Uses 100\n{}".format(ctx.message.server.name , invitelinknew))
why not work
-Python-
Any errors?
Maybe try removing the xkcd = True in defining invitelinknew?
And in send_message, use invitelinknew.xkcd.
why not juzt use await bot.say , destination is also not defined
And I think we should use #development. 
Xkcd 
List<String> voterIds = api.getVoterIds("bot id");
Has been giving me an error [JDA MainWS-ReadThread] ERROR org.discordbots.api.client.retrofit.GenericCallAdapterFactory - Error while executing request to https://discordbots.org/api/bots/mybotsID/votes?onlyids=true is there something i did wrong?
Hello hello, how do we set the weebhook? I'm kinda lost.
If I have a ```http://0.0.0.0:5000/dblwebhook
yes 0.0.0.0 would be changed to your VPS IP public ip address
@finite halo that may be the method with a depreciated endpoint
Thank you
@hollow wraith well I was using the example from the docs
Yeah i did too. One of them is depreciated, the other doesnt work as it should. Webhooks are you best option for detecting upvotes @finite halo
Hey, I'm on mobile and I don't know how to get bots onto my server
same way you do on a computer @Dispatch#4169
just not a very fun process on a phone
o rip
Do we need some kind of auth on this?
For some, you use your a token provided on the My bots section on the discord bot list api docs
so i am trying to use the webhook option on discord bot list and its sending to dblwebhook how do i send to the webhook i have provided?
@restive otter can you elaborate more?
@restive otter the webhook format is not compatible with discord's webhooks
You need to make your own webhook receiver
hmmm you mean in my coding?
You need to host a webserver that can handle post requests
is there doc that i can read to understand that more i have never used webhook with js before
Have you ever used expressjs?
no
ok will do thanks
How do you put on the page the number of servers that my bot is? I saw the channel #312614469819826177 and I did this. Restart the bot and the number of servers does not appear on the page. https://letters-of-the-alphabet-are.xyz/bw1Z76ri.png
it'll show after 1 hour
do you also know what setInterval does?
or also put it without the interval in the ready event @restive otter
@mystic wing nah not the ready event. That is only called once. The guildcreated event is more like it
And guilddeleted
or w/e they're both called
that is why he has an interval
I mean for the start (so he can tell if it is working)
Anyone know an api for a welcome thing like in #265156361791209475 ?
see channel topic
If posting to the stats domain return a 403 this host is not accessible, what does it mean
Someone is getting this js 0|main | { Error: 403 This host is not accessible. 0|main | at _response.transport.request.then (/root/forbidden-bot/node_modules/snekfetch/src/index.js:182:21) 0|main | at <anonymous> 0|main | at process._tickDomainCallback (internal/process/next_tick.js:228:7) 0|main | request: undefined, 0|main | body: <Buffer 3c 21 44 4f 43 54 59 50 45 20 68 74 6d 6c 3e 0a 3c 68 74 6d 6c 3e 0a 20 20 3c 68 65 61 64 3e 0a 20 20 20 20 3c 74 69 74 6c 65 3e 34 30 33 20 54 68 69 ... >, 0|main | raw: <Buffer 3c 21 44 4f 43 54 59 50 45 20 68 74 6d 6c 3e 0a 3c 68 74 6d 6c 3e 0a 20 20 3c 68 65 61 64 3e 0a 20 20 20 20 3c 74 69 74 6c 65 3e 34 30 33 20 54 68 69 ... >, 0|main | ok: false, 0|main | headers: 0|main | { date: 'Mon, 28 May 2018 22:30:53 GMT', 0|main | 'content-type': 'text/html; charset=utf-8', 0|main | 'transfer-encoding': 'chunked', 0|main | connection: 'close', 0|main | 'set-cookie': 0|main | [ '__cfduid=d2ee95068d9f5dd471c88fc83e8c3668a1527546653; expires=Tue, 28-May-19 22:30:53 GMT; path=/; domain=.discordbots.org; HttpOnly; Secure' ], 0|main | 'x-varnish': '872153839', 0|main | 'retry-after': '5', 0|main | 'strict-transport-security': 'max-age=15552000; includeSubDomains; preload', 0|main | 'x-content-type-options': 'nosniff', 0|main | 'expect-ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"', 0|main | server: 'cloudflare', 0|main | 'cf-ray': '42242b184fdd91ac-EWR', 0|main | 'content-encoding': 'gzip' }, 0|main | statusCode: 403, 0|main | statusText: 'This host is not accessible.' }
did you set your token in the header
Always do
are you posting?
The host isn't accessible, nothing related to their headers
CloudFlare is the returning server
Yes Jam
But it's not just that url that doesn't work. Every url I enter into snekfetch doesn't work.
wait what
@restive otter
Umm go to https://discordbots.org/api/docs
look at the docs. it’s there
is it if (message.content.startsWithprefix + "invite"); or if (message.content.startsWith(prefix + "invite"); ?
Ok
how does this relate to the dbl api?
I'm getting this error when I run a command that checks if a user has voted for the bot.
The code is something like
if (message.content.startsWith(prefix + "store")){
const { body } = await snekfetch.get(`https://discordbots.org/api/bots/430775188448083988/check?userId=${message.author.id}`)
.set({ Authorization: "myToken"})
if (`${body.voted}` !== "1"){
return message.channel.send("vote for the bot noob").then(message => message.delete(300000))
}
console.log('worked')
return undefined;
}```
@restive otter your token might be wrong
that's what i thought but i just compared it and it's the same token
the this host is not acceptable part is bothering me
it should be saying 403 forbidden, but what is this
snekfetch memes
afaik snekfetch never says that
it should have forbidden for 403
it was working fine all of yesterday and i just ran the command today without any code changes
and im getting that error
Tonnku im sure snekfetch is just showing the responded status code
pretty sure thats not snekfetch and rather than the DBL API
this host is not accessible is not a status code tho

sooooooooo should i work around that issue or is someone going to get back to me on that
Would it be possible to display stats on my website by taking them from DBL?
Make an XMLHttpRequest for https://discordbots.org/api/bots/:id/stats
or use window.fetch
server_count = xmlHttp.responseXML()
I have this and it responds with the xml yada yada
But How would i grab specifically server_count?
use the key?
Umm all of a sudden my bot's server count shows five in the api even though my bot still says 47?
nvm
just fixed itself
but it's only fixed in the api
not on the actual page?
could be cache error, CTRL + F5
does anyone still have a keyboard with actual function keys
yes
they arent used for anything else?
true
something is bothering me with webhooks. how can we sync the time that the user voted on webhooks?
What do you mean by that
Query strings are send back when the user votes, it's not 100% accurate, but you could generate a UTC timestamp and have the url be https://discordbots.org/bot/urbot/vote?timestamp=452353453425
The webhook take a min or two to send so I believe the timestamp is when the webhook was sent
I still dont get why webhooks aren't instantly sent
That doesn't seem like much of a challenge
Tonk said it's because of caching
will you send an email to me when u decline my mod application ??
hmmm the api endpoint isn't working https://discordbots.org/api/bots/365958655926992896/check?userId=231733082804322304
this is with my id and i upvoted
What isn't working?
^
?/
optional
o wait
const superagent = require('superagent')
superagent.get('https://discordbots.org/api/bots/365958655926992896/check')
.set('Authorization', 'BOT_TOEKN')
.query({ userId: '231733082804322304' })
how do I store the result?
like, store "Voted"?
that's out of the scope of #topgg-api
you're asking how to store the response from a http request and that is no longer related to our api
Webhooks are your best bet
thanks
Are you using JS for your bot?
Is there documentation on how to setup my bot to see who has upvoted?
Thank you
where is the webhook being sent if it isnt sending to the channel i specified?
it's not a discord webhook
oh what is it exactly then?
you're supposed to listen to it in your bot and receive the vote events
thats not coming through either looks like i need to do some more reading
what language are you using
dbl.webhook.on('vote', vote => {
console.log(User with ID ${vote.user} just voted!);
});
do you even need a webhook 
i dont have error
because the eg webhook should still work
wait
how much votes do you even get a month
console.log(`User with ID ${vote.user} just voted!`);
client.channels.get('275047183055847439').send({embed: {
color: 3447003,
author: {
name: client.user.username,
icon_url: client.user.avatarURL
},
description: `**${vote.user}** Oy Verdi!\n Botumuzu Desteklediğin İçin Teşekkürler!\nSende Destekelemek İçin\nhttps://discordbots.org/bot/412522145458159618/vote`,
timestamp: new Date(),
footer: {
icon_url: client.user.avatarURL,
text: "© Mcadventuretime.com"
}
}});
});
what
meh
ok
Where are you hosting?
hi
cya
is https://discordbots.org/api/bots/id/check?userId= only for bots with < 1000 votes?
But check only returns whether the user voted in the last 24 hours
if you are using java instead of creating a webhook just use UniRest its alot easier using what @spiral isle pointed out
https://hastebin.com/ilehuwimuj.cs
would it be against api rules to give users say 50 coins in my bots currency if they upvoted every 24 hrs?
as long as you can get coins without voting, sure
yeah you can get upto 100 coins every 5 min from a usual cmd
so its not abuse, thx 😛
i'll add that feature when i add my bot
@finite halo i wouldn't recomment using unirest
it's really badly designed + doesn't follow the http spec properly
heiii
POST bots/stats adds up all the shard's guilds size?
@restive otter then I recommend dblapi.js
@sudden rampart its currently working how else would i do it?
okhttp is generally accepted as the standard http lib right now
does it take a bit sometimes after a person upvotes to check the /check/ endpoint?
ah took about 3 minutes.. nm
an old result can be cached
^ if you do the requests in your browser you will see that it is instant
If you have problem with caching of the result (e.g. user used command to check for vote but didn't vote and now used it again after he voted but still shows he didn't vote), add a random number as a parameter. ?anticache=181818171716616 (you should use a libary for generating it)
Hello, can you please help me for the webhook, I do not understand how to make it work ^^'
how far are you so far
I put the link of the webhoock where it is asked https://discordbots.org/bot/433355193187434516/edit
and I installed the API
it doesn't send messages to discord channels, it's used to send data to your bot directly
I do not understand too much, would you give me an example please?
there's the example in pins for the code
the url should be something similar to http://12.345.678.910:5000/dblwebhook but with the IP to your bot
Are you hosting on your PC or on a VPS
on my computeur
I'm sorry to waste your time ... I do not understand, I'm too bad, sorry
I put that js const DBL = require('dblapi.js'); const dbl = new DBL("token", { 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!`); });
Webhook running at http://0.0.0.0:5000/dblwebhook
But I do not know what to do next
@restive otter the hostname has to be your public ip address
if youre running it on a local machine, u will probably have to set up port forwarding in youre routers configuration
with identifying with discord about your bot shards, is it alright to have the first shard send [0,1] then have the next shard which gets connected correct to [1,3] or would it invalidate the previous shard?
is the webhook only capable of receiving votes?
not a discord webhook
The webhook section in the bot edit page on DBL is for receiving upvotes yes
You can make a webhook server to listen for hook in your code for your bot. Or there are other ways. You can set up a webpage and use php to redirect dbl webhook to discord
I seem to be getting 401: Unauthorized, i didn't change my token, didn't regen etc. Just restarted my bot and this starts happening
The post works on startup, but doesnt on a JoinedGuild or LeftGuild event
Does this have to do with my code or has this problem happened before?
Nevermind, my code.
So i am trying to set up a command but before use i want it to check if they have voted how would i do this? I'm on the javascript library if anyone could help it would greatly be appreciated
I have but I'm not understanding the documentation is there an example of it anywhere?
this what your looking for?
I have that in my code already
well thats how you'd check if a user has voted
if (command === 'voted') {
dbl.hasVoted("95579865788456960").then(voted => {
if (voted) return msg.reply(`User has voted!`);
});
}
idk thats how i'd do it roughly
you could use a webhook then insert into a database 
because if you get 1000+ you’re going to need to use a webhook
Or make a get request to the check endpoint
hey boiiiii my bot was approved but its not on my list
@frosty gale you don't appear to have any approved bots, you sure?
If I pass an array with each shard's guilds size to POST bots/stats, does it display the shard count (array.length)
its on the site
@frosty gale your bot wasn't approved, lol
anyhow, not appropriate for #topgg-api, ask in DMs/other channels
Who can answer DBL API question?
no one if you don't ask it
Why doesn't log when someone upvotes
could there be a webhook for when someone adds the bot through dbl?
Good idea, suggest that here http://GitHub.com/DiscordBotList/issues @wet zenith
i feel like id be yelled at but sure
@restive otter I asked it above, twice actually
No one replied, so I assume no one knew
you can use the "bot invite link" to your own website and redirect from there
ye
custom website link -> website has script for analytics -> you get report for "someone has added bot"
JavaScript -- Can I get the total votes of my bot?
it's provided by the /bots/botid endpoint, it returns total votes all time and total votes for the month
is there any way for me to get a number of how many votes my bot has in the last month and overall?
oh w8
it's answered there
i'll take a look at that
that's exactly what i needed
Question: How does one get an API Key from DBL?
https://discordbots.org/api/docs#mybots click your bot there
Okay thank you
how do i get how many servers have added my bot on my profile page?
api/bots/bot_id/stats
A site can't know how many servers the bot is in, you have to post to the API manually, check the DBL API docs
^
yeah i didn’t read it properly
ahh ok thats what that was for I was wondering sorry dumb moment
thanks though
Guess I'll ask again, If I pass an array with each shard's guilds size to POST bots/stats, does it display the shard count (array.length)
somebody helps me with the webhooks?
What do you need help with?
@pliant valve what language
@sand hazel I believe so, test it and make sure
@uncut crystal I'm currently passing in an array with a single item, but it does not display 1 shard
So I'm wondering if it's suppose to show something
try passing two, we might just treat calls with 1 shard as normal calls
Hm I'll try 2
technically all non-sharded bots are just 1 shard
@uncut crystal A payload of [ 217, 50 ] is shown as 217 and no shard on the website
I'm passing it through postStats in DBLAPI.js
Doc says @param {number|number[]} serverCount The server count of your bot.
So I'm assuming it handles array
Alright, ping me when you do
is there a ratelimit for the bot votes endpoint?
Thanks
can't use snekfetch to update server count now, it says 403 access forbidden, so now my server count is wrong
what to do
show the code
it might be wrong url or not set authorization token 
or check ur token again
.set("Authorization", settings.dbltok)
.send({server_count: bot.guilds.size})
.then(() => console.log(`Updated discordbots.org server count: ${bot.guilds.size}`))
.catch(e => console.log(`Error posting to discordbots.org: ${e.message}`));```
token is right
copy + pasted it 5 times
Have you tried awaiting it?
bot isn't async
await is async
Take a look at #312614469819826177
did the DBLPoster way and I have an error
"You need to provide a client to bind to"
what does it mean by that?
how about dblapi.js 😉
I got it
Webhook
@hollow wraith javascript
absolutely beautiful
what are those lines below console.log though 
eslint errors no-console
cos I have eslint and a rule that says no console lol
o why tho
it's for the library, you'd want to get rid of debugging logs before releasing
Tonkku proud of dblapi.js
yes very proud
I hope that connecting a webhook to an existing webserver will help someone
an express middleware probably won't be worth it?
ohh
hey are upvote webhooks not working or is it just me
nvm
You're the only one I know using them so you were the only one I could ask xD

Tonkku uses webhooks
He probably has better stuff to do 😂
@arctic arch Ah while you are proud, mind looking at one of my issue, it's above, I talked with Timmy about it, but he wasn't sure
It's regarding dblapi
the array?
it should work
are you sure the bot page wasn't an old cached version when you loaded it up
i'm pretty sure
So i got my bot approved and I am looking to us the widget. So i got the id and everything but it dosent have the server count, I added the npm package and set it up but its still not showing servers
show your code
const dbl = new DBL(yourDBLTokenHere, { 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!`);
});```
and
setInterval(() => {
dbl.postStats(client.guilds.size, client.shards.Id, client.shards.total);
}, 1800000);
});```
so that's for webhooks when you want to receive votes
wait you're just copying and pasting examples from the module page
setInterval will wait 1800000ms before executing the first time
ohh true
have you actually placed the code in your bot
Who said pasting and changing wasnt ok?
no one
it was just weird when you pasted them here
anyway
those two lines at the bottom are pretty much all you'd need
yea
i pasted from site bc its on a cloud and didnt feel like getting code lol
forgot it had webhook thibng
If i am wanting to get if a user votes and connect it to another command to where they cant use that specific command unless they vote how would I do this?
query /check or db webhook
I have tried the db webhook but doesn't return anything even in the console @calm torrent
are you using js?
Yes
and using the example tonkku posted?
Yes
Is the port forwarded?
I connected my port forwarding to 5000
yes, make sure to use Public IP address, and make sure portforwarding.. you may need to allow it through your firewall aswell
How do i connect my ip to it?
you just need the listener.. hook.hostname
hostname == your public ip in your code
and in dbl webhook url input
@restive otter get it sorted out?
no looks like i got something in there wrong.. even in a test i dont get anything
paste code for the listener
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!`);
});```
you hosting locally?
yes
windows?
yup
u can try also making a rule in the windows firewall, if you dont have a 3rd party firewall
I can try that then
When you install the BizTalk Adapter Service (BAS) Runtime, it creates an IIS web site that is bound to TCP port 8080. In most computers, port 8080 isn’t opened on the firewall. When you install BAS, you can set any port you like but keep in mind that port 80 is reserved fo...
lol this is so annoying.. Im kinda new to the whole discord.js stuff so Im getting kinda frustrated you could imagine
yeah i went a completely differet route with my webhook
dbl api get votes is the last 1k votes right? and that includes the user that voted again
I mean is, do it always get the last 1k votes only?
How to setup the webhook for votes, Discord.js?
Check this maybe https://github.com/DiscordBotList/dblapi.js
dblapi.js - An official module for interacting with the discordbots.org API
There's an example at the bottom of that page
or pins
Yeah that too 😂
you'd put the URL to your website
where you'd be listening for webhooks
it's not the same as a discord webhook
Do you even webhooks bruh
the amount of people thinking that it's a discord webhook because of the word webhook is way too high
Certainly 😂
no your own webhook -> a http server written to take vote data from dbl
A webhook in web development is a method of augmenting or altering the behaviour of a web page, or web application, with custom callbacks. These callbacks may be maintained, modified, and managed by third-party users and developers who may not necessarily be affiliated with t...
lol
Well discord recieves data from a POST and displays it. Doesnt a webhook do exactly that?
Sends a post request
yes but Discord expects certain data
I wonder how many other webhooks people have tried to link to discord that are not slack, github, or dbl
A lot, that php thing i wrote gets used a lot. Even more so now that im not allowed to talk about it here anymore. A lot of people have bigger issues with portforwarding and firewall rules. Than just the coding portion.
put a disclaimer
I added a disclaimer when you actually put in a discord webhook
so my vote webhook suddenly stopped working and dont know whats wrong, i'm using the javascript library of dbl but the requests just stopped coming trough. Yes i did port forward.
plz help
so im not the only one with the problem
requests should start flowing through soon
so, i still dont get any requests, am i still supposed to wait and if so for how long excactly
depending on how long it was out, it might take a while
I'm still not seeing vote webhook requests come through.
Did anything change in the request body?
Jup still nothing
nothing changed
haven't got any for about 6 hours 
^^
@thin nova wrong channel
stop this shit
that's not an excuse to use a channel strictly for discord bot list api
they dont tell
So is the api gonna be fixed
yes of course
tonkku, webhooks can be canary.discordapp.com or discordapp.com 😳
*.discordapp.com/*
@uncut crystal Any chance you looked at it?
nop
.help
omg that spam though
i know, my messages are also considered spam here, sorry for that
the dbl isn't sending any data to the webhooks, i set up a small server to see every request but none are made. why hasn't it still not been fixed
Same. Not receiving any webhooks.
Hopefully they fix it soon
yup its dependency on nadeko aswell n causing issues came here to say
guess u already know
Same
any1 know how to make bots send dms about stuff?
Webhooks fixed when™
ağla
how do I detect if someone has a specific role (After name, in Discord.JS)
daengineer romanmı yazdın kardeşim
what??
Both of you, wrong channel
really its like 20 hours later and the webhook still isn't working, it can never be such a big problem that it takes this long to fix. i kinda really need it to be working
Same people are whining and complaining that they aren’t getting anything from voting ha
that is indeed the exact problem, now my bot is running on a quick unstable fix
just don't do a thing with votes, you won't have this issue
votes are kinda important to get your bot higher up the rank, pokecord probably has a lot of angry users
just don't use discord lol 
Oh I saw that webhooks are oof
Or aren't they? Because I tried a test a couple times on 2 different domains and I don't see any request arriving to me
jup, the webhooks still dont work
Rip webhooks
Seems to be the case here as well, can one of the Web admins update us on this? @arctic arch
Rip webhooks
do they not care or something?
They are probably just busy yeah
what makes this less important
Its a free service
ok exams is a good reason
I can wait a bit if Im getting a 85% traffic boost among other things for free lol
that shit important
Any announcements on the webhook bug?
They will probs make an annoucement when they fix.
afaik there's a webhook queue
fsr the iframe for my site isn't working
it's not iframing 
what does that have to do with the api
Are webhooks still fukked????
@timid nexus Yeah...
I kinda hope they are fixed sometime soon - I was expecting a wait but not a 48h wait
It's bad timing for me, I released a big update last night and my bug-reports channel is full of ppl complaining about votes so it's more difficult to find the real bugs
i needed to quickly create a workaround for this, just annoying
How would I check if a user has voted using their ID?
Partner told me that I could do this ^^
https://discordbots.org/api/docs#bots read this
what do you code your bot in?
NodeJS
https://github.com/request/request with this package you can easily send http request with headers etc
Ugh u aint helpin
Sorry, but im trying to help here, but you are just asking for a prefab solution which im not gonna give. Tell me what you have tried, share a snippet of code and what you think the problem may be.
Well i'm not a native speaker
@restive otter if you're going to be an asshole to someone who's just trying to help you, you can leave.
Webhooks are currently down.
oh rip

As soon as they want it to be fixed
Sorry for any possible ignorance on my part, but what's the endpoint to request to post bot statistics?
/bots/{bot.id}/stats
Hey, so I'm trying to use the Java wrapper for the API, and when I try to get my votes, I get this error:
ERROR org.discordbots.api.client.retrofit.GenericCallAdapterFactory - Error while executing request to https://discordbots.org/api/bots/213151748855037953/votes?onlyids=true
do you have more than 100 votes?
no lol
I've only just started attempting to make use of the new voting system
because as usual I'm late to all the new trends and stuff
I thought webhooks were broken too?
Webhooks should be working fine I suppose
nope, still broke
So I'm trying to make a workaround, because webhooks are broken right now
Does anyoneone know why this always gives me false?
I'm using NodeJS. And I have voted
dbl.hasVoted(msg.author.id).then(voted => {
console.log(voted);
});
Whoops nevermind, my dblapi package was outdated 
@arctic arch any update on the webhook situation?
investigating
rip
Still have no idea whats the purpose of webhooks
Web hooks allow you to get messages from dbl instead of constantly checking for new votes (in a nutshell) @spare axle
We hooks?
no webhooks
You got it wrong @slim reef
Web hooks ALLOWED you to get messages from dbl instead of constantly checking for new votes (in a nutshell)

Problem with the API
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)```
Code :
```bot.on('ready', () => {
setInterval(() => {
dbl.postStats(bot.guilds.size, bot.shards.Id, bot.shards.total);
}, 1800000);
});```
Code redirected :
```async postStats(serverCount, shardId, shardCount) {```
Const's like this :
```const Discord = require('discord.js')
const bot = new Discord.Client()
const DBL = require("dblapi.js");
const dbl = new DBL('You have really think I give you my token ', bot);```
@arctic arch can you help me ? ^^"
update node to version 8 or newer
Yesh > v8 node
ok
I am trying to get dbl working on my Python bot. However i get this error :
Failed to post server count
Forbidden: Forbidden (status code: 403): {"error":"Forbidden"}
Traceback (most recent call last):
File "/srv/NekoBot_Py/modules/dbl.py", line 26, in update_stats
await self.dblpy.post_server_count()
File "/usr/local/lib/python3.6/dist-packages/dbl/client.py", line 100, in post_server_count
await self.http.post_server_count(self.bot_id, self.guild_count(), shard_count, shard_no)
File "/usr/local/lib/python3.6/dist-packages/dbl/http.py", line 189, in post_server_count
await self.request('POST', '{}/bots/{}/stats'.format(self.BASE, bot_id), json=payload)
File "/usr/local/lib/python3.6/dist-packages/dbl/http.py", line 160, in request
raise Forbidden(resp, data)
dbl.errors.Forbidden: Forbidden (status code: 403): {"error":"Forbidden"}
Anyone any idea's what i am doing wrong here?
code:
import dbl
import discord
from discord.ext import commands
import aiohttp
import asyncio
import logging
import config as cfg
class DiscordBotsOrgAPI:
"""Handles interactions with the discordbots.org API"""
def __init__(self, bot):
self.bot = bot
self.token = cfg.dbltoken # 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)
def setup(bot):
global logger
logger = logging.getLogger('bot')
bot.add_cog(DiscordBotsOrgAPI(bot))
line 26 = await self.dblpy.post_server_count()
did you try to reset your token and check if all variables are defined with the correct value?
👀
Same result 😦
@restive otter Does cfg.dbltoken return a string with token?
yes
I seem to have found the issue...
Apperently this was being triggered before the bot had logged in completely.
After the 30min refresh the status was updated with no error.
Using on_ready, ftw.
yea you should make sure its ready when executing that code
on ready event as example

anyone can help me with the api , i'm a beginner with this api and i have this error when i try to get the list of perople who has voted
The Code
// will return a list of the user IDs
List<String> voterIds = api.getVoterIds("[id]");
The error
[JDA MainWS-ReadThread] ERROR org.discordbots.api.client.retrofit.GenericCallAdapterFactory - Error while executing request to https://discordbots.org/api/bots/[id]/votes?onlyids=true
mention me if you have an answer
yes
399115724926484490
that what i did
i'm going to restart my bot i will see if that time that's good
sorry if you see that like an advertise
i have always the same error :
[JDA MainWS-ReadThread] ERROR org.discordbots.api.client.retrofit.GenericCallAdapterFactory - Error while executing request to https://discordbots.org/api/bots/399115724926484490/votes?onlyids=true
But i see the bot return "null" when i print the list
Sorry for my english, it's not my main language !
ping me if you can help me i'm not connected now
won't change anything
the ?onlyids query param is ignored now
and the wrapper isn't updated
has webhooks been fixed yet?
ok thank you
I am using dblapi.js and the webhook has just recently stopped working
I haven't changed a thing
Webhook is having issues I believe
Indeed, webhooks dont work at the moment
Webhooks still fucked? Any news at all?
just be patient lmao... when it's fixed there'll definitely be a message
^ yup
-owner @alpine hatch
👀
Is there a delay before you can use your api key?
hmmm got a 403 after I just created the key thought it might be that
What endpoint are you using?
Im using dbl.py 2018-06-09T15:45:13.103577+00:00 app[worker.1]: yield from dbl_client.post_server_count() 2018-06-09T15:45:13.103579+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/dbl/client.py", line 100, in post_server_count 2018-06-09T15:45:13.103580+00:00 app[worker.1]: await self.http.post_server_count(self.bot_id, self.guild_count(), shard_count, shard_no) 2018-06-09T15:45:13.103582+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/dbl/http.py", line 189, in post_server_count 2018-06-09T15:45:13.103583+00:00 app[worker.1]: await self.request('POST', '{}/bots/{}/stats'.format(self.BASE, bot_id), json=payload) 2018-06-09T15:45:13.103584+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/dbl/http.py", line 160, in request 2018-06-09T15:45:13.103586+00:00 app[worker.1]: raise Forbidden(resp, data) 2018-06-09T15:45:13.103588+00:00 app[worker.1]: dbl.errors.Forbidden: Forbidden (status code: 403): {"error":"Forbidden"} think I've found the issue though
Nope still broken 😢
You want the whole log?
I don't need the log, I need to know how many characters your token has. 
155
Huh. Reset, then. 
Already tryed that twice
send code hide token
@asyncio.coroutine
def dbl_api():
logger = logging.getLogger('dbl_api')
if KEY_DBL is not None:
dbl_client = dbl.Client(client,KEY_DBL)
logger.info('dbl updater started: {}'.format(KEY_DBL))
yield from client.wait_until_ready()
while not client.is_closed:
try:
yield from dbl_client.post_server_count(client.shard_count,client.shard_id)
logger.info('Posted server count to dbl')
except:
error = traceback.format_exc()
logger.error('Error posting server count: {}'.format(error))
yield from asyncio.sleep(1800)
else:
logger.info('DBL api key not found')
umm... why not just use the example from the website..?
Its pretty much the same thing also I don't use cogs so I can't
no
its totally different
and i can help you convert it to non cogs
send it here
no
it's completely different, yours is pretty inefficient as well
send the website example :p
am on phone
import dbl
import discord
from discord.ext import commands
import aiohttp
import asyncio
import logging
class DiscordBotsOrgAPI:
"""Handles interactions with the discordbots.org API"""
def __init__(self, bot):
self.bot = bot
self.token = 'dbl_token' # 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)
def setup(bot):
global logger
logger = logging.getLogger('bot')
bot.add_cog(DiscordBotsOrgAPI(bot))
client , 3.6.5
what did you call the variable of your client instance
client
I kinda think this should be in #development, no? 
Its about the api
description > help with official api lib
Eh. Okie.
@sullen nymph async or rewrite
who what
- @dense fjord whoops
async





)