#topgg-api

1 messages · Page 59 of 1

spiral steeple
#

it can be anything

empty yarrow
#

ip/port/path? Or ip:port/path

spiral steeple
#

the latter

empty yarrow
#

Thank you!!

#

[EDIT] Work

stone elm
#

Can we have the API also store the timestamp a user has voted? (over the /check?id)

clever rock
#

you can do that on webhooks

placid mist
#

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

wet sequoia
#

You might setup one webhook server to receive all requests and then redirect it to your shards

placid mist
#

Oof

#

It was complicated

clever rock
placid mist
#

ty i will see

clever rock
#

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

boreal bridge
#

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

placid mist
#

@boreal bridge yes but i don't know how to send message between shard

#

Si i don't know how to do

boreal bridge
#

Then I suggest learning how sharding works

plain timber
#

or just use internal sharding which is way better than shardingmanager

drifting shard
drifting shard
#

ok, for some reason

#

the python library isn't working

#

beautiful.

restive otter
#

i think its not dblpy

drifting shard
#

Well idk what it could be, then.

#

I followed the exact method of install.

restive otter
#

idk its on the doc

drifting shard
#

I followed the instructions in the documentation.

#

No dice.

restive otter
#

Oh yes its dblpy

drifting shard
#

...so the library is busted?

#

ok

#

nope

#

nevermind

#

I was just being retarded.

twin forge
#

I am troubled for webhooks

plain timber
#

@twin forge explain

restive otter
#

I guess here @drifting shard

#

ok

drifting shard
boreal bridge
#

in the wrapper, what does providing the shardId do?

#

ping if answer tnx

plain timber
#

@boreal bridge is your bot sharded?

boreal bridge
#

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.

plain timber
#

well if each shard is posting its own stats then you should send the shard id

boreal bridge
#

Ah so that was my next question

plain timber
#

discord.js?

boreal bridge
#

Is it supported for each shard to post stats

#

And yes

#

On master

plain timber
#

yeah if you send the shard id lol

boreal bridge
#

Ok well that answers that

plain timber
#

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

boreal bridge
#

I see

#

Besides not having to use broadcastEval

#

What are the perks?

clever rock
#

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

boreal bridge
#

I see

clever rock
#

the great weakness of internal sharding is because it runs in single process only

boreal bridge
#

Yeah I read about that

plain timber
#

it wont actually fail at a server limit but you might have performance issues

#

basically

boreal bridge
#

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

clever rock
#

broadcastEval isnt scary as you think dont worry

#

once you get used to it, its easy

boreal bridge
#

Yeah it isn’t bad

#

But it definitely isn’t clean

restive otter
#

aa

clever rock
#

dont force me to answer your questions if you can just ask it on #development

#

Im not your personal debugger or coder

restive otter
#

Yo weeb come dm

boreal bridge
#

@clever rock are you speaking to me?

restive otter
#

woof

clever rock
#

nah that anon guy

boreal bridge
#

Oh lmao

restive otter
#

I hate big servers

#

Come dm

#

Frick

clever rock
#

I turned off my dms so go bother someone else or ask in #development

restive otter
#

k

#

In twist dms

#

I got blocked from both of you nice

graceful condor
#

vote checking doesnt work no more

thorny horizon
#
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

boreal bridge
#

@thorny horizon in the constructor

thorny horizon
#

Aha

#

Holdup

#

Can you give an example?

boreal bridge
#
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

thorny horizon
#

Yeah thats what i saw

boreal bridge
#

So that would setup a webhook server at port 5000

thorny horizon
#

So i gotta add the port?

#

Aha

boreal bridge
#

Well if you want a webhook server you need to define a port

thorny horizon
#

I have a URL which is running on a server service

boreal bridge
#

Ok

restive otter
#

my server got locked down what do i do ?

#

Hi guys

#

@restive otterwth

#

How

#

?

#

Your server locked down

#

xD

#

yes

#

what do i do

plain timber
tidal cave
#

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 😇

sullen nymph
#

Not the correct channel to ask that KannaSip You can use search feature

tidal cave
#

Sorry

#

Have no idea what I’m doing lol

waxen wedge
novel carbon
#

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.

tidal cave
#

Actually it’s not I’m an attorney and I’m not on her things I’m finding her in these chats

