#topgg-api
1 messages · Page 27 of 1
Oh yeah now i got it
and what just came to my mind is that eris-sharder might share tcp connections
but you'd get webhook events on all shards
Best is to make a single service that handles the webhooks anyway. There is no reason to let every of your sharded instance handle it individually.
Costs more runtime and only causes headachses
the on api only shows daily votes and you need to use webhook for month vote?
yes, just use webhooks, what's so hard about it? 
Webhooks sends if unvote?
Can I get someone to take me out of the NFSW thing? I don't like NSFW at all
why ask here?
I just want to not see the NFSW channel
do -nsfw
^
not here
Imagine reading #rules-and-info
it works here
doesn’t it work any channel Luca commands?
How do I make discordbots.org/api/bots/346353957029019648/votes send me only IDs? I've always been sending requests to https://discordbots.org/api/bots/346353957029019648/votes?onlyids=a but now it's sending me all kinds of information about the users
Need an api ratelimit prevent like discord bot event ratelimit handler event. To dblapi.js and all wrappper or to api
i think they got rid of it
onlyids was deprecated
Should I continue to use my snekfetch implementation or use the library? I'm using Discord.JS.
IMO manually gives you more control
Are you doing vote stuff as well or just stat posting?
Just stat posting right now.
Then I'd stay with manual
I'd just stay with the good ol snekfetch then
Okay, thanks.
IMO it's way easier to handle stats to other botlists
With my lib, aiohttp, you can just instance a session and connect to multiple botlists to post stats
Imagine every botlist having their own lib
I only use Discordbots.org.
good choice
What is the latest version for this? https://github.com/DiscordBotList/DBL-Java-Library
DBL-Java-Library - An API wrapper for https://discordbots.org/api/docs that works in Java
@sleek sinew its v1.0 atm
but its a bit out of date tbh
i only realized that theyre updated some portions of the api without me really knowing
Oh ok, thanks
const DBL = require("dblapi.js");
const dbl = new DBL('Your discordbots.org token');
if(dbl.hasVoted("129908908096487424")){
message.channel.send('you have upvoted')
}else {
message.channel.send(you have not upvoted)
}
would that work
im assuming theres gonna be api endpoints for servers?
soon™
damn, still gotta get the go lib done for bots haha
the message sends i just wanted to know if thats the proper way to check if someone has upvoted
because i haven't upvoted my bot and it sends the message saying i have
I did ```java
DiscordBotListAPI api = new DiscordBotListAPI.Builder()
.token("token I got from discordbots.org")
.build();
List<String> voterIds = api.getVoterIds("346353957029019648");```
and voterIds is just getting set to null without any exceptions being thrown. Is this supposed to happen?
@sleek sinew yeah the voter ids endpoint got removed actually
Oh, so now I can only do getVoters()?
yeah for now atleast
Okay, thanks
i need to find a way to add support for the check endpoint
and by find a way i mean like
just do it
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(vote);
// Do what you need to do
});```
Does this work right^?
dblapi.js: I tried to add the webhook thing thats pinned and got this error
well before that i did client.user.setPresence and that worked
! Add https://itunes.apple.com/us/album/made-to-worship/1034983962?i=1034984063 to my disc profile
???
Let me add it
Well for one, wrong channel, and for two I have no idea what you're doing
Does anyone know a api for anime like http://aws.random.cat/meow ?
Hello, anyone know how long it takes to accept a Bot? Mine takes more than 14 hours without approval, have not accepted or rejected, but I want to know the reason for the delay
Most of the time it can take around a day for a bot to be accepted however sometimes this can also be longer
Really depends on if the mods have time for it
All right, thanks man
@stuck sluice please keep irrelevant messages out of this channel
this is strictly for discussion of the API
is there a query parameter i can add on the widgets to make em larger?
@junior goblet ^^ mute this guy pls
<@&304313580025544704> spam
Please
Mute
Dude shut the fuck up
Whoever banned him thx
Np
what is the java's lib latest version?
so what should I use?
@restive otter what version of dblapi.js are you on
"dblapi.js": "^1.1.1",```
update to 2.0.0
okay
note the changelog tho https://github.com/DiscordBotList/dblapi.js/releases/tag/v2.0.0
i need to use this for the api tight? npm i dblapi.js
Yea
you dont necessarily need to use the module for the api
u can just use request/snekfecth to post and get information
im about to add webhooks to my bot for vote checking but ive just noticed that sometimes the authorization header is blank. this isn't normal, right?
and i changed the authorization key a few times during my testing and noticed that sometimes the authorization header in the request is an old authorization key
@next mantle share the full error
That's the full response
That's what I don't get
The endpoint, the authorization token, the request body, everything is correct
then most likely there's an issue with the server
iirc that's a 5xx message
Whats the new cool way to get dbl votes now using the dblapi.js
@arctic arch Any chance you can help me with your dblapi.js lib?
Just listen to webhooks @inner rune
Thats actually what I am working on
👍
right now its being an ass and refusing to use request.body
Yet again i would say york has some code related to webhooks sent in yhis channel
@narrow charm whatts the data property of a http post request?
req.data?
frick frack patty wack
Preety much a yes (as far as i remember)
eris-sharding supports dbl wrapper webhook?
dblapi.js has webhooks built in
Hey the api for the bot sats that my bot is on 4 servers but he is on 18 how to fix?
post the correct amount
by posting the correct amount to the api
wut
The api isnt a replacement for discord api
i just put this in my bot
by using this endpoint
setInterval(() => {
dbl.postStats(client.guilds.size, client.shards.Id, client.shards.total);
}, 1800000);
if you're not getting errors, you have 4 servers

