#topgg-api
1 messages · Page 59 of 1
ip/port/path? Or ip:port/path
the latter
Can we have the API also store the timestamp a user has voted? (over the /check?id)
you can do that on webhooks
I have a question when bot is in shard how can i do for setup webhook ? because it start 4 time and it can listen 4 time port 5000
You might setup one webhook server to receive all requests and then redirect it to your shards
https://github.com/Deivu/Haruna @placid mist in that case haruna may help you with your problem
Simple webhook vote handler for Discord Bot List https://discordbots.org/ - Deivu/Haruna
ty i will see
Haruna is an independent webserver that received the post from dbl, where your bot will just send get requests to Haruna. Since haruna runs independently, she is ideal for sharded/bigger bots
she
Also @placid mist just spawn the webserver when you are spawning the shards
Not in the shards themselves
And you can use the manager to fetch client values if you are using ShardingManager
@boreal bridge yes but i don't know how to send message between shard
Si i don't know how to do
Then I suggest learning how sharding works
or just use internal sharding which is way better than shardingmanager
🤔
i think its not dblpy
idk its on the doc
Oh yes its dblpy
I am troubled for webhooks
@twin forge explain
Already asked in #development
@boreal bridge is your bot sharded?
Yeah
Also I saw you talk about internal sharding earlier, do you have any source that I can take a look at? I did a quick search with no luck.
well if each shard is posting its own stats then you should send the shard id
Ah so that was my next question
discord.js?
yeah if you send the shard id lol
Ok well that answers that
and for internal sharding you dont need to use shardingmanager, just set shardCount: 'auto' in client options and it will automatically handle it
single process, single client, no broadcasteval
not complicated code
due to lack of broadcasteval
even its sharded, the data is stored in one process
but you need to drop internal sharding once you hit 5-10k guilds
I see
the great weakness of internal sharding is because it runs in single process only
Yeah I read about that
it wont actually fail at a server limit but you might have performance issues
basically
Well I just rewrote everything I needed to use broadcastEval
But if I continue to add
And it’s still a pain
I will definitely keep it in mind
That’s for your help guys
aa
dont force me to answer your questions if you can just ask it on #development
Im not your personal debugger or coder
Yo weeb come dm
@clever rock are you speaking to me?
woof
nah that anon guy
Oh lmao
I turned off my dms so go bother someone else or ask in #development
vote checking doesnt work no more
dbl.webhook.on('vote', vote => {
^
TypeError: Cannot read property 'on' of undefined
I wanted to add a webhook but im not sure how to define the webhook
@thorny horizon in the constructor
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(`User with ID ${vote.user} just voted!`);
});```
Straight from the DBL docs
Yeah thats what i saw
So that would setup a webhook server at port 5000
Well if you want a webhook server you need to define a port
I have a URL which is running on a server service
Ok
my server got locked down what do i do ?
Hi guys
@restive otterwth
How
?
Your server locked down
xD
yes
what do i do
Does anyone know how I search for someone on here or would be willing to help me? Pretty sure my wife is cheating on me using this 😇
Not the correct channel to ask that
You can use search feature

Hey @tidal cave stay out of your wife's things. it's illegal to go thru someone else's things like you are with your wife's Discord profile.
Actually it’s not I’m an attorney and I’m not on her things I’m finding her in these chats
Hmm
@tidal cave we are not the place to ask for this.
you just said it was your wife wtf
Hi
Hello
how to get the bot's webhook url
look api docs
thanks
soo the example code in the api docs is like creating the Webhook for the bot?
the webhook url is your server ip + port
Not that I know of
ahem, hello, how can i update my votes on my bot?
Update your votes on your bot? Could you elaborate?
Yeah, update my votes on the bot, just a bit brain dead rn since i havent slept in sometime
If you're referring to updating the votes on DBL, it is done automatically once a user has voted for the bot. It may take some time for the vote to appear on your listing.
^
@royal storm if you use .py I have something you could use using requests module
And you can just call it by
if user_voted()
Oh alright, ty. and I use js so uhh yeah
They have a similar one dont they?
That's tru
Tho all the things I've seen for the py one are for rewrite
But I use requests for most of what I use for the api.
You can easily migrate back to async
Using aiohttp in async code is still strongly encouraged. Just because it works doesn't mean it's good.
With that being said, let's move to #general
Aiohttp doesnt have headers? If you know how to use headers please tell that would be nice uwu
ye
https://discordbots.org/api/docs#reference
can someone explain this? I'm not getting it?
the authorization process
Whenever making a request to the api you need to have an authorization header with your token
When sending a request to DBL, you will have to provide a header where Authorization is key and your bot's DBL token as its value
Or you will get 401 Unauthorized
Oh alright.
K. Kopp 00 00
yo how do I set up webhooks
There are libs for the dbl api that can help you set it up
But mostly just open a port in your server and start listening to it, and add the url to your server on the bot's page
would express work for that
and in the edit thing I dont see a section for webhook url
oh nvm
Open a port in your router and it should be something like http://yourIP:port/webhook/path
what about hosting on something like heroku
Yup. Again, depends on your code
ok
If you're listening to the index path (or whatever that's called) then just the url
why does it say http://0.0.0.0:5000/dblhook
It always says that
wat really?
0.0.0.0 on logs means localhost
^
Is there any chance that there could be a option for reverse proxys in the js webhook libary, or should I pr the changes myself?
because afaik you can't run this webhook behind a reverse proxy
i mean
it creates a regular http server
on a specific port
so you can just reverse proxy that as you would anything else with something like nginx
correct, I'm not sure if I got this right, but dbl will try to post to the port the http server is running on, and not to the port the reverse proxy is listening on (80)?
so you mean I should just pass the port the reverse proxy is listening on?
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 80, webhookAuth: 'password' });
exactly
then you go to the Webhook settings in the Edit page of your bot on dbots.org, and set the url
I'm going trough the code right now, but I don't think that works, because if you only pass a port, then the library will create a new http server on the fricking port I just passed?
if (server) {
this._attachWebhook(server);
} else {
this._startWebhook();
}
_startWebhook() {
this._server = createServer(this._handleRequest.bind(this));
this._server.listen(this.port, this._emitListening.bind(this));
}
yeah
i have an example config somewhere, one sec
are you using it?
yes
actually no, i think im wrong
listen 80;
listen [::]:80;
server_name test.mydomain.xyz;
location / {
proxy_pass http://localhost:5000/;
}
}```
this is the config im using
i assume you could pass any port to the dbl webhook really, as long as it can create an http server on the port and its the same as the one in the config then it should work
yes
so, you can't use the webhook stuff if you didnt setup a webhook in the settings page for your bot?
exactly
otherwise dbl couldnt send any requests to your webhook
as it cant just magically assume where to send them to
thats why I thought the http server sends a first request telling it "bitch boi here I am"
I have to beat someones ass
thanks dude
youre welcome lol

