#topgg-api

1 messages Β· Page 53 of 1

clever rock
#

Its a handler

#

didnt you read the read me?

royal fiber
#

How to use it?

clever rock
#

read the red me

#

read me

royal fiber
#

I mean impliment it in my bot?

clever rock
#

starting the webhook is on readme

#

read examples on making a request to it

royal fiber
#

I cant use it because it req a port

clever rock
#

because you need a port

royal fiber
#

I cant use port for 2wise

clever rock
#

then im afaik you cant votelock your bot

royal fiber
#

Glitch issue

clever rock
#

you are using your port to ping

royal fiber
#

They told me i can with this..

const DBL = require('dblapi.js');
const server = http.createServer(app);
const dbl = new DBL(process.env.DBL_TOKEN, { webhookAuth: process.env.DBL_PASSWORD, webhookServer: server });

dbl.webhook.on('ready', hook => {
  console.log(`Webhook running with path ${hook.path}`);
});
dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});```
#

Yes to ping the bot

clever rock
#

yes but you use your port to ping

#

you need to remove that

#

if you want to use that

#

but you sacrifice your project to be offline if no one votes

royal fiber
#

If i remove my bot will be offline

clever rock
#

yes so you dont really have any other choice

#

other than the two tbh

royal fiber
clever rock
#

my mini handler will allow you to host the vote handling in another glitch server

#

but you set it up on yourself since

#

its really easy tbh

royal fiber
#

Can you show me that?

clever rock
#

I provided the startup code on readme

royal fiber
#
const DBL = require('dblapi.js');
const server = http.createServer(app);
const dbl = new DBL(process.env.DBL_TOKEN, { webhookAuth: process.env.DBL_PASSWORD, webhookServer: server });

dbl.webhook.on('ready', hook => {
  console.log(`Webhook running with path ${hook.path}`);
});
dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});```
#

I get this from the docs

#

How to use it?

clever rock
#

we wont get any progress you are just reversing the questions

#

I cant help you if you dont help yourself with the help I give you

royal fiber
clever rock
#

basically its the same of making your own webhook

royal fiber
#

If i make my own webhook then will i need port?

clever rock
#

ofc you need a port

#

dblapi.js needs a port

#

you cant use that without a port

#

where will the data go if theres no gate for it to go?

#

the port is a "gate"

royal fiber
clever rock
#

I said a many times

#

that you are gonna make your own server or endpoint via express

#

and get the vote from there

royal fiber
#

Ya

#

So i want to do it

#

How to do it?

clever rock
#

Make your own express server, Im sure you have the pinger there

#

tweak that a bit

#

make an endpoint for your votes to listen to

royal fiber
#

Do you have glitch?

clever rock
#

I tried my own handler on glitch

#

ofc I know it works on glitch

#

dblapi.js will too

royal fiber
#

Can you help me to make one?

clever rock
#

I already made one

royal fiber
#

Come in my project

#

And help my dblapi work

clever rock
#

I wont make one because I already have one

#

and its open source

royal fiber
#

Impliment it on my project

clever rock
#

thats asking too much now

royal fiber
#

I am new to glitch so confused

clever rock
#

when you only need to just literally read the link @spiral steeple gave you

spiral steeple
#

πŸ‘‹

royal fiber
#

Can't you just help me?

spiral steeple
clever rock
#

you just need to clone that on your glitch project

#

if you want to use that

#

OR

#

use dblapi.js and remove the pinger

#

then use something like a pinger from other server to ping your work

#

thats the easiest way I can give you

royal fiber
#

I dont want to ping my app

#

I just want my app page to be opened

#

Like OK

#

because i use uptime robot to ping the app

clever rock
#

then why you need to have an express server hogging the port then?

royal fiber
#

How can my glitch app website open without express?

#

I have just one aim: to open my glitch web page

clever rock
#

that wont open w/o express

#

although as I said endpoints

spiral steeple
#

@craggy sentinel

craggy sentinel
#

thanks tmeowsip

spiral steeple
#

❀

foggy harness
#

My god, it hurts to read that conversation.

plain timber
#

He's been spamming my dms asking me to fix it for him

restive otter
#

how do i show how many guilds my bot is in?

runic grove
#

with the api

little harbor
#

What language?

restive otter
#

oh yeah i want to do that too but idk how

#

Can anyone help me with the web hook that shows those that voted for the bot?

sudden rampart
#

onlyids has been removed

#

dblpy wasn't updated

#

remove it, there's no way of getting only ids

#

also gone

#

the best way of tracking voters is using webhooks and a database

sullen nymph
#

A webserver

#

Contact Google, it knows more than I do

#

Doubt that Python webhooks are kinda possible in simple way

sudden rampart
#

setting up a webhook is just starting an http server and listening for requests

sullen nymph
#

http.Server EarthThink

digital linden
#

@restive otter dblapi webooks

#

are you hosting?

plush ore
#

They do have a built in way of webhooking in their api wrapper

#

But it didn't work for me so instead I just did it manually by setting up a server that listens for post

sullen nymph
#

That's only for JS I believe

thorny parrot
#

The api is no longer updating for me.

#

I wouldn't know what info to supply, it just isn't updating.

sullen nymph
#

Currently testing webhook and not getting any response on my end whereas postman sends POST to the same URL and it works

clever rock
#

Still working for me but, Im not using the testing

#

users who voted still get logged

sullen nymph
#

After some time it started working but now authorization doesn't exist in the coming data dogeKek

#

ig it takes a while for it to update?

glass dust
#