left egret
#

Hmm

amber dune
#

@tidal cave we are not the place to ask for this.

worn quail
#

you just said it was your wife wtf

brittle socket
#

Hi

short bluff
#

Hello

azure hedge
#

how to get the bot's webhook url

restive otter
#

look api docs

azure hedge
#

thanks

#

soo the example code in the api docs is like creating the Webhook for the bot?

clever rock
#

the webhook url is your server ip + port

azure hedge
#

thats what i mean boss

#

:>

#

meh ill do it tomorrow

sudden depot
#

Can we get an APi Endpoint to set the WebHook URL

#

Dynamic IP makes it kinda hard

spiral steeple
#

Not that I know of

royal storm
#

ahem, hello, how can i update my votes on my bot?

sullen nymph
#

Update your votes on your bot? Could you elaborate?

royal storm
#

Yeah, update my votes on the bot, just a bit brain dead rn since i havent slept in sometime

restive otter
#

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.

worn quail
#

^

#

@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()

royal storm
#

Oh alright, ty. and I use js so uhh yeah

worn quail
#

They have a similar one dont they?

sullen nymph
#

(Don't use requests in d.py bot, if you ever intend to)

#

dbalpi.js exists

worn quail
#

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.

sullen nymph
#

You can easily migrate back to async

worn quail
#

True

#

if it works it works imo

sullen nymph
#

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

worn quail
#

Aiohttp doesnt have headers? If you know how to use headers please tell that would be nice uwu

sullen nymph
worn quail
#

ye

royal storm
spiral steeple
#

explain what

#

the api?

#

or that page

royal storm
#

the authorization process

spiral steeple
#

Whenever making a request to the api you need to have an authorization header with your token

sullen nymph
#

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

spiral steeple
#

Or you will get 401 Unauthorized

royal storm
#

Oh alright.

sullen nymph
#

K. Kopp 00 00

old halo
#

yo how do I set up webhooks

full socket
#

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

old halo
#

would express work for that

#

and in the edit thing I dont see a section for webhook url

#

oh nvm

full socket
#

Yup pretty much

#

And it should be at the very bottom of the page

old halo
#

what path would I use for express

#

if local hosting

full socket
#

Open a port in your router and it should be something like http://yourIP:port/webhook/path

old halo
#

what about hosting on something like heroku

full socket
#

The complete path depends on your code

#

Then your heroku app url

old halo
#

plus the /webhook/path part/

#

?

full socket
#

Yup. Again, depends on your code

old halo
#

ok

full socket
#

If you're listening to the index path (or whatever that's called) then just the url

azure hedge
plain timber
#

It always says that

azure hedge
#

wat really?

plain timber
#

Change 0.0.0.0 to the server's ip

#

Yes

azure hedge
#

it looks wrong

#

XD

#

wait how do i change that

azure hedge
#

nvm got it to work

#

uwu thanks

clever rock
#

0.0.0.0 on logs means localhost

restive warren
#

^

rugged sierra
#

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

runic grove
#

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

rugged sierra
#

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)?

runic grove
#

dbl will post to whatever you specify it to post to

#

or alternatively, a domain

rugged sierra
#

so you mean I should just pass the port the reverse proxy is listening on?
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 80, webhookAuth: 'password' });

runic grove
#

exactly

#

then you go to the Webhook settings in the Edit page of your bot on dbots.org, and set the url

rugged sierra
#

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));
  }
runic grove
#

why wouldnt it work?

#

are you using nginx for reverse proxying?

rugged sierra
#

yeah

runic grove
#

i have an example config somewhere, one sec

rugged sierra
#

are you using it?

runic grove
#

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

rugged sierra
#

yeah.. thats the basic reverse proxy

#

you use the dblapi.js library tho?

runic grove
#

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

rugged sierra
#

so, you can't use the webhook stuff if you didnt setup a webhook in the settings page for your bot?

runic grove
#

exactly

#

otherwise dbl couldnt send any requests to your webhook

#

as it cant just magically assume where to send them to

rugged sierra
#

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

runic grove
#

youre welcome lol

rugged sierra
azure hedge
#

webhook is working earlier but now its not

clever rock
#

reverse proxy is on webserver side I believe.

#

@azure hedge webhooks can be late sometimes

