#topgg-api
1 messages · Page 115 of 1
public class Webhook {
public static void main(String[] args) throws Exception {
HttpServer server = HttpServer.create(new InetSocketAddress(8000), 0); // create a Httpserver listening on port 8000
server.createContext("/dblwebhook", new MyHandler()); // creates a handler for when a requests comes into https://yourserverip.com/dblwebhook
server.setExecutor(null); // creates a default executor
server.start(); // Starts your httpserver
}
static class MyHandler implements HttpHandler {
@Override
public void handle(HttpExchange t) throws IOException {
String response = "This is the response";
t.sendResponseHeaders(200, response.length());
OutputStream os = t.getResponseBody();
os.write(response.getBytes());
os.close();
}
}
}
public class Reciever implements HttpHandler {
@Override
public void handle(HttpExchange t) throws IOException {
String response = "Hello World"; // the response
t.sendResponseHeaders(200, response.length()); // response.length being the length of response, needed in the header
OutputStream os = t.getResponseBody(); // get the response outputstream
os.write(response.getBytes()); // write and
os.close(); // close
}
}
These are both classes.
you don't need the static class myHandler in your Webhook class
ah im dumb yeah
replace new MyHandler() in your Webhook class to new Receiver()
so that the requests get handled by your Receiver class
If I do that it wants me to implement its methodes.
gives me a bunch of errors
public class Webhook {
public static void main(String[] args) throws Exception {
HttpServer server = HttpServer.create(new InetSocketAddress(8000), 0); // create a Httpserver listening on port 8000
server.createContext("/dblwebhook", new Receiver() {
@Override
public void send(MidiMessage message, long timeStamp) {
}
@Override
public void close() {
}
}); // creates a handler for when a requests comes into https://yourserverip.com/dblwebhook
server.setExecutor(null); // creates a default executor
server.start(); // Starts your httpserver
}
}
both those overrides methodes.
you're missing a ) afterwards
server.createContext("/dblwebhook", new Receiver());
or you accidentally imported the wrong class
make sure it's your class
what's the error?
add a debug line
I did and it's not printing anything.
are you running the correct class? remember that you have to start your webhook class
also, if you're running it on your local pc, you can also use localhost
It's running on a server
so accessing the webserver through your browser under localhost:8000 should now say the following: https://cdn.hopefuls.de/B3rD
Oh then instead of localhost, your server ip
The other parts should be done by you though: the dbl webhooks have the following format https://cdn.hopefuls.de/5nUy
now you should just be able to get the inputStream from the httpexchange through t.getRequestBody
then parse the request json from that RequestBody and boom you got the webhook
waitwaitwait
so
to get the query
I need to change the server.createContext("/dblwebhook", new Reciever()); to
server.createContext("/bot/:ID/vote", new Reciever());
nope, you should be able to use https://yourserverip.com/dblwebhook inside the webhook url of your bot page
ohh
so I insert that there aha
then everytime someone votes, it's sending data to that url
yeah, you will have to parse that data in order to get all the things in the screenshot above
i suggest using org.json because that one is the easiest
Can I first check if its sending data to that url?
yeah ofc, print the data you're getting by using
StringWriter writer = new StringWriter();
IOUtils.copy(inputStream, writer, encoding);
String theString = writer.toString();
can be wrong though, lemme look for something better
in my public void handle ? right
yeah
before your os.close that is
you should be able to get the inputStream by using t.getRequestBody
IOUtils.copy(inputStream, writer, encoding);it's not finding the copy , inputStream and encoding syntax
no libaries for that
I am using java 8
oh give me a second then
StringBuilder responseStrBuilder = new StringBuilder();
while((line = bR.readLine()) != null){
responseStrBuilder.append(line);
}
inputStream.close();
``` should be able to parse your inputStream to StringBuilder, which you should be able to get with ``responseStrBuilder.toString()``
but parsing the json data has to be done by you alone
😄 it's not finding line , bR and inputstream
inputStream is t.getRequestBody, you'll have to define it yourself
There's a bunch of tutorials on how to parse the inputStream to an actual String
alright I'll have a look
Quick question, would I have to replace yourDBLTokenHere with my DBL token in ''?
yes
Ah okay, thanks.
ah
Alright yeah
It's recieving the webhook
just need to read from it
Thanks man you helped me so much! 🙂
glad i could help
Ahh I am so happy ❤️
Wait, so if I get more then a thousand votes per month, I can't use the API and have to use webhooks?
Is it a hard limit? Like what'll happen if I go over?
Well you won't be able to use the getvotes endpoint
Thanks!
You won't get over it. It will just not return any other votes that come in past the 1000 limit
Awesome, thanks!
Hi
#general for chatting.
I am here for api discussing buddy
Don’t just say “hi” and wait almost a hour then.
It was out of politeness lol
anyone knows an api that gives random animals
@restive otter https://github.com/treboryx/animalsAPI
this lib combines bunch of apis
hasn't been updated tho
This channel is for the top.gg api only
Move to #development for anything not related to that
-api
TOP.GG API ONLY!!!
ANY OFF-TOPIC CONVERSATION WILL BE DELETED AND MUTED
This channel is only for SUGGESTIONS/HELP/BUGS to do with OFFICIAL API LIBRARIES and API DOCS found at: https://top.gg/api/docs
just send a request to the dbl api to check if a user has voted
@restive otter Is it in the link above?
You can also make the HTTP request yourself it aint that hard
Generally speaking, if I have a lots of commands that require voting, would DB be a better method?
I don't think you need a db only for storing votes, because they reset every 12 hours
You can have an in-memory cache of people who have voted. When someone wants to run a command that requires voting, you first check if the user is in the cache, if they aren't, make an HTTP request to check if they have voted, if they have, you give them access and update the cache, if not, deny access. Reset the cache every 12 hours
If the command can be used only once per vote, then an in-memory cache isn't needed
Hello
I'm alive!!!
Does the poststats api part need to be in a ```js
client.on("ready", () => {
})
Function
Presumably yes
How can I do this when a people vote then send it to a channel
:ping
uhm
i need help
so im trying to add a role for when someone upvotes my server
and im not sure how
when they upvote your server?
alright
and then they have to upvote again
can i invite you to my server, give you admin and u do it?
so basically
when the api returns a packet with "this user voted"
u give that user the role
???
and then set a timeout to remove it again
i have no idea what ur talking about lol
You're gonna have to make a bot to do it
coding yes
oof
uhm ur a bot developer right 
yes
good to know 
@commands.Cog.listener()
async def on_dbl_vote(self, data):
id = int(data["user"])
member = self.bot.fetch_user(id)
result = self.config.find_one({"id": id})
print(id)
print(data)
print(data['user'])
if result is not None:
try:
print('A')
await member.send(f"Thank you for voting for the bot you have recieved {self.coin}1500.")
except:
print('B')
pass
print('C')
self.config.update_one({"id": id}, {
"$inc": {"bank": 1500}})``` isnt printing anything on vote
@wintry sequoia Try to use on_dbl_test and press Test in the webhooks section on the website
Seems someone's firewall is blocking requests
I'd assume so
Well, your VPS' firewall :p
@restive lintel
Hm?
look at what they said
btw bigpuppys the other bot dev
and vps owner
but it also doesnt run on my pc
Uhhh
big do you know anything about this
So- I get whats happening
I don't know how to fix it
How would I get all the votes, and the users who voted for a bot through the API?
DMs
how do we setup a webhook
Using dblpy, you simply set webhook_port to a port (number) to run the webhook on. The rest (auth and path) has default values
@restive lintel
Thanks!
So how do I make a command so when I vote for the bot it sends a message?
In discord.js
what is a top.gg token?
or dbltoken?
oh wait nvm
@restive otter https://top.gg/api/docs?#jslib
thats the js page
that long thing is cloduflare thing
Thx
on_dbl_test is not working, we've set the webhook auth and port, along with path.
We changed the details on the webhook page also.
Could be something wrong with my pterodactyl panel, but I setup the allocations.
self.dblpy = dbl.DBLClient(
self.bot, self.token, autopost=True, webhook_auth="authcode", webhook_port=9677, webhook_path='/dblwebhook')```
@commands.Cog.listener()
async def on_dbl_test(self, data):
print('event')``` and its not printing "event"
(That is my pterodactyl panel, pretty much I setup an open port for the bot)
@restive lintel @wintry sequoia whoever can, please send me the exact webhook URL you are entering on the website
DMs strongly advised
what is the code for webhooks?
hi guys
i just wanted to say that it would be cool to include the time at which a user voted for a bot when checking votes
Create a webserver and listen for POST requests
@amber yacht you can suggest this on github
https://github.com/top-gg/issues/issues
oh
your bot's page?
Ye
you can use html/css on long description
just use markdown :p

Hi
My webhook comes up as https://undefined:8090/dblwebhook
Oh how do you do that?
@willow spindle zlr
What
How would i go about doing that
Kk ill check it out
Yes, all the way at the bottom it does
Yh i see thxs
help idk how
@unreal loom top.gg/api/docs
At the bottom
Of ur library choice
im on pthon
i dont understand
What's your goal though @unreal loom
to get the server count and discord.py thing on it lo
then read the part with servercount https://top.gg/api/docs#pylib
but you wont be able to set your servercount yet while your bot is not approved
I setup a webserver and it still comes up as undefined @wary ember
Help me on webhooks.
dbl.webhook.on('ready', hook => {
Cannot read the property 'on'
make sure to add port and auth on your dbl constructor.
Ya I added
can i see where you did that? hide your token please.
its ('token', options, client)
Nvm I didn't paste my dbl toke. Oof
Oh
How to get the dbl token ?
I have top.gg token
docs havent been updated in awhile, will be soon
you get a token once you have an approved bot @restive otter
Can I know how to votelock a command.. I'm asking this from a week
i know but my bot require it for some commands
if that commands will not work it will not be approved
youd want to keep that info in a database, then check the database if the user has voted @crude elm
Change the things temperory
Oh no.. my pc is dumb right now.. I can't install quick.db
Or some database module
Oof
quick.db has some prerequisites.
Oh
download git
I need python for it and my pc is bad right now

x32 ??
depend on your pc
I have 32
i have 64 bit
so download 32 bit
K
hey, what do you need?
the docs cover how to make a webhook.
https://top.gg/api/docs#webhooks
^ note there are some minor differences for servers which are covered at this link v
https://discordapp.com/channels/264445053596991498/412006692125933568/754260741107744839
can a top.gg widget be put as an image in a discord embed? it's not showing up when i try it
theres a trick you have to do iirc. lemme try and find it.
How do i make a dbl webhook, I don't get the docs
you make an http server that receives post requests @sharp hollow
or use one of the provided libs
how can i make one, im not really faimilar
depends, what programming language are you using?
discord.js, NodeJS
I would use the js lib https://top.gg/api/docs#jslib
Yeah I know but I am confusing in making a server
the js lib does that for you in this case.
@mellow plank what language are you using?
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!`);
});
I have my port as 5000
discord.js lib
Doesn't log anything when i restart my project
i've tried with .png as well, no luck
#commands message
try something like this.
not evaling, just was him showing an example
you have the dbl constructor correct? can you show me, with the token and auth hidden please.
Ok
const dbl = new DBL('', { webhookPort: 5000, webhookAuth: 'my auth i saved on my bots webhook page' }, client);
@jaunty plank
hmm. weird.
Yeah
perfect @jaunty plank thanks!
so I didn't create any other server just installed that and yeah, some people say to use like express
express isnt mandatory, the library is mostly indepentant, other than discord.js or eris 🤔
your not getting any errors correct?
Nope
http://publicip:5000/dblwebhook
Oh ok
publicip = the public ip of the server
If this is hosted on a home network youll need to port forward.
I tried sending it
it should be logging the Webhook running at ... stuff on startup.
make sure to save the file if you didnt, happens too much.
ay
just a heads up, 0.0.0.0 isnt the proper ip its just a placeholder.
if you mean in the console log, yeah. it always will log 0.0.0.0
0.0.0.0 means "you can connect to it from anywhere: doesn't matter if localhost, internal or external"
So @jaunty plank I voted, didn't log
some things to check
if on a home network, youll need to port forward.
If you have a firewall, youll need to allow past the firewall.
Check your url fits this http://ip:port/path
If not using https, use http. if you are unsure, use http.
port will be 5000 in my case, what about the path?
path by default is dblwebhook
just curious, wheres this hosted.
well, its kindof annoying danbots docs are down
oh
does danbot provide you with a public ip and a port?
yeah, and I am unsure how danbot hosting works, they may restrict what port you can use.
saddly with the docs down its impossible to find out.
So do i change the port to what they have?
if they restrict it, yes.
Ok
for now, make sure the ip is theirs. if they give you a port, try changing to it.
might just have to wait for their docs to be up then.
@jaunty plank Do i need to specify the webhook path in the options
the default one is fine.
i specified it as /dblwebhook
try manually making a request to it, through a request maker for example
@jaunty plank hey, i got the request! It says User ID with myid just voted!
oh, good!
@jaunty plank thank you so much for helping me 
no problem 🙂
``cool`
Hey, can i put a
const user = client.users.fetch(...)
user.send(...)
in the dbl.webhook.on function because im getting the bot to send messages when someone votes.
where i can get a soundcloud api
pls ping me when u answer me
@restive otter see channel topic
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
try {
const guy = client.users.fetch("742972160158728283")
guy.send("hello")
} catch {
console.log("An error!")
}
});
I've got this but it seems to encounter an error when sending the message to me
const guy = client.users.fetch("742972160158728283")
shouldn't this be :
const guy = client.users.fetch(vote.user)
``` instead ?
I'm having an error for
client.shard.Id and client.shard.total
I'm just tryna post stats for my bot aka also dogos bot minercord
Also is it possible to use this api using dbd.js
show error
I have the same question
http://ip:port/YOUR_WEBHOOK_PATH_HERE
There's no default that dblpy uses. You're pretty much forced to set your own port
and if I'm using a root server?
I use port 80 only for my production stuff and 5000 for anything related to top.gg stuff ¯_(ツ)_/¯
(Unless I cram both into one webserver and let chaos begin)
Yeah, that's a port that dblpy will attempt to use (if it's not already in use by some other process)
The URL, yeah
and auth?
It's essentially a password you come up with yourself to confirm that top.gg is, indeed, sending requests
both
So is there any reason at all that Python could not find dblpy
The Authorization field
Wrong interpreter ¯_(ツ)_/¯
Nope... I just acceditly did dbl.
Eh well
Like how to use the data that i get from dbl.on_bot_vote in python?
Do i need webhooks to do it?
Note to self: write guide how to host webhooks with dblpy in next update
Lol
What to do?
I was just approved
Idk anything
What am i doing with my life lol🤣
Shivako do i need webhook url?
yes
How can I get the bot to send notifications when someone votes for the bot?
i'm new
djs
Check pins
Can i user my Ipv4 for the webhook url?
can i use no-ip url [since im port forwarding] for the webhook?
the format will be something like http://ipv4:port/path
filling in ip port and path.
yes, you should be able to
is the path required doe?
path is determined by the http server(or library)
I dont see why noip would affect that.
does anyone know, how I can add a CSS file to my detailed descption?
I use a html Code, and want to make a CSS files, but I don't know how
<style> tag
actually ill find out my self
wut
server Count is wrong