So i have problem, i can see one of my users has voted via the 'deprecated' api /bots/botid/votes. But when i enter the same user in the /bots/botid/check?userId=userid api it returns {voted:'0'}. Does anyone know why this happens?

sullen nymph
#

Cache

glass dust
#

is there a way to bypass the cache or something else to get the correct result?

tidal burrow
#

"bypass the cache" sounds as ridiculous as saying "bypass discord's ratelimits"

#

you just have to deal with it

glass dust
#

yeah, i guess you're right

restive otter
#

bypass your destiny

arctic arch
#

/bots/botid/check responds with 1 if the user had voted in the last 12 hours

restive otter
#

Hey

#

can i set other port than 3000

#

if i am already using it?

#

i mean on express glitch

clever rock
#

sacrifice the pinger

restive otter
#

what?

clever rock
#

it means remove the pinger

restive otter
#

oh

clever rock
#

either you use the pinger w/o votes

#

or no pinger w/ votes

restive otter
#

but if i change to port 3000

#

on votes

#

it say on glitch that error 404

#

(i deleted the pinger)

dull moon
#

so the url i'm getting from the webhook thingy is 0.0.0.0:3333/dblwebhook and it doesnt seem to work

#

and basically anything on google about webhooks is chinese to me

#

since i've never done something like this

#

so is there any way to check for votes without webhooks?

digital linden
#

@restive otter easy dont use glitch

restive otter
#

@dull moon you host on what?

#

@digital linden,what you recommend

#

Free...

digital linden
#

oh

#

....

#

i guess

#

u can self host it

#

i mean a vpn is free if u use github student pack

#

u have $50 of digital ocean credit

#

amazon web services is free for a year

#

u can use

#

digital ocean , and othersz

dull moon
#

@restive otter Someone is already helping, but thanks <3

digital linden
#

@dull moon u use ur ip:5000/dblwebhook

restive otter
#

Glitch is 3000

#