slender void
#

why does it say my bots in 59 servers

#

then 63 and now 62

#

all after refreshing

#

twice

sudden rampart
slender void
#

thanks

sullen nymph
#

A question regarding search query param in /bots endpoint. What are the supported fields?

#

Disregard that question. Found out what I wanted

thorny horizon
#

If i would have a local webhook, how should I configure it in my bot edit

#

As i think just localhost:port doesnt work

restive warren
#

You would have to put your IP address in

#

and pray you have a static IP

narrow geyser
#

And you have to portforward it

restive otter
#

@urban vigil

#

Please do not tag random members, especially for zero reason.

white galleon
#

yeah, @anyone would otherwise be an option 😛

restive otter
#

is your port open

#

unless it's automatically open, you need to portforward it @stuck ingot

stuck ingot
#

Okay but isn't that a security risk?

restive otter
#

honestly, dont think the port is a security risk

spiral steeple
#

You can have a firewall if you really fear it

restive otter
#

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

stuck ingot
#

it is

#

xD

restive otter
#

well

#

you need that

stuck ingot
#

welp

spiral steeple
#

You can get a free domain and use cloudflare with an a record and srv

#

But it still needs to point to your ip

restive otter
#

^

sudden depot
#

also i hope you have a static ip

stuck ingot
#

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?

sudden depot
#

Do you understand how hosting a website works

#

@stuck ingot

stuck ingot
#

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

tropic basin
#

I have no idea how any of this works
Do you understand how hosting a website works
What a question

stuck ingot
#

xD

restive otter
#

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).

worn quail
#

@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)

limpid sorrel
#

@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

worn quail
#

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

limpid sorrel
#

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

worn quail
#

Not just you

#

And I say we move this to general tbh

idle silo
#

oi quick question for dbl api

worn quail
#

What lib

#

And also

idle silo
#

pylib

worn quail
#

Your bot needs to be approved

idle silo
#

its appr... ahum

#

i mean

worn quail
#

You can use the requests module for this

idle silo
#

i just need to get it working

#

approved or not doesnt matter

worn quail
#

:v

#

Send the code you are using

idle silo
worn quail
#

Did you just copy it

idle silo
#

well it worked befo... ahum

#

i mean yes

worn quail
#
    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

idle silo
#

one moment i'll post it at payload, so it will take probs 2 min before it finds an opening signal

worn quail
#

The code I use takes around 1 min to update

#

It's just dbl's cache

#

Nothing we can change

idle silo
#

yeah no worries, one moment

limpid sorrel
#

it's post_guild_count

worn quail
#

Ah

#

^^

idle silo
#

did it get updated lately?

worn quail
#

Possibly

#

Idk

idle silo
#

havent had issues with it ear... i mean

#

yeah ^^

worn quail
#

That's what my example was

#

Should work better for you than what I did due to it already being rewrite

azure hedge
#

my bot is not displaying total servers in Discorbots

idle silo
#

it needs to replace

#

bot.servers -> bot.guilds

#

@worn quail any alts

worn quail
#

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

idle silo
#

bot.servers wont work

#

cause my client is named "client"

#

i have to replace servers with guilds

#

due to rewrite

worn quail
#

Ok

#

I use async

#

I didnt know what one you did.

idle silo
#

i use the latest and greatest

#

atleast it works

sullen nymph
#

@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

worn quail
#

But work

#

My mindset: if it works it works

idle silo
#

reeeeeeee

worn quail
spiral steeple
#

but if it works and it's old it has the possibility of breaking with no support

sullen nymph
#

If it works, it works. Whether it works well is what matters

worn quail
#

If it breaks I'll do it another way

#

Tbh requests is mostly stable

halcyon zinc
clever rock
#

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 ^^

halcyon zinc
#

OwO

full socket
#

Smh jeff no meming here GWmythiFeelsBannedMan

halcyon zinc
#

xD

#

It was an Real question on a Website @full socket

#

🤷‍♂️

#

xD
But Ok

full socket
#

Yes, sending messages to discord every X seconds is API abuse

halcyon zinc
#

Hmmm

full socket
#

But this channel is about dbl api, not discord's api so

halcyon zinc
#

Ok

rugged sierra
#

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

worn quail
#

Add timer to set it.

#