you have to make a post request to https://discord.bots.gg/api/v1/bots/botid/stats
that contains guilds count, shards. shard id
how would i post the shard amount? i have this
@tasks.loop(minutes=30)
async def update_stats(self, ctx):
"""This function runs every 30 minutes to automatically update your server count."""
await self.bot.wait_until_ready()
try:
server_count = len(self.bot.guilds)
await self.dblpy.post_guild_count(server_count)
print('Posted server count ({})'.format(server_count))
except Exception as e:
print('Failed to post server count\n{}: {}'.format(type(e).__name__, e))
I dont know what to add 
you can just post the right guilds count...
Yea but I've been posting the guild count automatically via the on_guild_join event, but it seems to have stopped for some reason, and I haven't changed anything
probably not the problem but idk
make sure you're inserting the right number
try to insert it manually to make sure if it was your problem
class votes(commands.Cog):
def init(self, bot):
self.bot = bot
self.token = "I put my dbl token here"
self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True, webhook_path='http://myserverIP/test', webhook_auth='1234', webhook_port=22)
But it doesn't work
My friend
I'm sorry
class votes(commands.Cog):
def init(self, bot):
self.bot = bot
self.token = "I put my dbl token here"
self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True, webhook_path='/test', webhook_auth='1234', webhook_port=22)```
Now?
Yeah, looks good
Nope, nothing
Did you specify it in the URL
22 is SSH, top.gg is doing HTTP requests
So it's not 22 but 80 for HTTP and 443 for HTTPS
for the webhook, can i just use a discord channel or do i need a website? I just want to log when someone votes
You need a webserver
Oh, i did 20 in the url
Na-ah. Could use a few bots that do that but /shrug
Sesrch DBL Vote on top.gg
Well fuck
hmm
How to use api
thanks
hey, i'm pretty new to the api and need a bit of help.
I'm trying to use the on_dbl_vote listener but whenever someone votes I'm not receiving anything, I'm using the example in the docs just to make sure I'm doing everything correctly.
I'm using the python library.
so i got an application that forwards things from a url to a localhost but nothing happens when i test vote
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(config.top_ggToken, { webhookAuth: 'password', webhookServer: server, webhookPath: 'localhost:5055' }, client);
dbl.webhook.on('ready', hook => {
console.log(`Webhook running with path http://${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
app.get('/', (req, res) => {
console.log("gotit");
console.log(res.user);
console.log(req.user);
});
app.post('/', (req, res) => {
console.log("gotem");
console.log(res.user);
console.log(req.user);
});
server.listen(5055, () => {
console.log('Listening');
});```
and on top.gg i have the url set and when i test vote, the console.log is working but user is undefined. Am i missing something?
Your webhook path is set to localhost, that's the issue
Top.gg cannot send webhooks to your localhost
i dont have it set to localhost on the website tho i have something forwarding everything to localhost
does the url on the website and there have to match?
I'd just say test it with a request client, like Postman
im getting all of these requests tho
like when i test the webhook, i do in fact get stuff
Then you're most likely parsing the user wrong, let it print out the whole request data in your console.log
i dont see why dbl.webhook isnt working tho
and the api docs are incomplete on if i need to pipe the request or anything
ima give up on it because i wont go through the troubles of getting my own server when im 90% sure that exposing localhost to the internet should be a valid substitute
im super duper angry
heres the fix:
app.use(express.urlencoded());
app.use(express.json());```
@willow sphinx is the npm package for dblapi.js still like updated?
cuz i see the github is updated but the package is deprecated
I haven't had time to push updates to it lately but the npm deprecation is just tonkku being a cunt
since it's still under his name
would've probably disappeared if it wasn't for npm protecting packages
right, are there any plans to like move the package name or somethin idk
can u transfer npm packages?
not sure, I'd like to migrate the package to typescript and give it a new name but I really don't have time to maintain open source stuff while doing all this other stuff
berry for lib dev when 😔🖐️
would it be a good idea to put "use the github version" on the docs or something?
no, it's fine the way it is for now
I'd like to talk to veld to appoint someone who has time to maintain topgg open source, maybe one of the mods if possible
ik i joke about it but if you are interested i do know the ins of the package and typescript so if you can't find someone else i'm here
will keep in mind