Only :(

digital linden
#

thats why

#

u have to sacrifice your pinger or use websockets

restive otter
#

Yup

digital linden
#

fastify is works with u i think

sudden rampart
#

you can run more than one thing in a single port

spiral steeple
#

WHen I try that it says it's in use πŸ€”

sudden rampart
#

you can't start two listeners on the same port

#

you can run two different things as long as they share the same socket listener

spiral steeple
#

What does the uptime rovot on glitch even do, other than keep it up mmLol

#

robot*

sudden rampart
#

keeps it up

spiral steeple
#

Yea thanks ;-;

sudden rampart
#

so... a domain?

foggy harness
#

Forget I asked. I cba to explain the whole thing. I know it works with a domain.

restive otter
#

How do i get if someone has voted for my bot?

spiral steeple
#

use webhooks

#

Also what lib?

restive otter
#

discord.js

spiral steeple
#

You have the library?

restive otter
#

The DBL library? Yes i do

spiral steeple
restive otter
#

Yes i have that

spiral steeple
#

And set it up on the edit page of your bot

restive otter
#

i put in the discord webhook url its say it does not send to discord channels

#

and whats the password i use

spiral steeple
#

You use what you set it as, also it doesn't accept discord webhooks

restive otter
#

would it be https://discordbots.org/bot/:ID/edit

spiral steeple
#

no

#

Wait

#

the bots edit page

#

that's how you get to a bots edit page

#

the url to the webhook would be http://ip:port/path

restive otter
#

would it be my vps ip ?

spiral steeple
#

yes

restive otter
#

ok so what would the path be ?

spiral steeple
#

what you set it to, it default to dblwebhook tho

#

defaults*

restive otter
#

ok

#

i keep getting adress already in use on my pwrshell

spiral steeple
#

Then something is listening on it already

#

on that port

#

Actually, I dont think dbl auto closes it on death

#

which can create problems

#

I manually used to have to kill it, but idk if I just set it up wrong tho

sudden rampart
#

when killing the process all ports it's listening to will be "released"

restive otter
spiral steeple
#

0.0.0.0 is local host, and does it not have a path?

sullen nymph
#

127.0.0.1 is local host

#

0.0.0.0 uses public IP

#

Works for me with no path so idk /shrug

sudden rampart
#

0.0.0.0 is all ips

sullen nymph
#

thonkku ig I googled the wrong stuff then

zealous vine
#

guys how do i make my bot say <user> Has Upvoted Thanks!

vagrant patrol
#

Where to get loco api

plain timber
#

@vagrant patrol this channel is only for help with the DBL api

#

@zealous vine always say what language

zealous vine
#

JavaScript @plain timber

#

Dm me if u put a message

digital linden
#

read the docs first

#

We hooks πŸ‘Œ

smoky stream
#

FR : Pourquoi quand on vote pour mon bot sa fait rien ?
EN : Why when you vote for my bot it does not matter?

const DBL = require('dblapi.js');
const dbl = new DBL("MY TOKEN", { webhookPort: PORT, webhookAuth: 'MDP' });
dbl.webhook.on('ready', hook => {
  console.log(`Webhook running with path ${hook.path}`);
});
dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});```
#

πŸ€”

#

Can anyone help me?

digital linden
#

hm

#

@smoky stream is my token, and port correct

plain timber
#

dont leak your webhook auth 😬

spiral steeple
#

Well if they dont have his token they cant do anything with it

plain timber
#

??

#

what

spiral steeple
#

Wrong thing

#

Shh

plain timber
#

with the url and the webhook auth u can fake votes

spiral steeple
#

Well do you have the url πŸ™ƒ

#

my dbl auth is πŸ‘Œ

smoky stream
#

@plain timber I have never had Webhook or Url authentication: x

plain timber
#

What

smoky stream
#

The url and authentication, they send it by or?

#

@plain timber

plain timber
#

??

#

English pls

smoky stream
#

Enfaite je ne parle vraiment anglais ^^'

plain timber
#

DBL will send a request to the URL you set in your edit page

#

Huh

smoky stream
#

I do not really speak English ^^ '

plain timber
#

Well then we probably can't help you

smoky stream
#

But in the page of edition must put what like link for example?

#

I have the API key but not the link 😦

#

They say, "Webhooks will send a request for publication to a URL of your choice when your bot has been voted."

#

@plain timber So can I choose my link? The created directly in my editing page?

plain timber
#

the link is the endpoint the webhook is running on

#

usually https://YOURIP:PORT/dblwebhook

smoky stream
#

Ok

junior merlin
#

Why dose my bot widget (website) say servers undefended.

plain timber
#

@junior merlin do you post the server count?

copper quartz
plain timber
#

@copper quartz read what I just sent

#

Post server count to the api

#

See the link in the channel topic

copper quartz
#

@plain timber what do you mean with "do you post the server count"

spiral steeple
plain timber
#

Post it to the api

#

Yes

#

It's in the channel topic

jolly sonnet
#

Oh boy

spiral steeple
#

Very bottom, or use the lib for your lang

formal marten
#

The URL for the webhook should point to the server the bot is running on right?

spiral steeple
plain timber
#

No / after ip

formal marten
#

Thank you. Where would path go to, where your cog is at or the main file?

#

I'm using python if that matters

spiral steeple
#

Wait we talking dbl webhooks, ye?

formal marten
#

Yeah

#

Where it will tell me when someone votes

spiral steeple
#

I don't use py, but if it's like other webhooks, you should define the path when making the listen thing mmLol Cant describe it well

formal marten
#

:O

#

I can probably figure it out from here thanks.

plain timber
#

@formal marten you need to set up a webserver to accept post requests

restive otter
#

How much time does it take show that I have voted? I think its some seconds but I need excact time

formal marten
#

@plain timber I'm looking for examples. I only see one where someone used flask to handle it. Im assuming that would be the way to go unless you know of something better

#

I know Django really well but it seems like that would be more than I want.

spiral steeple
#

@restive otter mine are usually instant

plain timber
#

@formal marten I don't know python, sorry

queen mason
#

I get a error will posting my stats since today (discord bot list: Error: 503 Backend fetch failed)

#

I'm using dblapi.js

spiral steeple
#

Yep, wait it out

#

Nothing you can do

#

Atleast I don't think it's a problem on your end

queen mason
#

I hope so and thanks for the info

violet stirrup
#

oof was just gonna ask about that

plain timber
#

yes 503 means dbl is broked

ornate abyss
#

Hey

#

Where is the webhook thing for?

#

I thought it was for if someone votes that it will send it a channel but it’s not πŸ€”

tidal burrow
#

It's for your webhook, not discord's

ornate abyss
tidal burrow
#

DBL library is irrelevant to discord libraries

ornate abyss
#

Oo

spiral steeple
#

Uunless your trying to post stats with js you need to be using d.js or eris

ornate abyss
#

hey

#

how can i get the server amount the bot is in on the page?

spiral steeple
#

Post server count

ornate abyss
#

what

restive otter
#

@ornate abyss you need to get the server count from your client with the bot and post it with the API

ornate abyss
#

ah for everytime it gets kicked and added

spiral steeple
#

That is such an old channel

restive otter
#

@spiral steeple it has some good examples of what that means

#

But most examples are pretty outdated yeah

ornate abyss
#

does it still work?

restive otter
#

@ornate abyss some probably do

#

Pretty sure the PHP ones use CURL

#

Which for example still is used within PHP

#

C# still has WebClient aswell but I'm not sure if the library has changed

spiral steeple
#

Idk if thats what he means

#

He wants to post his count to dbl is what it looks like

#

And Im also guessing he uses py as he asked if the py lib was for rewrite

restive otter
#

He wants to display his server count

#

The best way to figure that out is by looking at http client examples and just posting the server count

ornate abyss
sullen nymph
#

aiohttp + manual HTTP request to a DBL endpoint with headers

wraith pine
#

How long does it take from when someone votes untill my webhook catch it and log it to console?

spiral steeple
#

Normally milliseconds

wraith pine
#

Ah

#

Guess my webhook is dead

plain timber
#

Or DBL is borked

spiral steeple
#

dbl borks a lot

wraith pine
#

503 Backend fetch failed

#

What is that

spiral steeple
#

Bork on dbl

#

cant do anything

wraith pine
#

Urgh

spiral steeple
wraith pine
#

I am trying to setup my webhook

#

To get votes

spiral steeple
#

And it's borked

wraith pine
#

But yea

#
const DBL = require("dblapi.js");

const express = require('express');
const http = require('http');

const app = express();
const server = http.createServer(app);
server.listen(5000, () => {
    console.log('Webserver is online on port 5000');
});

const dbl = new DBL("NOPE", { webhookAuth: 'password', webhookPort: 5000, webhookServer: server }, client);

dbl.webhook.on('vote', vote => {
    console.log(`User with ID ${vote.user} just voted!`);
    console.log(vote);
});

dbl.webhook.on('ready', hook => {
    console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
#

Why aint that working? It is logging that the webhook is ready

spiral steeple
#

I'd have to guess either dbl isn't sending requests or you dont have it set up in your bot's edit page settings

wraith pine
#

Got the webhook working πŸ˜ƒ Thanks

late jay
#

How do I post my bot's server count in Python?

#

Like, without using the dbl module

#

Just with requests or something

restive otter
#

Yes of course. A norma http request @late jay

#

Normal*

late jay
#

Yeah, but what are the headers/fields?

restive otter
#

Auth

#

server_count

#

I would reccomend you look at the website

#

How to display servers and shards on discord bot page?

late jay
#

@restive otter That table doesn't say anything about auth

#

That's why I asked

restive otter
late jay
#

But here it says Authorization, and you said it was Auth

restive otter
#

Because if you had any programming knowledge you would know that Authorization is builtin to most web clients as it's used a lot of the time.

#

Auth is a short word for Authorization and it's in the api docs which you should read

late jay
#

God

#

English

#

Anyway I'm aware of that

#

Thanks for the help

restive otter
#

Depending on what web client system you use. There's either a function for it or you can just include it in the header

late jay
#

I said I was going to use the requests module πŸ™ƒ

restive otter
#

What?

late jay
#

Like, Python's requests module

restive otter
#

There's a few. I never use python but either way. You can just include "Authorization" in the header

late jay
#

Yeah, but to send the request, I need to use the module, right?????

restive otter
#

I'm confused.

#

You need to make a post request

sullen nymph
#

@late jay aiohttp

#

for async code, requests for sync

#

Don't use requests in your dpy bot

crisp gorge
#

I dont get this

#

what do i need to do for authentication?

rocky mulch
#

I don’t get this either

#

Help

spiral steeple
#

It's your bots auth token for dbl

#

It tells you how to get it

rocky mulch
#

Yeah

spiral steeple
#

And it goes in headers as Authorization

rocky mulch
#

Can you show me this is first time

#

I can get my bot online

#

@spiral steeple

crisp gorge
#

ah okay

#

so i need to do nothing really

#

thanks!

spiral steeple
#

Im at school rn, no time to explain

crisp gorge
#

What does the event 'posted' signify or do?

signal lily
#

Just to make sure there is no rate limit on getting vote count right?

sudden rampart
#

all requests have a 60/minute ratelimit

#

per ip

signal lily
#

ah ok

spiral steeple
#

Why cant we just say 1 per second Thonk

signal lily
#

I am trying to figure out how to do a loot box system using votes tho my problem is my host doesn't allow different ports to be opened so I can't use webhooks (at least if I understand it correct lol)

spiral steeple
#

I see the conflict in my previous statement nvm mmLol

#

@signal lily do you have any ports open?

signal lily
#

I am using heroku :/

#

Yeah.........

spiral steeple
#

process.env.PORT

#

It should be defined by default

#

Try to console.log it

signal lily
#

Isn't that the 8080 port?

spiral steeple
#

All I know is that I ran a proxy on heroku

signal lily
#

hmm

#

Would it be possible if I did this using glitch?

restive otter
#

If you want to do it manually

signal lily
#

Thats not really what I asked for but thanks anyways lmao

spiral steeple
#

Never used glitch @signal lily sorry

signal lily
#

Hmmmm

restive otter
#

Funny because I wasnt even talking to you

signal lily
#

Thats the annoying thing if you can't afford a vps :/

#

oh lol

spiral steeple
#

I think you can still create a server on heroku

restive otter
#

@rocky mulch @crisp gorge try out rest API client to see if you're doing it properly

#

You add auth to Header, in body you could add server_count

signal lily
#

Heroku allows me to run @tired moat 24/7 but it doesn't allow me to open ports

spiral steeple
#

Ill see when I get time, or you can try

#

Are you already using a port?

signal lily
#

For lit bot yes

spiral steeple
#

You can use the same port then and set it to listen for post requests on the same port

#

Just a different path

signal lily
#

hmmmm

spiral steeple
#

You can do multiple things on one port

#

I use fastify

signal lily
#

Wait do discord bots on a vps actually use a port.... I think I am going crazy in my head atm lol

spiral steeple
#

You dont need a port to keep a bot up on a vps

signal lily
#

Welp then nope XD

spiral steeple
#

But you should be able to listen on the port

signal lily
#

I could use the 8080 port of heroku????

spiral steeple
#

The way I set up my server to my proxy was listening on process.env.PORT

signal lily
#

ok

#

Will do that as well then xd

spiral steeple
#

Its actually not even my proxy, its advaith

#

S

signal lily
#

lol

#

btw the webhook has to have the port on the end of the url in the edit page right?

spiral steeple
signal lily
#

yeah k

spiral steeple
#

I have to go no, Ill be back sooner or later

signal lily
#

ok thanks man!

signal lily
#

the port changes....

spiral steeple
#

That doesnt make any sense

#

process.env.PORT changes?

signal lily
#

yup

#

on every restart

spiral steeple
#

And can you not set your own port then?

signal lily
#

nope

spiral steeple
#

on heroku does it not let you?

signal lily
#

sadly nope

spiral steeple
#

Then I'm not too sure, sorry

signal lily
#

It doesn't even ready the webhook

#

:/

thorn violet
#

How do you properly setup the options for the DBL NPM package?

plain timber
#

@thorn violet what are you doing with it?

thorn violet
#

Check when someone votes for the bot

#

But apparently it's not an http server πŸ™ƒ

dawn fjord
#

I would recommend looking into the package's code to see how it creates an http server @thorn violet

thorn violet
#

Doesn't it just expect an http server to be passed in? Thats what the error is telling me

#

But I'll give it a look

cobalt ocean
#

Any way to get the date of the votes?

plain timber
#

you'll probably have to use webhook and save votes to a db

dawn fjord
#

If you get the votes via wehbook you can track the date yourself, I don't believe you can get the day the user voted though through /votes

cobalt ocean
#

Alright, thanks

rocky mulch
#

I can’t get my bot online plz help I have do everything right but it’s not working and I am on iPhone

clever rock
#

start by doing a proper code

rocky mulch
#

How

clever rock
#

Learn a programming language

#

python or javascript is easy for beginners

plain timber
#

Did you even code the bot yet HyperThonk

rocky mulch
#

Yeah

plain timber
restive otter
#

i write my code on paper and scan it with a printer

fading kraken
#

Is there any way to access information on a bot without being authorized? api/bots/:id returns an error in that case (and is the only bot website which does i might add)

arctic arch
#

you have to be authorized

inner venture
#

@fading kraken what error do you get

spiral steeple
#

Probably a 401

sterile cipher
#

What should I put in the webhook url if I want to hook up my bot that is being hosted on glitch.com?

sullen nymph
#

https://your_project_name.glitch.me:3000/dblwebhook

sterile cipher
#

Hmm

#

I've done that and this code that it's running isn't working:

const DBL = require('dblapi.js');
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!`);
});
sullen nymph
#