Let's say, 3min should do

#

I guess

rugged sierra
#

I don't know what a timer has to do with ratelimits but okay

worn quail
#

To allow for it to catch up

rugged sierra
#

I'm asking how often I can check if a user voted. And that is not a planned thing

worn quail
#

Ah

#

You can GET from the api as many times as you want. Post you shouldn't frequently

rugged sierra
#

And you know that because?

worn quail
#

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

rugged sierra
#

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.

worn quail
#

My view on it is what I said

sullen nymph
#

@rugged sierra 60/60s as far as I remember

rugged sierra
#

So 1 per second?

sullen nymph
#

Yes but no

rugged sierra
#

60 in one minute

sullen nymph
#

Yup

rugged sierra
#

Thanks, and also thanks for the new perspective on files and get methods kek

#

||if you don't know just don't answer||

spiral steeple
#

1/s is different than 60/min

worn quail
#

We have opinions

#

I use GET to access files and I get locked out sometimes

#

I'm too tired to talk cri

desert inlet
#

How to enter the webhoock panel in DBL?

full socket
#

In the bot's edit page at the bottom there's a field to enter your webhook url

spring shard
#

How can I track votes of users?

clever rock
#

on?

spring shard
#

Like when a user votes for your bot

clever rock
#

yes but webhook or api?

spring shard
#

Api

clever rock
#

Im afaik you need a webhook to save the users when they vote for your bot

spring shard
#

I'm storing it in a DB

clever rock
#

let me be clear

#

are you really using the api?

#

It feels like you are using the webhook part of the api

spring shard
#

Idk, there was a doc someone linked me to and I tried what I saw on it and it didn't work

clever rock
#

if thats what you are using, you need to

  1. have the port opened
  2. set the webhook settings right
worn quail
#

I just find the users by checking all votes

empty yarrow
#

Hi all, as soon as I put 2 shard on my bot, the voting system does not work with my bot, what to do?

spiral steeple
#

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

empty yarrow
#

i'am in internal sharding

restive otter
#

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?

dull star
#

Check this out

graceful condor
#

no u

azure timber
#

When my bot will approve

dull star
#

Also read the faq

worn quail
#

when my bot will be approved in 2019 in the month of june?

mental echo
#

xD

neat orchid
#

j!help

restive otter
#

Mute

sullen nymph
restive otter
#

@sullen nymph already said, he trolling i think

amber dune
#

@vague lagoon no

#

also radiorecord is good

fringe epoch
#

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)

clever rock
#

I believe shivaco made one

fringe epoch
#

Can u send?

sullen nymph
#

well there's dblpy

fringe epoch
#

I have dblpy but it doesn't work

sullen nymph
#

How come? Any errors?

fringe epoch
#

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

sullen nymph
#

post_guild_count

fringe epoch
#

Ohhh

#

Uwusum

#

❤ u

#

I was going to say

#

I'm rewriting

sullen nymph
fringe epoch
#

Hold on I'm testing it

sullen nymph
fringe epoch
#

Works

#

Thanks

#

Hella lot of other errors

sullen nymph
#

👌

fringe epoch
#

That's why it was hard to see

#

But those aren't caused by dblpy

#

Thanks a lot ❤

sullen nymph
#

yw

wraith pine
#

Bug?

runic grove
#

look at the stack trace. bot.js file line 30

#

also this is likely the wrong channel

wraith pine
runic grove
#

as judging by the screenshot it has nothing to do with dbl apis

#

oh

wraith pine
#

Does it not?

#

Also in the stacktrace it ways dblwebhook

runic grove
#

right i cant read

spiral steeple
#

send the code

rough tartan
#
AttributeError: module 'dbl' has no attribute 'Client'
#
self.dblpy = dbl.Client(self.bot, self.token)
sullen nymph
#

Don't name your folder or files dbl

rough tartan
#

ty @sullen nymph

restive otter
#

can anyone help me with my bot

sullen nymph
#

yeet ask2ask

restive otter
#
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();
    }
}
}
sullen nymph
#

You leaked your token

restive otter
#

i am going to generate a new one smart one

sullen nymph
#

And if it's not about our official libraries, please move to #development

restive otter
#

i just started making bots today....

dull star
#

ok, either way questions about making your bot should go to #development and not here