im a simp for open source it's just that all the other stuff take up so much time
I have another package I'm working on that I'd like to open source but ya know
right i feel you
Um
I still didnt get help with my error
I'm having an error for
client.shard.Id and client.shard.total
I'm just tryna post stats for my bot aka also dogos bot minercord
Also is it possible to use this api using dbd.js
Keep in mind posting the shards is optional not required. Posting the guild size is almost enough if you don’t use sharding anyways.
It wouldn't let me not use it without shards
Crap forgot to turn ping off
if your bot is small or you dont know what sharding is, then just omit them
google api pls!
webhooks
With which Bot
im getting upset over this api system because the built in stuff isnt doing the trick and something with js and vsc means I cant just ctrl click and see what is going on because of some stupid typescript. My issue is that I create a local host knowing full well that this isnt on the internet. So, I got this handy dandy tool that forwards all traffic from a website to my localhost so that i dont need to do anything with getting my own website. However, when I follow the api examples, the built in dbl.webhook.on("ready") gives an empty webhook (hook.hostname is always 0.0.0.0) no matter how much i specify. So my question is why is my manual vote listener better than the one with a library? I would like to use the library one so that it is cleaner but frankly its so much pain for zero gain, but that leaves me confused as to why it just isnt removed or is what im doing just not supported?
@lyric bay the hook.hostname will always be 0.0.0.0 in the console
why is that?
I don't know but it's always that, but the ip will be the same just that in the console.
okay so how do i set the ip?
What is your host?
localhost
I mean the bot host
Ok you have to read their docs or smn to get the server ip
Ok
so go onto your bot's top.gg page and go to the webhook part
You'll have to set an auth and the URL to http://127.0.0.1:4040/dblwebhook
wait no i has a link and its set but i didnt bother to do the /dblwebhook
the ip is where i can look at the stats in the web interface
alr back to testing ig
ok
😑 ofc it works
It does?
mhm
Ok then
either way it was fun learning about the internet
Ok, glad to help.
tysm
No problem.
should i put it in code or in dbl website?
Read the documentation please
wheres the example?
checked but idk what im doing with wehooks
please help
whats authorization.... ....
for the webhook or the authorization header you're talking about?
yeah
http://web_server_ip:port/dblwebhook
Password can be anything but should be the same you put in the script. That's it.
Oh ok thank you!
That means i need to add that bot in code and dbl website yeah?
You only need to put the port in the code and password, rest of it goes in the website.
Ohk
NASA's API is really helpful is anyone wanna use. Wondered that I should share it.
https://api.nasa.gov
out of topic sir
@restive otter so i need to add only ip:port in website and code?
And in authorization, add a password?
@winged widget
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)
As an example, This API code of Top GG does only takes the PORT and the authorization.
Whereas, In the website settings:
You fill this up followed by the things mentioned in it. http://web_server_ip/:port/dblwebhook
The port should be same as you filled in the Code.
The password (authorisation) should be same you filled in the Code.
Make sure the Port you select is open in the webserver, More of it can be searched in the settings of your VPS.
yes
yes
When i do like, add on_dbl_test...
And use test in website? Shouldnt it run the function?
Correct
Yes
Somewhere that's not here
i dm you
pretty much, yeah
you will have to setup a server to receive their post requests if you're using a home network you will have to port forward noip can help you
after doing all of that you will have to put this in the webhook url thing
http://serverip:port/path
(you will receive if it if you used an on connection function or something like that)
then parse the body and you'll get these
user:Id
query:
bot:
etc
(you will receive them as json)
you might want to add a key too
if you're using a vps you can skip the port forwarding part and create a server and it should work
you can create a server depending on the library you use (they're different ofc)
yw
Hi
make sure to have an Authorization header in your request or it will give you (forbidden)
Why does this not work? https://thadkkr.is-inside.me/lCJ7gOkx.png (also tag me if you know thx:) )
const dbl = new DBL([.env - redacted], client, { webhookPort: 5000, webhookAuth: '[redacted]' })
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
it is new DBL(token, options, client)
there must be a issue with the API as i check my total votes for this month in the analytics page and it is going down, and i have no clue what is going on. any staff able to look into this happy to show photos if pinged or privately messaged
like it looks like my bots data has been lost as also the invites and views have also gone down completely
TE buzi
@restive otter if xet hasn't gotten back with you on that one, submitting a github issue is the best way to submit an issue.
👍
heyy guys does someone knows how to make a webhook service server myself?
like not buy one somewhere
pls ping me if someone has an answer thx <3
well I need it for the top.gg webhook thingy that's why I ask here...
@pine heart server votes?
yeah
You want them to post to a Discord channel webhook?
nah
"Instead of requesting our API to see the users who have voted for your bot, we now have webhooks! Webhooks will send a post request to a URL of your choice when your bot has been voted for."
this
Are review webhooks possible?
what do you mean?
like can I get a webhook sent on review

hellu
@pine heart what library are you using
I think...
http://ip:port/path
yeah but how to get that
I read that like 100 times I'm feeling so stupid honestly
port and path will be defined in your code
oh so I have to set up a server right?
yeah
the easiest way is the js lib
Nope. But that would be a great feature. You can suggest it on GitHub or upvote it if it's already there.
that's what I wanted to know
the webhooks are not available until you have an approved bot anyway, so a webhook on review would be hard for devs to implement.

I've already installed the js lib and did this, but the url of the webhook is that with the many 0. So I still have to get an url somehow right? I guess I can do so by renting a server somewhere...?
like I did everything that is written here: https://top.gg/api/docs#jslib
@jaunty plank apologizes for ping <3
its fine its logging it(it always will)
but in your url on the webhook section you need to put the real public ip.
where are you hosting?
at his home
youll have to use his public home ip
uhhhh
youll also have to ask him to port forward.
again, he will have to port forward and open the port through any firewalls.
npnp 

☭
şu anki tahmini kuyruk süresi 1+ haftadır
Onaylansinda yeter@jaunty plank
sa
As hg
as
yep
You have to send the data to the API yourself, its not automatic.
they are sending it
Yea thats what I was trying to get lol
can I see the new DBL constructor
const Discord = require("discord.js");
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL('Your top.gg token', client);
// Optional events
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})```
^ From the docs directly.
new DBL(token, [options], [client])```
.postStats(serverCount, [shardId], [shardCount])```
Do you have that in your event?
no it does it automatically every 30 mins
look let me get logs
@rapid kettle how do i use SetTimeout to rn it every 30 mins, not just once
setTimeout(func, [time in ms])
that will run indefently
yes
@hot apex
allegro this is polish website
very popular for shopping
and 100% safe because it has a customer protection system
haha
ayo...
is it possible for a server
ayo...
it is also a music reference
hence the music bot
a y o . . .
Ok, thx

Like can i edit my bot description in top.gg every 12 hrs or upto rate limit if there is any?
You can’t do that in code
how to add url in webhook and what type is it
you might want to use this endpoint
https://top.gg/api/bots/botid/check?userId=userid
you'll have to use GET request that contains an Authorization header [check your top.gg bot token] or you'll want to make a webhook (better option depends on what you're doing)
using a webhook you'll instantly know when someone votes for your bot which is op(better in most cases)
https://top.gg/api/docs#mybots
you'll find your bot token there
if a user was voted it the json object will be {voted: 1}
you're using a home internet to host your bot?
^
because if so you'd have to portforward to make a webhook
you'd still have to create a server btw
did you read what the message link lead to though? 
using the python api I can easily fake the number of servers. 
ofc you can
all you have to do is sending a post request to their endpoint that contains a servers count number body what did you expect
even if it wasn't possible to do with the api you could just make your own post request which is easy
hello my bot seems ofline on the site but in reality its online how can i fix this
#support
also try to edit anything in your bot's topgg page
oh yeah is there a mutual server between your bot and dbl bot?
try to put both of them in a single server and then edit anything in your bot's page if it didnt work then you'll have to check #support
Hello,
Even if they voted for my bot, true value does not appear on the API. Some users have this problem.
afaik it takes 1-2 mins to confirm. You can setup the vote webhooks and store vote data in your db
15 minutes have passed
yeah best is to just track the votes with a webhook yourself
instead of relying on the api
you need an authorization headers
or it will give you something like this
{"error":"Forbidden"}
sometimes it can take time for the api to check if that person has voted for the bot [probably fixed]
I'm using Pipedream
as soon as the person votes I receive the POST in .json format
like 2-3 sec. at max.
if you're running multiple instances of the bot, do you use the dbl webhook for each instance to get the correct server total count? I'm not good with webhooks at all, was just wondering if you could have multiple as they would all be connecting to the same port
how ?
I told you
@glossy mantle create an account in pipedream > create a source > use the endpoint link > create an event listener in your code > voi là
I looked that up in the internet but couldn't find anything useful at all sorry :(
All good! Ty for letting me know, if you or anyone else knows the answer to my problem just ping me
hello how can i request a server counter for my bot on top.gg as this image said
please ping me with answer
It does. UDP isn't used with top.gg
ah
Why are you running multiple instances of your bot? And specifically, are you running multiple bots on the same bot account?
Yeah w sharding as I need more than 1 process
Oh bismillah, sharding
@craggy anchor https://stackoverflow.com/questions/11129212/tcp-can-two-different-sockets-share-a-port
then this shivaco says it's kinda the same
Hi
You can try to receive guild counts from multipme shards in your main shard (shard 0) and post array of guild counts there
I'm not exactly sure if posting to a specific shard ID works nowadays
shivaco maybe this is a dumb question and it's obvious to everyone else but what library are you a dev of?
dblpy
And eh, it's only obvious if you're actually familiar with development of dblpy and have seen the GitHub commits
which I haven't
which is understandable

how do I get my bot ID for the ```html
<dbl-stat bot-id="bot-dank-memer" stat="upvotes">Loading...</dbl-stat>
The bots user id doesnt work
Where can I find the docs for DSL webhook for server votes? I can only find for bot vote's webhook one in top.gg/api/docs
they're on the same page
I only find webhook for bot vote on https://top.gg/api/docs#webhooks unless I'm blind and didn't see where webhook for server vote docs located
It's for bot votes not server votes
whats bismillah
@tired moat the docs don't explain those yet, refer to pins in this channel instead
@sullen nymph sorry do you mind clarifying? Right now I just have 1 instance of the bot connecting to top.gg webhook, where exactly does the webhook read off the bot how many guilds its in
A
U
Ok
I'm not experienced with sharding so yee haw
The way I'd go about it is have some process/shard collect the guild counts of all shards and post them as an array
How can I get my bot page to show how many shards?
hello, this person has that many votes in total. how can I do it?
sample: ${total.vote.user}
??
i can't, i don't know
how do i make a api
#development , this is for using the top.gg api, not making your own.
Check the channel description
Can someone help me with getting data from DSL? So I got a simple webhook server but I’m confused how exactly I need to go about getting this to work. I’m using Python by the way
so apparently ISelfBot isnt found, is that something i change to my own value or is that supposed to be in the package, d.net btw
Anyone?
Guys, Everything is setup correct but unfortunately, The webhooks are not working. I am using AWS hosting and already port forwarded the PORT.
Upon clicking on the LINK: http://#####:5000/dblwebhook , 405: Method Not Allowed Which states, It's going fine. However, On testing the webhook or voting manually, Nothing is happening.
any idea?
def __init__(self, bot):
self.bot = bot
self.token = 'HIDDEN' # set this to your DBL token
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='##', webhook_port=5000)
@commands.Cog.listener()
async def on_dbl_vote(self, data):
print(data)
@commands.Cog.listener()
async def on_dbl_test(self, data):
print(data)
Also, The server count is not working.
@restive otter is Authorization field the same as webhook_auth
Yes bro
DBLWEBHOOKŞIFRE nasıl alıcam
raise client_error(req.connection_key, exc) from exc aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host top.gg:443 ssl:default [Network is unreachable] sience yesterday
Hi i need help with the voting system
Hey how's it going?
It makes sense that my bot got a V but it couldn't get into more than 100 guilds?
at https://top.gg/api/docs when your bot gets approved
If you want to post server count check https://top.gg/api/docs
ook
Does anyone know how to get webhook url from pythonanywhere?
if you need the python code snipsl on your bot file, i can send your mine.,
How do u make the server count appear?
which port should i use?
const webhook = new DBL(process.env.DBL, { webhookPort: 5000, webhookAuth: 'xxxx' });
I got this error:
Error: listen EADDRINUSE: address already in use :::5000
ok
Please test this bot
@left egret
-b @robust storm
Banned THEFIGHTER999#6901 (@robust storm)
oh their bot was added in queue...
That's just my quick reaction when someone posts their bot link, sorry 
🤭
Done bro, This is the response.
Status: 405 (Method Not Allowed) Time: 35 ms Size: 0.02
HTTP/1.1 405 Method Not Allowed
Content-Type: text/plain; charset=utf-8
Allow: POST
Content-Length: 23
Date: Fri, 27 Nov 2020 12:48:02 GMT
Server: Python/3.7 aiohttp/3.6.3
405: Method Not Allowed```
http://0.0.0.0:5000/dblwebhook i get this in my log,
do i just paste it in with the password!
i port forwarded already
Fixed ❤️
Yes, but replace the 0.0.0.0 with public IP of your machine
Can i ask? the get_user_vote() at python library gives u bool if user voted in past 12 hours or what?
at docs it says: vote status – Info about the user’s upvote.
so its for last 12 hours or how
Yes
ty
Hey! I am trying to figure out how to make voting rewards. This is what I have so far:
const DBL = require('dblapi.js');
const dbl = new DBL(process.env.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!`);
});
process.env.DBL_TOKEN is the thing labeled "API Key" that I got from the "My Bots" section.
Not even sure if that's right, though, because I also see something labeled "Authentication" in the "Reference" section
then why didnt it log it
when i voted for my bot
(yes the cringe, voting for your own bot, i was testing it
)
@sullen nymph is it webhookAuth then?
where i put the auth token
aiya