webhook is working earlier but now its not
reverse proxy is on webserver side I believe.
@azure hedge webhooks can be late sometimes
why does it say my bots in 59 servers
then 63 and now 62
all after refreshing
twice
Sometimes, numbers on sites like YouTube and Twitter jump up and down; subscriber counts lag, like-counts bounce all over the place. Why is it so hard for co...
thanks
A question regarding search query param in /bots endpoint. What are the supported fields?
Disregard that question. Found out what I wanted
If i would have a local webhook, how should I configure it in my bot edit
As i think just localhost:port doesnt work
And you have to portforward it
yeah, @anyone would otherwise be an option 😛
is your port open
unless it's automatically open, you need to portforward it @stuck ingot
Okay but isn't that a security risk?
honestly, dont think the port is a security risk
You can have a firewall if you really fear it
my vps is setup so any port can be used to make a connection
but only through my cp
for the domain use ipv4
so ipv4:port/dblwebhook
unless its your home network
don't do that
welp
You can get a free domain and use cloudflare with an a record and srv

But it still needs to point to your ip
^
also i hope you have a static ip
god I have no idea how any of this works
So basically I need to get a VPN and run my bot on that?
And then i use the VPN's IP?
Not really, no
I made a website for a school project once and used a free hosting service and that's about all I know about websites xD
I have no idea how any of this works
Do you understand how hosting a website works
What a question
xD
Please keep this channel to API related discussions only; suggestions/support/bugs related to DBL's API libraries and API documents (https://discordbots.org/api/docs).
@tropic basin #development, and for hosting a website I'd reccomend AWS route 53. .net is $11 per year (less than a dollar per month)
@worn quail if a mod says to keep this channel on-topic, then don't reply to someone from earlier which too is not on-topic
I know
But they asked and never asked their question there so I gave them something to use
Why do trial mods think they own the place :v
no need to get hissy with me, what I said still stands. what you said was off-topic after a mod warned everyone to keep the channel on-topic
pylib
Your bot needs to be approved
You can use the requests module for this
Did you just copy it
payload = {"server_count" : len(client.servers)}
async with aiohttp.ClientSession() as aioclient:
await aioclient.post('https://discordbots.org/api/bots/botid/stats', data=payload, headers=headers)
That should work
one moment i'll post it at payload, so it will take probs 2 min before it finds an opening signal
The code I use takes around 1 min to update
It's just dbl's cache
Nothing we can change
yeah no worries, one moment
did it get updated lately?
That's what my example was
Should work better for you than what I did due to it already being rewrite
my bot is not displaying total servers in Discorbots
it needs to replace
bot.servers -> bot.guilds
client.user.id returns none
@worn quail any alts
Hm?
The one I sent before should work fine. That's what I'm using currently. You will have to replace things like client.servers to bot.servers or sth
bot.servers wont work
cause my client is named "client"
i have to replace servers with guilds
due to rewrite
i use the latest and greatest
python3.7 -m pip install discord.py
atleast it works
@idle silo update dblpy
And I see you did. Wait until your bot is approved, there are examples on dblpy github repo as well as docs on dblpy.rtfd.io
Examples in #312614469819826177 are outdated
reeeeeeee