restive otter
#

gotcha

dull star
#

now go revoke your token since you just leaked it

golden oriole
#

О

restive otter
#

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.

worn quail
#

^

#

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

restive otter
#

i feel stupid for asking, but what does dbl stand for

spiral steeple
#

Discord bot list

restive otter
#

ah ok

ancient venture
#

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?

limpid sorrel
#

not hard

dull star
#

yeah not hard at all

limpid sorrel
ancient venture
#

Oh my bad, and thanks

normal willow
#

this rest api thing is very complex i can't find any good tutorial other than the cat, dog rest apis

clever rock
restive otter
#

hello

#

so

sullen nymph
#

@restive otter There are examples on how to use it

restive otter
#

wait

restive otter
#

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.

full socket
#

I don't think you can

#

Reasons not to use dmb GWcmeisterPeepoShrug

restive otter
#

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.

alpine fox
#
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

clever rock
#

is the port open?

alpine fox
#

like in webhook?

clever rock
#

yes the poer must be opened

#

port*

alpine fox
#

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

#

(

clever rock
#

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

alpine fox
#
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
clever rock
#

open the port

#

running the code will not work if the port is closed

#

open

alpine fox
#

how to open it?

#

no idea

clever rock
#

idk what is your server

alpine fox
#

glitch

clever rock
#

are you using keep alive?

alpine fox
#

no

clever rock
#

process.ENV.PORT should work I assume

alpine fox
#

ok

clever rock
#

given if you dont use keep alive

#

if you have a keep alive that will not work

alpine fox
#

and in env i need to add
PORT=(port-here)

#

?

clever rock
#

no

#

process.ENV.PORT only

alpine fox
#

ok

#

lets check

#

OH

#

no

#

still not

clever rock
#

clarify by still not

#

are you also saving it?

alpine fox
#

autosave

clever rock
#

nah

#

dbl

alpine fox
#

🤦

clever rock
#

dbl dont auto asve your webhook

#

if you change something there save it before test it

#

also how do you put your link?

alpine fox
#

idk

#

i just follow examples on git page

alpine fox
#

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)```
clever rock
#

you have no perm

#

not dbl api problem
thats more on your code

alpine fox
#

yeah i found

#

my promise

#

sorry

topaz wyvern
#

@mighty sierra wrong channel

mighty sierra
#

Oh thx

jaunty steppe
#

async def on_dbl_vote(self, data): what is data? a dict? (python module)

hearty lintel
jaunty steppe
#

ty

dull star
#

how about no

hearty lintel
#

@dull star wut

dull star
#

don't worry about it

worn quail
#

@topaz wyvern holy shit that's the same image I used back in 2017 as my pfp

#

The memorieessss

topaz wyvern
worn quail
#

Ye

feral lion
#

what's is de monei

#

asade lolod

#

kalian tolod

quartz sail
#

Hi

restive otter
#

yeet notr

proven knoll
#

m

mighty shuttle
#

Keep this channel on-topic please, other languages and off-topic content goes in #memes-and-media

trim bluff
#

Is my 10-char api key still valid?

dawn fjord
#

Not sure, try testing it

#

Likely not though

restive otter
#

How do I embed my dis bot page into a website?

worn quail
#

wha

#

you mean image embeds from discordbots, or meta embeds in discord chat

restive otter
#

like embed something into a website..

narrow zenith
#

whelp

worn quail
#

K so dbl embeds

narrow zenith
#

first you need your bot verified

restive otter
#

ok

#

then?

worn quail
restive otter
#

ok

graceful condor
#

anyone else have a 2-3 minute delay for the vote check api?

plain timber
#

yes that happens

#

if you want it instantly, use webhooks

worn quail
#

^

#

I dont mind a delay

#

Since everything is done through a reload command

empty yarrow
#

Hi everybody! As soon as I had shards, it only shows half of my servers on the site .. what to do?

restive otter
#

no its showing the entire server count

empty yarrow
#

Sure?

restive otter
#

not totally

#

ping a mod

#

web mod*

runic grove
#

you are likely only sending guild count of 1 shard

#

which.. makes complete sense. its sharded

empty yarrow
#

how sent globally?

amber dune
#

@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 angry

empty yarrow
#

yes but ... the problem is obvious I do not know how to do it

runic grove
#

they likely thought its a bug, and web admins are the ones handling bugs

amber dune
#

loop through the shards

#

then add up the guild count

#

there should be a way to get a list of shards

restive otter
#

🏓

empty yarrow
#

Mmm okay ty

sudden depot
#

@empty yarrow You can also instead senf the guild count and shard Id

#

then dbl should add them together flr you

empty yarrow
#

@sudden depot yes ty

#

cattyping I'm work

restive otter
#

How do we authorize our self then, I don't understand how to do it..

sullen nymph
#

Send a JSON header where Authorization is the key and the token itself is value

restive otter
#

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.

sullen nymph
#

Endpoint depends on what you want to do

restive otter
#

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.

sullen nymph
#

Are you doing raw HTTP requests or are you using a library

restive otter
#

Library I think yeah.

#

Discord.js

#

If its just sending the server count do I have to do that authorization thing?

sullen nymph
#

I meant a DBL API wrapper

#

Authorization is required on all endpoints

restive otter
#

But how do I authorize tho?

#

I use DBM, but I need to authorize still somehow.

sullen nymph
restive otter
#

I think I understand now.

worn quail
#

dbm

#

why

narrow zenith
#

it's like coding for beginners

#

but without learning

#

but i guess it works

outer kettle
#

Hey

#

I had applied for ads in discord!

worn quail
#

...

#

um

#

wha

outer kettle
#

When will I get its reply!?

#

Perms!

worn quail
outer kettle
#

Permissions!

#

K

worn quail
#

now calm tf down

outer kettle
#

Hey

#

Again!

#

Thats okay but when do i get perms from luca!?

amber dune
#

you wait

#

it shouldnt be longer than 2 weeks

outer kettle
#

So umm!

#

Ok thanks!

worn quail
#

And why do you put ! at the end of every sentence

restive otter
#

Well I'm testing the webhook of vote, but it does not work.
code:

clever rock
#

port

#

make sure port is open

restive otter
#

where do I enter webhook?

#

@restive otter in webhook url

sullen nymph
clever rock
zenith marsh
#

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?

sullen nymph
#

Nope

ebon mist
#

where do i put a link to my image api

spiral steeple
ebon mist
#

well i just spent the last 2 and a half hours writing api documentation and putting it into doscify.js

zenith marsh
#

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

#

My bot servers have grown from 32 to 92 but the API is stuck with the requests being sent

plain timber
#

@zenith marsh 502 = DBL is broken

zenith marsh
#

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

plain timber
#

You're sure you've been getting 502s the whole time?

#

Or just now

zenith marsh
#

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

plain timber
#

Probably usually a different error

zenith marsh
#

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

zenith marsh
#

I fixed it blobthumbsup

#

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

plain timber
#

Yeah switch to rewrite

thin gulch
#

Is it possible to make it so testing webhooks sends a query string of your choice so we can test that works?

hearty lintel
#

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

thin gulch
#

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

hearty lintel
#

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.

restive otter
#

Hoq do I check if user X voted for the bot in discord.py?

thin gulch
#

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

hearty lintel
#

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

thin gulch
#

Worst case I'll just edit the code to hardcode the server id which shouldn't be too bad.

#

Via github issues right?

hearty lintel
#

Correct (sorry for some reason coffee doesn’t work here)

thin gulch
#

No worries^^

thin gulch
#

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^^

hearty lintel
#

perfect!

glacial maple
#

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

glacial maple
#

how is a channel wrong?

restive otter
#

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

#

hi

#

h,

#

h,

#

hi

dull star
#

stop

restive otter
#

hi

sullen nymph
#

This channel is for official DBL libraries or DBL API itself

glacial maple
#

ah ty shivaco, it now works

worn quail
#

wait what nekobot

sullen nymph
#

Wait what channel are we in mmLol

worn quail
#

Ik what channel I'm in

restive otter
#

how i do dbl webhook

full socket
#

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

sudden depot
#

but be clear that it needs a webserver and forwarded ports

full socket
#

Yup you have to be able to forward ports/have open ports

sudden depot
#

Another Thing you have to consider is: static or dynamic ip

thers are also webhook relay services tho if thats something for you

worn quail
#

ima use my pi as a relay webhook thing

#

Send a file to s3 and have my bot check it every 15 seconds

hoary hill
#

I have POSTed my count like this, and it returns code 200 but it hasn't updated the count?

sullen nymph
#

Cache /shrug

lime gust
#

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?

hoary hill
#

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

restive otter
#

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

runic grove
#

you should post that to the issues repo that almost never gets looked at mmulu

worn quail
#

Wait

#

Wrong sub

#

Posting to the dbl sub would work

#

Lemme find it

flint harness
#

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.
hearty lintel
#

@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
buoyant sandal
#

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...

sullen nymph
#

What wasn't clear there?

buoyant sandal
#

this part?

#

I do not think the connection was successful

sullen nymph
#

Webhook stuff or all params?

buoyant sandal
#

I did not include any of those because it said optional

sullen nymph
#

What's your code currently?

buoyant sandal
#

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))```
sullen nymph
#