Try 5000 instead of 3000

sterile cipher
#

I'm not sure if it works

#

Yeah it's not pinging

#

It keeps saying 4 zeroes with dots and :5000 for example which doesn't exist

#

hmm

#

It's still not working

#

I've looked thru all the pages and it's not telling me anything

#

On how to create a webhook url

#

For code

spiral steeple
#

Its running on port 5000 then

foggy harness
#

Well, that is your webhook URL

#

0.0.0.0 is any IP.
That likely means that your server's public IP will have the hook running on port 5000

sterile cipher
#

Huh

#

Well how do I test if it works?

spiral steeple
#

The test button

sterile cipher
#

I did that multiple times

#

And waited a few seconds

#

And nothing came out in the logs

#

Also the ip is down as well :/

sudden rampart
#

what address did you put in the field?

#

it should be something like http://yourdomain:5000/dblwebhook or http://123.456.789.012:5000/dblwebhook

spiral steeple
#

Hes on glitch

#

Idk what the project url looks like

sterile cipher
#

https://the-keplerbot.glitch.me:5000/dblwebhook

#

Apparently

#

Doesn't seem to work though

#

Any ideas?

spiral steeple
#

Try http

#

Idk if it'd make a difference for you

#

Just a thought

sterile cipher
#

Hmm