but if it works and it's old it has the possibility of breaking with no support
If it works, it works. Whether it works well is what matters
API abuse ?
xD
not an api question, more like a meme. Please post that kind of pictures in #memes-and-media
or if general development questions, #development Thankies ^^
OwO
Smh jeff no meming here 
Yes, sending messages to discord every X seconds is API abuse
Hmmm
But this channel is about dbl api, not discord's api so
Ok
Are there any ratelimits I can look up to prevent getting banned by the API?
Especially for /bots/<id>/check.
pls Ping me, going to sleep
I don't know what a timer has to do with ratelimits but okay
To allow for it to catch up
And you know that because?
Because I've accidentally banned myself from my own api. GET statements are like reading a file. You can read it indefinitely. POST statements save to the "file", you can only save so often

Oh buddy
That's like, not true. Get methods aren't "like reading a file", in fact it doesn't matter, because you can build that exact same endpoint (the check one) with post requests. They do the same, the only thing that is different is the method how you transfer information about what user and what bot.
My view on it is what I said
@rugged sierra 60/60s as far as I remember
So 1 per second?
Yes but no
60 in one minute
Yup
Thanks, and also thanks for the new perspective on files and get methods 
||if you don't know just don't answer||
1/s is different than 60/min
We have opinions
I use GET to access files and I get locked out sometimes
I'm too tired to talk cri
How to enter the webhoock panel in DBL?
In the bot's edit page at the bottom there's a field to enter your webhook url
How can I track votes of users?
on?
Like when a user votes for your bot
yes but webhook or api?
Api
Im afaik you need a webhook to save the users when they vote for your bot
I'm storing it in a DB
let me be clear
are you really using the api?
It feels like you are using the webhook part of the api
Idk, there was a doc someone linked me to and I tried what I saw on it and it didn't work
if thats what you are using, you need to
- have the port opened
- set the webhook settings right
I just find the users by checking all votes
Hi all, as soon as I put 2 shard on my bot, the voting system does not work with my bot, what to do?
I'd suggest learning what sharding does and how to work with it
if you're using d.js then upgrading to master has internal sharding
i'am in internal sharding
Hey, I have one question. How can I use the api to make it say how many servers my bot is in on the bot page?
Check this out
no u
When my bot will approve
xD
j!help
Mute
@sullen nymph already said, he trolling i think
123
Ahhh yess!
Is good
GOP FM is best
Anyways, I was going to ask
Is there another API wrapper for Discord.py 1.2.2 (latest) and Python 3.7 (latest)
I believe shivaco made one
Can u send?
well there's dblpy
I have dblpy but it doesn't work
How come? Any errors?
Ignoring exception in on_ready
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/discord/client.py", line 270, in _run_event
await coro(*args, **kwargs)
File "/Users/ZL109819/Documents/PythonBot/GOPBOT/ GOPBOT new.py", line 164, in on_ready
setup(gopbot)
File "/Users/ZL109819/Documents/PythonBot/GOPBOT/ GOPBOT new.py", line 146, in setup
bot.add_cog(DiscordBotsOrgAPI(bot))
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/discord/ext/commands/bot.py", line 480, in add_cog
raise TypeError('cogs must derive from Cog')
TypeError: cogs must derive from Cog
Failed to post server count
AttributeError: 'Client' object has no attribute 'post_server_count'
Traceback (most recent call last):
File "/Users/ZL109819/Documents/PythonBot/GOPBOT/ GOPBOT new.py", line 135, in update_stats
await self.dblpy.post_server_count()
AttributeError: 'Client' object has no attribute 'post_server_count'
Ignoring exception in on_ready
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/discord/client.py", line 270, in _run_event
await coro(*args, **kwargs)
File "/Users/ZL109819/Documents/PythonBot/GOPBOT/ GOPBOT new.py", line 164, in on_ready
setup(gopbot)
File "/Users/ZL109819/Documents/PythonBot/GOPBOT/ GOPBOT new.py", line 146, in setup
bot.add_cog(DiscordBotsOrgAPI(bot))
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/discord/ext/commands/bot.py", line 480, in add_cog
raise TypeError('cogs must derive from Cog')
TypeError: cogs must derive from Cog
Failed to post server count
AttributeError: 'Client' object has no attribute 'post_server_count'
Traceback (most recent call last):
File "/Users/ZL109819/Documents/PythonBot/GOPBOT/ GOPBOT new.py", line 135, in update_stats
await self.dblpy.post_server_count()
AttributeError: 'Client' object has no attribute 'post_server_count'
I had it earlier
post_guild_count
https://dblpy.readthedocs.io/en/latest/whats_new.html I'd recommend reading this in case errors similar to this appear
Hold on I'm testing it