then you have 4 guilds
inb4 hard coded
^ this tbh
bot.on("message", async message => {
if(message.author.bot) return;
if(message.channel.type === "dm") return;
setInterval(() => {
dbl.postStats(client.guilds.size);
}, 1800000);
i use this for the servers size
:/
LMFAO
and in the new DBL part
that code wouldn't cause high memory usage just about 1 more request to the api every message
do you have client there
const DBL = require("dblapi.js");
const dbl = new DBL(process.env.dblapi, client);
this?
yea
so i delte this too and what i do
kk
the only code you need for stat posting is that
👍🏻
got any errors?
lemmie check
I bet you have reached the ratelimit so you have to wait
remove what
the thing showing the servers
hmm how can i add moving background for my bot?
if it's possible
that isnt api related
Ok i know why it's showing 4 servers but idk how to fix:/ when i tried the api for first time i tried it on my test bot dat is in 4 servers but now it's showing his info on my main bot page
:/
why isn’t it showing
how to get new token
someone did that yesterday with their test bot
add console.log(client.guilds.size) somewhere if it says 4 then its on 4 servers if it says otherwise something is wrong at a larger scale
I mean i did that but it was only to test
the test bot is on 4 the main is on 18

trust me it isn’t
:/
if you're comparing the beginning, the beginning is always the same
are you sure
does it tho
ye i tried 2 times
compare the ending on the token instead
kk
ok 2 times was the same and on the third it gave me diffrent toekn
now about how much time it will take to sync?
18000 milliseconds isn’t it?
😮
or an extra 0?
¯_(ツ)_/¯
it posts on ready and every 30 minutes
still didn't change
How to send a DM whoever votes for your bot.
url to ur webserver
authorization to be a "password" to identify if its dbl who used the url
my bot are not listen
webhook example for js is pinned
Anyone can post example the output webhook
https://discordbots.org/api/docs#webhooks
see data format
Thanks
msg.channel.send(`Commencing manual status update as per your request ufu~`);
async function csize () { dbl.postStats(client.guilds.size);}
setTimeout(() => {csize}, 3000);
msg.channel.send(`Updated with **${client.guilds.size} Servers** Teitoku ufu~`);
it doesnt errors but it didnt update the server count on my bot page its still N/A
nvm got it fixed
so eh, can someone give me a little example on how to use the webhooks for votes?
i wanna send a message to my servers discussion channel when someone votes, like
hey {user that voted}, thanks for voting for Givaway today! make sure to vote again in 24 hours at {bot link}!
but yeah, not that good with webhooks
what language do you use?
alright
you can use the dblapi.js module
there's an example to get you started in pins of this channel
just a question, if you want to use the vote feature of the api with a sharded bot, how can you avoid the memory leaks?
the webhooks? Run the webhooks on a different process
or just run it on shard 0
we'll look into that thanks
@restive otter what you mean by shard 0 is the script where sharding manager is started?
no. like if (client.shard.id === 0) startWebhook()
in the ready event or something
so we would put that on the bot script itself not on the sharding script?
putting it in the sharding manager isnt a bad idea as long as you dont need access to client
so sharding manager has no access to client but I can put it on the bot script also to make it simpler?
I mean,
If you need access to client put it in the ready event checking if the shard id is 0 if so start
if you dont need access to client put it in the sharding manager file
I see thanks for that big enlightment

good for you
@restive otter look up
Damn it Seth.
thanks

np
He's an idiot.
What
Bye Seth.
Ok
I got dragged into this, pls help me
Is there a wee.b chat
on the dblapi.js the dbl.hasVoted does it only work for the first 100 votes still?
ping me with your reply
??? (using dblposter)
const dbl = require("dblposter"),
dblPoster = new dbl("token", client)
//On event "ready":
dblPoster.bind();
.bind(client)?
Do you set the api token?
your token's wrong
how my token is wrong :/
it just is
wait a while
Look at the end of the token not the start
we dont offer support for dblposter
oh kk
your old authentication might still be cached
Are you using your dbl or discord token
dbl
it keeps giving me "[dblapi.js autopost] Failed to post stats: {"error":"Unauthorized"}"
could it be that you are trying to post to the wrong bot id?
no i have only 1 bot on the site
but still, maybe you hardcoded the id but accidentally copied the wrong id
by using css
what do you mean
i can send you the code it's just telling me that my token is wrong
then put the right one
i did it like 10 times today
wat lib are u using
discord js
are you using the provided module or doing it yourself?
so what's the problem exactly?
[dblapi.js autopost] Failed to post stats: {"error":"Unauthorized"}
@arctic arch
or if there is any way to make it to don't show my servers amount in the site?
const Discord = require("discord.js");
const client = new Discord.Client();
const snekfetch = require('snekfetch')
const token = 'dbl token';
client.on('ready', () => {
setTimeout(() => {
snekfetch.post(`https://discordbots.org/api/bots/stats`)
.set('Authorization', token)
.send({"server_count": client.guilds.size})
.then(() => console.log('Updated discordbots.org stats.'))
.catch(err => console.error(`Whoops something went wrong: ${err.body.error}`));
}, 3000);
});
client.login("ur bot token")```
if it says "Updated discordbots.org stats." just close the terminal/console
tell me if it works
kk lemmie try
[dblapi.js autopost] Failed to post stats: {"error":"Unauthorized"}
and
Whoops something went wrong: Unauthorized
welp cant help
is there any way so i can remove the server count from my bot profile?
Tonkku how to remove the server count from my bot profile?
question
why do you need to remove server count @toxic acorn ??
it shows the count for my test bot not the main bot
lmao
Then simply post with main bot.
ye i am doign ti
it *
but now it gives me wrong token wor smth liek dat
so i want to remove it
ur obviously not posting it right if it just keeps showing an error
const Discord = require("discord.js");
const bot = new Discord.Client({disableEveryone: true});
const DBL = require("dblapi.js");
const dbl = new DBL("token here", bot);
bot.on("ready", async () => {
setInterval(() => {
dbl.postStats(bot.guilds.size);
}, 1800000);
u are missing a }
error?
[dblapi.js autopost] Failed to post stats: {"error":"Unauthorized"}
ur token might be missing some letters or it is cached
what to do if it's chached
idk
or is there any way to remove the count from my bot profile?
how show me
idk
and i don’t think you can unless you’re certified
also that question is more #development
Put this in your bot desc
<style>
.is-flex .btns {display: none !important;}
</style>
``` @restive otter
I think that should work
Although I strongly recommend just fixing your stat posting
@toxic acorn sorry I'm sleepy
Is ir possible to make server count +10 servers
Instant of adding showing 12 servers
that didn't working
@vital elbow what do u mean?
Like my bot is in 13 servers and have 10500 memvers
Servers: +10
Members: +10k
Those are examples
it has to be a number
Can I like
"Fake" server counts and make it less..
Not more
If 13 :
Server count: 10
If 26 :
Server count: 20
@toxic acorn
<style>
.servers {display: none !important;}
</style>
``` that should work
yes thx
@toxic acorn remove setInterval
const Discord = require("discord.js");
const bot = new Discord.Client({disableEveryone: true});
const DBL = require("dblapi.js");
const dbl = new DBL("token here", bot);
bot.on("ready", async () => {
dbl.postStats(bot.guilds.size);
still won't work
it says that there is problme with my token
@toxic acorn regenerate and try again
Is there any error?
[dblapi.js autopost] Failed to post stats: {"error":"Unauthorized"}
Try to replace constant in ready function
the token is the prblem my old bot tokesn still chached in the site database and i gotta wait not usre how much time
xd
Either clear cache or go incognito
@toxic acorn Can you not manually reset your token?
Anyone offering an API token should have an option to reset it.
you can
anyone having issues with collecting votes? I know i voted but the bot is returning false
Is any way to make my bot sending msg in specified channel right after someone upvote my bot?
i didnt really get how to, is here any examples? cuz i tried pinned post
and when i got this @ashen hull
client.on('ready', () => {
^
TypeError: client.on is not a function
whats is this means?
ok...
is your client variable = new Discord.Client()?
and @tawny cargo look in the channel topic
you will find: https://discordbots.org/api/docs
all you need
and https://discord.js.org for your bot
const bot = new Discord.Client();
Is this like js only or are there python methods as well?
there are others
@worthy tapir look at https://discordbots.org/api/docs it has methods on all langs of the apis
^ those are the official wrappers
Ok thx
there are also some unofficial ones
ye, i already checked links and reason why im here is just because i didnt found what im doing wrong
any way to programmatically allow a discord user to upvote?
dbl.userVote(bot.author.id)
He meant through a command
Ah
Then no
Too abusable
bot.on("messageCreate", async msg => dbl.upvote(msg.author.id))
Lol
ive only got 2 upvotes that’s perfect lul
@arctic arch with the dblapi.js the thing .hasVoted does that only work for the first 100 upvotes?
24h
?
it's for the last 24h
it only works for the last 24 hours and then you have to upvote again for it to return you have upvoted?
yes
i dont know if i have done something wrong but every time it says i havent upvoted and i did upvote
if (dbl.hasVoted(message.author.id) == true) {
message.channel.send('you have upvoted').catch(console.error);
return;
}
} else {
message.channel.send("you havent upvoted").catch(console.error)
return
}
it's a promise
so what do i do then....
hasVoted(id).then(voted => {
if (voted) ...
})
ok
hello
@arctic arch new limit is 100 votes/ 24h??
Is this apply on this to
Too
https://discordbots.org/api/bots/botid/check?userId=user:id
1000 or 100, tell pls.
how can I set a reward or execute something if a user upvotes the bot?
webhooks
any example for d.py?
https://discordbots.org/bots/424606447867789312/votes
Doesnt work either, 404
ah thanks got it
dbl.hasVoted(message.author.id, 1).then( voted => {
if (voted) Users.addVote(senderName, sender.id, message.channel);
else message.channel.send("Error: You have not voted in the past day. Please vote and try again.")
})``` why does this not check for votes in the past day
it just errors
saying "Error: You have not voted in the past day. Please vote and try again."
even though someone has
dbl.hasVoted(message.author.id, 1) checks for 1 day right?
dm me if you have an answer or just say it here and i'll look at it when i come back
thanks
yeah
sure?
welp still not working
dbl.hasVoted(message.author.id).then( voted => {
if (voted) Users.addVote(senderName, sender.id, message.channel);
else message.channel.send("Error: You have not voted in the past day. Please vote and try again.")
})```
not checking for a vote in the past 24hrs...
it says i haven't voted when i have
Logistical question about webhooks: When a webhook is sent from DBL, is my bot supposed to handle it or does it show up as a message in Discord?
you need to configure a webserver to handle it
discord webhooks can't be used for upvotes
Ok, I see.
Hmm
@lusty drift
how is this #topgg-api related
It’s not.
how is this DBL related
servercount = results.reduce((prev, val) => prev + val, 0);
dbl.postStats(servercount, bot.shard.count);
})```
is this how i would post my shard count aswell?
nvm i got it
I need help to setup webhooks in my bot 🙃 Im using discord.py rewrite and would like to use the api's webhooks
Does anyone has a simple script that handles the post request (and saves it into a json file)? Im not that good in php ☺
Nvm, already figured out for my self 😃
I already had an apache2, so I use this one.
One question: How do I get the Authorization header in php?
@snow fiber
I really don't have php experience sorry
Ok, thank you 😃 An then Im searching for a header with the name Authorization?
its either gonna be in that func or in $_SERVER['HTTP_AUTHORIZATION'] iirc
@clever viper Its working when I test it with curl in debian curl -X POST -H "Content-Type: application/json" -d '{"user":"1234546322313"}' --header "Authorization: 12346789" http://www.embed-generator.com/test.php, but not when Im testing it on dbl ...
My code to test it: if(getallheaders()["Authorization"] == "123456789") { ...
Ok, maybe the test function on dbl site is a little bit buggy, because sometimes it works, sometimes not. No errors in the apache log ... Thank You anyways
💙
Can i get some help please?
I used the provided js code for updating DBL guild stats
and it sent my API Key to all bot servers
and didn't update the stats
But some gobshite from one of the servers thought it was a great idea to spam the API with my token and set my Guild amount to 2,300,000
const botClient = this.getDBM().Bot.bot;
superagent.post(https://discordbots.org/api/bots/388733712281632769/stats)
.set('Authorization', 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjM4ODczMzcxMjI4MTYzMjc2OSIsImJvdCI6dHJ1ZSwiaWF0IjoxNTE5OTAzOTUwfQ.pnvSIdXQi4IrlQy1tHgCdIdc6xCMB1Rirlk5dAQg_ZE')
.send({ server_count: client.guilds && client.guilds.size ? botClient.guilds.size : (botClient.Guilds ? botClient.Guilds.size : Object.keys(botClient.Servers).length) })
.then(() => console.log('Updated discordbots.org stats')) ```
Lol don't send the API key
Its invalid
Oh ok
Don't worry
It is not supposed to send anything
ik
only i have access to the bot files
But now my bot will probably get removed for false guild counts
why am i getting this
as it is causing my bot to crash
const snekfetch = require('snekfetch')
snekfetch.post(`https://discordbots.org/api/bots/stats`)
.set('Authorization', 'KEY')
.send({ server_count: client.guilds.size })
.then(() => console.log('Updated discordbots.org stats.'))```
this is the script i am using
when is it running
i start my bot up and this happened with the script above..
anyone got a better script
for post server count to DBL API?
where did you place the script
@tawdry spindle
Eggsy is offline. i am a Mod for DBM Mods.
what
i need help
I need help is a very bad description of your problem.
@tardy mauve why don't you DM me 
Didn't want to disturb you bro was pretty late.
with?
I can’t get b!pclaim to work
not #topgg-api related
I don't know if it is supposed to be like that but when I check a user if he voted it returns 0 even if he just voted. Does it take some time to update?
That's something I've noticed as well
maybe its cache?
Probably caching. I assume there are different clusters that all have some kind of caching.
maybe
Can I somehow detect if there was a test webhook request or a real one?
the test webhook will have different data
which are?
¯_(ツ)_/¯
I don't have that info at hand right now
but I know for a fact it's different
ree time to have fun
type is test
oh thanks
that endpoint has been removed
Rip docs
(actually ?onlyids is ignored but same result)
how do i make a vote command
^^
i made 2 command will these work ```javascript
if(command === "votes") {
dbl.getVotes(true)
}
if(command === "vcheck") {
const ID = args.join(" ");
dbl.hasVoted(ID)
}```
whats that true
it said on the API site
cmon
yeah
hmm
wat about me
let checkForVote = await dbl.hasVoted(message.author.id);
dont do shit
that should work
not working
let checkForVote = await dbl.hasVoted(message.author.id);
if (!checkForVote) return message.channel.send("You need to vote to use the music commands. You can do so here, https://discordbots.org/bot/332971222897786892/vote");
remember that the hasVoted is about the last 24h
well i just voted and it not working
you can't do that lol
ok
yeah the api's broken
{ Error: 401 Unauthorized
(node:23209) UnhandledPromiseRejectionWarning: Error: 400 Bad Request
if it was broken, no one elses token would work either
well it was working 5 mins ago
send code
..
that is completely your fault @restive otter
huh?
there is something wrong with your program
your problem has nothing to do with the API
LMAO
theres nothing wrong here
Funo has always worked with the api
first time its done that
i think it is a known "bug" that the api doesnt instantly add the vote at the backend I presume it is cached so u have to wait a while till the vote registers
how do you get vote count from webhooks (without a lib)
you don't
they don't
you can receive events when you get an upvote with webhooks
but you can't get upvote count with them
You store the votes in a db
But will it delete after one month?
true...
That is something I didn't think of...
Maybe have it run a clean every month due to new Date()?
or you could just not care about monthly votes
I just use check endpoint currently as my bot not have 1000 votes/month
the ratelimit remember
XD

do webhooks have to return 200 OK
Why
I'm asking about dbl webhooks
Ik
in general all webhooks have to return 200 ok on success
your webserver's IP + the location of your webhook (unless it has a domain)
^
How can I get my bot token?
discord developers page
but this is discordbots.org token?
You need to have a aprooved bot on the discordbots.org page, to get a API-Token https://discordbots.org/api/docs#mybots
Would something like that here be possible with the DBL API?
private static DiscordBotListAPI api = new DiscordBotListAPI.Builder().token("token").build();
// returning the api, to use it somewhere else.
public static DiscordBotListAPI getAPI(){
return api;
}
nvm.
I guess it works...
Just changed some stuff, like only making private static DiscordBotListAPI api; and later set api = DiscordBotListAPI.Builder().token("token").build();
using the authorization header
how to? i am using python
i am mean I know how to set a header but which header do I set?
@arctic arch
@long spade are you using aiohttp or requests
aiohttp
ok good
i know how to set the header but which one to set?
set the Authorization header to your DBL token
DBL token?
get your dbl token here https://discordbots.org/api/docs#mybots
thanks ill try
When exactly are the vote reset times?
Because I now have a claim command with 24h cooldown which isn't really the best solution
theres no specific time, it's just 24 hours from when the user votes
its not time zone specific or anything
Okay
Can DBL send a webhook to a text channel?
I tried to do it but it wouldn't work for me
no you handle the webhook request yourself
its not something that is sent to discord
When posting guilds to DBL, is there something odd that happens when a bot attains 95 guilds? My bot currently has 101 guilds, but DBL has not updated for about a day. I can't seem to find any relevant output.
then see what the server count says
if it says 95, there is something wrong with your code
else, it's a known issue
Ok. Thanks.
Anyone help me on this webhook? in private please .;
What dies a Web hook do
Every time someone votes for your bot, DBL will send a request to the irl you input there
What dies
for the .NET library, does the AuthDiscordBotListApi extend DiscordBotListApi (i.e does the auth client have the same capabilities as the base, plus auth things)?
Why do you not just use the ObjectBrowser?
node version?
update to v8
update to current, I mean its not buggy
Every 30 mins I believe
You can change it to minimum 15 mins with js new DBL(token, {statsInterval: 900000}, client)
mercy has done research
have you used the module
Nope, just found the source
I'd guess today, not sure if you can get if a user has voted ever anymore. I'll have a look
@hot oxide It's whether they have voted today
Np
I'm using hasVoted in Javascript. My promise is setup and the token is correct. Voting for my bot says I have already voted today. Using getVotes shows my ID. Is there any reason hasVoted returns false for me?
Is it deprecated?
@jaunty umbra Are you trying to check if a specific user has voted
Yes
Ok, thanks
Not deprecated
@jaunty umbra Are you sure you've voted in the last 24hrs?
Yes. I have attempted to vote throughout debugging this.
And each time, I get “You’ve already voted.”
I checked the package earlier and the endpoint it uses still works
So it must be a problem on your end (No offence)
None taken, I understand. Thanks. That’s very useful to know.
The only thing I can think of is that I am using a test bot, but the token is the same as my live bot.
Hold on, could you try editing a file in the package for me? In the node_modules/whateverthedblpackiscalled/src/index.js change ```async hasVoted(id) {
if (!this.token) throw new Error('This function requires a token to be set');
if (!id) throw new Error('hasVoted requires id as argument');
const response = await this._request('get', 'bots/check', { userId: id }, true);
return !!response.body.voted;
}
toasync hasVoted(id, botid) {
if (!this.token) throw new Error('This function requires a token to be set');
if (!id) throw new Error('hasVoted requires id as argument');
const response = await this._request('get', bots/${botid}/check, { userId: id }, true);
return !!response.body.voted;
}```
Then do hasVoted(userid, botid)
@jaunty umbra
Sorry if it's coded wrong, I'm on mobile
Oh. Interesting. I’ll try that when I have more time, but that might just work.
Thanks. I’ll write back if it works.
@lavish helm Yeah, that seems to work. Thanks a lot!
One more thing I think should be noted is that my dblapi.js dependency is at version 1.2.1, when 2.0.0 came out, that could've been a factor as well.
I just updated to 2.0.0 just to be sure and that also worked.
Exception in thread "main" java.lang.IllegalAccessError: tried to access method com.google.gson.Gson.newJsonWriter(Ljava/io/Writer;)Lcom/google/gson/stream/JsonWriter; from class retrofit2.converter.gson.GsonRequestBodyConverter
what did i do wrong
version mismatch
Gson.newJsonWriter is not accessible to GsonRequestBodyConverter
but how can I fix that @sudden rampart
// will return a list of the user IDs
List<String> voterIds = api.getVoterIds("bot id");
this list is always null
why
because the lib's not been updated after support for the onlyids query param was dropped
i need some help with the api : how to set the online status of the bot ?
make your bot online
oh yeah... it's not here
it haven't been kicked 😐
it just left the server
how can i add it again ?
you have to ask the mod that kicked it
oh
wait
just ask any mod
no one kicked it
- wrong channel
- you could literally copy paste the code from the image
Ah,
how to know if someone has voted for my bot ?
Last 1k votes
how does it works ?
how can i get who voted last 24h ?
Open the link
yeah ?
now look around
i already did that
but i don't know how it works :/
how can i use this
/bots/{bot.id?}/check
/bots/urBotID/check
Quick question from the docs "BOT_DISCORD_ID" is the client id right?
@vast junco
YOUR_TOKEN is the token you get from DBL
i guess
yeah, i think the id would be your client id and your token would be the dbl token
not discord
yeah
know how to get a dbl token?
I want to say "it's your bot's token" but that is misleading
dbl bot's token i guess
yeah
that's where you get your bot's api token
.
Dont ping random mods, just ask your question
there is a bug with API
my bot have 4 votes, and with getVotes() method it just returned array with 315 objects
monthly vs total votes
NAB, like natan said, it's showing monthly votes. The api is showing you total votes @hot oxide
is there any way to get daily votes?
As far as I know, not by default. You can set up webhooks and do your own daily vote logging though
hasVoted() also checking for monthly?
tbh, the votes endpoint should return an object with total and monthly properties 
Or a parameter or smth to interchange them
for each user? @restive otter
nah, actually what viction said
Well, the vote endpoint isn't really that encouraged compared to dealing with it all using webhooks.
thousands of bots using the vote endpoint ( a lot per command ), and some bots having up to 70k monthly upvotes, it doesn't do well
hasVoted() also checking for votes in month?
I don't know, I don't use the javascript module for it. I use webhooks
Same
im new to webhooks, it requires some URL?
You need a webserver to handle it
please no, ngnix an shit
no
express.js works fine
this works
i also need http module?
n-no?
read the readme
look at the code
are you talking about the require('http')?
yes
That's internal with node
sorry im oldschool i guess :S
literally all you have to do with that code is follow what the readme says to do, and then insert your own function on what to do once dbl tells your webserver that someone voted
webhook secret is bot token?
ok random string that i put in, like some password
i had to change listening port to 8080
should this work?
http://myip:8080/dblwebhook
your port 80 was already in use?
yeah
by what, do you already have a webserver running?
yes @gloomy brook i already have ngnix, installed long time ago, i jus stopped process with sudo systemctl stop nginx
but still port 80 is in use
nvm it works
ok, how can i be sure that webhook works?
yes and alert pop-up with text tested... bla bla
nothing happend after
is it ok to get this message in a browser?
yes
it is for post, not get
@hot oxide
You shouldn't be able to send a get request there, only a post request
ok, but looks like testing is not working :S
Webhook tested! This may take a few seconds
still nothing in my console.
Did you actually handle the post request
@gloomy brook any idea?
Webhook Successful!
after 5min lel
response looks wierd af
17|server | writable: true,
17|server | _bytesDispatched: 0,
17|server | _sockname: null,
17|server | _pendingData: null,
17|server | _pendingEncoding: '',
17|server | allowHalfOpen: true,
17|server | server: [Server],
17|server | _server: [Server],
17|server | _idleTimeout: 120000,
17|server | _idleNext: [TimersList],
17|server | _idlePrev: [TimersList],
17|server | _idleStart: 34411,
17|server | _destroyed: false,
17|server | parser: [HTTPParser],
17|server | on: [Function: socketOnWrap],
17|server | _paused: false,
17|server | _httpMessage: [Circular],
17|server | [Symbol(asyncId)]: 37,
17|server | [Symbol(lastWriteQueueSize)]: 0,
17|server | [Symbol(bytesRead)]: 0,
17|server | [Symbol(asyncId)]: 39,
17|server | [Symbol(triggerAsyncId)]: 37 },
17|server | _consuming: true,
17|server | _dumped: false,
17|server | next: [Function: next],
17|server | baseUrl: '',
17|server | originalUrl: '/dblwebhook',
17|server | _parsedUrl:
17|server | Url {
17|server | protocol: null,
17|server | slashes: null,
17|server | auth: null,
17|server | host: null,
17|server | port: null,
17|server | hostname: null,
Well yeah, you have to handle the request yourself
yeah, i fixed now everything
just Mods, keep in mind that getVotes() in most of the time return array with object of some random server with 319votes now :S I never seen those usernames, its not mine, my bot have 6 votes from begining.
I'm not sure if this is the right channel to ask, but can someone explain the difference between the ^ [NUMBER] thing on my bot's page and the [NUMBER] Upvotes under my profile on DBL?
@jaunty umbra the ^ [NUMBER] (the one that appears on the bot profile) shows bot votes for this month, whereas [NUMBER] Upvotes (displayed on your user profile) shows all time votes
Okay. Thanks!
what would the best way to recieve a webhook post to the bot be
i know many ways
but i can't think of a good way with little code
python btw
what do you use for data storage
Postgres
then why not store it in prostgres 🤔
halp
webhooks
python
how does it work
i want it to send a message to my server via webhook when someone upvotes
but within python
Make flask/sanic server,
Make endpoint,
On vote ~> do stuff for storing if you want to store the user here ~> push to discord channel with a discord webhook
confused as fuuuccc
Dbl pushing to your server ~> server receives message ~> server sends to discord



how to fix