#

I think I got it

#

I've done the test button three times in a row quickly and a minute or less later I see the pings in the logs

spiral steeple
#

It's usually instant, so that's weird, could just be dbl being slow tho.

sterile cipher
#

maybe

#

I have no idea

#

Is there a proper way to check if it works?

sudden rampart
#

glitch only allows you to listen on port 3000

#

listen on 3000 -> https://your-project.glitch.me/dblwebhook

sterile cipher
#

It says "address already in use :::3000"

#

And it keeps saying that over and over

sudden rampart
#

because you're running two servers on port 3000

sterile cipher
#

What do you mean by that?

sudden rampart
#

you're running two tcp servers on port 3000

sterile cipher
sudden rampart
#

you can only run one

sterile cipher
#

Where is the other one?

sudden rampart
#

you're running something else in port 3000

#

idk

#

it's your code

#

you should know that

sterile cipher
#

But it's not in my code

sudden rampart
#

it is

sterile cipher
#

Thats the only spot it's in

#

I did a CTRL-F search

sudden rampart
#

i can guarantee you there's another one, otherwise you wouldn't get that error

sterile cipher
#

The other thing is I can't get to the node.js files

#

Like that's part of the package

sterile cipher
#

For now I'll have to leave it

#

As I need to get more people

#

But I am searching for help

#

And I still cannot find it thru my code!

sturdy vine
#

did you store it in a variable and use that elsewhere?

#

if yes find the variable

sterile cipher
#

I got it to work! :D

#

I asked for help on the support page glitch has and they directed me to the right direction! :D

restive otter
#

I am trying to make a log channel of votes on my bot i sopose i need to use webhooks but im not sure how to do it

spiral steeple
#

@restive otter What lang

#

and lib

restive otter
#

JS Node

#

@spiral steeple

spiral steeple
#

Ye, webhooks to receive the vote and preferably one to send it too mmLol do you have the dblapi.js lib?

#

a discord webhook to send it*

restive otter
#
dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);// What im i soposed to put here ?
});
dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});```
spiral steeple
#

Nothing in the ready, except the console.log, unless you want something in there. The on('vote') part is what is emitted when the user votes

restive otter
#
 

dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);// What im i soposed to put here ?
});```
#

so do i need that

spiral steeple
#

that's still the ready event

#

you can have it

#

but you dont need it

restive otter
#

oh okey ill try

spiral steeple
#

I'd keep it though

restive otter
#

Pls

onyx vine
#

@mighty shuttle one question how would i slow down commads without cancling them completly in error

plain timber
#

uh

#

what

sturdy vine
#

i think they mean ratelimiting their commands

empty forge
#

hi

#

@plain timber what now

plain timber
#

hi

#

so have you looked at the docs

empty forge
#

yeah

#

i dont understand them

plain timber
#

you use js right

empty forge
#

both the dbl docs and ksoft

#

yeah

plain timber
#

the js page has a code example

empty forge
#

ok

#

lemme see

#

@plain timber

plain timber
#

yes

empty forge
#

will this post in a channel who voted

plain timber
#

that will log it to the console

empty forge
#

yeah

plain timber
#

did you even read the code

empty forge
#

so i can set the channel

#

anyways

#

i have the dbl token

#

but how do i get the password

