#topgg-api
1 messages · Page 66 of 1
He did say he figured it out
Is this the channel you can get help on?
No, #development
@daring lynx unless you need help with the API
from DiscordBotListAPI import API #import module
dbl = API(bot, 'dbl_token') #bot replace with your client
await dbl.post_guilds() #post guild count
@mild oyster
Not sure how that fixes the 403 problem
What's your dblpy version
You are importing dbl in file named dbl 🤔
Ug
Hh
Uhh
:OmegaLUL:
But official api doesn't have on_vote event
We will make it
Based on webhooks
dblpy has on_dbl_vote and on_dbl_test events
Mmm
Also, API wrapper is not "API"
Mmm
hi
please
i have that
(node:2214) UnhandledPromiseRejectionWarning: Vote locking is turned off.
how to turn it on ?
that doesnt look like it's coming from the official library, so please move to #development
It come from the « new-dblapi »
My code is in JavaScript and every time I run the code this happens
exit status 1
Can someone tell me what it means
@stray vessel for js you import by example:
const discord = require("discord.js");
ok
Also #development not here
10-4, my apologies
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)
Where do I get the /dblwebhook?
Thank you
You set it yourself 🤔
Set it myself?
Is it the url of the webhook or I'm supposed to get it somewhere from dbl site?
It goes to the webhook URL, aka http://yourip:port/{webhook_auth}
Depends ig
If that domain handled DBL requests, I mean why not
and if you're sure it exists
I think it is
But for some reason, though ngrok receives data from dbl
but it keeps raising 302 Found
They say it's not client side, but I think I'm doing something wrong here
Thanks anyway
Hi
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)
Is this correct?
And this also?
Because nothing happens when I click the test button
Do you have the on_dbl_test event?
@sullen nymph Sorry for the ping. Yes I do.
@commands.Cog.listener()
async def on_dbl_test(self, d):
print(d)
return
user = self.bot.get_user(d['user'])```
I've found someone's suggestion in this chat to forward the port 5000
Are you sure the URL you are entering is correct? 
Because I am out of clues other than to poke random solutions
I searched google "What's my ip?" and used the result
Is that ok?
It's http://xxx.xx.xx.xx:5000/dblwebhook
Eh ig that should do it
Is your firewall blocking any requests? Is your port open and are you forwarding to that port?
The owner of my place's router is not here so I'd try to forward it later
Thanks for the suggestion
hi
i have
const api = new DiscordBotListAPI({ port: 8080, path: '/some_insanely_secret_path' });
wich path should i put in "/some_insanely_secret_path"
basically whatever
if i haven't webhook ?
then dont put anything there
just
const api = new DiscordBotListAPI()
?
and my dbl token ?
const dbl = new DBL("", {port: 5000, auth: "Auth", path:"/vote/"})
const Dbl = new DBL("",bot)
const api = new DiscordBotListAPI("",bot);
dbl.on('vote', (vote) => console.log("J'ai recu un vote :\n" + vote))
Dbl.on('vote', (vote) => console.log("J'ai recu un vote de Dbl:\n" + vote))
api.on('vote', (user, bot) => console.log(`vote by ${user} for bot ${bot}`));
dbl.on('upvote', (vote) => console.log("J'ai recu un upvote :\n" + vote))
Dbl.on('upvote', (vote) => console.log("J'ai recu un upvote de Dbl:\n" + vote))
api.on('upvote', (user, bot) => console.log(`Upvote by ${user} for bot ${bot}`));
i try all this methods
nothing work
hot api
THIS CHANNEL IS ONLY FOR SUGGESTIONS/HELP/BUGS TO DO WITH OFFICIAL API LIBRARIES AND API DOCS FOUND AT https://discordbots.org/api/docs
Go to #development @olive tusk
s!ajuda
is there a way to get raw message content in discord.py? I can't find a way
it would help if I could get default emojis as their in colons counterpart
like how 🖐 is :hand_splayed:
are there any problems with the API, or do the key reset like every few months?
this works??
where should i use dbl api and can i find any examples about it
p!help
.
Please do not post dots to clear your messages/get attention. It adds absolutely nothing to the conversation and just causes spam If you need to get attention, then say hello everyone. If you need to clear your messages, then press the Esc key. If you do not follow these instructions you will be muted.
ok
how long does it take for the vote to be registered in the bot.
At most 5min
Should this work
should what work
.
dad dotpost @restive otter
Please do not post dots to clear your messages/get attention. It adds absolutely nothing to the conversation and just causes spam If you need to get attention, then say hello everyone. If you need to clear your messages, then press the Esc key. If you do not follow these instructions you will be muted.
why dad
hot api
THIS CHANNEL IS ONLY FOR SUGGESTIONS/HELP/BUGS TO DO WITH OFFICIAL API LIBRARIES AND API DOCS FOUND AT https://discordbots.org/api/docs
@restive otter ^
Sorry
How do I access the API?
Also I had a question...

About the api.

dad ask2ask
Dont ask to ask
Just ask your question
it wastes time if you say "i need help" or "can someone help me?" instead of just saying what the problem is. Save your time and other people's time and just ask the question.
Please read https://dontasktoask.com/ for an explanation on why this is an issue.
@restive otter ^
How do I get api status widget
Problem: Where does one put the API in a Python code that includes many cogs and files?
To be specific, How do i add it to my bot, in a new file/cog or in an existing file that starts the bot?
I just made it a new cog and now i get this error?
AttributeError: module 'dbl' has no attribute 'Client'
its DBLClient or something
Ah,
dbl nicetry @grizzled moat
Hey, any bots that have common prefixes are now blocked from reading any channel. Nice try spamming your dms though.
@runic grove yes, it is about the API
and all i get after adding my dbl token is that attribute error when i use the given code with it
i deleted them
realised it was a god damn stupid question
sorry that it made you confused
is DiscordBotListAPI.Builder().botId() something that you get once your bot is verified?
how to use the widgets?
p!y
that is not what this channel is about
@void hawk pls read the channel topic
@rugged crater Heres DBL Api
@amber dune ok..
error:
Cannot read property 'on' of undefined
My code:
dbl.hook.on('vote', vote => {
hook.sendMessage('Thanks for your vote!' + vote.user)
});
discord.js v11.4.2
hi
hot api @restive otter
THIS CHANNEL IS ONLY FOR SUGGESTIONS/HELP/BUGS TO DO WITH OFFICIAL API LIBRARIES AND API DOCS FOUND AT https://discordbots.org/api/docs
Hey
I need help to setup my bot on dbl
I'm using discord.py and i'd like to add the webhook
Are you using dblpy?
yes
https://github.com/DiscordBotList/DBL-Python-Library There's a webhook example in README.md
Your link will be http://ip:port/webhook_path
A simple API wrapper for discordbots.org written in Python - DiscordBotList/DBL-Python-Library
What's up?
webhook_path arg in DBLClient instance will have value'webhook' then
Try it without port 
Hold up, are you sure dblpy is running under that IP?
Try playing around with the URL
i've xhanged the url to the ip of my vps
it's not working
- why my bot isn't showed as connected ?
I'm confused on how to start my "vote command" or setting up this dbl thingy
I tried this part below on the image.
I did:
Installing dblapi.js
replacing yourDBLTokenHere with process.env.DBL ( my dbl token )
replacing webhookPort 5000 with 27017 ( MongoDB Compass ).
When I run the command, it console.logs the link with its port but when I click it, it doesn't show anything in browser.
The webhook port is a web server
A webhook in web development is a method of augmenting or altering the behavior of a web page, or web application, with custom callbacks. These callbacks may be maintained, modified, and managed by third-party users and developers who may not necessarily be affiliated with t...
Hello. Who can help me with discord api for .net?(https://github.com/DiscordBotList/DBL-dotnet-Library). I use my app token and id but I get 401 "Unauthorized" in tests
@worn quail port of the mongodb web server is 27017
that's not what I'm meaning. Is it a public webserver?
Localhost isnt public
ah
a webserver uses a public IP
can I connect to local or does it have to be public
so did I do it correct?
I think
I never mess with web servers much since I just directly access the dbl api

uh
this is is so complicated .-.
Can I have help with giving the server number over to show
aka api server thing
Replace 0.0.0.0 with your external IP
Should be
@restive otter dblapi.js autoposts server count every 30 minutes if you provide your Client to its client
It gives me this:
When I click it, nothing happens
When I run the command again, it says it already exists
Send a POST request to it
aka try putting that URL on the bot's edit page in webhook URL field, save it and test
rtd
wat
no need to call me a retard

rtd = read the docs i assume
Yes
I tested it & clicked the link again after I restarted
nothing happened
hello
who can help me with youtube api/
THIS CHANNEL IS ONLY FOR SUGGESTIONS/HELP/BUGS TO DO WITH OFFICIAL API LIBRARIES AND API DOCS FOUND AT https://discordbots.org/api/docs
How would I do the next step?
Hello Everyone
Instead of webhooks
can I just use a database?
I want to use mongodb
every time someone votes, it stores in mongodb
you won't be able to receive a vote without a webhook
but I have made the webhook
above
& added to bots website
containing my IP & the mongodb port of localhost
Ehh you'd need to handle requests in your code
that means.....?
You don't get your requests sent to mongo directly
You'll need to handle the data-saving part by yourself in your code
ahhh
Before I create the thing containing the user & vote amount, would this be correct though?
I tried the link and it does not open
why are you trying to open a mongoose and a webhook connection on the same port
try changing your webhook port to something else
have two connections on different ports, you got mongoose connection already, use that
i dont think having 2 connections on the same port is a good idea
so should I use the mongoose or the webhook port?
I'll make it 5000
Who should I inform about incorrect code example for the python client? on https://discordbots.org/api/docs#pylib
showing to use dbl.Client when it should be dbl.DBLClient
The link does not work when clicking it, I already generated a webhook in my server.
For some reason, it still does not work.
I don't get what I'm doing wrong.....
webhook port is 5000
IP is in code & bot website with the port
I connected mongoose localhost with 27017 in that code which means that after webhook port 5000 works, the vote.user gets added to database & is saved there.
Nothing happens when clicking.
Also when using the test button, nothing happens.
Here is a webhook I generated before...
My localhost:
What am I doing wrong at this point.....?
@restive otter errr did you just put a discord webhook in that field
Yeah
I did but hardly any of it makes sense lol
;-;
are you hosting from home?
if so do you know how to check your router wan ip?
if you know, check your router wan ip, and check if it matches the whats my ip result and google
How have a API For memes?
hot api @restive otter
THIS CHANNEL IS ONLY FOR SUGGESTIONS/HELP/BUGS TO DO WITH OFFICIAL API LIBRARIES AND API DOCS FOUND AT https://discordbots.org/api/docs
=p Virgoun bukti
One message removed from a suspended account.
regarding the hasVoted boolean in the api;
Does it only return true for a time period? 12 hrs? Or does it return true indefinitely as long as they have voted once?
The former and yes, 12 hours
If you want to make a vote-locked command, I would suggest using webhooks to hit ratelimits less :p
Was about to set up a whole SQL table just to store last voted times.
What are the rate limits on the dbl api?
60/60s as API docs say
60/min, sorry. I was on the github page, not the site

So I still probably need to store the data myself with a webhook 
Hello, I would like that my bot thank all the people who vote for him, for that I followed this doc:
https://discordbots.org/api/docs#jslib
but I can not find anything, it does not work, someone could enlighten me on how to do?
alright this sounds real botty but how would i create a webhook?
i wanna just see when someone votes and announce it in my server
Webhook is just a server running under some IP and port that accepts requests on the go
^
so i have to have a port open in order to see when someone votes for my bot?
are webhooks supported in the java library?
The reason I sent the link
you could just make your own
I have a website hosted, but when I put in the url and press test, it doesn't call the php file it's linked to
is that what the webhook is supposed to do?
it sends a post request iirc
I did a simple test where it's just a php file that mails my email some random text to confirm it got called
because it doesnt "open"
it sends a post request
not the typical get request a browser would when the link is visited
so it is getting called, just not in the same way my browser calls it?
so if I make it add the vote to a database now it would work?
read the documentation for more info. ive never used php and i have no idea how it works
well thanks anyway, I'll try making it throw the data into a database quick and see if it does something
await axios({
url: `https://discordbots.org/api/bots/${mentionedMember.user.id}`,
method: 'get',
})
why i get a 401 error when i try this, but i can get on there with Chrome
One message removed from a suspended account.
One message removed from a suspended account.
@halcyon zinc because your request in chrome is authorized
but you're not providing any form of authorization in that request
Hi, how can I get the IDs of the people who voted for my bot in the last month? So that I can give them access to some commands
bots/*/voted/?check=userid I think
can someone show me the diffrent widget ui's?
hotasapi @ember saddle
THIS CHANNEL IS ONLY FOR SUGGESTIONS/HELP/BUGS TO DO WITH OFFICIAL API LIBRARIES AND API DOCS FOUND AT https://discordbots.org/api/docs
@inner venture thx
Trying to get the api working so I can post my guild count to my bot, I copied this example from the docs and replaced the placeholders with my bot's info but it doesn't seem to be doing anything. Excuse my ignorance but can someone point me in the right direction?
class DiscordBotsOrgAPI(commands.Cog):
"""Handles interactions with the top.gg API"""
def __init__(self, bot):
self.bot = bot
self.token = 'dbl_token' # set this to your DBL token
self.dblpy = dbl.Client(self.bot, self.token)
self.updating = 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 not self.bot.is_closed():
logger.info('Attempting to post server count')
try:
await self.dblpy.post_guild_count()
logger.info('Posted server count ({})'.format(self.dblpy.guild_count()))
except Exception as e:
logger.exception('Failed to post server count\n{}: {}'.format(type(e).__name__, e))
await asyncio.sleep(1800)
def setup(bot):
global logger
logger = logging.getLogger('bot')
bot.add_cog(DiscordBotsOrgAPI(bot))
To add on I also have all the imports in the example as well
dbl.DBLClient
not the docs
Question, for the webhook our password can be anything we want?
and another question, how can we set/view the port?
"view" a port? I'm sorry?
hot api @jagged meadow
THIS CHANNEL IS ONLY FOR SUGGESTIONS/HELP/BUGS TO DO WITH OFFICIAL API LIBRARIES AND API DOCS FOUND AT https://discordbots.org/api/docs

can anyone tell me basicly what is api, how to use it on discord.jc, why do i need it and stuff like that
you dblapi.js
Are you posting your stats to the api
no
It doesn't happen automatixally lol
ok
after go to
POST to https://discordbots.org/api/bots/<your_bot_id>/stats with JSON {"server_count":<your_server_count>}
I think that's the correct endpoint
Try not to feed beginners
Can anyone basicly tell me what is API?
It really depends
at a basic level, its just some way to interact with some external service
in the case of dbl, its how you can interact with DBL to post your server count and other stuff in a way that a program can understand
with dbl, these interactions are done through HTTP requests
How do i find my api for servers?
@restive otter ^
# importing the requests library
import json
import requests
# defining the api-endpoint
API_ENDPOINT = "https://top.gg/api/bots/533383387763965982/stats"
# your API key here
TOKEN = "insertmytokenhere"
# data to be sent to api
data = {'server_count': 100}
data_json = json.dumps(data)
payload = {'json_payload':data_json}
headers = {"Authorization": TOKEN}
# sending post request and saving response as response object
r = requests.post(url = API_ENDPOINT, data = data, headers=headers)
# extracting response textp
pastebin_url = r.text
print("The pastebin URL is:%s"%pastebin_url)
Am I doing something wrong here? Can't seem to get this to post been trying to trouble shoot for a good hour.
Response is Error: Unauthorized but the Token is right I have checked it twice.
What's the response code? 401 or 403?
ur suppose to supply content type headers, instead of serializing the json and using data= use the json kwarg
401
what i mean is its most likely expecting Content-Type: application/json
Works just fine
That means there's something wrong with my token then right?
That code should work just fine, try regenerating the token
Yeah, I regenerated it and it gave me code 200, that means its good right?
yes

]]moreinfo
If you want people to be able to assist you, please provide more information, such as what library and language you're using, the code in question and what you are trying to do and/or what is causing the error.
Also, please try before just asking
Is there any reason the vote api would only work while the bot is running on my local PC?
As soon as I push my changes to my production server, the API stops returning data regarding voting.
Maybe some sort of whitelist IP dbl has?
Not that I know of
The hasVoted boolean returns nothing at all on my production server
Quite annoying
Like I said, works fine on my local PC
Are you using dblapi.js
Well not js
Whatever your using
I just default to that 
well i did happen to find out that i had to reset my api token due to the new website migration
I'm using the
API but ye.
how do I send the shard amount ? I'm using JDA (Java)
I'm creating the api object like this in my main class
public static DiscordBotListAPI api = new DiscordBotListAPI.Builder()
.token(Config.apiToken)
.botId(Config.botId)
.build();```
Then Im calling it to update the stats on guildJoinEvents with no problems.
The issue is calling it to check votes.
```java
Bot.api.hasVoted(user.getId()).whenComplete((hasVoted, ev) -> {
if(hasVoted)
DoSomethingHere();
});```
Resetting my token did not work either
Thanks for the suggestion though
Ah, I would offer to help if I knew anything about the java library for dbl
but my knowledge of java is limited to a one year course in school last year
why not try to make the request yourself?
I didnt use the library for java in dbl, but I do the request myself and it works
I may just need to try webhooks I guess.
Those are the better option in the long run aswell.
Anyone have experience using webhooks in Java?
@real frost yep, there are some example 40 line webservers in java where you can trigger functions when you receive a post request to a certain endpoint and/or port
the search term is http web server
that will get you the simple stuff needed for dbl webhooks
I was looking into using okhttp, is that the way to go to integrate with y'alls api?
i guess so
the library for vote checking stopped working on me >.>
yea the library is mega gay
but for some reason, setting stats works fine?
yea lol
I just have a webserver running in the same jar file alongside the bot
in the main method it starts up the webserver then the bot lol
seems unnecessarily heavy, no?
Do you mind posting an example?
Does anyone how to find out how many users your bot is listening to on .py
@polar mortar #development
Ok thanks
dbl.webhook.on("vote", async vote => {
console.log(`User with ID ${vote.user} just voted!`);
let voter = bot.channels.get('627797390556004352')
let membvo = await bot.fetchUser(vote.user)
let embed = new Discord.RichEmbed()
.setColor("GREEN")
.addField("**Received Vote**", "Let us thank "+membvo+" for voting for Project Genesis!");
voter.send(embed)
});
anything wrong with the code?
someone help plz
whats the error
are u getting logs?
why not await voter.send()
see if that logs anything
if not then im afaik its your port
@sonic zealot abajo no será
vote.send (embed)
comment créer un bot svp
@restive otter dm
-m @north breach spamming flags in #topgg-api | 6h
🤐 Muted proteção do Servidors#8674 (@north breach)
When I do the following in terminal:
$ curl -H "Authorization: MY_AUTH_HERE" "https://www.artybot.ga/dbl/wh?user=1343&type=test"
I get the expected response:
No-one should be looking at this :/
And the data is received and processed. However, when I use the test button for my bot, no data is processed. I have checked that the settings are correct, and have removed checking of the Authorization header (though it still errors if there isn't one), but still no luck. I checked logs on the server, and it seems that requests from DBL don't even include an Authorization header. My website uses Cloudflare but I don't think that should be a problem and it works when I test it... Any help would be appreciated.
Ah I fixed it to accept POST requests 🤦, but I'm still not getting anything...
make sure its a post and parsing body to json content etc.
Hey, can anyone help me out please? I have been getting these errors ever since I created a function to post my server count every 30 minutes, not sure why it's happening.
Here is my code (the function is being called in on_ready):
async def guild_count_update():
"""Updates server count on Discord Bot List/TOP.GG every 30 minutes"""
try:
API_ENDPOINT = "https://top.gg/api/bots/{}/stats".format(client.user.id)
data = {'server_count': len(client.guilds)}
headers = {"Authorization": TOKEN}
requests.post(url = API_ENDPOINT, data = data, headers=headers)
logging.info('Successfully posted guild count to DBL, {} servers.'.format(len(client.guilds)))
except Exception as e:
logging.exception('Failed to post guild count to DBL - Error: {}'.format(e))
await asyncio.sleep(1800)
Here are the exceptions I'm getting, it seems to be crashing the bot but my auto-restart script is bringing it back up (or it's doing itself one or the other):
WARNING:discord.gateway:Shard ID None has stopped responding to the gateway. Closing and restarting.
WARNING:discord.gateway:Heartbeat blocked for more than 5 seconds.
WARNING:discord.gateway:Heartbeat blocked for more than 10 seconds.
ERROR:discord.client:Attempting a reconnect in 1.66s
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/discord/gateway.py", line 468, in poll_event
msg = await self.recv()
File "/usr/local/lib/python3.6/dist-packages/websockets/protocol.py", line 350, in recv
yield from self.ensure_open()
File "/usr/local/lib/python3.6/dist-packages/websockets/protocol.py", line 501, in ensure_open
self.close_code, self.close_reason) from self.transfer_data_exc
websockets.exceptions.ConnectionClosed: WebSocket connection is closed: code = 1000 (OK), no reason
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/discord/client.py", line 457, in connect
await self._connect()
File "/usr/local/lib/python3.6/dist-packages/discord/client.py", line 421, in _connect
await self.ws.poll_event()
File "/usr/local/lib/python3.6/dist-packages/discord/gateway.py", line 476, in poll_event
raise ConnectionClosed(exc, shard_id=self.shard_id) from exc
discord.errors.ConnectionClosed: WebSocket connection is closed: code = 1000 (OK), no reason
That's not the DBL api
that's something about the discord.py package
What version are you using
Since I have a similar exception, and I just pass whenever it happens, and in the aiohttp library, disable auto disconnection. (Yes that's a bad idea, i know)
But it has since fixed it
I don't use the aiohttp library I'm using requests for posting to apis
should I switch to that?
Ah ok, will do, but what's the issue with using requests over aiohttp? Does requests not work properly on discord.py?
Okay thanks.
@south pike requests is blocking, aiohttp is async. You always want to make sure to use async wherever you can so that your bot doesn't stay in idle for more than X minutes and then crash.
The error code meanwhile, iirc, means that either you lost connection or that's just old library version giving you crap
Yeah I think it’s the old library didn’t get those until I added the requests stuff in yesterday
Thanks for the help guys
Hmm 
when the webhook responds, if it doesn't provide the right auth is it to be ignored or should you send back a reply like 403
Is that a question?
You mean the webhook for DBL?
For a sharded bot should I pass the client object of every shard to a new botlist api instance or can i simply instantiate it once in the manager file and pass the shardingmanager?
hi i have big problems with editing my server information page
what is it
first i wanted to update the page
but deleted it by mistake
i mean the page not the server
i dont believe we can
No i dont want to restore
oh cool
i want to do A NEW SITE
I'll contact an admin about this @carmine nebula
thank you
and the server i should go to is moved
Discord Server List (MOVED) can you link a new one?
this is the new one
ahh
and wrong channel anyways
okay sorry
Just updated my bot to use sharding and the bot page looks like its only taking the server count from one shard. Do I have to manually update server counts when I shard?
@slate saddle you're posting one shards guild count as the entire bots guild count
you just need to specify the shard id +total while posting it so dbl knows its only part of the total bots guild count
I’m not actually manually posting anything, I’m simply passing the client object to the constructor of dbl in each shard @inner venture
Could it be related to me running djs master? They replaced client.shard.id with client.shard.ids
i dunno, i dont write js 🤷
@slate saddle nice name 😂 😂 😂
!play ballin
dbl nicetry @rugged roost
Hey, any bots that have common prefixes are now blocked from reading any channel. Nice try spamming your dms though.
Hello
you should probably update the python example in your api documentation to use the new and preferred way in discord.py to do regular tasks: @tasks.loop(minutes=30.0)
It's been redirected to admins and they're aware
thanks 👍

also, when looking at the example on github, that will not work.
you need to self.update_stats.start() in the init
and preferrably
def cog_unload(self):
self.update_stats.cancel()
1.2 or something
or more likely it was there since 1.1.. i have never used it without start()
Weird
It works for me just fine without that
Oh wait, you mean the tasks extension
I'll need to try that out myself
how do i add my bot
g
why do i keep getting this error? (node:4) UnhandledPromiseRejectionWarning: Error: 401 Unauthorized
wah?
with?
server count on bot
how do you install the api? i try as listed and i get a lot of warnings, the warnings say that i need peer dependencies, i install them, but get more warnings saying i need these peer dependencies too, basically an ""infinite"" loop of "install this", how do i install the api without the warnings?
You are not required to install peers
you dont need peer dependencies
bruh, did i install the wrong thing?
No
lemme try that again real quick
It does work without peers
npm screams at you for all missing peer deps
if d.js has missing peer deps, npm is mad
^
algun bot para trabajr el oro?
Hey
did you read the log or what it says?
ok
but why on mac it has it?
I hope you read the changelog
and no errors
I hope you are THOROUGHLY sure your versions match up
youre not supposed to be selfbotting xD
Hello everyone, I created my webhook for a channel and when I put the link in my bot's info and test it, nothing gets sent to the channel. What could I be doing wrong?
You don't do anything wrong @restive mantle , the webhook doesn't send messages on its own.
@restive otter can you help me set this up?
python
I'm trying to do the exact same thing but it doesn't work for me :/
What part doesn't work?
the on_dbl_test(data)
when I hit test on the website, it doesn't print out anything
I have:
dblpy = dbl.DBLClient(bot, token)
@bot.event
async def on_dbl_test(data):
print(data)
@bot.command()
async def upvotes(ctx):
uv = await dblpy.get_bot_upvotes()
print(uv)```
the command o!upvotes works, but whenever I try and test the dbl_test thing, it doesn't do anything.
You need to use the built-in webhook system
Specifying webhook_port will run one under that port but it has to be open and forwarded
const DBL = require('dblapi.js');
const dbl = new DBL(`${config.DblApiKey}`, { webhookPort: `${config.webhookport}`, webhookAuth: `${config.auth}` });
dbl.webhook.on('ready', hook => {
console.log(`Webhook: http://${hook.hostname}:${config.webhookport}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`L'utilisateur ${vote.user} vient juste de voter pour le bot!`);
client.channels.find('id',`ID_CHANNEL`).send(`L'utilisateur ${vote.user} vient juste de voter pour le bot!`);
});```
(console: Webhook: http://0.0.0.0:3001/dblwebhook)
Why doesn't it work?
Damn, this sound so difficult :/
:/
Is webhookPort supposed to be a string
Mmmh
@restive otter because 0.0.0.0 means its listening on your external ip
Just made a webhook for another site and worked without any coding 😕
that isnt what you should enter on the site
const DBL = require('dblapi.js');
const dbl = new DBL(`${config.DblApiKey}`, { webhookPort: 3000, webhookAuth: `${config.auth}` });
dbl.webhook.on('ready', hook => {
console.log(`Webhook: http://${hook.hostname}:3000${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`L'utilisateur ${vote.user} vient juste de voter pour le bot!`);
client.channels.find('id',`ID_CHANNEL`).send(`L'utilisateur ${vote.user} vient juste de voter pour le bot!`);
});```
?
Oh
How to solve that i don't understand...
Well it's not much coding here
You just need to make sure that the port you are trying to use is open
Yes he is open
instead of 0.0.0.0 use the ip of the system that your bot is running on
I dont even know which port to use 😂
Oh okay
Something that is not in use rn :p
what
He is in my bot page
Mmmh
rip my webhook 😂
yes
i need to sent the server count like:
headers: {
authorization: '<authorization key>'
},
data: {
server_count: bot.guilds.size
}
🤔
One message removed from a suspended account.
discord.js
The data JSON is supposed to be sent as request body
Why can't I use the API to send a GET request through code
I get Exception: The remote server returned an error: (401) Unauthorized.
While I can just run it through my browser and it works fine
Are you sure you are sending your token for authorization
Do you need auth for GET?
Yep
🙂
How do I do to change the name of my bot ?
I changed it in my discord developper but the name is still the same
client.DefaultRequestHeaders.Add("Authorization:", authorization); returns Exception: The header name format is invalid.
Anyone up to help?
@astral river You sure you hit Submit?
"Authorization:", "bot token"```
Oh
That's what I do
Authorization, not Authorization:
Do I have to download other module than npm i-- discord.js and npm i-- sfs ?
npm i [module]
@astral river to change a bot's name, no. If you wanna use things like canvas, then yes
this is the api channel
server count is not getting updated on top.gg why?
i even have them setup in my bot
its not getting updated at all
const DBL = require("dblapi.js")
const dbl = new DBL('Token');
// Optional events
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})
@restive otter using this
And when do you run that?
@restive otter
And you're aware that // Optional events dbl.on('posted', () => { console.log('Server count posted!'); }) doesn't post it, its just the event that checks when its posted.
when i restart bot and it auto updates guild
ohh
oof
xdddd
That's why its an Optional event 😉
idk how to make it update guild per minute oof
you can just run it when it joins / leaves a guild
ok
setInterval(() => {
dbl.postStats(client.guilds.size);
console.log(`Posted! server count ${client.guilds.size}`)
}, 1800000);
will this work if i put on on_ready?
@restive otter
let me check the javascript api
Yep, that posts the count 😄
k
make sure you do use your token, xd.
instead of Token haha
hello
i have problem installing packages with "npm" command
whenever i open it it prompt to other cmd prompt and do nothing
how i fix it
i see everything
node.js is in path
everything is all right
but can;t install anything
Are webhooks working atm?
Yeah, they work, but why so huge delay between vote and webhook?
aaaa are u telling to me?
to all who can reveal some info about issue
One message removed from a suspended account.
see the video
One message removed from a suspended account.
ok
wait
i teell you
the problem is node.js is complety installed on my computer but the npm command is not working whenever i try to install any package it prompts to another window
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
oh
One message removed from a suspended account.
One message removed from a suspended account.
?
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
oh sorry
One message removed from a suspended account.
i have like 4 drives
guys, who here use linux?
is this api related
if it is just ask your question
otherwise move to general or off-topic
thnks
Will the API be getting moved to top.gg at some point or can we just keep reporting to dbl site?
@karmic hound afaik for now it will stay on dbl site for consistency
Everything about the API has been moved to top.gg
Preuve:
Dbl site Unauthorized : https://discordbots.org/api/users/488398758812319745
you're just not logged in to discordbots.org in your browser
but not on discordbots.org...
if you make the request using an api token it will work
Okay
I think it’s because he’s probably logged in on top.gg so the discordbots.org endpoints won’t have auth btw @arctic arch
thats what I just explained
Feck
I can't get my vote event
dbl.webhook.on("vote" exc.
Because it’s not the full code
@serene oracle example
But use glitch for votes this is best
@restive otter I can't see this link
@narrow zenith Ofc this is not the full code, I just want to know the correct syntax
Oh wait
No
He can't expire
But you have to use https://uptimerobot.com/
For stay online the glitch
Yea I know, I mean if your project will set to private
No he is public
^^
You can use the remix options for make you own project for security et make it private
Is it required to use a webhook in order to tell when someone votes for your bot in the last 12 hours?
I’ve been reading about them but I’m still a bit confused on how to go about setting up a webhook. Does anyone have a useful resource I could read to check out how to set up a webhook?
Any help would be appreciated 😄
You can use one of the official libraries to easily set it up
Ah ok, so the webhook will automatically be set up provided I use that library?
yeah
Awesome, will the example code on the page work if I give it a valid token?
Gotcha, thanks my dude 🙏
That’s also part of my issue too, though
Like, where do I get the webhookPort and webhookAuth from? I’m assuming the example code has dummy values for those
You set them yourself
I’m just struggling to see where I can set up a webhook correctly
Ok, so when I edit my bot’s page, under API options, under Webhook, I have to give a URL and authorization. What should be going into those fields and where can I get/set up those values?
Url is your webhook url, the password is whatever password is used in the webhook
Where do I get the webhook url? Is that an external thing I have to set up?
Yes
Do you know where to set this up? Sorry lol I’ve never worked with this stuff before and I want to learn how
anyone else having weird problems with adding reactions through bots specifically
some bots can and some cant
dbl api @frank ravine
THIS CHANNEL IS ONLY FOR SUGGESTIONS/HELP/BUGS TO DO WITH OFFICIAL API LIBRARIES AND API DOCS FOUND AT https://discordbots.org/api/docs
ask in #development
Ok sorry !
Not sure if this is the proper place but the Python documentation needs to be updated. (https://top.gg/api/docs#pylib)
Lowercase the -R on install from source and change dbl.Client to dbl.DBLClient
bot.shard.fetchClientValues('guilds.size')
.then(results => {
bot.user.setActivity(`-help | ${results.reduce((prev, val) => prev + val, 0)} guilds`);
data.postStats(`${results.reduce((prev, val) => prev + val, 0)}`, bot.shard.id, bot.shard.count)
})```
This is pushing more guilds than the bot has
Anyone have any idea why?
Its pushing the right number of guilds to the setActivity
But not to DBL
@errant wasp If you suggest dblpy to someone, please ask them to read the Github repo instead 
Well, I mean if you're working on a bot these issues are easy to solve since they require basic knowledge anyways

Well yeah but not all people read changelogs or the docs apparently
You aren't wrong
What does an example webhook URL look like?
i.e. how is the authorization sent? is it just in a query string? example: https://domain.com/webhookCheck?Authorization=xxxxxx
Most look like http://ip:port/path
Depends on if you have a domain and dns for it
The authorization is a header as well
Presumably the key of the header is 'Authorization' and the value is the authorization value set in the edit page?
yes
Hm ok ty
@restive otter <dbl>.postStats(guildcount, ?shardcount)
@restive otter
@XxMirayxX21#3561 you dont use <dbl>
@restive otter
you use your dbl client
Eg DiscordBotList.postStats(guildcount, shardcount)
What timezone does the monthly vote reset happen? midnight utc?
around that I believe
Yes
thanks
@restive otter 
<dbl> is ur dbl client
so what you defined ur dbl client
why do ppl fall for that i dont understand
Ohhh mine is dbl. btw ik how to fix that now


One message removed from a suspended account.
@scarlet cobalt
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Why is my api telling me that no DBL token has been provided altho i have provided it with a token?
One message removed from a suspended account.
uhhh
its gonna be a mess
but sure
multiple files ya know
const Discord = require('discord.js');
const client = new Discord.Client({ disableEveryone: true, disabledEvents: ['TYPING_START'] });
const DBL = require("dblapi.js");
const dbl = new DBL(process.env.DBLTOKEN, client);```
event.execute(client, dbl);```
async execute(client, dbl) {```
dbl.postStats(client.guilds.size);```
DBLTOKEN=<token copied from top.gg -> edit -> scroll down -> show token
async execute(client, dbl) { ?
You might also want to specify message caching settings.
Webhook running at http://0.0.0.0:5000/dblwebhook
is that normal 🤔
nice ip lol
Yes, you replace 0.0.0.0 with your external IP
okay I got a short question
when I try to run the example from https://top.gg/api/docs#pylib it says:
Traceback (most recent call last):
File "C:/Users/nope/Desktop/Programmierung/QBot Beta/beta.py", line 407, in <module>
setup(bot)
File "C:/Users/nope/Desktop/Programmierung/QBot Beta/beta.py", line 404, in setup
discord_bot.add_cog(DiscordBotsOrgAPI(discord_bot))
File "C:/Users/nope/Desktop/Programmierung/QBot Beta/beta.py", line 66, in __init__
self.dblpy = dbl.Client(self.bot, self.token)
AttributeError: module 'dbl' has no attribute 'Client'```
its python btw
boi it's dbl.DBLClient
what starts automatically? Server posting?
:D?
Did you read the topic of this channel?
Sorry ^^’
how can i automate vote rewards? i just want to automatically reward users for voting for my bot
Webhook
i know you need webhooks, but ive googled a bunch and i dont know where to start
There might be one provided by your DBL library if you use one
im using the javascript library, is that one of them?
dblapi.js has built-in webhook
oh shoot
sorry, im really new to webhooks so its all a blur for me
but do you know what information i have to provide it myself, and where to get that information?
i see you need a port number, auth, password
how do i give it the correct information, and where do i get it from?
any help is appreciated 😄
Everything is customized
You'll have to make sure the port will be forwarded and open and no firewall is going to be blocking any traffic for that port
Auth is set by you on the bot's Edit page. DBL will send the Authorization header with your auth value
ohhhhhhh
okay, i see now
so to summarize, i would need to make sure im not blocking top.gg from sending data, and customize the authorization so the value i put on the site matches my code?
and thats it?
Pretty much
awesome, thanks man!

i think i got the right setup, how can i test it?
oh ok lmfao thanks again
in "messageUpdate" events, does "message" still work or do you have to speciy oldMessage/newMessage ?
I'm posting only server_count which is 43,143 but on the website it appears 24,636, any clue why that might be the case?
Cache





