#topgg-api
1 messages · Page 83 of 1
Yeah
is the auth discord id for your bot, or your user?
One message removed from a suspended account.
One message removed from a suspended account.
0.0.0.0 is not a valid IP address...
it means all ip's on the computer
it's similar to localhost and 127.0.0.1, but not exactly
That means you can access the webhook at http://*:5000/dblwebhook so any open ip on your machine
wait on glitch
nvm, you'll have to do some other stuff, it has a specific url
One message removed from a suspended account.
Also you'll need to run it on process.env.PORT
hi
my bot has more than 200 servers
but it shows 130
led me here
using glitch.com
Where should I put the token
I already have a token Discord Develeoper from and use
coin?
whereever your client.on("guildCreate") event is
yeaap okey
or you can just set a interval and post your server count there
hey, im trying to use manuel server count code from https://top.gg/api/docs#pylib but im getting a weird error
Extension 'dbl' raised an error: AttributeError: module 'dbl' has no attribute 'DBLClient'
can someone help?
Are any of your folders or files named dbl
Hi guys my long got spam with error:
Unauthorized: Unauthorized (status code: 401)```
Anyone has same issue?
I just accisently regen token and changed it with new one and thats start heppening
Hi guys my old code Im using:
self.dblpy = dbl.Client(self.bot, self.token)
The new code from github:
self.dblpy = dbl.DBLClient(self.bot, self.token)
But when I try the dbl.DBLClient(self.bot, cant find in initreference DBLClient
What's the error
cant find reference DBLClient in init i think
has no attribute 'DBLClient'
Extension 'cogs.TopGG' raised an error: AttributeError: module 'dbl' has no attribute 'DBLClient'
Let me update it first
Same thing
just update it to 0.3.4
Still have this error discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ExtensionFailed: Extension 'cogs.TopGG' raised an error: AttributeError: module 'dbl' has no attribute 'DBLClient'
Any solution?
I tried to instal the API v 2.0 and i dont get error
dbl.webhook.on('vote', vote => {
client.guilds.channels.cache.get("703729301794587219").send(` ${vote.user} bota oy verdi!`)
console.log(`User with ID ${vote.user} just voted!`);
});```
does not message to the channel
@restive otter sunucuyuda tanımlayarak at
english only @restive otter
sory
Still get error AttributeError: module 'dbl' has no attribute 'DBLClient' 😦
But it works fine when I use API0.2 with Client instead of DBLClient
dbl.webhook.on('vote', vote => { client.guilds.channels.cache.get("703729301794587219").send(` ${vote.user} bota oy verdi!`) console.log(`User with ID ${vote.user} just voted!`); });``` does not message to the channel
@restive otter you are not receiving the post request from dbl 
Make sure in ur dbl page, u have SERVER_ADDRESS:PORT/WEBHOOK_PATH
How do I fill this place?
are u using glitch or server ? @unborn ridge
your glitch project link/dblwebhook put to URL part
turkce konusmak yasak sadece ingilizce
ekliyorum seni
we can talk in there @unborn ridge
I sent a friend request, let's talk to you
just put glitch-link/dblwebhookurl to URL part then authorization is your password write what you want. then define in your bot
I couldn't, let's talk dm
i tried using the webhook on glitch, it worked for like 5 hours but then randomly stopped working, i didn't even do anything with the code
someone please help me
why my api (topgg embed )isnt working its giving error message (my bot isnt approved)
because you bot did not get approved yet?
@hard ridge Are any of your files named dbl?
you create them yourself
its a password and port for the webserver that will be listening for webhooks in your machine
oh ok thanks
OH neato
https://top.gg/api/docs#mybots api token for your bots.
@hard ridge Are any of your files named
dbl?
@sullen nymph i dont have file with name dbl except the dbl folder it self
Hi guys, I've used this code to post my bot stats, but the number of servers on the page still shows up N/A:
setInterval(() => {
dbl.postStats(client.guilds.size, client.shards.Id, client.shards.total);
}, 1800000);
My bot file is not
Well, print(dbl.__version__) 
Dbl folder is inside the venv
Ok I will try it. Last night I just reverted it back to v0.2.0
With v.0.2.0 it works fine
Another question: Can I use the webhook feature if Im self hosted? Is it required ssl?
can someone help me, I have a problem in the event dbl.webhook.on("vote", ....), I use Glitch!
@main cobalt Translate kkkkkkkkkk
eu sei ingres fi @steep pivot
Nope
Am i doing this wrong or could somebody help me understand why i'm getting {'error': 'Unauthorized'}
URL = f"https://discordbots.org/api/bots/{self.bot.user.id}"
PARAMS = {
'authorization': config.bot['dbl_token'],
'content-type': 'application/json'
}
r = requests.get(url=URL, params=PARAMS)
data = r.json()
print(data)```
what does this mean {"shards":[]}
i'm having a problem with the .getvotes() method. if i understand correctly, it's supposed to return a list of users who have voted for your bot, but none of the people that have actually voted for my bot shows up on the list. any help would be appreciated!
@ancient venture yes that is wrong for the following reasons:,
- i would advise you use the dblpy lib which manages this for you
- You need to send a header with your dbl token and type
- normally requests takes
data=rather thanparams - it needs to be an actual endpoint rather than that url
ah okay
So what's the method to get the Server Count of a bot in dblapi module?
Ik the others but not the server count
.
Please do not dotpost.
is this how you do it https://top.gg/api/bots/1233/server_count
Hmm did you read the docs?
Hmm... Idk about java tho
Im just trying to get the json
trying to see something
For it to show the server count does the bot have to be in the server?
In this server? No
Code:
String userId = mentionedUsers.get(0).getId();
api.hasVoted(userId).whenComplete((hasVoted, e) -> {
if (hasVoted) {
mentionedUsers.get(0).openPrivateChannel().complete().sendMessage("Your order is complete! Thank you for your support!").queue();
event.getChannel().sendMessage("Order Complete! Thanks, " + mentionedUsers.get(0).getAsMention() + "!").queue();
msg.delete().queue();
} else {
mentionedUsers.get(0).openPrivateChannel().complete().sendMessage("Before your coffee can be prepared, you have to vote for me! https://top.gg/bot/702109112292343919/vote").queue();
event.getReaction().removeReaction().queue();
}
});
Problem: It's not doing anything... Before I added the check for if it voted it worked fine, so I know the event is firing but... it doesn't do anything
@spare solar dont you need auth for that?
I don't think so
try it with auth
how are you suppose to add an auth in the link
how are making the request?
set it as custom token
getting still the same
let me try then
My bot isn't in this discord server so not sure if that's the issue
possibly
so since my bot isn't in here top.gg can't track my bot on how many servers are using it on their website
im trying to get my server count with it
im trying to make it so it shows on the website
then you need to post it first lol
were do i post it
youre not posting
you're getting
GET is to obtain information from a resource
POST is to send information to a resource
ah k
you can use one of the official libraries
@vapid cape do you have any idea on what's the method to get server count?
I know how to get the bot's prefix, upvotes etc etc but how's that one possible?
the password is for the webhook which you have to set up manually on a vps / server which you can set yourself on the bot edit page
@violet robin ^
thanks i will have a look :))))
No problem feel free to ask any other questions you may have here too!
does the bot need to be a confirmed bot on the website?
ç
any help with my problem please?
i'm having a problem with the .getvotes() method. if i understand correctly, it's supposed to return a list of users who have voted for your bot, but none of the people that have actually voted for my bot shows up on the list. any help would be appreciated!
Hello! I'm using JDA and trying to get the voting feature functional. I want it to only allow something to happen if the user has voted. Here's my code: https://paste.menudocs.org/paste/u7por It's calling the method, it's printing all the way to "Has Mention" but nothing past that. Anyone know what the issue is? I'm not getting any errors.
Actually!
I forgot to check the e variable oops xD
Added e.printStackTrace testing now :P
Nope... no errors
What am I supposed to put for token? Is it the bot token or..
Found it
Now I feel stupid
Lol
I've been trying to fix it for so long but I was just using the wrong token
Thanks xD
Wow that's a long token hahaha
idk why they went for such a long token either lmao
😂
hello everyone, is youtube api currently under limit today?
for those who have music bot whether youtube api limits daily exceeded today?
When i click Test
Noting happening in Console
just gonna say change ur auth on that hook
@restive otter woah, u leaked ur webhok password!
@restive otter what lib u use
discordjs?
literally the beginning
@true talon i dont care about the password, anyway i gonna change lamo
lol
double checking does the server post go in the ready event?
depends
fixed it 🙂
thx
I created a separate event pro dbl.webhook.on () but the error in on what I do?
What does the unauthorized error mean. You got the wrong token?
yea
@quaint sierra are you writing your bot in python using discord.py?
yes
are you using commands.ext?
no
while True:
await client.change_presence(activity=discord.Game("créer par choucouPEEK!"))
await asyncio.sleep(10)
await client.change_presence(activity=discord.Game("*aide"))
await asyncio.sleep(10) ```
for the moment i have this
this is for #development not #topgg-api
hes asking about showing guild count in status not on the site
you meen api token of my bot M
no
go to #development , minx miss interpreted that
y it is not updating
as it has been updated in page
it just takes a few mins todo
and requires u normally regening it
its working on your bots page tho wouldnt kill you to make it less eye tearingly hard to read
I asked this in #development but saw this is the better place.
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });```
Hey, I don't understand what the value of webhookPort should be. 5000 connected it to my own pc
@junior tusk thats exactly how it works
it starts a webhook server on your pc to receive vote events from top.gg
oh oof
but now I didn't got the request again to give that program access to my pc (or something)
once you allow it in the firewall warning, it will be remembered
unless you move it to another folder
but I did 'cancel'
then you need to go into your firewall configuration
okay thanks
was it this one? Node.js server-side JavaScript. I guess it was
I allowed that one and it's still not working
or should it also have 'particular' access?
if you're self-hosting your bot, you will also need to port forward in your modem/router
oh I was just testing it. Then I can better test it on the host
vote
like dbl.on('vote') ?
you have to setup webhook
yeah
Well.
I set up a webhook but it's running locally
anyone knows how to do it correctly ?
if I test my webhook, will it send a fake vote event?
technically no
excepted if you set the correct headers
but mine isn't working
like it's set on 0.0.0.0:5000
oh I think we have the same problem then
is there somewhere a tutorial about the vote webhooks made for noobs?
if I test my webhook, will it send a fake vote event?
@junior tusk "Test" button triggering vote event
it works now, @restive otter do you need help?
My webhook is working, but when I'm using dbl.getVotes() I get one element of a user I have never heard of, instead of getting the users who just voted on my bot (I know who they are). What is going wrong?
webhooks are completely separate to get votes
ohw
but it's using partially the same code
oh wait it's updated now
but the posted event wasn't emitted
dbl is essentially two things in one
dbl is a small request manager for requesting top.gg api endpoints
dbl.webhook is a webserver created by dbl that runs in your process and listens for data sent by top.gg
When I try to use the webhook it says running at 0.0.0.0 what do I enter as the webhook url?
where is your bot hosted?
for vps hosting, the URL is http://YOUR.VPS.IP.ADDRESS:WEBHOOKPORT/dblwebhook
Okay
Even if it says 0.0.0.0 ?
Someone help
@restive otter yes, it will always say 0.0.0.0, its hardcoded
@stone sierra does your repl.it have some kind of public url or address?
Yes
then use that and add /dblwebhook
also, for repl, you need to check which ports are allowed
for example, glitch and heroku have process.env.PORT
check if repl has something similar
Ok
hmm
ways to sneak information into a rich embed
trying to get my game variables back from an embed object
I'm guessing any url will cause some static if its a bs string
oops wrong channel
I'm using dbl.webhook.on('vote', (vote) => {... and vote.user.id is undefined. How?
It's emitted with real votes, not test votes
hey yall, what exactly are webhooks?
@junior tusk console.log(vote)
Yes will try that tomorrow. But that won't direcly solve anything of course
@wet wing https://top.gg/api/docs#webhooks
ah it’s ok i got there :)
Hi
Seems there’s an issue with the JavaScript pkg. I post stats by just passing client into dbl, however, seems to not be posting an accurate count across shards
It seems the number being posted is much lower then my actual could across shards
examples and code samples?
Not on pc currently, one moment
Here as you can see I pass client into the constructor. The strange part is, the log does work as expected, just the number being posted is incorrect
oh you're that guy who runs that weird ass shard handler
my guess would be that there's some additional accidental count posting thats overriding the correct one
try logging every single posted event you have, along with shard id and server count
Hmm I’ll take a look
didn’t occur on my master build iirc, only occurring now on stable
why does the png not update?
@bold gulch =>
https://top.gg/api/widget/YOUR BOT ID.png?v= + (Date.now() >> 0).toString(36)
How i can have the server count in the list page
You'll want to post your stats. You can find info how here: https://top.gg/api/docs
Wha?
Yeah, it's dbl lib
Ok
Choose one for your language
I was trying to use eval function to make my boy execute python statements that we send as a message and it would send the output as another message
how to make it execute multiple lines
In dpy
Why is there not a number for API Latency?
Yeah
module.exports.run = async (client, message, args) => {
// Command Handler Module Code
let disabled = 0;
if (disabled === 1) {
message.channel.send();
} else {
const m = await message.channel.send("Pong :ping_pong:");
let E = new discord.MessageEmbed() // Start of embed
//.setTitle("Pong! :stopwatch:") // Embed Title
.setColor("BLUE")
.addField(
"Bot Ping",
`${m.createdTimestamp - message.createdTimestamp}ms`
) // Shows Latency
.addField("API Latency", `${Math.round(client.ping)}ms`) // Shows API Latency
.setFooter("Cryptic's Bot Ping")
.setTimestamp();
message.channel.send(E); // Sending the embed
}
};
which discord.js version do you use
12.2.0
then its client.ws.ping
ah, Ok!
also I forgot that we are in the api chat
next time ask in #development
if its not related the dbl api
Ok
const dbl = new DBL(process.env.TOPGG_TOKEN, { webhookPort: 3000, webhookAuth: 'khlang' });```
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE: address already in use :::3000
help me plz
hosting with glitch
@junior tusk vote events are sent by top.gg and only contain the data that top.gg sends you, they have nothing to do with discord.js's User objects. vote.user is not a discord.js User
@vapid cape oh oops, thank you! I indeed usedvote.user.usernamebutvote.user.idwas undefined too. But I will look at it today
@valid ravine do you remember you already used port 3000?
they said glitch use PORT 3000
Ow I see now, vote.user is userId
Well I can try to say useful things but I honesly don't know
@restive otter did you fix it?
oh oops, thank you! I indeed used
vote.user.usernamebutvote.user.idwas undefined too. But I will look at it today
solved btw ^
thanks for helping
any help with my problem please? (https://discordapp.com/channels/264445053596991498/412006692125933568/704097277286940703)
@hollow tree I also came across this problem.
How to do this in the right way?
then its
client.ws.ping
@shy vortex never knew this was a thing, doesn't calculating the message timestamp minus Date.now() work the same?
@visual moss client.ws.ping is the websocket latency, its a different thing
It seems that on webhook its not sending an authorization header or a user id?
(using test button if that matters)
what do you mean?
hello why in the api it said that i dont have any bot, but i had one ??
do i need to add a bot and wait for it to get verified to get the APi?
oh
i thnk i have to wait on them to verify it
oh
yes
ok
so how long i have to wait ??
till it gets verified i guess
1week ? 1 month
more like a week
oof
And you find top.gg token either on your bot's Edit page or on https://top.gg/api/docs#mybots when it's approved
@stray sluice are u making that u are new
thanks sir
yes
im new to it
they declined it just for a command dm
and i had to re-apply
meanwhile my official discord bot verification going on too
Sounds like a topic for another channel
Rlly?
No
yeah, get dblapi.js
from where
npm
How can I have my bot feature on the first page
it has like 70 upvotes, but I don't see it on the front
ads or it needs a crap ton of upvotes
-auctions
What are auctions? What is #bids for? Click here to find out
this ^
so check out this
it explains how to do it
ok
where is your bot hosted @next pendant?
ah okay, that should be fine. just make sure you are using ports that are open
if you need any help with setting it up then feel free to ping me
I have it installed
which is the file I edit? index.js in there?
I just made my API key
Is there a video or something
lol
const DBL = require('dblapi.js');
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' }, client);
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!`);
});
dbl.on('posted', () => {
console.log('Server count posted!');
});
dbl.on('error', e => {
console.log(`Oops! ${e}`);
});
@next pendant that is pretty much what it says on the website
Where does it send me the notifications for hte votes
just ensure your ports are all correct and setup and that you have entered your url on your top.gg bot page
can I have it send to a specific channel in discord
yeah, you can
this is more confusing than I thought
can I have it send to a specific channel in discord
and with this question, basically all you do is search for a channel with a specific id (the one you want the messages to be sent to) and just create an embed or something saying who voted
it is difficult at first, but if you understand it, it all makes sense
check the seconds pinned message in this channel, it explains pretty well how it all works
Should I do this in src/index.js or webhook
webhook.js
ohhh
this goes in my client index
file
yeah
omg
damn
I'm going to have to reboot my bot then
-auction
-auctions
what was it again
lol that only works for mods
if u wanna talk about auctions then we should move back to #general lol
@vapid cape hey whats teh port for AWS any idea?
i dont use aws, but they should support any port you chose
you might need to check their admin panel if you need to open it in the firewall
const dbl = new DBL('API', client);
// Optional events
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})```
Im having some problems
With this code
Bot starts but it goes down with this error
that error has nothing to do with dbl
you're doing something weird
client has to be the same client you client.login() with, not another new Client
client.dbl.postStats(servers, shardID, shards);
Does this automatically post every once in a while?
the answer is no, that does not autopost
you'd have to put it in an interval yourself
yes you can try and see
I have it in my bot for the last couple of weeks and don't really know if its updating because its restarting or not
make the thing and give it an hour or so
if it doesn't autopost then something's happening
I can't dude
if you supply a client when constructing the class, it will autopost
The bot doesn't join that many servers each day
@spiral steeple thanks!
Was the answer I was looking for
@steel hawk console.log("posted")
Bruh
I mean, to see if the method is being called
The just log the response returned the lib
postStats returns the response iirc
Also, don't u have a written log?
When testing the webhook there is no authentication header or query parameters
I've tested it with postman so I know it's not something on my end
these are all the headers i received { host: 'ghxst.xyz', connection: 'Keep-Alive', 'accept-encoding': 'gzip', 'cf-ipcountry': 'US', 'x-forwarded-for': '', 'cf-ray': '', 'x-forwarded-proto': 'https', 'cf-visitor': '{"scheme":"https"}', 'cf-request-id': '', 'cf-connecting-ip': ', 'cdn-loop': 'cloudflare' }
Also using .getVotes with the js library seems to return very wrong results
I have voted for my bot multiple times and a few friends have
None of our names show on the list
Can't get the server count stuff setup
You can use https://www.npmjs.com/package/dblapi.js
I'm using AWS
not sure if theres a port issue or what
my console said connected but when I run the test it doesn't do anything
can I just use the POST link instead of the database?
Can you show me the code youre using to post your server count
dbl.DBLClient(self, keys.dbl_token, autopost=True)
This will start posting once bot is ready, right?
should
also
Shouldn't on_guild_post here in the automatic example here (https://top.gg/api/docs#pylib) be decorated with commands.Cog.listener()?
maybe 
setInterval(function(){
//test news
let req = https.request({
hostname: "top.gg",
port: 443,
path: `/api/bots/${client.user.id}/stats`,
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: TOKEN2,
}
}, (res) =>{
console.log('statusCodeTopGG:', res.statusCode);
res.on("data", d => process.stdout.write(d));
})
req.on('error', console.error);
req.write(JSON.stringify({ server_count: client.guilds.size }));
req.end();
//fin test news
}, 1800000);```
nothing wrong with doing that, i do that too
Well make sure ur token is correct
yes i am sur
Is port 443 open
does your console show anything?
no nothing
did you wait 1800 seconds?
no i believe it's post directly
ok i wait and i come back but my code it's correct ?
you can put the code outside of the setInterval to test immediately
and if it works, then put it inside the interval
ok i test
put it in the ready event
port 443 it's correct?
yes
ok it's correct
ty
but my bot it's on 13 serveur and he post on top.gg 348. Why ?
no i'ts ok
sorry it's correct 13 serveur lol
oh ok
def __init__(bot):
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='something', webhook_port=5000)
@commands.Cog.listener()
async def on_dbl_test(self, data):
print(data)
why doesn't this code print out data when i ask for it
Is port 5000 open? Are you sure your indentation isn't messy? Are you sure your URL is correct?
ok so
how can i check if port 5000 is open
my indentation is not messy
and the url is IP:5000/dblwebhook
ok
i used a online tool
and it says that port 5000 is open
where is your bot hosted?
Error: 502 Bad Gateway
This is coming from the dblapi.js. Is it something I can solve?
Nothing you can do your end
okay. But is that just randomly thrown or is it thrown while a user votes my bot?
@tepid harness try making a request with reqbin
uh
if it gives you unauthorized, its working
if it gives you connection error, then the port is blocked or the ip is wrong
you can have multiple listeners on the same ports right
no
okay. But is that just randomly thrown or is it thrown while a user votes my bot?
@junior tusk Most likely whenever you try to send a request to top.gg
ok it works now
@junior tusk Most likely whenever you try to send a request to top.gg
@sullen nymph oh like postStats() for example. Yes according to the uptime and the interval, that it is
thanks
When testing the webhook there is no authentication header or query parameters
I've tested it with postman so I know it's not something on my end
these are all the headers i received { host: 'ghxst.xyz', connection: 'Keep-Alive', 'accept-encoding': 'gzip', 'cf-ipcountry': 'US', 'x-forwarded-for': '', 'cf-ray': '', 'x-forwarded-proto': 'https', 'cf-visitor': '{"scheme":"https"}', 'cf-request-id': '', 'cf-connecting-ip': ', 'cdn-loop': 'cloudflare' }
Also using .getVotes with the js library seems to return very wrong results
I have voted for my bot multiple times and a few friends have
None of our names show on the list
(previously posted with no response)
you put the authorization on the site and pressed saved before testing?
I can't show because I don't have a bot anymore, but on your edit page you need to remember to save the webhook settings
yes @spiral steeple
idk why it wouldn't work then, I never had an issue like that
Should server count show up instantly on the site or does it takes some time
because I am kinda confused if i messed something up
did you post the data?
um it's kinda my first time doing that
i have created the cog with the first example
pasted my token there from top.gg
ah py, I've nver used dblpy before
@mossy bay try refreshing the page
Force refresh if that doesn't work (shift + refresh in Firefox)
ctrl + shift + r is override cache on most browsers
(tested on chrome, opera, firefox, edge)
yup
token should in quotes right as a string
?
because that i wasn't really sure of
I mean it is a string and without the quotes it's... an error
It's a syntax error if it wasn't in quotes
Anyone knows a slap api ? the nekos.life one does not work
For server count to show the first python example is sufficient or I should do something more to make it work
?
because i have done that and it is still
the first example should be suficient
it should print "server count posted successfully" every 30 minutes
Jeez, maybe I should add logging to internal dblpy code
Hello, do you know if I can use another port for APIs?
if you mean top.gg webhooks, you can use whatever port you want as long as its allowed by your hosting
Hey
Is there someone I could talk to about this? https://discordapp.com/channels/264445053596991498/412006692125933568/705094396369961080
what is the webhookauth?
a random code you come up with
must be the same as what you put in your bot's top.gg Authentication field
i just told you what lmao
a random code you come up with
must be the same as what you put in your bot's top.gg Authentication field
oh i said Authentication sorry
its Authorization
its the same thing really
what about the URL field?, i thought you put the webhook url but idk
yes, you do @steel terrace
this one right? @granite jasper
no
how do i do that?
get the ip to your server
aight
then add the port you're using (eg: 5000) and set the webhook url to that
Is there someone I could talk to about this? https://discordapp.com/channels/264445053596991498/412006692125933568/705094396369961080
???
its been over 24hrs and no help, it's not something on my end
It seems my shard stats are pulling correctly from my client, but my guild count is 1k+ behind. Anyway I can check what is being posted in the onPost event?
Would be nice if the posted event in the js lib returned the values or something
well their webhook isnt working 🤷
It is
is hasVoted ratelimited?
it isnt for me, it's not sending an authorization header or any data
Iir it has a limit of 1000 votes
its making a blank request
So it wouldn't return vote 1001
i thought hasVoted isnt limited to the 1k limit..?
It is
When vote 1001 is submitted, vote 1 is deleted
Also, there is a ratelimit, but you shouldn't hit it unless spamming getVotes
oh
is the format for the webhook url just https://websit.com/path ?
"Individual User Id Voting Check for the past 12 hours.
Use this endpoint to see who have upvoted your bot in the past 12 hours. It is safe to use this even if you have over 1k votes." @knotty garnet
Iirc there's a red message on the top of the page
Also, you gotta setup a webhook listener to use the webhook, not just pointing to your ip
well empty as in it does not give userid or authorization
But is it triggering?
Hm, are you getting the request body or the request headers?
...all the data IS in the body
"body: {}"
The headers only contain default request ones, like User-Agent
Try printing your entire response
yeah, i did
https://discordapp.com/channels/264445053596991498/412006692125933568/705094396369961080 shows the header i receive
What does it return?
yeah
Have you whitelisted dbl?
but testing with postman works so that shouldnt be a problem
uhhh
well its still getting the request tho..?
Hm, what kind of host do you use?
digitalocean
express
Weird
The weirdest part is that you're receiving the event, just not the data
Could you show me your webhook listener?
hastebin plz
I'm in mobile atm
Codeblocks are unreadable on mobile
Ah
Try res.json()
And see what it returns
Res not req, srry
mk one sec
there @knotty garnet
what do you want me to look at?
body is still empty
Idk then, I'm as clueless as you
Like, it was supposed to have body data
If there was something blocking it then you'd not even receive the event
See if someone here uses express as webhook listener
It could be a teeny tiny detail we're missing
See if tim knows something about this
tim?
tested using postman again https://cdn.jimpex.xyz/sx/Discord_2020-04-29_20-11-36.png
Yeah, tim is a big js bot dev here
Well, you could do that
whats his ping?
yeah
there are a lot of tims
you just need to see his pfp tho to know which tim you're talking to
how to do I get upvotes for a bot? I'm not very familiar with webhooks and I just copied the code from the example docs
can the dbl library (I'm using python) create a webserver for me?
@tiny compass
Voting on the website a way for users to show their support and interest for a bot; developers can also use this to reward users for voting. The amount of votes you see on the website is the monthly vote count which is, obviously, reset every month. Once a user has voted for a bot, they cannot vote for that bot again for 12 hours. During weekends (PST), one vote will count as two. If you're a developer and would like to reward users for voting or if you would like to view a list of voters, you can do so via the votes API.
I hope that helps.
why is there an error when i use the actual vote but not when i use the test webhook
That's a great question, I'm not actually too sure however I'll see if I can find someone that can better answer your question.
ok
just fyi, the error is
aiohttp.http_exceptions.BadStatusLine: invalid HTTP method
Error handling request
0|CTZN | aiohttp.http_exceptions.BadStatusLine: invalid HTTP method
In the end I couldn't reproduce that error...
Please report it on the Github repo, I'll get to it soon
Ok
Eh yeah that errors be there for a while
I have no idea what is causing it as it seems to be a aiohttp internal error from the stack traces
Hi. dbl.hasVoted always returns false after a bot restart, even if the user has voted. Why?
I don't use webhooks
I read this embed a little bit above here: https://discordapp.com/channels/264445053596991498/412006692125933568/705274611700334653
Is the PST timezone always used or will it change when it's winter?
The python examples use a bot variable.
Should that be the client object from discordpy?
ah nvm, found it bot – An instance of a discord.py Bot or Client object
I read this embed a little bit above here: https://discordapp.com/channels/264445053596991498/412006692125933568/705274611700334653
Is the PST timezone always used or will it change when it's winter?
does anyone know?
the /bots/{bot.id?}/votes give me not a count back, is there a way to get a info, how often a user voted?
Or must I do it with a task over all users with /bots/{bot.id?}/check?
But that will be a ton of requests ...
use a webhook then a store the votes in your own db
ah ok, yes that is much better anyway, so I dont have to pull all the time
I know u probably get this all the time, but im trying to handle the data from the api and i get a coroutine object. Im trying to handle it but i really dont know what to do (python)
also alot quicker most of the time
true so I can send the user instant a msg about it
that is fine
thx
I know u probably get this all the time, but im trying to handle the data from the api and i get a coroutine object. Im trying to handle it but i really dont know what to do (python)
Im really stuck sorry. I know its probably obvious but i have no clue
Ok doesnt matter, i dont think you can cast it. But either way i got it
asked admins and its UTC
@craggy sentinel so that's 100% sure now? Thanks
Maybe change it in the embed from @abstract moth
@green mantle thx! works like a charm.
where is your bot hosted?
should be http://REPL-NAME.USERNAME.repl.co/dblwebhook
with your relp name and your repl username
doesnt matter, it has to be the project name and the project owner's username
whatever username it says there
the repl/project name
should be written there lol
show a screenshot of your repl project
apparently yes
you basically have the entire url written there already lol
you just add /dblwebhook to it
anything you want
as long as its the same thing you put in webhookAuth
are you using dblapi.js?
dblapi.js is the module for the top.gg api
but you dont really need it, you can get votes without it
make a code to receive it in your bot
if you're not using dblapi.js then you need to add a /dblwebhook endpoint in your express server
its not client id
its your top.gg token
webhookPort should be process.env.PORT for repl.it
webhookAuth should be the same thing you put in Authorization
i literally showed you?
yes
How to in python? Sorry I´m not really good in english
There's a dblpy library that can help you post guild count easier
Because it should be long
for security
👀 What's the error?
Put it inside quotes
It must be a string sooooo
"IloVEMYToKEN.MyPreCioUSTokENn.PlEASEdoNThACKMe" is basically how it should look
see the quotation marks
carry on, nothing to yell at here
0|index | (node:12496) UnhandledPromiseRejectionWarning: Error: 500 Internal Server Error
0|index | at IncomingMessage.<anonymous> (/home/cxllm/Bots/Corynth/node_modules/dblapi.js/src/index.js:118:25)
0|index | at IncomingMessage.emit (events.js:323:22)
0|index | at endReadableNT (_stream_readable.js:1204:12)
0|index | at processTicksAndRejections (internal/process/task_queues.js:84:21)
0|index | (node:12496) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
0|index | (node:12496) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
Is there a way you can remove the 500 errors lmao
I'm just getting spammed with them
it's an error, you don't remove it, you handle it
You can remove them by trying to do something a bit later
because 500 is server-side and you have no control over DBL's servers so all you can do is wait patiently and help us not lose our hair in the meantime. Thank you for understanding
Yes, of course, I mean like is there a way to just stop them from being logged
Because they're really annoying when you're trying to debug stuff
But I'll just wait
My bot can't connect for some reason anyway
What library do you use
discord.js
I assume you use dblapi.js as well then?
Yessir
Error: 502 Bad Gateway
at IncomingMessage.<anonymous> (/app/node_modules/dblapi.js/src/index.js:118:25)
at IncomingMessage.emit (events.js:322:22)
at endReadableNT (_stream_readable.js:1187:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
api not working ?
yes
Yeah my bot just doesn't work any more
@finite hare iirc, all it does is reject() in promises so if you use .catch() and just have it do nothing, it wont log the error
thx again
But what I want to know is what the hell that random event is
Yeah discord is dying
Thought so
I use try catch
if the image would ever load I'd help you, but the cdn is also dead
open it yourself
All it says is
'es' localisation failed to load
Listening
Connected to db!
Left a server: undefined | 264445053596991498
guildCreate
lemme find it
guild_delete i think
It happens every single time I start it up
Same id
No idea why
is it recent?
Ah
My best guess would be because of server outages, but idk
Yeah my bot started to not connect when it happened to dbl
I don't know if sharding would fix this problem
Yeah that's the dbl server id, your bot must see it as an outage
it was down for me earlier
Oh
It'll probably fix itself when the api stops dying
shows offline for me
I know it is probably a trivial error but i just can't figure it out why it just won't work. I would really be thankful for a helping hand. I'm almost running out of my wits
ugh image doesn't want to load
Hi, your API is taking 6+ seconds to server widgets
the site is slow rn
ya
you know. why doesn't anyone use discord.php?
¯\_(ツ)_/¯
| { Error: 500 Internal Server Error
0|bot | at IncomingMessage.res.on (/root/ezv/node_modules/dblapi.js/src/index.js:118:25)
0|bot | at IncomingMessage.emit (events.js:194:15)
0|bot | at endReadableNT (_stream_readable.js:1103:12)
0|bot | at process._tickCallback (internal/process/next_tick.js:63:19)
0|bot | raw:
0|bot | '{"error":"Oops, I think a bad happened, I\'m trying again just hang in there"}',
0|bot | body:
0|bot | { error:
0|bot | 'Oops, I think a bad happened, I\'m trying again just hang in there' },
0|bot | status: 500,
0|bot | headers:
0|bot | { date: 'Thu, 30 Apr 2020 18:50:12 GMT',
0|bot | 'content-type': 'application/json; charset=utf-8',
0|bot | 'content-length': '77',
0|bot | connection: 'close',
0|bot | 'set-cookie':
0|bot | [ '__cfduid=dd00cc9814c377f7cb232c93da00dffcc1588272612; expires=Sat, 30-May-20 18:50:12 GMT; path=/; domain=.top.gg; HttpOnly; SameSite=Lax; Secure' ],
0|bot | 'x-powered-by': 'Express',
0|bot | etag: 'W/"4d-bawlvXmIX77Lqj+rNFbli5+PTRI"',
0|bot | 'x-cacheable': 'NO',
0|bot | 'x-varnish': '499912419',
0|bot | age: '0',
0|bot | via: '1.1 varnish-v4',
0|bot | 'cf-cache-status': 'DYNAMIC',
0|bot | 'expect-ct':
0|bot | 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
0|bot | 'strict-transport-security': 'max-age=15552000; includeSubDomains; preload',
0|bot | 'x-content-type-options': 'nosniff',
0|bot | server: 'cloudflare',
0|bot | 'cf-ray': '58c372749890f025-EWR',
0|bot | 'cf-request-id': '026e05dce20000f0258a2b0200000001' },
0|bot | ok: false,
0|bot | statusText: 'Internal Server Error' }
Uh
same here, just notified me
Nah i no that too
F