#

the webhookouth

plain timber
#

that can be whatever you set

#

but it needs to be the same in the edit page

empty forge
#

what

#

what password

plain timber
#

...

#

read what i literally just said

empty forge
#

so i can just set the password to anything

plain timber
#

yes but it has to be the same in the edit page ...

empty forge
#

but how do i see my edit page password

#

?

plain timber
empty forge
#

i dont understand shit

#

so i download the dblapi package

plain timber
#

it helps if you have a basic understanding of coding, js, and webservers

#

the token goes where it says yourDBLTokenHere

empty forge
#

idk webservers

#

yes ik that

#

but how do i get the password from the edit page

plain timber
#

...

restive otter
#

Hahaha

plain timber
#

you type it where it says authorization

restive otter
#

What password

plain timber
#

can you actually read what i say for once

restive otter
#

<_>

plain timber
#

see the red box

empty forge
#

yes

#

there is nothing there

restive otter
#

HAHAHA

#

Nooo

empty forge
#

where is that page

plain timber
#

its the edit page

empty forge
restive otter
#

@plain timber I mean that field isnt nessecary

empty forge
#

here

restive otter
#

Unless he has an open index

#

Just the URL

#

Is what's needed

plain timber
#

@restive otter iirc the js lib requires it

restive otter
#

O

#

Really? Damn

plain timber
#

not sure

#

but its always best to have it anyways

restive otter
#

True but he seems to struggle

empty forge
plain timber
#

yes

#

i said that

#

like 5 times

empty forge
#

ok what about the url

#

where is the url

plain timber
#

do you use glitch?

empty forge
#

well yes

#

i code on vsc and push on glitch

plain timber
#

https://PROJECTNAME.glitch.me/dblwebhook

#

also make sure you set webhookPort to process.env.PORT

#

yes

restive otter
#

Well now you just..ok whatever

plain timber
#

@restive otter see why he needs the auth now BlobLul

restive otter
#

Haha but he showed it

#

I didnt show mine

#

@empty forge its usually not good to show others your urls

empty forge
#

whats wrong

#

why not

plain timber
#

well it should be fine if you have the auth

#

but make sure you dont show anyone your auth

empty forge
#

k

plain timber
#

if someone has the url and the auth they can make fake votes

restive otter
#

Well he used JS? @plain timber

empty forge
#

does the token need to be in a string

plain timber
#

yes

restive otter
#

ok I like SUCK at websites but cant others see JS code

plain timber
#

what else would it be πŸ€”

#

its node so server side @restive otter

#

its not client side js

empty forge
#

i just do port in the webhookport

restive otter
#

Oh so node makes it server?

#

Nice

plain timber
#

yeah

#

k

empty forge
#

then i choose a password

#

and write it in the edit page as well

plain timber
#

yes and dont tell anyone

restive otter
#

Yes put 123

plain timber
#

no dont

restive otter
#

Haha

weary ember
#

Just use anything tbh

empty forge
#

lol

restive otter
#

I bet his password is

#

AndDontTellAnyone

empty forge
#

done

#

now what

#

i wrote all 3

#

now what do i do

#

test it?

plain timber
#

save it first

#

then test it

restive otter
#

What does he do with the info? @plain timber

empty forge
restive otter
#

Log it?

empty forge
#

error

plain timber
#

@empty forge you're already running a webserver so you'll have to link dbl to it

empty forge
#

what

plain timber
#

can you send your line with app.listen

empty forge
#

wtf

#

does that mean

plain timber
#

you probably use express

#

which makes a webserver

empty forge
plain timber
#

ok

#

so remove webhookPort: blah and change it to webhookServer: listener

empty forge
#

like this

plain timber
#

yes

empty forge
#

then save and try

plain timber
#

yes

empty forge
#

no errors

#

i perssed the test

#

and nothing happend

#

nvm

restive otter
#

Did you save the page too

empty forge
#

forgot to save

restive otter
#

Ye

empty forge
#

lol

#

but i get id and not name

#

how do i get name

restive otter
#

....

#

Are you serious son

empty forge
#

yes

#

vote.user.user.username

#

?

restive otter
#

You get the discord id

#

Get the discord user through your discord client

arctic arch
#

you need to find the user via the library you use

empty forge
#

hm

#

how? sorry im dumb

restive otter
#

What library

empty forge
#

d.js

restive otter
#

Eris? D.js?

#

Ok

#

Then you search

arctic arch
#

client.users.get()

empty forge
#

im using bot

restive otter
#

Discord.js get user with id

empty forge
#

so bot.users.get()

#

bot.users.get(vote.user)?

restive otter
#

.id

#

Or

arctic arch
#

vote.user is the id

restive otter
#

Is that how you have the id already

#

Oh ok

arctic arch
#

that is correct

empty forge
#

then what do i do after

arctic arch
#

what ever you want

restive otter
#

You put it in a variable

#

Maybe

empty forge
#

how do i get their username

restive otter
#

By calling the variable and getting the property username

empty forge
#

let username = bot.users.get(vote.id).username

arctic arch
#

just like you would with any user object in d.js after that

restive otter
#

Well

#

Thats not reccomended

empty forge
#

lol

arctic arch
#

vote.user was correct

plain timber
empty forge
#

no

restive otter
#

Just do (idk syntax) user = bot.users.get(vote.user)
And then call user.username

empty forge
#

can't i just do let username = bot.users.get(vote.user).username

restive otter
#

(Never done JS)

#

Sure but you wont have the user object

arctic arch
#

creating a user variable is unnecessary if all you want is the username

empty forge
#

yes

plain timber
#