👌
yw
right i cant read
send the code
AttributeError: module 'dbl' has no attribute 'Client'
self.dblpy = dbl.Client(self.bot, self.token)
Don't name your folder or files dbl
ty @sullen nymph
can anyone help me with my bot
yeet ask2ask
import net.dv8tion.jda.core.accounttype;
import net.dv8tion.jda.core.JDABuilder;
import javax.security.auth.login.LoginException;
import jdk.nashorn.api.scripting.JSObject;
import jdk.nashorn.internal.objects.Global;
import jdk.nashorn.internal.runtime.ListAdapter;
public class main extends ListAdapter {
main(JSObject obj, Global global) {
super(global);
// TODO Auto-generated constructor stub
}
public static void main(string[] args) throws LoginException {
JDABuilder builder = new JDABuilder(accounttype.bot) ;
String token = "NTg5NzA2OTEwOTcwODA2Mjcy.XQauZg.Xy1OAHlMdX1LHuxMz597694QAM4" ;
Builder.SetToken(token);
Builder.addeventlistener(new main());
builder.buildAsync();
}
@Override
public void onMessageReceived(MessageReceivedEvent event) {
system.out.printin("We Recived Message From " +
event.getauthor().getname() + ": " +
event.getMessage().getContentDisplay()
);
if(event.getMessage().getContentraw().equals("!ping")) {
event.getchannel().sendmessage( "pong!").queue();
}
}
}
You leaked your token
i am going to generate a new one smart one
And if it's not about our official libraries, please move to #development
i just started making bots today....
ok, either way questions about making your bot should go to #development and not here
gotcha
now go revoke your token since you just leaked it
О
Help my for api voted please
If you're referring to updating the votes on DBL, it is done automatically once a user has voted for the bot. It may take some time for the vote to appear on your listing.
^
To check if a user has voted, you can make GET checks to the vote area on the API. There are easier ways using dbl api, but just making the checks myself gives me more freedom on what I do kek
i feel stupid for asking, but what does dbl stand for
Discord bot list
https://oliy.is-just-a.dev/jivhlm_284.png Also wrong place to ask
ah ok
I know this is a million dollar question considering I have close to 0 experience with python apis (yet) but would it be hard to create a command that takes a bot id or mention and checks if it is on dbl, if it is, get the prefix and lib?
not hard
yeah not hard at all
also #development
Oh my bad, and thanks
this rest api thing is very complex i can't find any good tutorial other than the cat, dog rest apis
#development this is for dbl api only
@restive otter There are examples on how to use it
wait
Has anyone in this chat made their bot through DBM or such. I'm looking to find out how to send the servers through a DBM bot.
No, In one of the DBM servers someone posted the code for it about 8 months ago but the raw link does not work anymore so it shall work if it worked back then.
const DBL = require("dblapi.js");
const dbl = new DBL('XXX', bot);
dbl.on('vote', (vote) => {
bot.channels.get("590496704718176259").send(`${vote.user} thanks for upvoting me), i love you :heart:`)
})
when i upvote, not send message to channel
is the port open?
like in webhook?
oh
but glitch((
oh
const dbl = new DBL('XXX', { webhookPort: 5000, webhookAuth: 'my-password-hete' });
dbl.webhook.on('vote', vote => {
bot.channels.get("590496704718176259").send(`${vote.user} thanks for upvoting me), i love you :heart:`)
});
like this?
not workin
(
did you open the port
that will not work if port 5000 is closed
dbl is like trying to send on a port that is closed
const DBL = require("dblapi.js");
const dbl = new DBL('XXX', { webhookPort: 5000, webhookAuth: 'my-password-here' });
dbl.webhook.on('vote', vote => {
bot.channels.get("590496704718176259").send(`${vote.user} thanks for upvoting me), i love you :heart:`)
});
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
not working but webhook is ran
Webhook running at http://xxx:5000/dblwebhook
idk what is your server
glitch
are you using keep alive?
no
process.ENV.PORT should work I assume
ok
autosave
🤦
dbl dont auto asve your webhook
if you change something there save it before test it
also how do you put your link?
idk
i just follow examples on git page
An official module for interacting with the discordbots.org API - DiscordBotList/dblapi.js
not the code
aaa
understood
xD
when i upvote
goes this err
(node:4310) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions
at item.request.gen.end (/rbd/pnpm-volume/391b6344-06f5-46b4-b905-de236dd93e84/node_modules/.registry.npmjs.org/discord.js/11.4.2/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:79:15)
at then (/rbd/pnpm-volume/391b6344-06f5-46b4-b905-de236dd93e84/node_modules/.registry.npmjs.org/snekfetch/3.6.4/node_modules/snekfetch/src/index.js:215:21)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:4310) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4)```
@mighty sierra wrong channel
Oh thx
async def on_dbl_vote(self, data): what is data? a dict? (python module)
@jaunty steppe https://discordbots.org/api/docs#webhooks > data format
ty
how about no
@dull star wut
don't worry about it
@topaz wyvern holy shit that's the same image I used back in 2017 as my pfp
The memorieessss
lol #memes-and-media
Ye
Hi
yeet notr
m
Keep this channel on-topic please, other languages and off-topic content goes in #memes-and-media
Is my 10-char api key still valid?
How do I embed my dis bot page into a website?
like embed something into a website..
whelp
K so dbl embeds
first you need your bot verified
ok
anyone else have a 2-3 minute delay for the vote check api?
Hi everybody! As soon as I had shards, it only shows half of my servers on the site .. what to do?
no its showing the entire server count
Sure?
you are likely only sending guild count of 1 shard
which.. makes complete sense. its sharded
how sent globally?
@empty yarrow you would need to count the servers of every shard, add it together, then send it over to dbl
@restive otter why do they need to ping a web mod 
yes but ... the problem is obvious I do not know how to do it
they likely thought its a bug, and web admins are the ones handling bugs
loop through the shards
then add up the guild count
there should be a way to get a list of shards
🏓
Mmm okay ty
@empty yarrow You can also instead senf the guild count and shard Id
then dbl should add them together flr you
How do we authorize our self then, I don't understand how to do it..
Send a JSON header where Authorization is the key and the token itself is value
Erm hmm
Could you possibly try help make the url if its a url i have to access and ill put token myself.
If that's what you mean.
Endpoint depends on what you want to do
Hmmm, well it says i need to authorize myself. All I wanna use the api for now is to send server count but seems i need to authorize but i dont understand how to do that.
Are you doing raw HTTP requests or are you using a library
Library I think yeah.
Discord.js
If its just sending the server count do I have to do that authorization thing?
https://discordapp.com/channels/264445053596991498/412006692125933568/591388052811808855
This could be fixed with Google and some time ngl
I think I understand now.
now calm tf down
bruh I just told you to read #502193464054644737
And why do you put ! at the end of every sentence
Yes please move to #memes-and-media, everyone is affected
#memes-and-media pls
Hello, I have a question. My bot hasn't been posting to the API correctly, so I have always been stuck at 32 servers. But, now my bot is in 92 servers. If I post to the API, will this be such a humongus change that I could get banned on DBL/bot removed?
Nope
where do i put a link to my image api
uh wot also https://oliy.is-just-a.dev/p6zgt_374.png
well i just spent the last 2 and a half hours writing api documentation and putting it into doscify.js
When trying to post to DBL via the REST API, my bot failed to post the info. I recreated the request in my web traffic tool called Fiddler and it shows that the API is having a 502 bad gateway error.
And note: I do not want to use DBLpy
This code always used to work, but it suddenly stopped.
My bot servers have grown from 32 to 92 but the API is stuck with the requests being sent
@zenith marsh 502 = DBL is broken
Yeah but it has been broke for a couple of months now @plain timber
Like my count has been stuck at 32 for like last year december and up to this year
nope
my count has always been failin
I can put an exception handler on the post thing so I can take a look in the logs later
Probably usually a different error
The problem is this SAME CODE used to work
so I have no idea anymore.
Either DBL is broke
or I'm being very unlucky rn
I fixed it 
And I should learn the Discord.py rewrite, because I am still on async to keep original code working and I don't want to migrate it as I'm fully rewriting my bot
Yeah switch to rewrite
Is it possible to make it so testing webhooks sends a query string of your choice so we can test that works?
The test already sends a little query, forgot what it was but look at it. I don’t think™ u can make the test page do certain queries
Could I make that a feature request somewhere then?^^
It would be useful for me to be able to test that I can reward the right users/servers when processing votes
I mean you shouldn’t be depending on queries to process votes. It should already give you the info you need to do it for correct users, bots, etc. the problem being any user could probably mess with it and change the query whenever they want.
Hoq do I check if user X voted for the bot in discord.py?
In my use case, I'll just be using it for letting users choose which server they want a reward sent to so I don't really care too much if they change it as I can verify they're in that server in the bot
In that case not really, I do believe it’s not possible to send special queries via testing, you can give it a shot by editing the query on the edit page but I very much doubt it.
@thin gulch if that doesn’t work tho you can send in some feedback here \/
Or not, Check out faq
Worst case I'll just edit the code to hardcode the server id which shouldn't be too bad.
Via github issues right?
Correct (sorry for some reason coffee doesn’t work here)
No worries^^
Apparently you can change the query if you just take the request sent and modify the querystring bit and use curl, so all is good for me^^
perfect!
he if i want to invite the nekobot i can't chose any of my server but i am leader of 2 servers? pls help
how is a channel wrong?
stop
hi
This channel is for official DBL libraries or DBL API itself
ah ty shivaco, it now works
Wait what channel are we in 
Ik what channel I'm in
how i do dbl webhook
In your bot's page after you click the edit button, if you scroll down you will find a webhook url field
Enter your website's full path to the webhook, then on your website listen to GET requests
Also there's libraries that already do that for you
but be clear that it needs a webserver and forwarded ports
Yup you have to be able to forward ports/have open ports
Another Thing you have to consider is: static or dynamic ip
thers are also webhook relay services tho if thats something for you
ima use my pi as a relay webhook thing
Send a file to s3 and have my bot check it every 15 seconds
I have POSTed my count like this, and it returns code 200 but it hasn't updated the count?
Cache /shrug
Am I correct in saying that the shard manager should send one http request for the post stats feature and collate all the shards info into one request?
oh yeah it was cache
that's odd though because even when I made a GET request to see the servercount using insomnia it showed it as the wrong value
just a thought, but would it be possible for DBL to host a ws server and distribute real-time events (user voted etc.) that way, instead of using webhooks. theoretically, a ws server would be more effective than webhooks, more users are able to connect to a ws than host a server themselves
you should post that to the issues repo that almost never gets looked at 
@restive otter
Wait
Wrong sub
Posting to the dbl sub would work
Lemme find it
Hi, I was wondering why I would be receiving an end of stream unhandled error when trying to post stats to DBL.
The code I'm using is below and running on discord.js v12
client.setInterval(() => {
dbl.postStats(client.guilds.size, client.shard.ids[0], client.shard.count).catch(e => client.emit('error', e))
}, 1800000);
```this is the first time it's happened and only seems to be happening since I've updated my code to d.js v12.
*update:* I've added a getStats request once all shards load and the results have given me back this information
```js
{ server_count: 949, shards: [], shard_count: 11 }
```seems like the shards and their guild counts aren't being saved.
@flint harness best idea is to do a fetchClientValues on the client.shard prop. (this is a promise) so for example=>
setInterval(()=>{
client.shard.fetchClientValues("guilds.size").then(x=>{
dbl.postStats(x).catch(e=>client.emit("error", e));
})
}, 1800000)```
when submitting sharded guilds, the best way of doing it is giving an array, dbl will automatically reduce them and set the length to the shard amount
How can I make a connection to the dbl api? The example in https://discordbots.org/api/docs#pylib did not seem to work and I do not find the documentation helpful. Please help...
What wasn't clear there?
Webhook stuff or all params?
I did not include any of those because it said optional
What's your code currently?
I tried the example script
class DiscordBotsOrgAPI(commands.Cog):
def __init__(self, bot):
print('api yay')
self.bot = bot
self.token = 'token'
self.dblpy = dbl.Client(self.bot, self.token)
self.updating = self.bot.loop.create_task(self.update_stats())
async def update_stats(self):
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))```
Did it output any errors?
no
What's your discord.py version?
1.0.0
I just migrated from 0.16.12
and I heard that dblpy is supported from 1.0.0 and beyond
Well does that output anything?
nothing is outputted
I hope you are loading that cog properly 
I tried to include print in the script but that didnt work
What's your dblpy version then
0.3.1
How are you loading the cog
class DiscordBotsOrgAPI(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.token = 'the token'
self.dblpy = dbl.Client(self.bot, self.token)
self.updating = self.bot.loop.create_task(self.update_stats())
async def update_stats(self):
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))```this is the exact script im using
its in def setup?
Im not?
does it not attempt to connect automatically and I can request data from it?
so is it supposed to attempt to connect everytime I request a data?
...
there are still scripts after it that loads...
Well that won't work
How are you loading that class in your bot then
Because it won't magically load without you doing anything
Put that bot_add_cog outside of the class
Why i'm I gettins a 400 Bad Request when I post stats ? 
What are you sending as headers? 
headers are likely wrong
Yep, 0 as server count doesn't work
Cache
I forced refresh but still shows it's offline 
is it ????
Ya
is it in this server
Nope
That's the reason
How can I get it here ? 
Yes, i'm using the beta version rn
but the beta is online
Should it be the main version for it to work ?
You should try to make it go online at least once
I would guess so
Thanks 
Can't we get what response dbl get from the webhook ? That would be usefull for debugging
Don't think so

@rigid shuttle the vote webhook?
Yep
how can i send shard count
ty
hey
New java api wrapper incoming.-.
http://prntscr.com/o6gbnx
http://prntscr.com/o6gcn8
http://prntscr.com/o6gee4
#memes-and-media daniel c:
How do I create a webhook in a bot with heroku host?
im back again does anyone here using deploys.io?
With voting, is it possible to redirect the user to your site afterwards to allow for an interface where they can choose their reward?
Don't think so, but you can dm them when they upvote to choose the reward
Ah oof
I guess I could but that's kind of spammy
State in your description telling the user to visit your website after voting to get a reward
@topaz imp how do you test it, you dont have a bot and all routes need auth
@restive otter https://discordbots.org/api/docs
@plain timber i got a token from a friend of mine
oh
(fyi, i will not be manually sending bot shards in the future, this is primarily for error diagnosing)
what am i doing wrong ^^ ?
@lime gust shards should be an array of multiple numbers
If your bot is not sharded, dont send any of the shard stuff
Gotcha. But is [ 18 ] not an array?
i think so, but multiple shards != one shard?
Changed it, thanks
yeah was a guess of mine xD
Hello, I have a own Discord Bot but i haven't a idea for upload it where I can it? In the Browser?
You mean shard/server count?
Yes Sorry
Read this https://discordbots.org/api/docs
Is anyone here having ideas for bot commands?
Tag system
Keep this channel on topic 
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.
Alright, let's keep off-topic in appropriate channels
@lime gust use a json content type
Is there an event that will be ran every time the bot has been voted?
if you set up the webhook, then that will run
Ello, so im trying to set up webhooks for voting, and i have this code on my bot:
const LibDBL=require('dblapi.js');
const GlobDBLHandle=new LibDBL(GlobDBLToken,{webhookPort:5000,webhookAuth:GlobWebhookAuth},GlobDiscordClient);
GlobDBLHandle.webhook.on('ready',hook=>{console.log('Webhook started at http://'+hook.hostname+':'+hook.port+hook.path);});
GlobDBLHandle.webhook.on('vote',vote=>{console.log(FindUser(vote.user).UserName+' voted');});
And i get to log Webhook started at http://0.0.0.0:5000/dblwebhook
On the website i have webhook url set to http://openbot.ga:5000/dblwebhook
openbot.ga is my domain, i have also tried my ip and same result.
i then click the test button and wait
the .on 'vote' never gets called. anyone know why?
did you save before testing?
no, i assumed since the test button was on the edit page that it would work. that fixed it, thanks
Hello, with discord.py, how do I use on_dbl_vote and get_user_vote? or any of the code? I was able to connect to dbl and update the server count, but not actually use any of the data. Please help.
the documentations are not very helpful and clear
well yeah
I wanted get_user_vote because I was hoping the data to be more accurate
and also weekend status
Tru
because using the url method, the data updates slow
again, webhook.
I'm working on turning my pi into one
That will send data to my computer

wait discord webhooks?
what type of webhooks
and how is it used
Example:
@bot.event
async def on_dbl_vote(data):
print(data)
Will output the following:
{
'type': "upvote",
'user': "247741991310327810",
'bot': "264811613708746752",
'isWeekend': False
}
lol the documentation makes it look easy
Actually
where do I get the webhook url?
Im trying to get on_dbl_vote and get_user_vote to work
I only got posting server count to work
pretty surr you find out of all the info when you get ur bot token from discordbots.org/somethingidktheurl
well yeah thats for the bot token
Like a pi.
Also if possible could someone shoot me a quick tutorial on how to do that through ssh?
you run a webserver, expose it to the internet, put it's url in the bot edit page, save it, then whenever someone votes DBL will send an http request to the url you provided
And when you get the http request, you can forward the information to whatever you use to host your bot ig
yes

Im not sure what to put for the url section though
im assuming that i create a password for Authorization
and I match that password in my bot
guess so
the url is an url pointing to whatever webserver is handling your webhook
basically this```natan@scw-9b8f33:~$ nc -l -p 8080 | grep -vi 'authorization'
POST /dblwebhook HTTP/1.1
User-Agent: DBL
host: REDACTED
accept: application/json
content-type: application/json
content-length: 127
Connection: close
{"bot":"301504284745531395","user":"182245310024777728","type":"test","query":"?test=data¬RandomNumber=8","isWeekend":false}```
i shouldnt really say anything i dont even know what you are doing
Essentially that's what he is getting from DBL
so its going to send data to the url I provide?
Go to API on discordbots.org and click my bots and create token if i remember and i think you get the info you need
apt-get is mostly network and storage bound
cool, I think I can get it now, im assuming you make a random password for the authorization part though right?
yeah, you can put anything there, and dbl will send it with the request it makes
so you can validate it really is dbl doing the request
Im kind of using python flask now....
is it like kind of submitting a form? can I use request.form[value here]?
@buoyant sandal is this what you want?
thats possible yes
async def update_stats(self):
while not self.bot.is_closed():
try:
await self.dblpy.post_guild_count()
print("Server Count on DBL Updated!!")
except Exception as e:
print('Failed to post server count\nError: {}'.format(e))
pass
await asyncio.sleep(1800)```
this worked for me
after I defined stuff
im trying to get on_dbl_vote to work mostly
oh voting i tought you needed server count
This happens every time
do I have to put an authorization password? or is it optional




I'm work