Did it output any errors?

buoyant sandal
#

no

sullen nymph
buoyant sandal
#

1.0.0

#

I just migrated from 0.16.12

#

and I heard that dblpy is supported from 1.0.0 and beyond

sullen nymph
#

Well does that output anything?

buoyant sandal
#

nothing is outputted

sullen nymph
#

I hope you are loading that cog properly thinkW

buoyant sandal
#

I tried to include print in the script but that didnt work

sullen nymph
#

What's your dblpy version then

buoyant sandal
#

0.3.1

sullen nymph
#

How are you loading the cog

buoyant sandal
#
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?

sullen nymph
#

Loading the cog from your bot

#

The cog code is fine

buoyant sandal
#

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?

sullen nymph
#

Uhm

#

Where did you put that code anyway

buoyant sandal
#

near the end

#

after @client.event stuff

sullen nymph
#

...

buoyant sandal
#

there are still scripts after it that loads...

sullen nymph
#

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

rigid shuttle
#

Why i'm I gettins a 400 Bad Request when I post stats ? tanking2

sullen nymph
#

What are you sending as headers? chadthonk

runic grove
#

headers are likely wrong

rigid shuttle
sullen nymph
#

Yep, 0 as server count doesn't work

rigid shuttle
#

Yea I fixed that one