you can just use bot.users.get(vote.user).username where you want it

empty forge
#

so

#

yeah

plain timber
#

blah blah ${bot.users.get(vote.user).username} voted!

#

fyi, that'll only work if the user is cached

empty forge
#

like this?

#

it worked

#

thanks guys

restive otter
#

Thats a nice id

plain timber
#

yes

#

but yw

empty forge
#

now i can send it in an embed in a channle in my server

plain timber
#

yes

restive otter
#

I was for no help

empty forge
#

can i do the same with peole inviting it

restive otter
#

But my conclusion is the fact

plain timber
#

client.channels.get('id').send(...)

restive otter
#

C# > PHP > JS

plain timber
#

well for that you would need to do it in your bot itself

#

not with dbl

empty forge
#

so i cant use dbl to see who invites my bot

#

ok... sad

plain timber
#

yes

empty forge
#

they should add that

arctic arch
#

you cant really tell who invites the bot at all

plain timber
#

mee6 can thinksmart

empty forge
#

u can

#

look

arctic arch
#

code grant?

empty forge
#

what

arctic arch
#

that was a question to advaith

empty forge
#

k

plain timber
#

i think it gets it when you invite through the dashboard

arctic arch
#

and I thought you meant the user who invites it

plain timber
#

not sure if/how they do it directly

tidal burrow
#

Best thing you can do is see who clicked the invite button, but 95% of the time it's gonna be random users that don't need to log into dbl

empty forge
#

@arctic arch cant you do the same as vote, but for people inviting the bot

arctic arch
#

we cant

empty forge
#

ok

plain timber
#

look at what deivedux just said

#

they will probably not be logged in

arctic arch
#

and we dont know if they actually click authorize after clicking invite

#

if you have a website with an oauth2 setup and require code grant enabled you can tell who invited the bot

empty forge
#

is this right

plain timber
#

yeah

empty forge
#

nice

#

gg

#

it worked

#

thanks guys

plain timber
#

yw

empty forge
#

what else could i do with webhooks

#

like this?

plain timber
#

you can save votes to a database

#

you can give rewards for voting, in the bot or roles

empty forge
#

cool

#

lemme see the docs

#

i could save it in a file

#

what is this

#

what does it do

#

and query?

plain timber
#

on friday, saturday, and sunday, each vote counts as double

#

if so, isWeekend will be true

#

query just tells you whats at the end of the vote url, after a ?

empty forge
#

wtf does that mean

#

do u have a example

#

lol

plain timber
#

for which

empty forge
#

both

#

and whats the point of em

plain timber
#
if(vote.isWeekend) console.log('this vote counts as double')```
#
if(vote.query) console.log(`this vote had the query ${vote.query}`)```
empty forge
#

whats their purpose

plain timber
#

https://discordbots.org/bot/id/vote?this-is-the-query

#

just for extra information

#

for example

#

you can give them more rewards if its a weekend double vote

tidal burrow
#

Rly

empty forge
#

lol

plain timber
#

of course thats a 404, theres no bot id

empty forge
#

ik

#

lol

#

does it say on the docs, how to store all votes?

tidal burrow
#

That's up to you

plain timber
#

once you get the vote you can run any code

empty forge
#

i runed the code i have on glitch on my pc and it didnt work

#

is it because of the url, cause the url is glitch

plain timber
#

yes

empty forge
#

so if i push from my pc to glitch, will it still work on glitch

plain timber
#

yes it should

empty forge
#

k

#

oh, i could store all votes, and users in a array and make a leaderboard

#

wowowow

#

wait how do i count all votes the user has

#

like it counts and adds 1 when they vote

polar mirage
#

use database

empty forge
#

no

polar mirage
#

ok

#

Well with that it's gonna be lost everytime you reboot

empty forge
#

no

#

its not

#

i am using JSON for several things

plain timber
#

Don't store data in json

#

It will get corrupted

empty forge
#

well i am

#

for now

plain timber
#

Well it's gonna be gone

polar mirage
#

the code you showed doesn't write anything to the file

empty forge
#

ill use a database when im done

polar mirage
#

just use a database now

empty forge
#

which

#

is the best

#

i use mongoDB for storing reports

polar mirage
#

if you're already familiar with mongo

#

then just use mongo for this too

empty forge
#

a little

#

what does Uwu mean

plain timber
#

Google it

#

It's supposed to be a face

empty forge
#

lol

plain timber
#

Related to anime

empty forge
#

Uwu

#

i have something no other bot has

#

hehhe mohahahaha mohahahaha

polar mirage
#

also

empty forge
#

yes good sir

polar mirage
#

please use camel case for your variable names 😩

empty forge
#

why

plain timber
#

Why

#

My variable names are super inconsistent

empty forge
#

whats up with camel cases

#

why do u need em

polar mirage
#

notsoeasytoread
prettyEasyToRead

empty forge
#

okIGetIt ThankYouNot

#

lol

polar mirage
#

ok bye

empty forge
#

lol

restive otter
#

lol

tranquil bronze
#

sa

restive otter
#

Hi, can anyone tell me an example of using api to post servers without using lib?

spiral steeple
#

just make a POST request to the /stats endpoint

restive otter
#

yes

#

but i need my token for this correct ?

spiral steeple
#

You need tokens for any request to the api

restive otter
spiral steeple
#

a token*

#

it's your dbl bot token

#

it goes in the Authorization header

restive otter
#

Did you misinterpret my question?

spiral steeple
#

This isnt using the lib

#

this is raw http requests

restive otter
#

I want to know if it's possible to do the same thing in dbl

spiral steeple
#

You wanted to post server count I thought

