#topgg-api
1 messages · Page 63 of 1
.webhook

dbl.webhook.on("ready", hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on("vote", async (vote) => {
console.log("ff");
//some unnecessary stuff...
})
const dbl = new DBL(token, { webhookPort: 5000, webhookAuth: "woahthislookscool" }, bot);
dbl.on("posted", () => {
console.log("Server count posted!");
});
dbl.on("error", e => {
console.log(`Oops! ${e}`);
});```
are you both having the same issue?
yes
okay hold
yes
CC @arctic arch are we having issues with webhooks?
also you missed a semicolon on line 37 @deep bay
that's needed?
no
No
but it makes it prettier
i'll add that, just for you
And consistent
I'm using a webserver to process votes. But it works for me.
the most pointless chatter
I would confirm webhooks working or nah but that'd require to get a second bot approved 
webhooks work
hm
Are you sure that your URL and Authorisation are filled in correctly?
yes
And that you are using the same in your code
i wrote the webhook url that i created
@chrome canyon shush
yes...
00f
Do you have a webserver for it
Because DBL is self does not send that in Discord webhooks format
ah
b
then when you press the test button in the screenshot, what's it supposed to do?
yeah but define test
brainpower 100
does it run the stuff in the vote event?
its sending a post request Ig
it's still not emitting the vote event
@azure pollen do you have any idea why?
apologies for the ping
im busy now ask a mod ¯_(ツ)_/¯
okay np
@azure pollen if you make me a mod I'll reply as a mod
no
the highest role is tonkku above all else
the highest actual useful role is Web Admin
the most op role is op af
but that's not fitting for this channel
i'll just disband vote rewards for now, thanks for all the previous help
have a great day
the url cant be a discord webhook
it doesnt work like that
its not a discord webhook anymore
this site, i scrolled all the way down to the API Options
@restive otter it has to be a webhook made not using discord
eg googling "free webhook" should work
Instantly test, bin and log webhooks and HTTP requests with this handy tool that shows requests to a unique URL in realtime.
i searched that and went on the first one, and its accepting requests when i use the test button
^
but i dont get what to do next
lmao
Okay so
A normal webserver works the following
You send it a GET request and it returns usually html
if you submit a form, you send a POST with the form data, and the web server handles that data
A webhook only accepts the second type
So basically you hook up a webserver like express
And process all requests
damn, didnt know vote rewards was so complex
It really isn't
i think ill just not have vote rewards
d.js
const dbl = new DBL(yourDBLTokenHere, { webhookPort
i replace "yourdbltokenhere" with the bot token from https://discordbots.org/api/docs#mybots correct guys ?
Yes
Should I write a dependencyless webhook module for dbl
yes
@dense basalt do you have a node bot with eval
Can you eval require('os').networkInterfaces().eth0[0].address
I can just host it on my pc, brb
I got you
It works on GalaxyGate
I just need some more coverage before putting it into a module
Yeah it gives my actual VPS's IP
Host?
the IP of my server
nono
im abit confused on that area, what is it asking me to put ?
and 800 to go
nah I need like 5 working hosts
A password you come up with to verify it's you
nice
I think I'm save
same
Infinity years
but yeah so
Nice
probably on all kvm servers
require('os').networkInterfaces().eth0[0].address gives ext ip
good enough ig
on windows hahayes http://very.verylegit.link/SCKM,+.4Wbjj9K424iphone!pcmonitor.apk.json.exe
ravy that gives an ip address lol
yeh its the same
I have it installed
can ya run require('os').networkInterfaces() and tell me which of those could give a possible external IPv4 (not 192.x)
for me it's called 'vEthernet (Default Switch)'
Lemme just boot up
ty because uh
I'm tryna auto-generate the webhook url
and that requires ext ip usually
@chrome canyon Linux for vps, macos for pc
ok can you run the same thing on mac
require('os').networkInterfaces()
and see which one is an ext ip
I'm out for dinner now 
Probably in 3 hours imo
because I'd love to not need to make an external request to get the public ip
I don't get an external ipv4
what interfaces do you get?
Ethernet and "Loopback Pseudo-Interface 1"
are you sure Ethernet doesn't have a public ip in any of the address fields?
Do you want me to run anything on Linux since I can do that from my phone
but yeah it should be able to autodetect some stuff
same procedure :p
require('os').networkInterfaces()
Aight, one sec
and see which ones could potentially give ipv4
On console or what
enter a node repl first, assuming tahts node
I'm on Mobile so this shit is gay to do
@chrome canyon do you still need it
What?
the require('os') shit
yes
As much testing as possible
Because that can be used to auto generate the webhook url
@chrome canyon Linux:
Running require('os').networkInterfaces() gives me 2 IPv4s
MacOs:
Running require('os').networkInterfaces() gives me 2 IPv4s and 4 IPv6s
And you're qt
@dense basalt which interfaces give you the external ips?
like
the actual ones
not 192.x
What do you mean, I only get address, netmask, family, mac, internal and cidr
you dont get your public ip that way
yes you do
you'll only get a private internal ip
on linux it's eth0
on both my VPS' it's set in eth0
@dense basalt can you check eth0/address against your public ip
Linux: eth0 gives my VPS's IP and lo gives me public Ip I guess
lo is loopback
fine keep going if you want to waste your time
Not sure what my mac's IP is
os.networkInterfaces().eth0[0].address is 99% your external IP on a VPS
well yeah
because mac
which interfaces you got there?
also your device does know it's public IP otherwise hostname -I would be bork
so you're able to get it in node

lo0, en0, awdl0 and utun0
all I get is internal ip
on?
literally any machine I've ever used lmao
heh
well if I eval it, I get my public IP
on wsl, ubuntu, and arch.
and across two different virtualization thingies so far
so I'm pretty confident
both GCP and DO VPSes give internal IPs as well
also this is just to simplify people's webhook stuff
if it doesn't get the ip then /shrug
but if it does then bonus point
I would've implemented that in the library if it was possible but it isn't
at least on most machines
except yours
Nice clicking on General
@arctic arch I mean if you wanted to implement it, you can also just ping a site like https://canihazip.com/s
but my personal goal is to get it without sending a request
and a machine knows its public IP so there has to be a way 😔
yeah I was going to do that but left it out from the initial release of webhooks
I wanted to at least have it as an api request on DBL api instead of any random site but still doing a request is a bit meh
or sub_process.exec this http://click.on.this.verylegit.link/Jm,jP~;S2OY211ip-camera+test.mp4.pdf 
curl 216.239.34.21 -H "Host: ifconfig.me" :^)
yes but curl in js would require a child_process call
and if I call child_process, I can also just do hostname -I
is that uppercase i
Yes it is
not a valid option for me
I do love eval
I get my IP twice when doing a lowercase i
also, just executing that won't work on eg windows
it's more reliable to just have an api endpoint that returns the public ip
hostname (GNU inetutils) 1.9.4
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Debarshi Ray.
hostname: unrecognized option '--all-ip-addresses'
yeet
hostname --all-ip-addresses just gives me my VPS's IP
weird as heck
different distros can have different commands
yes
can you try require('os').networkInterfaces()
and see if any of the address fields match your ext ip
Oh my god this hotel wifi
none
manjaro
2804:431:b700:dac3:8ab5:63bc:79a8:4647
might be public
fe80:: is internal for ipv6
fc00 and fd00 are local
might just have IPv6 as ext IP
can you curl https://v6.ident.me/
because I'm like completely confused
and no it wouldn't tbh
2804
I dont have ipv6 rn
well, give me a function that can parse that data from any format and get an accurate external ip
also a problem with your solution
it's not that hard
it's not always eth0
thing.wlp3s0[2].address
just iterate over all the interfaces
mine's that
are you on wifi?
yeah I think thats the same as my laptop
and you're gtg
and 172.*
my lan is enp0s31f6
it's def not the easiest
my gcp is ens4
and shows on the array before my public ip
¯_(ツ)_/¯
it's the 192.168.0 and .1
easier to just hit an api endpoint than relying on that
if api fails then the webhook won't work anyway
schedule a retry and keep doing
also an api endpoint would allow libs for other langs to be able to just hit it instead of having to figure out the ip themselves
¯_(ツ)_/¯
well that'd then require an api endpoint at dbl
which I'm sure is possible
but doesn't currently exist
Can someone help me out? I fetch the vote from webhook on event but its not working
dbl.webhook.on('vote' , vote => {
const user = bot.users.get(vote.user)
user.send("Thanks for voting!")
bot.channels.get('the channel id im 100% sure true").send(user.username + " voted for the bot!")
})
I tried testing and actual voting both arent working
Whats the issue
@pearl ibexu need to set webhook server and put webhook auth. And token in your bot's page
I can post the server count and stuff @restive otter
Servercount and webhook thinga different
How i can set the webhook? Im using heroku
how do i get a webhook URL?
and is it neccasary for me to get the votes on the code end?
ping me pls
@thick flint you need to make a server that accepts post requests
@hearty dagger please dont just say stuff like "heroku bad" it ads nothing to the conversation and causes arguments..
i cant get hold of bots api for discord servers
anyone guide me
anyone help me how to add this
this servers thingy
thanks
@plush oar what library are you
js
Alright, read this https://discordbots.org/api/docs#jslib
// Optional events
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(Oops! ${e});
})
do i use that to display my server count ?
I have no clue, I don’t use js
oh lol
No
what
I have no clue what part posts it, just read the whole page
ok sorry
at Module._compile (internal/modules/cjs/loader.js:774:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
at Module.load (internal/modules/cjs/loader.js:641:32)
at Function.Module._load (internal/modules/cjs/loader.js:556:12)
at Function.Module.runMain (internal/modules/cjs/loader.js:837:10)
at internal/main/run_main_module.js:17:11
it has my API key in the error tho
const dbl = new DBL(TOKEN', client);
^
ReferenceError: client is not defined
at Object.<anonymous> (index.js:5:180)
at Module._compile (internal/modules/cjs/loader.js:774:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
at Module.load (internal/modules/cjs/loader.js:641:32)
at Function.Module._load (internal/modules/cjs/loader.js:556:12)
at Function.Module.runMain (internal/modules/cjs/loader.js:837:10)
at internal/main/run_main_module.js:17:11
You need to make client before u submit client too it
how do you define your Discord.Client()
const Client = new Discord.Client();
Then make the client uppercase?
then use Client instead of client
then you will stop copy pasting examples?
we only get our token after approval right
Yep
Fix those problems
Just check if the channel is nsfw and if not reject the command
What??
With the google command you can search NSFW sites like porn. Make sure this command is only available in NSFW channels else this breaks Discord ToS.
in the d.js the dbl.hasVoted isn't a function?
I tried running my bot and i received this error in the console:
{ Error: 429 Too Many Requests
at IncomingMessage.res.on (C:\Users\spenc\Discord Bots\GRiM Project\node_modules\dblapi.js\src\index.js:118:25)
at IncomingMessage.emit (events.js:202:15)
at endReadableNT (_stream_readable.js:1129:12)
at processTicksAndRejections (internal/process/next_tick.js:76:17)
raw:
So I have my bot send server count to DBL and then it will refresh the server count every hour after that.
So im not even near being rate-limited
well, if you're getting that error, you're being rate limited somewhere
Pof
well no shit
@onyx vale what lang you use.
Also this should be taken to #development
If its python async, I have a github repo with things to check for NSFW channels
and nitro things
@brisk scroll I believe so
Figured it out
Hello,
when i have my bot running on multiple vps, how do i best send the servcount? can i send the shardid+servercount from each individual vps to discordbots.org, and it will be added up there? or do i have to take care of the "collection" myself, and then send the final values in once?
using the javascript library, does on('test') work as a callback for running a webhook test on the edit page?
.on('vote') will be emitted, yes
nice
one more thing, is it normal for the hostname to show as 0.0.0.0 when logged? I looked at the source and it seems hardcoded in but that seems like a strange choice
alright
it's weird that things still arent working but i guess i'll just keep trying
yeah no big deal, i appreciate the info youve given already
i sent a request to the URL through Postman and .on('vote') triggered, but when I do it through the Test button or get one of my friends to vote as a test, no response
is there any reason for that? are certain URLs not accepted?
What's this error I keep on getting?
Error: 504 Gateway Time-out
at IncomingMessage.res.on (/app/node_modules/dblapi.js/src/index.js:118:25)
at IncomingMessage.emit (events.js:203:15)
at IncomingMessage.EventEmitter.emit (domain.js:448:20)
at endReadableNT (_stream_readable.js:1145:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
wasnt there an event that was like
@commands.Cog.listener()
async def on_dbl_vote(self, data):
...
? cause it never seemed to get dispatched and now i cant even find it on the gh
what does the api do?
An API is an application programming interface, it allows parties to access some form of data, or post their own via HTTP/s (or internal) calls. It allows applications to communicate. Of course this is extremely basic but google does exist
someone has/can explain me how to use API for a discord bot
well most people use an api wrapper
the most popular are discord.js, discord.py, and JDA. But if you were talking about discordbots.org api, you can use dblapi.js, dblpy, there is multiple others too
I believe
If you want to make calls yourself, for whatever reason, consult the discord api docs or the dbl docs
https://discordapp.com/developers/docs/intro or if you meant discordbots.org: https://discordbots.org/api/docs#intro
I'm having some trouble getting the event that someone has voted for my bot
I'm using the python api wrapper and the event doesn't seem to be firing
Question
Do you have to be certified for your bot to have the cert icon in the widget?
Yes
Aight
So me no get lel
Also, in my "my bots" page, what's the N/A for?
That cert?
server count
Help me, speak spanish???
@tepid temple Hola, solo hable espanol en #memes-and-media, por favor, gracias!
how do i post my server count using js
self.discord.guilds.size
dbalpi.js automatically posts server count every 30 minutes if you provide your Client to it
I have mine update every 5 mins
@hearty dagger Make sure you have webhook_port that you specify in dblpy Client open and forwarded
@jaunty steppe Are you sure you are using the dblpy webhook system?
I don't quite follow. Do I need a webhook link or anything and do I need a specific port? The docs on dblpy aren't terribly informative on this.
@sullen nymph Sorry for tag but I'm still having a bit of trouble
https://github.com/DiscordBotList/DBL-Python-Library example in README shows webhook_port being used. You should use any port above 1024
A simple API wrapper for discordbots.org written in Python - DiscordBotList/DBL-Python-Library
http://yourpublicip:yourport/yourwebhookpath
gotcha
Can webhoobpath be anything? @sullen nymph
Sorry I'm not really one with webhooks and website stuff
Oof
Who can tell me how I do in discord.py that gives a role on support server to a voter and sende a message?
Use the on_dbl_vote event
Ok
im bad at wehooks lol and when ever i put a webhook it says "This webhook cannot send messages and only used for your bot"
ping me when respond xd
@frank laurel that's fine..
wdym. i mean the webhook would act like its invalid
My on_dbl_vote event still doesn't work
I opened a port and forwarded it to the correct device
So idk what to do now
Are you using webhook_port that dblpy provides
yes
Can the dbl API wrapper for js add error handling?
The backend errors are annoying in my logs and error tracking
^submit a pull request
Neither the actual vote event nor the test event is firing for me so I'm a bit lost. Maybe I'm just dumb, maybe it literally doesn't work
@hearty dagger did you make a webhook?
yes
Did you put the url into the edit page on dbl?
yup
Does your console log somethingg like "Webhook running at http://0.0.0.0:port/path"
did you save
And that 
@arctic arch I don't understand what you mean with catch, I mean it's not some promise rejection.
Do you mean listening on the error event like dblclient.on('error', ()=>null)?
read up on promises
I'm pretty sure I know how promises work.
But how am I supposed to catch errors from postStats running in an interval
Just gonna write my own request and do nothing with failing requests. 
dbl had 5 Errors in 6 Hours.
using .catch won't help me because it's literally the package running it in an interval, dunno how I should catch that.
@rugged sierra you can always edit the code yourself, it isnt very hard to get to
You are telling me to edit the files in node_modules?
@spiral steeple
Yes it is
That would make sense, but editing the files in node_modules
sounds very dumb
But I will just write the simple request myself
Easier thank forking it 
Okay I got it buddy
Just saying, if your backend regularly failes your wrapper at least should be able to handle it

I dont use dblapi.js so I wouldnt even know what it does with errors
Well obviously not handling it like you would with a failing backend, because I have it in my logs everyday.
Just trying to post stats, idc for server errors
Hey
How long does it take for a vote to update?
Few seconds max
Huh, cause with aiohttp it takes multiple minutes for it to update
async with aiohttp.ClientSession() as session:
async with session.get(f'https://discordbots.org/api/bots/606698583076372480/check?userId={ctx.author.id}', headers=headers) as result:
HasVoted = await result.json()
strange
And now my on_dbl_vote and on_dbl_test events aren't firing again
I'm so confused
Ima try using requests on this
@hearty dagger Yeah it is, but aiohttp does not work basically
If you have a non blocking other suggestion for me to fix this then tell me 😂
see if requests responds faster
Yeah
It shouldn't but who knows
lmao
My vote and test events were working perfectly yesterday
And now they have stopped working
And I don't know what changed
How strange
I don't mind that its blocking as long as it works, but i would rather use something non blocking
I may have to resort to hitting the api myself if I can't get these damn events to work again
@manic kayak dbl has a delay for updating votes using http GET
guy how to get dbl api ?
what lang
@worn quail Ohh, so what should i use instead?
@manic kayak a webhook
Wait so how should i go about hooking that up then
The issue is i am discord.py rewrite
Yea
dblapi.py exists, but I'm not a py dev so you'd have to get help from someone else or figure it out by yourself
Ah
If it's as easy as js, it's right in the docs
I actually dont know what it does, or if it makes a webhook for you
I havent looked at it, but tbh, it should, or I would guess it would
Ah
self.dblpy = dbl.Client(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)
Do i need to fill out any of this? @hearty dagger
Im using the webhook example from the github
you need your api token
if you want to get vote events you need the webhook stuff otherwise you don't
class DiscordBotsOrgAPI(commands.Cog):
"""Handles interactions with the discordbots.org API"""
def __init__(self, bot):
self.bot = bot
self.token = "Not Showing U"# set this to your DBL token
self.dblpy = dbl.Client(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)
@commands.Cog.listener()
async def on_dbl_vote(self, data):
logger.info('Received an upvote')
def setup(bot):
global logger
logger = logging.getLogger('bot')
bot.add_cog(DiscordBotsOrgAPI(bot))
So i basically just gotta put in this?
have you set up an open port through your firewall
then the vote listener is pointless
Going to move it to a Server in the next few days
That can be firewalled n stuff
That i run a server network on
it can't listen if you don't give it anything to listen to
Ok, welp then todays goal is for me to move this to my SoYouStart host
@hearty dagger Ok migrated the bot and voted, but it doesn't seem to be doing anything?
import dbl
import discord
from discord.ext import commands
import asyncio
import logging
class DiscordBotsOrgAPI(commands.Cog):
"""Handles interactions with the discordbots.org API"""
def __init__(self, bot):
self.bot = bot
self.token = "Not showing u" # set this to your DBL token
self.dblpy = dbl.Client(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)
@commands.Cog.listener()
async def on_dbl_vote(self, data):
print("Received an Upvote")
def setup(bot):
global logger
logger = logging.getLogger('bot')
bot.add_cog(DiscordBotsOrgAPI(bot))
I opened the port with ufw
ufw allow 5000
are you forwarding the port to the machine the bot is hosted on
And did you set up the webhook in your bot edit page
Wait i have to set up the webhook on the bot page?
Ohhhhh
@hearty dagger So how would i hook up the webhook to the bot then?
how to im get dbl api ?
im dont know what am wating for :l
@hearty dagger Ok found the docs on it, it says i have to put in a url that i want the info to be sent to? What url should i make it send it to
You make webhook
ideally a script on your server / website that handles the incoming data
How would i go on making a webhook then
Do you have a website?
Uh, i own a domain
Cool, so you can access that in your browser yes?
Its not for a website its for a server
So it would not be accessible from browser from my understanding
Okay you need to basically have a URL that DBL can post to, so you'd need that
Ok
So with my Domain what do i do with it
Do i just put the domain into the thing?
When you say domain, you mean a URL right, like example.org
Cool so you need to attach that to your server cos right now that isn't resolving
To my server that is hosting the bot?
Yeah, where is the server? Is it shared hosting or a R PI or something?
It is a SoYouStart host
Okay, so on that host, you have an account right, can you setup a website on that
Uh how would i set up a website?
Oh yeah btw
The domain is hooked to my host
Does that help
Holy crap SoYouStart is so expensive 😮
Its for gaming servers
Yeah I gathered lol, damn
Yea
Its fine
I host multiple server networks on it
And the bot now that i migrated it is running godly
Lol I bet
Anyways
So, how would i create a website
The Domain is Currently hooked up to my Host
Yeah so I have no idea what there web panel looks like
Well what would i need to do on it
I'm not too sure but basically you need to setup a basic apache web server
Wanna priv chat?
Yeah
You purchased a dedicated machine not web hosting.
3 hours later and we're nearly done lol

How would i prevent rate limiting when using the hasVoted method
read modlog
@grand bladewhen my bot sent link messages
And what shoulf i do to add my bot here again
Idk ask a mod
How would i prevent rate limiting when using the hasVoted method
By storing the last time you called the endpoint
I think libraries handle ratelimits
Not sure though. Check with the devs
I am rn
I'm talking about the dblapi
Lol
Wouldn't be here talking about a different api
I know
There are libraries for dbl api already, and I do believe they handle ratelimits
hello
Well @muted oar You don't prevent rate limiting, you just make sure the code doesn't hit it. There really isn't a way to prevent it besides making sure the code calls it at the right timews
times*
i mean doesn't JDA have a queue of some sort?
but JDA doesn't deal with DBL's api
This channel is only for discussion about our API, please move to #general or #memes-and-media @tawny dawn
oh sorry me
@near sparrow Wait I can't add a cooldown or something? Cause if multiple people use the command within the rate limit time it'd rate limit correct
Isn't the authorization password for webhooks that I set on the website the one I set in my bot at webhook_auth? I just set both to different values and used the test button, but the request still seems to go through. I feel like I'm missing something 
Did you save
well then something went wrong, because https://github.com/DiscordBotList/dblapi.js/blob/master/src/webhook.js#L59
An official module for interacting with the discordbots.org API - DiscordBotList/dblapi.js
take a look at the code yourself.
The python lib is working fine for me
Using the JavaScript DBL API, I can't get the vanity url at all, it just responds with undefined.
bot.vanity.length? bot.vanity : "Unavailable"
A lot of bots dont have a vanity url
https://discordbots.org/bot/memes is an example of a vanity url
Basically, it's not the discord bot id for the url, but an actual name
That's why there's a question mark on the object https://oliy.is-just-a.dev/j64htl_855.png
general practise in docs is if you see ? on a parameter it means optional
https://paste.nomsy.net/unayiqaval.rb
I don't understand what made it fail at fetching whatever it was trying to fetch
What is dblapi has voted time limit before it becomes a rate limiting problem
To whoever runs the docs, it might be worth adding somewhere that if the webhook URL has a port on it, like 0.0.0.0:5000, it won’t work
I was running into brick walls that I didn’t know existed until I pointed port 80 to port 5000
A preventable headache with a little note in the docs
@muted oar there is a global hard rate limit of 60 requests/minute
@timber orbit It logs in console where it's running tho for example htttp://0.0.0.0:6969/dblwebhook
It does, but when I tested requests it didn’t work until I pointed the port I was using, 5000, to 80
Despite working when I used software to post to it manually
It’s reserved for web traffic but I can point a port towards it
How are you hosting?
AWS
closed port perhaps?
What do you mean?
A closed port just blocks all incoming and outgoing traffic
well
But actually voting and the test button didn’t do a thing
yeah... it's from the same machine 
Either way, I dont have this issue so idk what happened with yours
Doesn’t make a whole lot of sense
You are gonna have your bot post it to DBL
hmm
Either by using .postStats or dblapi built in posting server count
Actually what Lang you using
discord.js
Okay ye
Docs @viral ledge
is dbl.hasVoted() is only for the past 24 hours only?
how can it detect for the past 12 hours?
unrelated to the api
@forest summit can't afaik, you will need to store the votes yourself
but you could fetch the last 1k votes
but kinda cancer
is it just me or why does my vote command say I voted even tho I dind't
how did you do yours
it checks if you voted and if true it gives you a value named gold and says thanks for voting
if false it says you dind't voted for the bot you can vote here link to page
what url did you get that from
get from what
Yes
but it does
what lang do you use?
when I do the vote command here
its normal
when I use it in other servers
It always says I voted

Ik
Might wanna ping tonkku about this
Im not gonna do it
Or kyoyou
im afraid I get a punish
seriously

eeeeee

no, i already did
J
I
ok
I need link for server
It's in #502193464054644737
Would it still be ok to use the old archived version of posting server count?
https://discordapp.com/channels/264445053596991498/312614469819826177/390605562771013632
oof
it's best to use the new api examples
I'm attempting to send webhook responses on every vote, however it won't seem to come through, the endpoint won't even get triggered...
app.post('/upvote/discordbots.org', function(req, res) {
if(req.headers.authorization !== config.credentials.discordBotsDotOrgAPIKEY) return
console.log(result.body)
});
This is the URL i'm sending it to
http://64.52.85.218:3001/upvote/discordbots.org
Please ping me when you respond
@restive otter
- is the port blocked by a firewall?
- dbl doesnt send the token as auth, so your code will always return
|| use semicolons
||
No and I've tried a different auth value
@rugged sierra
I do use semi colons, but i'm testing first
but currently you are comparing it to the api token, which is wrong
That's already been changed

lemme try a different port
still nothing
Anyone else able to help please?
Scroll up to see the issue
On the webhook part of the page, you specific your own, custom, key
don't use your api key
Where i can get webhookAuth password?
How do i make it show how many servers my bot is in on the website?
Check out the documentation https://discordbots.org/api/docs
How can I get extend/get more votes using .getVotes()
Or is there another way to get the bot vote count
hello .... I'm looking for some tournament bot
Just have a small question regarding the Java api:
DiscordBotListAPI api = new DiscordBotListAPI.Builder()
.token("token")
.botId("botId")
.build();
token is the api key while botId is the token from Discord to start the bot?
token - your DBL token
ID - your bot's ID
Ah, id in the web link?
Should be
Is there a way to check how much time does it need to pass for someone to vote again with the api?
can't manage to find if it exists
The time is 12h so when they vote make a cool down for that user of 12h
I'd need to add a webhook for that I guess
I mean create a webhook on the bot, intercept the event, store it and etc. etc.
I thought about that but I wanted to see if the api does have that
is there a way to send the bot's onoine status pr dpes it have to be in this server
^using the python library btw
has to be in this server
Do you guys have integration with botblock.org
^
To update the server count on multiple bot listing
Dbl doesnt endorse other bot lists, so why, from a business perspective, would they ever support that
^^
bot block isn't a bot list?
BotBlock doesn't work with dbl anyway
what's the point of botblock
Over complicate everything and collect data
I would trust it more if it was an npm module that made HTTP requests directly to the bot lists that it posts to, but botblock makes us send our data to its own server, so
oh so when i post server count it goes to botblock then goes to the bot list?
That's not what we're talking about
Is there a way to automaticly reward people for voting for our BOT ?
Yes
Check if they voted and if so give them the reward
I can't make it auto?
There’s an event iirc for checking when votes happen
That would require a webhook
I put the following code in the main-class, but the serversize is still on N/A - could someone help me?
DiscordBotListAPI api = new DiscordBotListAPI.Builder()
.token("TOKEN")
.botId("USERID")
.build();
int serverCount = jda.getGuilds().size();
api.setStats(serverCount);
Oh I got the wrong token.
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!`);
const voteembed = new Discord.RichEmbed()
//Random Stuff
client.channels.get(``).send(voteembed);
});
Is this how to post upvotes to a channel in your server?
Look at the dblpy docs
#312614469819826177, outdated, bad, but it works.
const dbl = new DBL('My token that I found at DBL.org in API', client);
dbl.on('vote', vote => {
let embed = new Discord.RichEmbed()
.setTitle(emoji ("609307502093533214") + ' Récompenses de vote')
.setColor("PURPLE")
.setDescription(emoji ("609307501833486336") + `Le joueur** ${vote.user} **a voté pour Gato et gagne ainsi **1500` + emoji("609307501594411048") + "**")
.setColor("PURPLE")
client.channels.get("611122034474483715").send(embed)
});```
When I voted, no embed were sent, the channel ID is right, what did I make wrong please ?
doesn't this have to be with webhook ?
Discord is not set as a variable
that's what i think is causing the problem, since you said no embed was sent
B r u h, he doesnt even have a webhook
well the fact that he doesn't even have a webhook is not the only problem
still could be a possibility
What does that have to do with Dbl api @supple flicker
He's just showing us his client mods
Lol

That belongs in offtopic though right
Honestly though I can see how that can be useful but also annoying @spiral steeple
It was a joke. Just pointing it out.
question, what is stopping me from doing postStats(999999999), just curious
Your bot being removed
Nothing, but if they notice (very likely) your bot will be removed
And with marco's stats website, it will be detected really quickly
@teal lava we monitor what stats people post, so dont try and fool the system 
not going to
but I see that the DBL constructor requires a "client" object, why not pull the guild size from there instead of lettings people enter whatever they want?
Is retry-after the time in minutes?
@hoary timber retry-after is usually in seconds
But not sure how dbl handles it
which is why I ask
@restive otter https://discord.gg/ESkzfwf
@hoary timber seconds