#

But why it isn't updating the status on the website tk

sullen nymph
#

Cache

rigid shuttle
#

I forced refresh but still shows it's offline thinkOnion

sullen nymph
#

is it ????

rigid shuttle
#

Ya

runic grove
#

is it in this server

rigid shuttle
#

Nope

sullen nymph
#

That's the reason

rigid shuttle
#

How can I get it here ? tanking

sullen nymph
#

What's the bot's ID?

#

Or, well, name

rigid shuttle
sullen nymph
#

It's in this server ThonkRotate

#

Your bot is offline

rigid shuttle
#

Yes, i'm using the beta version rn

#

Should it be the main version for it to work ?

sullen nymph
#

You should try to make it go online at least once

rigid shuttle
#

Okey

#

It works pepehappy

#

So it's @abstract moth who is doing the status thing right ? tanking

sullen nymph
#

I would guess so

rigid shuttle
#

Thanks FeelsFIngerGunsMan

rigid shuttle
#

Can't we get what response dbl get from the webhook ? That would be usefull for debugging

plush ore
#

Don't think so

storm pier
plain timber
#

@rigid shuttle the vote webhook?

rigid shuttle
#

Yep

upper magnet
#

how can i send shard count

short bluff
#

bottom

upper magnet
#

ty

topaz imp
#

hey

restive otter
proper cedar
#

How do I create a webhook in a bot with heroku host?

azure hedge
thin gulch
#

With voting, is it possible to redirect the user to your site afterwards to allow for an interface where they can choose their reward?

rigid shuttle
#

Don't think so, but you can dm them when they upvote to choose the reward

thin gulch
#

As I don't really want to DM them

#

^^

rigid shuttle
#

Ah oof

thin gulch
#

I guess I could but that's kind of spammy

sullen nymph
#

State in your description telling the user to visit your website after voting to get a reward

thin gulch
#

I'll probably go the DM route then 🤷

#

Would be nicer if you could though

restive otter
#

@azure hedge I have used deploys

#

How come?^

plain timber
#

@topaz imp how do you test it, you dont have a bot and all routes need auth