restive otter
#

yes but using http

spiral steeple
#

Yes

#

Like I said

#

it goes in an Authorization header

restive otter
#

now it's clear, thanks

spiral steeple
#

mhm

restive otter
#
#servidores comando
@client.command(pass_context = True, hidden = True)
async def postarservidoresliabot01323213213232132(ctx,):
   URL = "http://discordbots.org/api/bots/idbot/stats"
   token = "dbltoken"
   PARAMSHEADERS = {'Authorization':token} 
   r = requests.get(url = URL, params = PARAMSHEADERS) 
#

Ok how to make the request? this documentation is very confusing

spiral steeple
#

I dont use python, so I wouldnt know

restive otter
#

It's okay, you already helped me a lot. I'm grateful.

arctic arch
#

instead of params it should be headers

#

and if you're posting stats you need to change get to post

restive otter
#

I understand thanks for the good reply I want to know how to post every request needs a token and also the number of servers how to pass this to the post, the documentation does not explain very well

arctic arch
restive otter
#

Thank you for your help

#

@arctic arch @spiral steeple I'm going to thank you both for the help now, my bot is with the servers posted!

spiral steeple
#

:+1:

sullen nymph
#

@restive otter I would recommend using aiohttp instead

restive otter
#

I thought that the moment I was giving git to upload my bot to the public kkk I will solve this the next time I go up, thank you very much for the tip kk

lapis dagger
#

why do I still get with this code Unauthorized? {"error":"Unauthorized"}

public void postGuildCount(int guildCount) {
        JSONObject jsonObject = new JSONObject().put("server_count", guildCount);
        RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), jsonObject.toString());
        Request request = new Request.Builder()
                .url(DISCORD_BOTS_API + String.format("/bots/%s/stats", this.botId))
                .post(requestBody)
                .addHeader("Authorization", this.token)
                .build();
        try (Response response = this.httpClient.newCall(request).execute()) {
            if (response.body() != null) {
                log.info(response.body().string());
            }
        } catch (IOException e) {
            log.error("something failed with posting stats to DiscordBots!", e);
        }
    }
#

the token that I provided was to 100% the right one

spiral steeple
#

is it the dbl token or the discord bot's token

lapis dagger
#

the one which I generated from DBL

#

the funny fact is, that it works perfectly with Bash

#

I mean curl, with that it worked perfectly fine

plain timber
#

@lapis dagger unauthorized usually means you aren't sending the token at all

lapis dagger
#

but how?

spiral steeple
#

unauthorizaed can mean you are sending the wrong token too tho

lapis dagger
#

I tried that with curl as well and it worked fine

#

but with OkHttp not

timber fulcrum
#

why do I get dbl.errors.Forbidden: Forbidden (status code: 403): {"error":"Forbidden"} error ?

#

I've put the api key and I am using the example that's shown on the website

#

πŸ€”

plain timber
#

@timber fulcrum the API key is probably wrong

restive otter
#

Okay so idk wtf this error means. I have made a command for me to just update the server count rather than having it constantly update. I was getting the error Fulger up there was getting but I regened my token and put it in and got this error

#
Ignoring exception in command update:
Traceback (most recent call last):
File "/home/container/discord/ext/commands/core.py", line 62, in wrapped
ret = await coro(*args, **kwargs)
File "/home/container/cogs/dev.py", line 73, in update
await self.dblpy.post_server_count()
File "/home/container/dbl/client.py", line 100, in post_server_count
await self.http.post_server_count(self.bot_id, self.guild_count(), shard_count, shard_no)
File "/home/container/dbl/http.py", line 189, in post_server_count
await self.request('POST', '{}/bots/{}/stats'.format(self.BASE, bot_id), json=payload)
File "/home/container/dbl/http.py", line 164, in request
raise HTTPException(resp, data)
dbl.errors.HTTPException: Backend fetch failed (status code: 503): <!DOCTYPE html>
<html>
<head>
<title>503 Backend fetch failed</title>
</head>
<body>
<h1>Error 503 Backend fetch failed</h1>
<p>Backend fetch failed</p>
<h3>Guru Meditation:</h3>
<p>XID: 527597576</p>
<hr>
<p>Varnish cache server</p>
</body>
</html>
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/container/discord/ext/commands/bot.py", line 898, in invoke
await ctx.command.invoke(ctx)
File "/home/container/discord/ext/commands/core.py", line 611, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/home/container/discord/ext/commands/core.py", line 71, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: Backend fetch failed (status code: 503): <!DOCTYPE html>
<html>
<head>
<title>503 Backend fetch failed</title>
</head>
<body>
<h1>Error 503 Backend fetch failed</h1>
<p>Backend fetch failed</p>
<h3>Guru Meditation:</h3>
<p>XID: 527597576</p>
<hr>
<p>Varnish cache server</p>
</body>
</html>```
#

using python

#

Can anybody help me out

#

And I just didnt change anything and tried the command again and got the forbidden error

plain timber
#

@restive otter 503 backend fetch failed means DBL broke

#

403 Forbidden means wrong token or ip banned

restive otter
#

okay well token is right

#

so why banned

sullen nymph
#

DBL was dead at the time of request

#

That's what 503 means

restive otter
#

well now its giving me forbidden

sullen nymph
#

That's dblpy for you

#

Outdated as hell, you may wanna use aiohttp and send the request yourself

restive otter
#

thats really annoying

sullen nymph
#

You could go deep into the source code of dblpy and find the function for your needs and copy it into your bot

restive otter
#

Who is the one that made the dblpy

sullen nymph
#

IPv4, iirc, but why do you need that?