#topgg-api
1 messages · Page 50 of 1
yeah but it doesn't work 😕
I use the python library like this:
client 1: await self.dbl.post_server_count(shard_count=self.shard_count, shard_no=0)
client 2: await self.dbl.post_server_count(shard_count=self.shard_count, shard_no=4)
but it it doesn't add the server counts up
It's just like client 1 posts server count 2966 and client 2 posts 1428, but on the website it just displays the last one that was posted. Like either the first one or the last one, but not those 2 added together . . .
@plain timber
can i remove my server count once i put it on dbl?
it has to be removed by a website admin
Exists triggered gif api?
oml ok can can someone help me here
for the life of me i cannot find anything online about this damn api, the website is no help, it directs me to some page that says hello world and some page that says it doesnt exist, so i need someone to tlel me how the hell im supposed to get this server count logger thing to work
I suggest if its not related to dbls api you ask in development
it has to do with the api technically, cuz idk what the hell im supoed to do wiht this things API but alrigght if someone could help thatd be nice
So you want to post your bots server count on the site?
yes
on the website the only bit of code or api at all is the example on the api tab and ive tried so much but i cant figure out what i need to do to call the setup() function and not get an error
What library?
No
A simple API wrapper for discordbots.org written in Python - DiscordBotList/DBL-Python-Library
ok so is there any specific thing i need to look at in there
or like
just lok around until i find what i need
A simple API wrapper for discordbots.org written in Python - DiscordBotList/DBL-Python-Library
ok so that readme is the same thing thats on the website right and ive looked at it and i gave it my token and all, but the issue it that i need to vall that setup function, but it requires the bot variable, but
alright ill try my best
its too hard to explain
i think i have an idea
@fringe glen thanks bro sorry it is python i just saw those curly brackets and assumed it was js, imma try that cuz i alrady had the library and shit, do u have any advice on where to put that in my code like before or after everything else or what
in python theyre not nearly as common
ok so i put that code(with my token) and its giving me an error for async and shit its not recognizing them?
even tho i have them imported
and i use async and await in like a million other places
i put it in the begging hold on lemme moveit thats smart
still getting errors
oh i fucked up the indednts im rarted that makes sense
well in python u dont use the curlys its all whitespace based
it really is a much more modern looking langauge but its from the 90s
and 200s
2000s*
not 200
of python in general?
Python was created before JS 
Ok can we say that java is such a bitch to code in, not js just java but fr
its like taking a tank to the supermarkety
Java itself is a bitch
oml yah its so ass
too bulky for no reason
Wrong chat tho
oh aha
I knew it wasnt, just good conversation 
question again
@fringe glen
ok so that code isnt giving me errors but i wanted to make sure it was workingm so i added a print("shits happening") to the inside so it looks like this
url = f'https://discordbots.org/api/bots/{self.user.id}/stats'
headers = {'Authorization': TOKEN}
payload = {
'server_count': len(self.guilds)
}
async with aiohttp.ClientSession() as session:
await session.request('POST', url, json=payload, headers=headers)
print("Stuff happened")```
so i have a print thing right
so when i added it to my test server it would tell me
but i tired like a million times
ok so i tried at the begging and the end(middle is the on_message so that wont work) and it no work, so i tried it underneath a @client.event too, im really new to the discord.py library and the dbl library so thanks for all the help
yeah thats what i did i mean
do u want my code?
the whlething rn
ok its like 200 lines so its not gonna fit but ill put the necesary bits
import discord
import aiohttp
import dbl
import asyncio
import logging
TOKEN = 'blah'
client = discord.Client()
def level(aut, name):
f = open("levels.txt", "r+")
pos = f.read().find("%s" % aut)
if pos >= 0:
f.seek(pos)
if aut == f.readline(18):
f.seek(pos+18)
lvl = int(f.readline(5))
if lvl <= 99994:
f.seek(pos+18)
f.write(str(lvl + 5))
if lvl % 625 == 0:
client.send_message("Congrats <@" + str(aut) + ">, You are now level " + str(lvl/625) + ".")
else:
f = open("levels.txt", "a")
f.write(aut + "10000")
print("added %s to the registry." % name)
def levelcheck(aut):
f = open("levels.txt", "r")
pos = f.read().find("%s" % aut)
f.seek(pos + 18)
lvl = int(f.readline(5)) - 10000
return lvl
@client.event
async def on_guild_join(self, guild):
url = f'https://discordbots.org/api/bots/{self.user.id}/stats'
headers = {'Authorization': TOKEN}
payload = {
'server_count': len(self.guilds)
}
async with aiohttp.ClientSession() as session:
await session.request('POST', url, json=payload, headers=headers)
print("Stuff happened")
ok
i hope u can understand that
theres a lot of comments
ok
fized it
so thats whats before it
the rest is pretty much just using those functions and client.run(TOKEN) to start it off
thx again for helping me i know this isnt the most fun thing in the world @fringe glen
is that f suppoed to be htere
there
in the ur;
url
class?
also how u get those colors
ah
so the f before the url is supposed to be there
ok ok just making sure
@sly ledge it should be on_server_join(server)
since you are using async
Code: ```js
const express = require('express');
const http = require('http');
const app = express();
const server = http.createServer(app);
const { RichEmbed, Client } = require('discord.js');
const { get } = require('superagent');
const client = new Client();
const DBL = require("dblapi.js");
const dbl = new DBL(process.env.DBL_TOKEN, { webhookPort: 5000, webhookAuth: 'myPass' });
dbl.webhook.on('ready', hook => {
console.log(DBL Webhook running with path http://${hook.hostname}:${hook.port}${hook.path});
});
dbl.webhook.on('vote', async vote => {
const { body } = await get(https://hd-development.glitch.me/api/fetchUser?id=${vote.user});
let embed = new RichEmbed()
.setColor('RANDOM')
.setThumbnail(body.avatarURL)
.setAuthor('Hasuki DBL Webhooks', 'https://cdn.discordapp.com/emojis/338808864352763904.png')
.setDescription(***${body.tag}*** Just voted Hasuki\nWith ID: ${vote.user})
.setTimestamp();
client.channels.get('528781217274003470').send(embed);
console.log(User with ID ${vote.user} just voted!);
});
client.login(process.env.TOKEN);
client.on('ready', () => {
console.log(client.user.username + "online");
})
Not work, no error and course I have set at bot edit page like: `https://mydomain/dblwebhook` and pass. just won't work :/
Help
Some quick stupid questions.
How often should I post the server count? Is 30 sec ok?
Is it alright if I use the same token for my dev bot (will stop using it once I release dbl integration)
30 sec is too quick imo
I'll change it to like 5 minutes because it rarely updates anyway. But I still need an answer to the second question because idk if the api will get mad if the server count just goes from 2 to 50
Or not. I have a better idea. I should just update it when it changes 
bad idea
Why though?
lets say you have like 500 guilds
the discord api goes down and most of your guilds become unavailable
Makes sense. I'll stick to the 5 minute idea then.
Be more specific pls
str(len(client.servers))
lol
@restive otter do u mean this?
@restive otter post server count to DBL API
I use JS
oof
and btw how do u markdown python?
Huh
Same as you would do it in your client?
How can we have our token?
@wild zinc bot token?
For api
@wild zinc https://discordbots.org/api/docs#mybots
Going here, and then clicking on your bot name will show you the token for dbl
Assuming you are already logged in
Thank
no u
doesn't your bot need to be approve to get an api token
What's the max amount of entities DBL lets you retrieve in one request?
Is there a way to make a webhook that sends if people upvoted of someone other's bot ( with his permission )?
Like logging votes
Even with permission of the bot owner?
uh
I mean you upvoted for example lucas and tonkku allowed to me to check who upvoted for luca since he owns the bot ( I hope )
@restive otter you'll need to ask the owner to add the webhook settings
and it sends a webhook that Joyiscold#2552 has upvoted to luca.
also its luca not lucas
yes with owner permission
yes the owner will need to change the settings
but it doesn't matter where its set to go to
so it's not against the ToS
i dont think joyiscold knows what you are talking about, its not
yw
Code: ```js
const express = require('express');
const http = require('http');
const app = express();
const server = http.createServer(app);
const { RichEmbed, Client } = require('discord.js');
const { get } = require('superagent');
const client = new Client();
const DBL = require("dblapi.js");
const dbl = new DBL(process.env.DBL_TOKEN, { webhookPort: 5000, webhookAuth: 'myPass' });
dbl.webhook.on('ready', hook => {
console.log(DBL Webhook running with path http://${hook.hostname}:${hook.port}${hook.path});
});
dbl.webhook.on('vote', async vote => {
const { body } = await get(https://hd-development.glitch.me/api/fetchUser?id=${vote.user});
let embed = new RichEmbed()
.setColor('RANDOM')
.setThumbnail(body.avatarURL)
.setAuthor('Hasuki DBL Webhooks', 'https://cdn.discordapp.com/emojis/338808864352763904.png')
.setDescription(***${body.tag}*** Just voted Hasuki\nWith ID: ${vote.user})
.setTimestamp();
client.channels.get('528781217274003470').send(embed);
console.log(User with ID ${vote.user} just voted!);
});
client.login(process.env.TOKEN);
client.on('ready', () => {
console.log(client.user.username + "online");
})
Not work, no error and course I have set at bot edit page like: `https://mydomain/dblwebhook` and pass. just won't work :/
Help
yes
that code can't work with glitch
wdym
yeah make that on vps
then in bot edit page like http://my.ip.here:port/dblwebhook
yeah
This is my code of posting server count. It isn't working.
bot.on('ready', () => {
dbl.postStats(bot.guilds.size, bot.shards.Id, bot.shards.total, bot.serverCount);
}, 5);
});
Language: JavaScript
Library: discord.js Commando
Version: 0.10.0
@plain timber
@restive otter I'm not sure if it's the same on commando but for discord.js I use this ```js
// POST SERVER COUNT TO DBL
const DBL = require("dblapi.js");
const dbl = new DBL(${cfg.dblapiKey}, bot);
dbl.on('posted', () => {
console.log('MarksBot Guild count posted! - Bot Ready');
})
dbl.on('error', e => {
console.log(Oops! ${e});
})
//END POST SERVER COUNT TO DISCORD BOT LIST```
You'll need to npm i dblapi.js if you've not already done it and change cfg.dblapiKey to your token etc
Show your code
Well did you get an error?
I'm going to guess it was a copy/paste job @spiral steeple 😛
how would I get the users who upvoted my bot in discord.py?
@latent ocean you can either use the http api directly, or you can use dblpy
iirc dblpy is outdated and partially broken
what is password in webhookAuth
nvm
I do not know if Discord currently supports POST requests from websites' links embeds and I don't think so. But if it's the case here is a suggestion:
The Embed for https://discordbots.org/bot/:ID/vote would contain a discord button <vote> which would make the discord User who clicked vote automatically, without having to visit the page / quit Discord.
what about oauth ?
@indigo shoal what do you mean?
you have to login to vote, you login with oauth
otherwise how does it know its you?
yes but this happens outside of discord
Whereas if a discord user clicks on a button from discord, you would already know it's him 🙃
Question:
Everywhere in the documentation, it is written that "Users can vote every 24 hours for each bot". However it's been a while and I'v always read on the website and tested with success that it is now 12 hours.
So I'm wondering, does the individual UserID voting check (GET /bots/{bot.id?}/check?userId=user.id?) is still checking for 24 hours or now only 12 hours?
Am I supposed to know if the DBL webhook is working
like by visiting the page
I get a 404 when I try to go to the page and I've opened the port & everything
when you open your webhook url in the browser it makes a GET request, the webhook uses a POST request
if you get a 404 that means it does work tho
The test button doesn't seem to return anything when logging on vote, not sure if the test is supposed to trigger on vote
does get_upvote_info return the list of everyone who voted or only the new voters since the last call?
Everyone
rip
@restive otter this channel is only got asking for help with the DBL api
Also don't tell people to DM you, just ask your question in the server
Oh u deleted ur message
Is there a way to only get the new peeps who voted and not the other ones?
@sand hazel @plain timber
webhook?
with that get_upvote_info
no
So theres no way to get the new voters id?
Well I don't know how to use webhook :l
well shit, too bad
Darn couldn't you make the basic? Just getting the list? I'd probably be able to do what I need it to do
Webhook is pretty basic
Eh
cant you just compare the old list and the new list @latent ocean
True, but what if the application turns off and back on, will it keep the old list saved? And what if someone votes twice (2 different day)
just store it in a db??
@latent ocean make a gateway that receives a vote and puts it in a database then fetch from the database whenever needed
is there a way to add more than 1 reaction of the same type to a message?
use custom reaction
thanks, is that in the official api?
Is the api usable even if your bot isn't registered on the list?
@tender pine he means just react with a custom emoji
i see. I meant to add more than one exact same emoji to a message (bad wording on my part), but i dont think its possible
@plain timber thanks for the answer tho!
Is DBL going to yell at me for querying /bots/bot_id for every bot displayed on the page?
Isn't that api abuse
How is that API abuse?
Over requesting using the api
I mean I'll happily use an API endpoint that will return data for multiple bots if we are provided one
The thing I'm doing is if server is in cache it will display top 3 bots from the server. So it's max 3 requests per server page
Basically data I need is URL to DBL, avatar, username and short description
If those only I guess ok since other bots are using it too
I'd suggest adding returning multiple bots from /api/bots/bot_id so we could use it like this api/bots/123,456, that would return data for bots with IDs 123 and 456.
It would reduce amount of GET requests going to the API and could be found useful by some members.
Not sure if this is already supported through /api/bots as I couldn't manage to get data for 2 separate bots searching by their ID.
@lyric wasp what are you going to do with the data?
Lemme get you screenshot
Easier to explain
Bot I'm working on has some kind of server list integrated in it
(If guild owner allowed their server to be cached)
I could cache bot data myself but why reinvent the wheel when I can give traffic (Humans browsing the site not API calls of course) to DBL as well and use their data /shrug
That's a bad idea.. but alrighty
What is?
Give me feedback so I don't work on features that will be deprecated in few weeks
You could just use the bots endpoint and filter for the bots you're looking for
Isn't bots endpoint going to return random 50-500 bots
Note that I only have bots ID stored
Only way to find the bots is to query /bots endpoint until I find all bots I need which is extremely API abuse
"Not sure if this is already supported through /api/bots as I couldn't manage to get data for 2 separate bots searching by their ID."
Also isn't querying /bots and searching essentially same as /bots/bot_id
I mean this
id: botId id: botId
not sure if it works like that never actually tried
but worth a try
I tried http://discordbots.org/api/bots?serach=id: 264811613708746752
no space
Same response
Do website admins hate being pinged
Because I think this is something only they could answer (If it counts as API abuse)
Not exactly sure how you even query it for 2 results because you can't have spaces in links, tried + and , to split it doesn't seem to work
%20?
I tried %20, ',', space nothing works
Querying this for all the IDs is same as /bots/bot_id tbh
It's /bots/bot_id but just different endpoint and different way of doing it
It's probably more aimed for searching for other fields like username for example then
Yup
{
"status": "success",
"data": {
"id": "235088799074484224",
"name": "Rythm",
"description": "Ever wanted a bot specially made for music? A fully functional, stable music bot? Rythm does it all",
"page": "https://discordbots.org/bot/235088799074484224",
"avatar": "https://images.discordapp.net/avatars/235088799074484224/16c197c4c3f0eb808f9bceb6e1075e71.png"
}
}```
Just finished this endpoint in my API, just need greenlight from admins
So what if 61 people use the same command at once are you fucked?
anyone know why I am getting a Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object. at DiscordBotsList.Api.DiscordBotListApi.<GetBotAsync>d__6`1.MoveNext() --- End of stack trace from previous location where exception was thrown ---
(.NET, C#)
when ran via Visual Studio I get
How is it decided which bots are trending?
its just new bots that get a lot of votes
MHM
MHAHAHAHAH
I need help with Craig bot
@undone mauve
a) Wrong channel, this is the support channel for the Bot List's API
b) Try asking in Craig bot's support server
@spiral steeple that’s why you use webhooks or cooldowns (or caching where applicable)
if your users rate limit you, that’s your fault
Is it 60/guild/min?
60/minute/ip
Oh
ip = your machine
Everytime you make a request it returns what you have left and when it resets right?
Rate limit remaining i mean
can someone help me with this ipstack API?
atleast help me enough so i can get a basic understanding
@restive otter this channel is only for the DBL api, as you would know if you read the channel topic -.-
but its discord related and i rlly need help :<
Well it doesn't belong in this channel
You can ask in #development but idk if anyone will know the answer
Try just looking at their docs?
Or asking them for help
Instead of people who have no idea what you're talking about
@lyric wasp might be late, but I doubt you can "serach" a bot (msg sent yesterday 3:07 pm EST)
Oooo
Remember?
teddyfit GAR?
@humble bison thx more making me think my bot got acepted
@restive otter I tried to help you via dm and you blocked me 🙄
Smh
Yep
bois
guys im an idiot and cant figure api out
im working with js
how do i check how many servers my bot is in
and how should i run the api
like through visual studio
someone please help
ive been going down a rabbit hole of api nonsense
i really need help
i just want to see how many servers my bot is in
i can understand any of this
please ping me if anyone can help
please someone
help
Have you tried googling it? @lean plume
@civic gorge Ill help you in a bit okido?
Did you use Nuget to download the dependency?
Because if it can't find the only sub-dependency I'm worry
i assume im not allowed to @ roles
or @ random staff members
even if theres something i think needs looking into
dbl votewebhookk???
I have an issue with "discord.on_reaction_remove(reaction, user)":
Parameters:
reaction – A Reaction showing the current state of the reaction.
user – A User or Member of the user who removed the reaction.
However, for me, if the bot (client) removes a reaction, the user parameter will not be the client.user but the reaction.message.author (the user who originally added the reaction).
Is this behaviour intended? And is there a way to get the user who actually removed the reaction?
@vital anvil yeah I used nuget
@shrewd burrow that's correct, what do you need?
@mossy scarab what about it
@tender pine this channel is only for the DBL api (as it says in the channel topic), for that go to #development and make sure you say the lib and version
@plain timber two people were able to vote multiple times, without incrementing the vote count but triggering the webhook
Yeah, that happens often
.
How to use the dbl api
you need general knowledge about how to use an api
I mean discordbotslist api not general api
@willow fiber https://discordbots.org/API/docs
How to setup a DBL Webhook
@willow fiber what language
Node.js. I already put the Webhook's code but how to activate the webhook in a channel on my server
It has nothing to do with discord webhooks
If you want you can code your bot to send a message in your server
I mean how to alert when someone voted my bot
How
In the on vote function change the console.log code to whatever you want to do when they vote
Did you set it up on the page?
yeah
@civic gorge I'll see if I can reproduce it
Alright
host name what webhook id ??? @plain timber
Python
I get this everytime i run the cog/extension.
I have put the right token but still i get this forbidden error
What am i doing wrong?
I think the python example is outdated
Where can i find the new one
Nvm, i found it
(dblpy is kinda outdated, either way)
Kinda? 
@mossy scarab can you talk in actual English so people can understand you
@toxic hazel you would be better just using aiohttp to post it
Do you have like a working example of it @restive otter?
You could check source code of dblpy
@smoky stream English pls
Well one of the rules is to speak English
If you want, use Google translate
https://goo.gl/bpNbU
Google Translate
Google's free service instantly translates words, phrases, and web pages between English and over 100 other languages.
I have a problem with this code there, I put it in my main.js but it still does not work.
It shows me the ready but it's written to me nothing in the console when a person votes
@plain timber
Did you add the webhook settings in your bot's edit page
I don't no
I just found, I have to put it like this?
https://discordbots.org/bot/459470182855737366/edit
@plain timber
Yes there are two webhook setting fields at the bottom
The url and the authorization (password)
The second is mandatory?
yeah, unless you want people to make unauthenticated call to the endpoint
Ok
I just did everything you told me to do but nothing works yet: x
@sand hazel
I'm sorry but I will have to sleep but we will resume the conversation tomorrow because I still have not solved my problem: x
Ghost ping 
What
@untold sparrow best profile picture
So i keep getting this error, I installed dbl and inputed my token```
Oops! Error: 401 Unauthorized
@drifting nebula are you using a dbl api lib? 401 means no or invalid token
That's the url to the webhook endpoint on your webserver @restive otter
Did you code the webhook yet?
nope, xd
Well do that first
Can anyone help me with how to listen for votes with C#
@summer pine you want to run code when someone votes?
Yes
Set up a webserver and use DBL webhooks

I setup everything regarding the webhook on vps & dbl bot site.
I put the IPv4 of the VPS on DBL, connected it to the bot with the authorization
But testing doesnt work at all
ping me when you reply
gonna need more info than that
how can i vote lock 🤔
just check if they have voted when they run the command
anyone selling an OVH
??
ovh??
?
anti ddos
ovh is a vps company
Oohhh
?
ovh
w h a t
Yes
ovh
We cant sell it because its theirs
@errant echo more info plz!
do we have to use a lib or can we do it our self (updating guild count)
however its better to use a lib since the lib will be updated if the api is
otherwise your things using the api will break
LMAO
@faint sleet what u set it on the site
?
In your bot's edit page there is a password field
Yeet
can you test for me?
How?
Send me your bot
unless i can emit
yeah basically
const dbl = new DBL(client.config.dbltoken, { webhookPort: 8080, webhookAuth: client.config.dbltoken });
wait..
the default one is /dblwebhook
Hm its not working
will options.webhookServer: (ip) be correct?
?
this makes no sense...
Wait fam just gonna make sure dbltoken is not your DBL token
i just set my password to dbl token cause im lazy .-.
Not recommended but aight
That's normal
o
:wesmart:
now how could i votelock 🤔
Store votes in a db
When a command is run check if their id is in the db
Make the DB entry expire after x time
and after 12 hours remove it?
Yuh
ah seems ez
@errant echo Please don't ask here
where do i ask then

Is there any other ways to sort bots other than points?
@little harbor thanks
How can I get when a user votes without a webhook?
u cant
thats how u make a webhook right js dblvote.webhook.on('ready', hook => { console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`); });
so why does it say you have to use a webhook if you have over 1k votes/month, that implies there is another way of doing it?
?
If you really wanted to, you could run a loop that makes a request to the vote endpoint. Would be way better and more efficient to just use webhooks.
Basically make a webserver that accepts POST requests to an endpoint and interpret the body
Ok
const listener = app.listen(process.env.PORT, function() {
console.log('Your app is listening on port ' + listener.address().port);
});
const DBL = require('dblapi.js');
const dblvote = new DBL(process.env.DBLTOKEN, { webhookPort: 3000, webhookAuth: process.env.DBLAUTH });
dblvote.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dblvote.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
```Im starting webhooks
its wrong
What's wrong
its wrong but are you actually going to give us the error or do we just have to guess
lol
error isnt catched
i mean unhandled
const express = require("express");
const app = express();
app.get("/", (request, response) => {
console.log("Ping received!");
response.sendStatus(200);
});
// listen for requests :)
const listener = app.listen(process.env.PORT, function() {
console.log('Your app is listening on port ' + listener.address().port);
});
const DBL = require('dblapi.js');
const http = require('http');
const server = http.createServer(app);
const dbl = new DBL(process.env.DBLTOKEN, { webhookAuth: process.env.DBLAUTH, webhookServer: server });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running with path ${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
app.get('/', (req, res) => {
// ...
});
server.listen(3000, () => {
console.log('Listening');
});```
thats what im running on
what
const express = require("express");
const app = express();
app.get("/", (request, response) => {
console.log("Ping received!");
response.sendStatus(200);
});
// listen for requests :)
const listener = app.listen(process.env.PORT, function() {
console.log('Your app is listening on port ' + listener.address().port);
});
const DBL = require('dblapi.js');
const http = require('http');
const server = http.createServer(app);
const dbl = new DBL(process.env.DBLTOKEN, { webhookAuth: process.env.DBLAUTH, webhookServer: server });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running with path ${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
server.listen(5000, () => {
console.log('Listening');
});```
it doesnt work
no error
does anything appear in the console
other then my regular things
no
Bot is online!
Server count posted!
Ping received!
- abunch of other commands loaded
you're not getting listening! ?
yeds tonkku
then your http server isnt listening successfully
Hi, i have a bot on DBL, how can i post the servercount to its page?
@ebon dragon read the docs
I love how the docs tell people to come here if they have questions and then we tell them to read the docs
I love how the docs even provide examples for posting server count
@sand hazel what info do you need
I need someone to help me with the webhook tbh. Everything is connected but testikg doesnt work
Did you save
yo, I need help
is the webhook url really supposed to be http://0.0.0.0:5000/dblwebhook
also, if I vote, nothing happens
it returns Unable to connect
pretty sure you need to have it pointed to a website or discord but I could be wrong
because https://0.0.0.0 isn't a website
@restive otter 0.0.0.0 is local host
basically you are trying to send a webhook to dbl local host
and thats not what you want because why would you send it to dbl local host lmao
what you need to put there is <ip of your server:port opened for it>/blabla
yes
ipv4?
well its fine even ipv4
it has to be your public ip
ok
it doesnt work rip
http://ip.ipi.pip.ipi:5000/dblwebhook is my webhook link
nothing happens in my console either
I have a weird issue, where one vote of a user, that is on my guild is counted as an anonymous vote, which would only be when he's not on the guild.
He made sure he's logged in with the right account (Also has only one account so that's that.)
Any ideas why that could be the case?
help me setup vote logging xD @hoary timber
What API/Library?
javascript
Can't help with that
oh
wait
how does your weebhook url look like
is it like the one i sent earlier?
hm
I don't say my port for reasons
yeah i get it
But my bot listens for it and gets the info with help of DBLs vote-library
And then performs actions depending on if user is on guild or not
hm
But this issue really bugs me right now....
My bot doesn't see any votes even if I (hopefully) did everything correctly.
My webhook URL is https://public.ip.that.starts.with.83:5000/dblwebhook and my password there is the same as in webhookAuth in my index.js file
I have my listener setup with a simple API that allows you to create a webserver-thing....
if you are hosting in a home network you need to configure your router @restive otter
on how to do that, well just google it
Err hi. I get a Forbidden (status code: 403) whenever I try to post the servercount
I am using the github example with the correct token
It worked once
and has now stopped updating
dont know what happened but its now sporadically working again
use the dbl token
If it's the py lib, it has some issues
If I'm running my bot on glitch, should I get the IP of it and put it on the webhook?
If I want to use webhook.
@blazing umbra use https://projectname.glitch.me/dblwebhook
Oh. I see.
but if you are using express (or another webserver) and dblapi.js in the same project, you must connect them to each other using dblapi's webhookServer option
@plain timber what should I do if I host it at home
or dblapi.js won't work
Okay okay. Thankss.
@restive otter use your public ip
is it the one that shows up when I write what's my ip?
hm
but make sure its exposed or whatever
you'll probably need to modify your firewall settings
Is there any other ways to sort bots other than points?
Does it take time for the voting webhook to take affect if I change the webhook url?
or should it take place immediately?
ah nvm, tried updating once more did the trick
@clever rock its my home network on my plex server thats online 24/7
then you need to route it where you want in your home network
scroll down
const DBL = require('dblapi.js'); const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
Where is the password?
🙃
Anyone here have their bot on glitch and uses webhook?
hey guys can you tell me why theres three question marks for my online status? this bot got approved yesterday and with my other bot everything is working fine.
@calm zealot the bot isn't in the server, it might have been kicked (see #mod-logs)
@blazing umbra if you use express and dblapi.js you will need to connect them using the webhookServer option, and the url is https://projectname.glitch.me/dblwebhook
You mean by using express is this?
const http = require('http');
const express = require('express');
const app = express();```
Yes if you use an express webserver and you want to also use dblapi.js you have to connect them
I am sorry i cannot find any ban or kick information in mod-log. what can i do?
@plain timber How?
I am having an issue with my API connection:
dbl.errors.Forbidden: Forbidden (status code: 403): {"error":"Forbidden"}
using the standard python code from the website:
class DiscordBotsOrgAPI:
"""Handles interactions with the discordbots.org API"""
def __init__(self, bot):
self.bot = bot
self.token = SETTINGS.dbl_token
self.dblpy = dbl.Client(self.bot, self.token)
self.bot.loop.create_task(self.update_stats())
async def update_stats(self):
"""This function runs every 30 minutes to automatically update your server count"""
while True:
logger.info('attempting to post server count')
try:
await self.dblpy.post_server_count()
logger.info('posted server count ({})'.format(len(self.bot.servers)))
except Exception as e:
logger.exception('Failed to post server count\n{}: {}'.format(type(e).__name__, e))
await asyncio.sleep(1800)
Ada apa ini
Forbidden means incorrect authorization
the server administrator for that website doesn't allow the action you're trying to make it do, so it will come back with 403: forbidden authorization
@restive otter use a domain so you can update the ip on the dns
im using noip
eg with cloudflare's api
is cloudflare free
yes
you'll need to tell it that
Could anyone help me with the connection for webhooks? (voting)
I believe I have everything setup correctly, but the test doesn't seem to be working
Fixed finally^^
@restive otter you on discord.js?
mhm
@blazing umbra if I were to use bot.users.get(vote.user).tag to get the users tag
That'd work right?
Need to be sure cause multiple restarts would f some things up rn
And how would I use the persons tag in the msg
(I don't code with discord.js normally only using for dbl)
I'm not sure tho.
What is supposed to happen if you setup the webhook correctly and press test?
iirc nothing for you to notice, it like pings your webhook checking if it even exists or something
So how can I test it works?
ask someone to vote or something
Okay thank you
It says webhook is running but nothing happened when someone voted
This is what I used where xxx is where my password is js const dbl = new DBL(`${cfg.dblapiKey}`, { webhookPort: 6275, webhookAuth: 'xxx' }); dbl.webhook.on('ready', hook => { console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`); }); dbl.webhook.on('vote', async vote => { bot.channels.get('544641898900619265').send(`${vote.user} just vote for MarksBot`); console.log(`User with ID ${vote.user} just voted!`); });
I get this in the console
Webhook running at http://0.0.0.0:80/dblwebhook
and im using noip to use my ip as a subdomain to use in dbl.
the link is myepicnoip.noipwebsite.net:80/dblwebhook
What am I doing wrong?
thats not the actual link, but you get what i mean*
do you have http://
How do I get the total votes of my bot?
@bold edge did you edit your bot page and enter the link? also, is port 6275 open?
@restive otter Yes the port is open and the correct link is in the bot page.
its literally my domain http://mydomain.com:6275/dblwebhook
hm
Does dblwebhook have to exist on the server?
if you want I made a little handler for the webhook voting process and parses the votes for you
basically you just start it as a different process
Can you send it my way , it's worth taking a look @clever rock
https://github.com/Deivu/Haruna
its an api on its own that takes votes from dbl via webhook, and stores it via enmap so that its not a pain to set it up @bold edge
Simple webhook vote handler for Discord Bot List https://discordbots.org/ - Deivu/Haruna
Thank you @clever rock
@quartz heron the password is whatever you set, it just has to be the same password that you set in your bot's edit page
The port can be any open port on your server
stop
what
sorry, spam bot advertising in channels earlier
k
@restive otter DBL webhooks are not related to discord webhooks. You will need to receive the vote webhook post request on your webserver.
If you use JavaScript you can use the dblapi.js package which will handle it for you.
Hi all, how can I do that when someone votes for a bot it sends a message to a specific discord channel
dbl.webhook.on("vote", vote => {
console.log(`User with ID <@${vote.user}> just voted!`);
client.channels.get(channel.id).send(`User <@${vote.user}> just voted!`);
});
have fun!
literally the code above you, with just an extra simple line of code
uh whats the error
undefined
..what is undefined? @restive otter
votes.size undefined
🤦
Is votes an array? 
because we have no idea what youre trying to do and how
Objects don't have a size property.
https://npmjs.com/dblapi.js
use the official api wrapper
@rocky fossil the official api package is https://npmjs.com/dblapi.js
ah, mb. Thanks. Corrected my mistake
and uh what are you expecting to have a size property @rocky fossil
and why is it an issue that it doesnt have one
I was answering Xention's question
oh
i'm posting the bot server count now
but it says two servers which is wrong
https://discordbots.org/bot/522866622407376948 my bot count isn't two servers 🤔
It took my bot a little while for it to update the count.
idk if that is the problem though
but it started and the first time it said it was 2
🤔 Was the code added after the bot was in the added servers?
that part took my bot a little bit to update.
yeah my bot didn't jump from 2 to 45
ah that will do it 😄
much better ty
Ehh how do we actually make it so when someone votes the bot sends a message on a text channel saying who voted .. like what do we do with the api?
@restive otter #development
He literally asked "how do we actually make it so when someone votes the bot sends a message on a text channel saying who voted"
Without development that wont work
Using the api
He is coding a bot
With the API
And he is wondering how he can make such command
with the api, so he is in the right place
🤦 fine
Its litterally not a command.
@restive otter stay in there then, sorry for multiple pigns
@spiral steeple if its not a command how is he gonna trigger the code wtf
So how do we do it

Listens to a server
Wut
Do you have the dblapi.js lib installed?
Yes
Vps
Alright, so you know it's ip, yes?
You're going to want to make sure the port you're listening on is open aswell
Aight
Head over to your bot's page and hit edit
scroll all the way down
Theres a place for webhooks
✅
Alright, so in url
you'll want to put http://YOUR-IP:PORT/dblwebhook
iirc the default port is 5000
Aight
it's what I use anyways
Authorization can be whatever you want, but you'll need to remember it for later
I haven't changed anything for the port so mine should be 5000 as well
http://myip:5000/dblwebhook like this ?
if myip is the vps's ip, yes
✅
or he just cencored it
I know
Some people dont always understand
So you just have the basic
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});``` in your actual file?
You'll want to go on the docs https://discordbots.org/api/docs#jslib
Line
This is basically all that it will event to, but instead of logging, send to a channel
✅
webhookAuth is what you made it as on the bot page, correct?
(F me. .. I need to figure out how to use broadcast Eval the right way re in order to get all the channels probs pass a function )
And yes I think so
well all you have to change if the auth is right, is the vote event
Does voting not work on the site?
Hey
so i am trying to make it so the bot posts a message on a text channel whe it gets voted
const DBL = require('dblapi.js');
const dbl = new DBL(re, { webhookPort: 5000, webhookAuth: 'webhookAuth' });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
bot.channels.get('521253781254701058').send(`User with ID ${vote.user} just voted!`)
});
``` and it doesnt work
@restive otter error?
@short glade is there a way to test the webhook without having someone to reallyvote?
yeah, there is a event for such thing but i dont remember the name, lemme see if i can find it
Scroll down to Testing Events @restive otter
lel
yes it is on site
it says test webhook
is there a way to make it so u get the users name , avatar etc?
the object the webhook returns contains a property called user
user is the user_id of someone who voted
I already say that user contains the user_id of someone who voted, and you said You know, yet you asked again that you want the name?
is it this https://discordbots.org/api/docs#bots
I do realise that vote.user shows the id of the user who voted but i want to get the guys name
@name
then you should have realized client.users contains the ID of users that may contain that ID
he wants username
yes Im just not spoon-feeding the answer directly
user has a tag property
@restive otter You can by in <@!id>
yes but that wont show properly if the user isnt cached
i just did
and it will say invalid user i know
i was just trying to find a way for it say the Username and discrim but ok
sighs.
client.users.get(USER).tag
how can you not realize that
dude
:V
I already said ID of the user who voted, and client.users contains the users in your bot.
all you need to do is try to get the user from client.user using the value you obtained from the vote. Done
Webhook is working perfect just need to get the name as Saya said
hi
@mossy scarab s.a, hi
aa türk
@stable elbow iae
@restive otter ```js
funo.guilds.get(config.logServerID).channels.find("name", config.logChannelName).send(new Discord.RichEmbed()
.setDescription(User ${await getUsername(vote).username}#${await getUsername(vote).descriminator} just voted!)
.setColor('BLUE')
.setTimestamp()
)
name 
@short glade naber Türk.dd
@restive otter Iyidir knk, sen?
Aslinda, turk sayilmam, isvecliyim, ama turkce biliyorum
Hi!
Does .hasVoted(id) fully work or is it worth storing votes in a database?
@ripe linden it works but iirc it can take a while to update
It's best to use webhooks
Ah ok thanks
regarding the vote webhook, how the heck do i even set it up
@plush ore you need to set up a webserver to accept a POST request DBL will send to the specific URL. If you are using JavaScript then you can use dblapi.js: https://discordbots.org/api/docs#jslib
for other languages you will need to set up the webserver yourself
@toxic narwhal you only send shards and servers to DBL
There's no point in showing cached users, it's a useless stat
okay
i set the server myself because the js wrapper wasn't working. the requests go through fine. i also parse the request into a json format.
but my question is, if weekend double vote thing is active, would the post request of "type": be is_weekend
true probably
so
dbl.webhook.on('vote', vote => {
client.channels.get('545963588251156480').send(new discord.RichEmbed()
.addField("New vote on", "DBL")
.setColor('RANDOM')
.addField("User ID:", `${client.users.get(vote.user).id}`)
.setTimestamp()
.addField(`Attempt to mention `, `<@${vote.user}>`)
.addField(`Tag`, client.users.get(vote.user).tag )
.setThumbnail(client.users.get(vote.user).displayAvatarURL)
)
});
``` this is my code and .. by default when someone votes for 1 of ur bots it will post it now what i want is to make it so it says the name of the bot the user voted for .. cuz if someone votes for 1 of ur bots it will still be logged .. not sure if u get what i mean
basically it doesnt really matter for which bot people vote for it stillposts it .. thats not treally my problem.. i just want to make it so it says name of the bot it voted for
client.user.username?
Im not sure on what you want
so Im assuming the bot where that vote is from
yes thats what i want but client.user.username gives the name of the bot the message is sent by
so Im assuming the bot where that vote is from
yes considering you are running that server in your bot's code
i got one bot which is votes manager and then 2 other bots which are on the list.. i have made it so when somoene votes my manager votes bot [posts a message
but it doesnt clarify for which bot the person voted
you can create 2 api listeners then
that isnt running on your bot
one will handle one bot
hah?
basically make 2 api servers (webhook listener) in other ports so you wont get problems sorting votes for each
aight
i keep the url of the webhook the same but i just change the tokenn on the webhook ?
you have 2 bots right?
yes
basically change the port only.
1st bot http://blabla.com:3000/
2nd bot http://blabla.com:3001/
1st bot listens to 3000
2nd one listens to 3001
i did that ... so now how do i make it so it says for which bot the vote was
witht eh cleient username it just says VotesManager
or just http://whatever.com/<bot id>
so you can use the path to know which bot it is
on your votemanager
try to see what port the vote is from
so for example its from port 3000, and u put port 3000 on your bot 1, then its from bot 1
you can use the same url and the request body has the bot variable
wut