plush ore
worn quail
#

And lightshot is a bit meg

#

meh

topaz imp
#

@plain timber i got a token from a friend of mine

plain timber
#

oh

topaz imp
#

he's one of the lead devs from the groovy bot project

lime gust
#

what am i doing wrong ^^ ?

plain timber
#

@lime gust shards should be an array of multiple numbers

#

If your bot is not sharded, dont send any of the shard stuff

lime gust
#

Gotcha. But is [ 18 ] not an array?

topaz imp
#

i think so, but multiple shards != one shard?

lime gust
#

Changed it, thanks

topaz imp
#

yeah was a guess of mine xD

lone hemlock
#

Hello, I have a own Discord Bot but i haven't a idea for upload it where I can it? In the Browser?

plush ore
#

You mean shard/server count?

lone hemlock
#

Yes Sorry

plush ore
quartz sail
#

Is anyone here having ideas for bot commands?

tropic hill
#

Tag system

restive otter
#

Keep this channel on topic blobokhand

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

worn quail
scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

sullen nymph
#

Alright, let's keep off-topic in appropriate channels

arctic arch
#

@lime gust use a json content type

azure hedge
#

@restive otter

#

i dont know how to get my bot's webhook

#

:,>

severe crystal
#

Is there an event that will be ran every time the bot has been voted?

plain timber
#

if you set up the webhook, then that will run

restive otter
#

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?

plain timber
#

did you save before testing?

restive otter
#

no, i assumed since the test button was on the edit page that it would work. that fixed it, thanks

buoyant sandal
#

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

worn quail
#

on_vote uses a webhook I believe

#

The get_user_vote I remade using aiohttp

buoyant sandal
#

well yeah

#

I wanted get_user_vote because I was hoping the data to be more accurate

#

and also weekend status

worn quail
#

Tru

buoyant sandal
#

because using the url method, the data updates slow

worn quail
#

That's v tru

#

5min top I think

buoyant sandal
#

I have no idea how to use on_dbl_vote though

#

yes

worn quail
#

again, webhook.

#

I'm working on turning my pi into one

#

That will send data to my computer

buoyant sandal
#

wait discord webhooks?

worn quail
#

No

#

I wish

#

That would make things easy

buoyant sandal
#

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

worn quail
#

Actually

buoyant sandal
#

but that doesnt work

#

but its not really helpful

worn quail
buoyant sandal
#

how are webhooks necessary if you already verified your auth

#

thats weird

vital anvil
#

wuh

#

how else are you gonna get the data from dbl?

buoyant sandal
#

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

halcyon valve
sudden rampart
#

webhook url is something you host

buoyant sandal
#

well yeah thats for the bot token

worn quail
#

Like a pi.

Also if possible could someone shoot me a quick tutorial on how to do that through ssh?

sudden rampart
#

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

worn quail
#

And when you get the http request, you can forward the information to whatever you use to host your bot ig

sudden rampart
#

yes

buoyant sandal
#

ohhhhhh you can scroll down

#

to the api section

worn quail
buoyant sandal
#

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

halcyon valve
#

guess so

sudden rampart
#

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&notRandomNumber=8","isWeekend":false}```

halcyon valve
#

i shouldnt really say anything i dont even know what you are doing

worn quail
#

Essentially that's what he is getting from DBL

buoyant sandal
#

so its going to send data to the url I provide?

worn quail
#

Depends on the url

#

You would need to configure the address to accept those reqests

sudden rampart
#

yes

#

dbl sends a POST request to your url

worn quail
#

Now.
Wait a hour until apt-get does their stuff

#

Since 1gb is horrible

halcyon valve
#

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

sudden rampart
#

apt-get is mostly network and storage bound

buoyant sandal
#

cool, I think I can get it now, im assuming you make a random password for the authorization part though right?

sudden rampart
#

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

buoyant sandal
#

Im kind of using python flask now....

#

is it like kind of submitting a form? can I use request.form[value here]?

halcyon valve
buoyant sandal
#

wait thats possible?

#

I already got posting server count though

halcyon valve
#

thats possible yes

buoyant sandal
#
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

worn quail
halcyon valve
#

oh voting i tought you needed server count

worn quail
#

This happens every time

buoyant sandal
#

do I have to put an authorization password? or is it optional