#topgg-api

1 messages · Page 58 of 1

fleet pebble
#

nevermind i figured it out

#

i thought i already defined Discord but i guess i deleted it

spiral steeple
#

uh you need to define discord

#

by requiring

balmy hamlet
#

dude

fleet pebble
#

i said "nevermind i figured it out"

#

so dont say dude

#

i realized what i did wrong

#

so my bot has been running for about 5 hours now and it hasnt posted the stats to dbl, so im assuming theres something wrong in the code but i dont know what

polar mirage
#

Does your client actually log in

#

(and why did you just call the client dc that name doesn't give any information at all CringeHarold )

sullen nymph
#

DiscordClient

#

DC

polar mirage
#

Yes that is indeed the first thing that comes to mind when seeing dc

fierce haven
#

Hello ! My widget does not update, but, on my bot page, there is 6 votes

#

But on the widget, only 2

#

Do you know why ?

spiral steeple
#

Dont download the image

#

It cant just be a static image on a page, it should be the link

#

It wont update in things like discord automatically because of user cache

fierce haven
#

I do not download the image

#

Just the link

#

In my embed

#

But yes, probably user cache

#

What did you see in #commands ? By typing lofi info

#

Goodbye

spiral steeple
#

Says 8 for me

fierce haven
#

Ok so this is caching

#

Thank you

restive otter
#

I need to fix this code
message.author.send(client.guilds.array()[5].channels.array()[0].createInvite().code)

tawdry spindle
#
// ASYNC:
const invite = await client.guilds.get("GUILD_ID_HERE").channels.first().createInvite();
message.author.send(invite.code);

// OTHER WAY:
client.guilds.get("GUILD_ID_HERE").channels.first().createInvite()
    .then(invite => {
        message.author.send(invite.code)
    });
wintry plover
#

How should I set up the webhook port and auth?

#

I'm hosting on a vps

restive otter
#

Check dbl docs

spiral steeple
#

The port can be any open port, usually 1024-49151, just something not used tho. The auth can be anything you want

fierce haven
#

Hey !

#

I'm trying to get the votes for my bot, however, it returns 301 and not 9, do you know why?

Here is my code :

console.log((await message.client.dbl.getVotes()).length) // 301
#

And now it's 1000

fierce haven
#

And now it's 301

plain timber
#

@fierce haven use let bot = await dbl.getBot(client.user.id) then
bot.monthlyPoints (or just points if you want all time votes)

fierce haven
#

Okay thanks you

restive otter
short girder
#

The error is in plain english.

#

You need to install dblapi.js

restive otter
#

I need help, how to get dbl api token?

narrow zenith
#

add your bot first

restive otter
#

He is on the list

short girder
restive otter
#

Done

fathom sluice
#

-un

vagrant patrol
#

How can I make a ID card with canvas

grim hazel
#

id card?

arctic arch
deep musk
#

home page

#

my profile page

#

why?

runic grove
#

likely a caching issue

deep musk
#

"too many requests"

#

on bot inicialization

#

oh

#

its fixed

#

:3

#

spiral steeple
#

Is that dbm?

#

oh it's fixed

balmy hamlet
#

what

daring cove
#

Who can my bot write in Web?

sullen nymph
#

That question made no sense

tawdry spindle
#

but it has 4 stars

crisp solstice
#

lmao

daring cove
#

@sullen nymph

narrow zenith
#

what?

#

in web?

daring cove
#

This is not his name?

#

Web

#

?

#

@narrow zenith

sullen nymph
#

What do you mean by 'Web'

daring cove
#

Whatch the pic

#

@sullen nymph

narrow zenith
#

?

#

i still don't understand

crisp solstice
#

@daring cove do you mean embeded messages?

daring cove
#

Yes

crisp solstice
#

lmao

daring cove
#

Thanks

crisp solstice
#

np

sullen nymph
daring cove
#

Ok

hearty lintel
#

I think posting stats should return a complete bot object. Because what I need to do right now is post my stats and then at the same time I have dynamic votes that I store so after I post I also have to get again and get that number of votes, it’d be easier for anyone if it’s all throw in one request and one response

spiral steeple
#

You can put that in yourself if you want to

#

If you mean directly from the api, you'd probably make a request on github

hearty lintel
#

Yea I mean with the actual api it just gives the full bot object. As far as I can tell on POSTing stats it doesn’t even return the new data

#

Also the actual rest isn’t on github so

hot stratus
#

So I see some odd errors in my log, and they seem to be related to the api:

#

Anyone has any idea what this means?

#

Oh, and also "dblapi.js". Duh. I guess that's a much more obvious giveaway.

wraith flax
#

@hot stratus seems like a serverside error

smoky hedge
#

....

wraith flax
#

@arctic arch sorry for the ping but are you aware of this bug? it seems to only appear "at random" when posting the server count every 30 min

#

if its bug or not im not sure, but it's something

arctic arch
#

yes

wraith flax
#

ah so u know this ^^

hot stratus
#

@wraith flax so I can not do anything on my side? Or, rather, should I care?

sullen nymph
#

You can't do anything about a website/server being down unless you are the owner. Unless it's really important, you don't really need to bother

granite pollen
#

yt*invite

hot stratus
#

Well, that's what I meant: I don't know if it's something important or not.

shut sun
#

How to write web server (what functions i need) to use webhooks? I know some basics of flask

sullen nymph
shut sun
#

thanks

sullen nymph
#

I should remove the mongo stuff from that thing but I hope you get the gist

shut sun
#

so i dont need that mongo stuff?

#

oh btw this is better for me

#

because i want to give people rewards when they vote

sullen nymph
#

I mean, if you want to use another database, go ahead

shut sun
#

i dont want to use any database ugh

#

because i cant on pythonanywhere

sullen nymph
#

F

shut sun
#

;/

#

so i think i have to

sullen nymph
#

You're not forced to

#

I should someday actually remove mongo from there to make it more customizable tbh
You can just remove anything related to pymongo in that code and you are good

shut sun
#

ooo

#

okey thank you so much

sullen nymph
solid solstice
#

Is there any way to check when the User has voted, so he can get a reward?

spiral steeple
#

Webhooks

urban thunder
#

Can we pull a user's vote history at all?

plain timber
#

you should use webhooks and store the data

#

but there are a few api endpoints for votes

restive otter
#

a p i

#

hey

worn quail
#

:v

restive otter
#

const dbl = new DBL(yourDBLTokenHere, { webhookAuth: 'password', webhookServer: server });
What goes in the (webhookServer: server) option?

worn quail
#

The webhook's server

#

I think the IP it's running on

sullen nymph
#

Docs say http.Server

restive otter
#

oh

sullen nymph
#

@worn quail the IP is not configurable through options in Client

worn quail
#

Reee

restive otter
#

This doesnt seem to run?:

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!`);
});
spiral steeple
#

does the ready run?

restive otter
#

Nope

#

nvm it does

#

i guess

spiral steeple
#

Just the vote doesnt/

#

?*

restive otter
#

mhm

spiral steeple
#

Go to your edit page on dbl

#

scroll all the way down to webhook options

restive otter
#

im here.

spiral steeple
#

Alright you made an auth right?

#

it's whatever you want

restive otter
#

Yes

#

thats also in my code

#

does it have to be in ' ' format

spiral steeple
#

Alright, what do you have in the webhook path

restive otter
#

or can it be called from another location.

spiral steeple
#

it should be http://ip:port/path

restive otter
#

For my webhook path i have like a Web hook URL from discord?

spiral steeple
#

No, discord webhooks dont work

#

it has to go to your http server that dblapi set's up

restive otter
#

in console

spiral steeple
#

on dbl or the console

#

So basically put that in the edit page in webhook options but change 0.0.0.0 to the ip of the server it's running on

#

idk how you host

restive otter
#

Glitch

#

but i dont know the server Ip

spiral steeple
#

Ah glitch is special

worn quail
#

Ye

spiral steeple
#

Im not entirely sure, but if you search glitch in this channel you'll find it

#

probably

restive otter
#

My Glitch Hosting port is different

#

@spiral steeple What does the Test Button in the Webhook options preform?

sullen nymph
#

Sends test request to your webhook

worn quail
#

Yeh

jaunty tartan
#

What should the Port be for the webhook if you use glitch? I searched back and a lot of people on this channel said 3000 but when I use that I get a “3000 already in use” error

dire cloud
#

Hi

daring cove
#

(now it's online)

tidal burrow
#

submit it again

daring cove
#

Ok

calm zodiac
#

how do you get your current vote count for this month? (node.js)

arctic arch
#

using dblapi.js or not?

topaz falcon
#

Can anyone help me? I have added the API Libary and the code for the API to my bot, but it still won‘t show the server count.

arctic arch
#

provide more details

#

errors, code snippets

topaz falcon
#

I don‘t get any errors. The bot is running on discord.py. I added the code into the main bot file. I changed the API key, but I can‘t see the bot count thing appearing on my bot‘s list page. @arctic arch

arctic arch
#

self is this

#

@topaz falcon reset that token, you just shared it publicly

#

also @sullen nymph

topaz falcon
#

@arctic arch
So what exactly do I have to change here?

(I changed the token).

#

I understand self to this. But all self to this?

arctic arch
#

ignore the self is this message
the person I responded to removed their message

topaz falcon
#

Oh.. so what do I have to do

arctic arch
#

and I don't do python so I pinged shivaco to maybe help you

topaz falcon
#

Alright.

calm zodiac
#

@arctic arch yeah using dblapi.js

wraith flax
#

@topaz falcon i see

#

u need to cog it

#

DiscordBotsOrgAPI is redundant if its running latest discord.py version

#

not redundant as whole function, but u need to add a perimeter to it

sullen nymph
#

Examples there are up to date

#

@arctic arch that looks like the example from DBL docs :p

#

Also looks like you got your error handler to ignore errors, might wanna fix that

slate raptor
#

im having some difficulty coding my bot

runic grove
#

Wrong channel

slate raptor
#

Sorry, where do I go

runic grove
#

#development and post about the actual problem, just saying "im having difficulties" doesnt say anything

slate raptor
#

Okay, I'm sorry

solid solstice
#

How can I check if the User has voted to send him a reward? (JDA)

#

for example:
if(user.completedVote) {
sendReward;
}

dawn fjord
#

Read the docs for our Java library

solid solstice
#

yeah, I done this. But there is no example for this. There is only the method how to check if he has voted.
So, if the user runs a VoteCMD and the bot says you have already voted or you can vote and When the user gets a reward every time the bot says you have already voted, the user can "cheat" him the reward

#

you know? @dawn fjord

dawn fjord
#

You can use the API to check if a user has voted

plain timber
#

i dont think we understand what you want @solid solstice, you know that you can check if the user has voted, so what do you want to check?

solid solstice
#

I want that the user gets a reward when he has voted

#

So when he run a VoteCMD the bot checks if he has voted or not

#

if not, he sends a link

#

if he has voted, the bot reply you have already voted

plain timber
solid solstice
#

but when now, I give him a reward, when the bot replies you have already voted, he can get unlimited coins if he vote once, and do this command every second

plain timber
#

ok so you would need to store that they have already voted

solid solstice
#

yes, I think so

balmy hamlet
#

was there a global api key reset?

#

bc the api is now giving this

plain timber
#

no

restive otter
#

is this all i need to get the thing to work```
const Discord = require("discord.js");
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL('Your discordbots.org token', client);

// Optional events
dbl.on('posted', () => {
console.log('Server count posted!');
})

dbl.on('error', e => {

console.log(Oops! ${e});
})```

plain timber
#

yeah that should auto post

#

you dont even need the optional stuff, thatll just spam your console

barren flint
#

How do I make a dblpy request to check whether a user has upvoted d bot?

plain timber
barren flint
#

Python

#

Kk ty

plain timber
#

I think you need get_upvote_info

barren flint
#

Does it return info of who upvoted d bot in a list?

#

Like wdym by ‛Info about who upvoted your bot.’

sullen nymph
#

Returns all users who upvoted your bot

#

Disregard that

#

I should fix the docs and make it make any sense

#

Because client.get_upvote_info actually returns a list of dict objects with user info

calm zodiac
#

how do you get your current vote count for this month? (node.js - dblapi.js)

restive otter
#

Yeah?

plain timber
#

@calm zodiac ```js
let bot = await dbl.getBot(client.user.id)
bot.monthlyPoints

restive otter
#

and then?

#

@plain timber

plain timber
#

bot.monthlyPoints is the amount of votes

#

Use that wherever

restive otter
#

and how can i log it?

plain timber
#

uh

#

console.log(bot.monthlyPoints)

worn quail
#

console.log(bot.monthlyPoints)?

restive otter
#

thanks can you german?

worn quail
#

No I cant german

restive otter
#

Oh

#

I can ^^

#

He has write dbl is not defined what can i do?

#

@restive otter Developer

#

@worn quail @plain timber

worn quail
#

.....

restive otter
#

Was hast du dort stehen ?

#

Sry is GErman xD

#

What do you have standing there?

plain timber
#

English only

#

And did you even read the docs

restive otter
#

Not really

plain timber
#

smh

restive otter
#

Thanks

plain timber
#
const DBL = require("dblapi.js");
const dbl = new DBL('Your discordbots.org token');```
restive otter
#

And how do i create the Webhook?

#

I have a question @plain timber

#

Well i get this error whenever posting guild count, using .py tho

#
    await self.dblpy.post_server_count()
AttributeError: 'Client' object has no attribute 'post_server_count'```
#

i am using the example from the DBL website itself

#

mention me if someone replies.

sullen nymph
#

@restive otter guild

#

not server

placid hare
#

Is the a vote api?

runic grove
#

yes

#

wait no

#

or maybe

#

idk what you mean

restive otter
#

@plain timber

placid hare
restive otter
#

no its guild count

sullen nymph
restive otter
#

its the api for posting guild count

sullen nymph
#

post_server_count has been changed to post_guild_count in latest updates

restive otter
#

ah works fine

#

thanks!

sullen nymph
plain timber
#

@restive otter stop pinging me, read the docs

restive otter
#

what do i read in webhook port

jaunty tartan
#

For the dplapi vote webhook, what’s the port for glitch?

clever rock
#

process.ENV.PORT

teal plaza
#

is there a tutorial for using webhooks with glitch

#

im new to this whole webhook thing

#

and im like

#

struggling

worn quail
#

:v

#

Dont use glitch

teal plaza
#

true

#

best way through an express app?

worn quail
#

Just run the script on your computer

teal plaza
#

so say i run it via a vps

#
const DBL = require('dblapi.js');
const express = require('express');
const http = require('http');

const app = express();
const server = http.createServer(app);
const dbl = new DBL(yourDBLTokenHere, { webhookAuth: '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!`);
});

app.get('/', (req, res) => {
  // ...
});

server.listen(5000, () => {
  console.log('Listening');
});```
#

and use this example, my webhookurl would be the ip to my server and then port 5000?

calm zodiac
#

yes
http://<serverIp>:5000/dblwebhook/

rustic burrow
#

Yup, also confused on this

 { webhookPort: 5000, webhookAuth: 'password' });```
#

running on heroku btw

rustic burrow
#

Hello

worn quail
#

Dont use heroki

#

Just host from a laptop or sth

rustic burrow
#

like whats webhookport?

worn quail
#

Port is 5000 by default I think

#

The IP is the address of the bot being run on

#

That's why using a laptop is better

rustic burrow
#

Where does the like ip and stuff go
trying to get who voted and stuff, and to use it as a command so the server ip and stuff would change

worn quail
#

Read the api docs

#

Idk what lang you use

#

I am not messing with votes tbh

#

I'll just do a voting feature from my bot's webpage itself

rustic burrow
#

JS

worn quail
#

K then I cant help

rustic burrow
#

rip

worn quail
#

Read the dbl api docs for js

#

All I know is it's easier to use api with a laptop

normal willow
#

how do I get normal date and time, instead of using Date.now()

normal willow
#

Never mind got the answer

coarse siren
#

How to create webhook?

limpid sorrel
#

a webhook is just your local server accepting http connections

dawn fjord
sullen nymph
#

@wraith nymph Wrong channel, wrong server to advertise in, please delete (also nobody cares about a channel that someone links without any context)

#

@craggy sentinel 342973820291776512 ads

craggy sentinel
#

@wraith nymph bongoban

#

ty

sullen nymph
#

👌

vague mountain
#

Where can I find how to get my server count displayed?

#

on the site of course, lel

#

nm found it

#

my NEW question is when I npm install dblapi.js
is it going to modify existing files? When I installed sqlite it modified existing files, my bot was offline for hours and it was a major headache

edgy violet
#

?

vague mountain
#

what do you need me to clarify

proper atlas
#

does anyone know how to get the guild owner name/tag in discord.js?

#

bc message.guild.owner is sending undefined

#

but only on this server

craggy sentinel
plain timber
#

@vague mountain installing packages cant modify your bot files

#

it installs inside its node_modules/dblapi.js folder

vague mountain
#

when i installed sqlite it overwrote some of my js node files though

#

just making sure this package won't do the same

plain timber
#

that shouldnt be possible

vague mountain
#

I KNOW

#

but it did

plain timber
#

you just used npm install sqlite or whatever?

vague mountain
#

yep

plain timber
#

thats rly weird

#

well anyway dblapi.js doesnt do that

vague mountain
#

ok thanks man

plain timber
#

yw

coarse siren
#

how to create this webhooku

plain timber
#

@coarse siren what language?

coarse siren
#

Turkish

#

Bad english

#

@plain timber

plain timber
#

@coarse siren i mean what programming language

coarse siren
#

english and turkish

#

2 language

#

mixed

#

:d

#

@plain timber

#

I think we'll talk by tagging

plain timber
#

@coarse siren programming language

#

like

#

javascript or python

coarse siren
#

javascript

#

as i said half my english

#

I think we'll talk by tagging

#

@plain timber

plain timber
#

it has example code

#

"Example of using webhooks to receive vote updates"

coarse siren
#

Ok

#

Bot.js or commands

plain timber
#

run it on start

coarse siren
#

Uh

#

it will be a little difficult

restive otter
#

Hello, anyone can help me with vote webhook in Java ?

proper atlas
#

do i have to do more than it says in the docs for the webhooks? it spits this in the console

Webhook running at http://undefined:undefinedundefined

last cedar
#

how do I check how many upvotes my bot has?

plain timber
#

@last cedar it shouldn't be saying that, can you send the code?

#

Shit I meant @proper atlas sorry

#

@last cedar what language

proper atlas
#

Lol I just have the normal code but setup with my event manager

plain timber
#

Send it

proper atlas
#

Aight

last cedar
#

discord.js

#

javascript

proper atlas
#

I’ll be one min gotta do it from my phone

last cedar
#

node.js

plain timber
#

@last cedar ok so once you have set up dblapi.js (look at docs https://discordbots.org/api/docs#jslib), you can do ```js
let bot = dbl.getBot(client.user.id)

Then you can use `bot.monthlyPoints` (or `bot.points` for all-time votes) wherever you want to show the amount of votes
proper atlas
plain timber
#
  1. Combine dbl and wdbl
#
  1. The webhook code has to actually be in the dbl.webhook.on event
proper atlas
#

Like the wdbl stuff?

plain timber
#
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!`);
});
#

You can't just take the console.logs out

last cedar
#

oh i see

plain timber
#

They will only work inside the dbl.webhook.on functions

#

Also what code are you trying to run when they vote 🤔

#

That needs to go in the on vote part

#

But you didn't send any

last cedar
#

wait me?

plain timber
#

No

#

Canine

#

For you just read the one message I pinged you in @last cedar

last cedar
#

ye

#

well its the first one you pinged me

safe remnant
#

How do i get my dbl token

#

Says its on my bots page but i cant find it

sullen nymph
plain timber
#

@safe remnant two places: bot edit page or that page ^

safe remnant
#

Ok thanks

vestal relic
#

Does this work?

#

and how good is it compared to the official one?

runic grove
#

it doesnt have anything that the official one doesnt have i think

vestal relic
#

Does the official one have anything this one doesn't have?

runic grove
#

idk

#

dont think so

vestal relic
#

ok

spiral steeple
#

Lol that's the first time someone posted that here

#

But as far as I know it does everything the official one does.

#

And some

arctic arch
#

y tho

#

if your library has nothing that makes it worth using, why publish it

spiral steeple
#

It was a personal project as well, I just published it because why not

#

But it does have votelocking for people that dont want to set that up themselves, even tho I highly hate votelocking

teal plaza
#

does webhook testing have a cooldown

past finch
#

Is there an API ref doc with actual endpoints listed?

#

I'm after the votes endpoint and I've seen others mention it but cannot find the API ref doc

sinful rampart
#

how do i test votes

#

Ive tried to use the webhook thing to get vote updates to my bot, it doesnt seem to be 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!`);
});

I copied this but it doenst seem to work

cosmic summit
#

Do you actually have a webserver?

#

With something like express

sinful rampart
#

nope

#

can you not get vote updates without one?

cosmic summit
#

Maybe use this one I found on Github then

sinful rampart
#

I want it in my own bot

#

not another one

cosmic summit
#

I know

#

You're not understanding what this is

#

Receiving voting events requires you to have a webserver (website), with a domain etc

sinful rampart
#

i got domains and websites

#

Is that all i get?

cosmic summit
#

Then you need to launch something like that, that will be able to handle the incoming requests

#

then you can log em to discord channel if you know how to connect your bot to the website

sinful rampart
#

so i clone that repo into my bot folder?

cosmic summit
#

Yeah you can do that

#

Then just import your bot client into the webserver part

sinful rampart
#

you lost me

#

@cosmic summit okay i cloned it, how would i connect them, what file is it i need to connect ect

wise agate
#

spoonfeeding is bad

sinful rampart
#

just asking for help in something that is completly new to me

cosmic summit
#

Honestly no clue how to help you from here

#

I have no idea how your bot is like n stuff

sinful rampart
#

I just dont know how to setup this thing you sent me and how to connect it to the bot...

#

it says in the to add a config and i filled int he info

#

Trying something else now

#

what is the url that i need to enter? @craggy sentinel

#

forget it im just not going to use the api

worn quail
#

I use my own personal api mmLol

craggy sentinel
#

@sinful rampart its your own URL that points to a server that recieves a webhook

#

also message edits dont ping

#

i found this message while randomly going through channels lol

clever rock
#

webhook url is your server ip + port + /vote/

worn quail
#

ty

#

Question. I've tried to get my url ip and bit the /vote/ at the end

#

But nothing happened

#

Tbh I dont need the api but it would be nice

#

But I can get the values from a json from somewhere

#

andmakemyownapi

clever rock
#

how did you do it

worn quail
#

Wdym?

#

Using scripts ig.

clever rock
#

the url

worn quail
#

O

#

Just my bot's webpage

#

Idk if that works or not

#

Ik probably just dumb rn

clever rock
#

it should be the directly where the server

worn quail
#

Us-west-2 I think

#

So near LA

clever rock
#

I mean the server ip

#

wait in game

worn quail
#

K..

clever rock
#

try accessing the port

#

where the api is hosted

#

it should show the haruna api ver

worn quail
#

Nothing?

#

Eh its fine I'll just make my own one

clever rock
#

then something is wrong

#

in your setup

#

thats the basic of checking if the port is open

worn quail
#

Its fine

clever rock
#

and if it setup correctly

worn quail
#

Never mind srry

#

I'll make my own one through uploading my own files ig

clever rock
#

your c hoice

#

that api is soley created for those who want a fast api for voting handling

worn quail
#

Meh

#

I'll likely use it eventually but I can just tie in some stuff from other api(s) I have created

#

But yeah it would be fastest

#

I'm not gonna be able to do anything now anyways

#

too tiRed

clever rock
#

I know its fast because I query to that api per message event xD

worn quail
#

o dam

restive otter
#

api key only available to verified bots, right?

loud gulch
#

yes

restive otter
#

ight

restive otter
#

👀

wintry leaf
#

How do I set up the webhook , my console is saying 0.0.0.0:5000 but that dont work nor my ip and port .

restive otter
#

Replace 0.0.0.0 with your public ip

wintry leaf
#

Ye i tried but when i test it / also do a vote. It dont do anything , It is told to console.log it but it aint.

restive otter
#

Make sure your ports are open

rigid shuttle
#

i'm running an http server for dbl webhook
i use an reserve http tunnel
last day the webhook has worked fine
and today no requests are getting here

#

what i'm i doing wrong ?

toxic veldt
#

hey how can i get my webhook token

sullen nymph
#

What webhook token are we talking? Is it related to DBL?

toxic veldt
#

@sullen nymph the webhook token of a channel i created

sullen nymph
#

https://discordapp.com/api/webhooks/webhook_id/webhook_token

restive otter
#

in channels settings

teal plaza
#

my webhook has a way of crashing my bot

#

and theres no logs for it

restive otter
#

hi

teal plaza
#

hey

#

do u need help

restive otter
#

Good evening, a person is how to make a voting system with discordbots.org in channel ping me for help please

#

(with api) ?

plain timber
#

@restive otter always say what language

#

and be specific on what you want to do

restive otter
#

discord.js and javascript

#

how to make a voting system with api

plain timber
teal plaza
#

^

restive otter
#

you can explain to me because I do not understand very well on the web

#

(I am french)

teal plaza
#
const DBL = require('dblapi.js');
const express = require('express');
const http = require('http');

const app = express();
const server = http.createServer(app);
const dbl = new DBL(yourDBLTokenHere, { webhookAuth: '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!`);
    client.users.get(vote.user).send("**Thank you very much for voting!**\nAs a reward, you have recieved 1 point.");//gets user and sends them a dm
client.channels.get({channelIDhere}).send(`\`\`\`css\nUser with ID ${vote.user} just voted!\`\`\``);
});

app.get('/', (req, res) => {
      // ...
});

server.listen(5000, () => {
      console.log('Listening');
});```
#

like literally just throw that in ur bot code

#

and that happens is

#

when a user votes

#

it will send them a message, and log it in a channel

#

pretty straightfoward

#

and then on ur bot edit page, just change the webhook url to wherever your hosting the bot's ip or url ex. http://127.0.0.1:5000/dblwebhook and the webhookauth to a password that u choose

runic grove
#

I thought app.listen will just create the servee?

#

So theres no need to import http

teal plaza
#

im just copy pasting the example @runic grove

#

mine works differently

#

so idk

runic grove
#

Wait is that actually the example lol

teal plaza
#

i added like 5 lines

#
client.users.get(vote.user).send("**Thank you very much for voting!**\nAs a reward, you have recieved 1 point.");//gets user and sends them a dm

client.channels.get({channelIDhere}).send(`\`\`\`css\nUser with ID ${vote.user} just voted!\`\`\``);```
#

was literally all i added

#

lol

pearl ibex
#

can someone help me with voting event, its litteraly not recieving any voting data

teal plaza
#

@pearl ibex wdym

#

and language?

pearl ibex
#
   console.log("Someone voted")
})
#

even this code isnt working

#

js

#

its not giving any errors its not doing anything

#

i even tried making it async funcion

#
dbl.webhook.on('vote', async (vote) => {
    console.log("someone voted idk who this is just a test")
});
#

help

plain timber
#

@pearl ibex did you set up the webhook in your bot edit page

#

and you're sure the port is exposed

pearl ibex
#

@plain timber yes dbl.webhook.on('ready') works but vote doesnt

#

Which is the weird thing

clever rock
#

nope its not weird

#

ready happens when its just ready to listen to the port

#

it doesnt mean it will work on vote because it fired ready

#

dbl webhook dont know if that port is open or not

#

imagine this logic

#

imagine a road blocked by a wall

pearl ibex
#

Actually true

clever rock
#

do you think a car can go through it?

pearl ibex
#

Webhook was on 0.0.0.0:5000 port

clever rock
#

if port 5000 has a wall

#

then no

pearl ibex
#

It shouldve been like that?

clever rock
#

open it before it will work

pearl ibex
#

I have no idea how am i gonna do jt

#

It*

clever rock
#

you can google for starters

#

not every server is same

pearl ibex
#

google is the saivor who saves everyone lmao

clever rock
#

start from small details to bigger details

pearl ibex
#

how am i gona get my bot auth password?

quartz pumice
#

You mean your dbl auth key ?

restive otter
#

This place has an API? Jeez i need this

runic grove
#

view channel topic

restive otter
#

Jeez thanks, mod

restive otter
#

Is there any way to emit the vote weebhok event?

#

@pearl ibex you can choose your own auth password

pearl ibex
#

yeah i realized that

spiral steeple
#

Yes

#

You use .emit

#

You can emit any event, even on the bot

#

dbl.webhook.emit(...) I believe would be the default

restive otter
#

Thank you, i wasn't sure if i could use it in this specific case

fleet raven
#

I'm eating a lot of faeces trying to get my vote detection to work

#

like what should I input in options.webhookServer

plain timber
#

you dont need that

#

just use the example code @fleet raven

fleet raven
#

nvm I was using glitch

#

I"m an idiot

#

have to use port 3000

#

but anyone know how does the test work

plain timber
#

@fleet raven you need to save the info, then test

#

the webhook url should be https://PROJECTNAME.glitch.me/dblwebhook

fleet raven
#

I figured that part out

#

Was just wondering how to use http-proxy

plain timber
#

what

#

you.. dont need that

clever rock
#

Webhook stopped working for us, is there an issue?
Edit: Its just slow

restive otter
#

how

fleet raven
#

@plain timber I'm using my only glitch port for sth else already 😛

#

anyways, the webhook path has to be where the voting script is, right?

graceful condor
#

Yeah

#

Can confirm Webhook is slow / not working at all

#

nvm. it's just slow

#

took 3 minutes to update

#

@arctic arch what's going on?

plain timber
#

@fleet raven then remove webhookPort and set webhookServer to the express listener

fleet raven
#

EH ok

#

think it worked

#

lemme see

#

thanks all 😃

#

Cripes it worked lmfao

sullen nymph
#

(Can we not use that kind of emotes here)

worn quail
#

^

cobalt ruin
#

Just kicked the webhook server, should be running smoothly again now?

sullen nymph
#

911, I would like to report someone kicking webhook servers

worn quail
#

Lol

restive otter
#

can someone help me with the webhook in the js api ?

plain timber
sick sun
#

hi

restive otter
subtle vault
#

Hi im wonder if they is a command so i can change the prices

#

Iv joined wrong group sorry lol

woven pendant
#
const DBL = require('dblapi.js');
const express = require('express');
const http = require('http');

const app = express();
const server = http.createServer(app);
const dbl = new DBL('KEY', { webhookAuth: '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!`);
});

app.get('/', (req, res) => {
  // ...
});

server.listen(5000, () => {
  console.log('Listening');
});

Hello, I'm using this code right now to get the votes but it does not work. I think it comes from the URL that I did not put but I do not know what to put ...

restive otter
spiral steeple
#

Any 500 error is server side

restive otter
#

So i can't resolve this ?

sullen nymph
#

Negative

restive otter
#

Okey thx c:

safe flicker
#

how can i make the website say that the bot is online?

sullen nymph
#

If the status on your bot page is "???", your bot has been kicked from this server for breaking the bot rules described in #rules-and-info. Search #mod-logs for your bot to find out the exact reason

safe flicker
#

ok but my bot did not get approved yet..

sullen nymph
#

If the bot page exists but the bot is not in this server, the status will be "???"

safe flicker
#

ok

#

thanks

#

i did not know yet

restive otter
#

ew

old merlin
#

im trying to sign into discord bots but it is only showing one avatar to authorize and its not mine, how do i put mine in?

#

nvm

restive otter
#

wdym

scenic crescent
#

i need held

arctic arch
worldly hollow
#

why can't bots acces Member.profile()?

sullen nymph
#

For privacy reasons

worldly hollow
#

makes sense

night cedar
#

Is there any simple way to check if an user voted, something like /bots/bot-id/user-id?

restive otter
#

And nice pfp pepeOK

noble ruin
#

Hey can someone help explain to me how sharding works exactly and how I can utilize it

restive otter
#

For using sharding you need to have a certain number of server

night cedar
#

You don't need sharding untill you hit like 1,5k servers

restive otter
#

^

night cedar
#

somehow i can struggle with sharding, but this api just fucks me up

noble ruin
#

But i like overkill ablobsadpats

night cedar
#

ah, one server per shard overkill like

noble ruin
#

That's a bit too much overkill

#

I'd like to see the server bill if someone tries that

#

but basically with sharding is it like you run let's say 3 servers and then you split the bot's load across those 3 servers

#

so each server is in charge of a 1/3 of the guilds?

plain timber
#

you dont need multiple servers

noble ruin
#

yeah so that's what i'm confused about

#

how would you use sharding

#

also i'm at around 700 servers with one of my bots so i'm just wanting to future proof possibly

plain timber
#

well basically you just need to make multiple connections to discord

#

you could run each one on a different process but its easier to just run them all on one process

#

what lib do you use?

noble ruin
#

Discordgo and Discord4J

plain timber
#

oh, im not sure what types of sharding those support

#

might want to ask in their support servers

noble ruin
#

ok but answer me this

#

theoretically

#

if i wanted to

#

could I run 54 instances of my bot each on it's own CPU thread and each with 2GB of ram

#

If i wanted to

#

not that I would

#

but could I

plain timber
#

yeah you could

#

you can run each one on a different server theoretically

#

but it might also depend on the lib and whether it supports it

noble ruin
#

Discordgo doesn't support it natively but it's a really bare bones framework

#

there are some libs for it that add sharding support

plain timber
#

discord.js has support for both internal (single-process) and external (multi-process) sharding

restive otter
#

0-1m

night cedar
#

ye it updates

#

but i can't grab it {"error":null,"statusCode":401,"success":false}

#

and not sure what i'm doing wrong

night cedar
#

@restive otter for ze token is &token= right nvm saw in docs

graceful condor
#

lol

#

that was quick

proper atlas
#

what is all the info of a bot that i can get from dbl.getBot(botID)

calm zodiac
proper atlas
#

ah aight, was in the js lib section

narrow zenith
#

\

proper atlas
#

dbl.getStats('580810346252468254').points isnt grabbing the upvotes?

#

is that not how you get upvotes?

plain timber
#

@proper atlas

  1. Points is in getBot not getStats
  2. The methods return a promise
#
let bot = await dbl.getBot(client.user.id)
bot.points
#

Also points is total votes, monthlyPoints is votes for the month

shrewd ginkgo
#

when a user votes for my bot how would I send them a pm letting them know their rewards in discord.js

plain timber
shrewd ginkgo
#

ahh okay thanks a lot

proper atlas
#

@plain timber thank you!

plain timber
#

Yw

proper atlas
#

do the Widgets work in embeds?

sullen nymph
#

The latter

floral finch
#

Can anyone help me to setup webhook in my node bot

#

😨

wet sequoia
#

You have to setup a server which takes requests from DBL and handle them

floral finch
#

🤔 🤔

shrewd ginkgo
#

read the documentation

wispy urchin
#
dbl.hasVoted(msg.author.id).then(voted => {

Throws Error

TypeError: dbl.hasVoted() is not a function

I have no idea what i'm doing wrong.

spiral steeple
#

Where did you define dbl

wispy urchin
#

@spiral steeple

const dblapi = require('new-dblapi')
const dbl = new dblapi(process.env.DBLTOKEN, client)
spiral steeple
#

It needs to be in the same file if it isnt global

wispy urchin
#

This is in the same file. bot.js

sullen nymph
#

checkVote(id) Checks a users vote. Returns true or galse. Thinkmas

wispy urchin
#

API says .hasVoted() ?

sullen nymph
#

You seem to have new-dblapi installed

wispy urchin
#

Yeah? The API on your website however doesn't say that.

sullen nymph
#

Spot the difference

spiral steeple
#

Lol

#

I didnt even see that

#

Fcking my own lib mmLol

#

Galse

#

Wow

#

When was the last time I updated that

#

Answer: now. If you want better help you should really just use the official lib mmLol

#

Then everyone here can help you and not just the few people that use mine

misty geode
#
Error: connect ENOBUFS 104.25.196.27:443 - Local (undefined:undefined)
Error: connect ENOBUFS 162.159.129.233:443 - Local (undefined:undefined)
    at internalConnect (net.js:932:16)
    at defaultTriggerAsyncIdScope (internal/async_hooks.js:294:19)
    at GetAddrInfoReqWrap.emitLookup [as callback] (net.js:1081:9)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:61:10)
Uncaught Promise Rejection: 
Error: connect ENOBUFS 162.159.129.233:443 - Local (undefined:undefined)
{ Error: 504 Gateway Time-out
    at IncomingMessage.res.on (C:\Users\Desktop\node_modules\dblapi.js\src\index.js:118:25)
    at IncomingMessage.emit (events.js:187:15)
    at endReadableNT (_stream_readable.js:1081:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
  raw:
#

anyone know how to fix this

#

just recently started to get it

#

Error: 504 Gateway Time-out

limpid sorrel
#

you cannot fix 500 level errors. these are server errors

misty geode
#

yeah ik kinda sucks

#

ima shut off any dbl webhooks fornow

#

cause its killing my bot

limpid sorrel
#

you can catch the errors and then do whatever with it

misty geode
#

yeah im just do that

#

acc

clever rock
#

new dbl api feels like it is based of from haruna

#

but with exception it doesnt run with the bot's process

#

well anywaays use the official dbl wrapper if you want to use the dbl .hasVoted()

plain timber
#

@misty geode 500 errors arent from webhooks, its from something else

#

you can get a 500 if you are making a request to dbl

#

webhooks are the opposite so you cant get a 500 on that

spiral steeple
#

@clever rock Except it's a full api wrapper, but it's bote lock system is basically identical

#

idk how much of it is the same, but I remember it was quite close

#

I wasnt looking at it when I was making it, just a vague memory

clever rock
#

at least you made it with eris support GWahreeVampySmug

plain timber
#

lol eris

spiral steeple
#

I was told it just worked with eris

#

by someone who used it

#

I dont know the first thing about eris mmLol

clever rock
#

I was originally planning to make the votewebhook in java due to how simple to run Java programs but who knows what future holds

#

specially with fast embedded dbs

spiral steeple
#

wait you changed haruna

#

it's just .sweep now

#

I didnt even know that existed

clever rock
#

yeah I rewrote that server handler and release 2.0.0

spiral steeple
plain timber
#

k what is haruna lol

spiral steeple
#

Saya's vote handler? idk what it does now

#

I thought it just did the webhook earlier

clever rock
#

still the same but improved internals to handle more load

#

and better readability

spiral steeple
#

Your commit on that was in February, idk exactly when you changed it from that to sweep tho

#

I wonder if the sweep code is the same as the for loop internally

proper atlas
#

how would i get the bot owner tags instead of the ids

#

bc i assume <@${bot.owners}> would do something like <@343180696556404736 353782817777385472>

#

nvm i think i got it

#

is the api supposed to return '' instead of null for github and stuff is there isn't one?

runic grove
#

I was getting tons of 401 errors from dblapi.js for months without knowing what was going on, as the token was the same in my code and website. I reset the token, replaced it and turns out i wasnt posting about 100 servers oof

proper atlas
#

could i get some help this error message aint givin me much to go off of (node:2820) UnhandledPromiseRejectionWarning: Error: 404 Not Found at IncomingMessage.res.on (E:\Canine\node_modules\dblapi.js\src\index.js:118:25) at IncomingMessage.emit (events.js:194:15) at endReadableNT (_stream_readable.js:1125:12) at process._tickCallback (internal/process/next_tick.js:63:19) (node:2820) 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: 1) (node:2820) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

spiral steeple
#

404 not found is everything you need to know

worn quail
#

^

#

There something I'm doing wrong?

#

Also it restarted itself like 20 times last night

#

Due to me being spammed

narrow geyser
#

Memory leak warning

worn quail
#

Meh

echo wolf
#

is the webhook thing working?

#

i tested mine with ifttt and it worked but i get nothing with the test

#

nevermind

#

had to press save

silver juniper
#

O

peak brook
#

Error: Cannot find module 'ytdl-core'

#

anyone know how to deal with this error?

edgy violet
#

npm i ytdl-core

peak brook
#

?

restive otter
#

@peak brook npm i ytdl-core in the console

peak brook
#

thx

restive otter
#

Np

peak brook
#

but now it says server is not defined

edgy violet
#

What does your code look like @peak brook

peak brook
edgy violet
#

do you have a servers object? where is servers defined?

#

i have a feeling that you are copy pasting code

tranquil ginkgo
#

How bot Play#4329 ??

night cedar
#

So using a webhook will that reward users as soon as they vote, or do they need to call a command etc. (not experienced at all with webhooks) - Thanks in advance crekto_love

sullen nymph
#

Depends on how you implement it

#

You can do either

restive otter
#

can't make a channel

#

channelType.toUpperCase() is not a function

craggy sentinel
#

looks like wrong chnnale

restive otter
#

dafaqu

#

exacttly

#

ples clarify

golden wing
restive otter
#

but discord.js is a library

#

i thoug

#

oh

#

well there are stuffs about normal code in here aswell

restive otter
#

Guys! How the webhooks works in this website?? I don't understand! The webhooks are not showing!

arctic arch
#

tell us more details about your implementation

restive otter
#

I'm using other library! So i tried with webhooks! But they aren't working! The webhook it's not showing up in the server!

arctic arch
#

what url did you use

restive otter
#

My webhook url

arctic arch
#

a discord webhook url?

restive otter
#

yes

arctic arch
#

did you read the alert that popped up when you clicked save

restive otter
#

But it didn't showed any alert

#

I'll try again

arctic arch
#

you're supposed to set up a webserver that can receive requests containing the vote data

#

we do not post the data in a discord webhook format

#

you can program your bot to send messages

restive otter
#

How?

shut sun
#

How to get int of votes with python dbl lib?

sullen nymph
#

int of votes?

full socket
#

I think he simply means number of votes

shut sun
#

yup

#

im using it

#

and its giving me 28

#

when my bot has 41

full socket
#

Look for the points property

sullen nymph
#

/bots/id/votes isn't kinda reliable imo

#

So yeah, if get_bot_info doesn't do the job either, rip

shut sun
#

so what should i use

full socket
#

@shut sun try what I suggested in my last message

shut sun
#

okey thanks

full socket
#

No problem

arctic arch
#

/bots/id/votes only has the most recent votes and does not you wont see double weekend votes twice

sullen nymph
#

Ah

stone elm
#

So what would be the best and esiest way to reward someone as soon as theh voted?

Webhook right?

#

I found out that using the /bots/id/check?usdid is kinda slow for some reason

#

It takes like a good 30/50sec to update over ze bot

spiral steeple
#

webhooks.

#

They are pretty instant

stone elm
#

Well i have never used one, so i ll try my best

#

And do i need to do anything to get double votes over the weekend, or is that by default, and checking it would be just for an extra reward etc?

arctic arch
#

see documentation for the webhooks

stone elm
#

@arctic arch sorry for ping, but i'm struggeling for a good time already to get server count on the website

#

And i'm just not able to

#

so to get the servers on, i only need

  "server_count": "var"
}````
arctic arch
#

yes

copper flame
#

hello

#

I think it sends a discord server the name of the person who voted for the boat.

#

but how it works

#

please help

#

?

#

:/ hey

runic grove
#

it doesnt send in a discord server afaik

#

it links to the webhook documentation

#

read it mmLol

worn quail
#

yawn

copper flame
#

come on but boring to read

restive otter
#

you need to make an HTTP server and discordbotlist will send requests to it

#

read the documentation to see how the requests are crafted

copper flame
#

web site redirected me here again

#

:/

#

What should I set for webhooks in bot

#

😑

restive otter
#

you need to make an http server

#

that is publicly accessible

#

do you use nodejs? @copper flame

copper flame
#

yes

restive otter
#

run this

#

npm install dblapi.js

#
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!`);
});
#

this will print a message to the console with a link starting with http://

#

just copy the whole thing and paste it to your bot edit page

copper flame
#

I'm installing dolap.js but it still gives an error

#

by the way i threw it into server.js

restive otter
#

dblapi.js

copper flame
runic grove
#

uh

#

likely

copper flame
#

how will i fix it

runic grove
#

judging by the issue you posted

#

dont declare it twice

#

problem solved

copper flame
#

const DBL = require('dblapi.js');

  ^

SyntaxError: Identifier 'DBL' has already been declared

at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:617:28)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Function.Module.runMain (module.js:694:10)
at startup (bootstrap_node.js:204:16)
at bootstrap_node.js:625:3
runic grove
#

dont

#

declare

#

it

#

twice

#

also not an api related issue

copper flame
#

const DBL = require('dblapi.js');

  ^

SyntaxError: Identifier 'DBL' has already been declared

at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:617:28)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Function.Module.runMain (module.js:694:10)
at startup (bootstrap_node.js:204:16)
at bootstrap_node.js:625:3
#

read what it says there

runic grove
#

can you read

copper flame
#

Did you see

runic grove
#

i did, and tried my best to explain how to fix it

narrow zenith
#

you put the same code twice @copper flame

#

or already defined it

copper flame
#

const DBL = require('dblapi.js'); **<<<<<<bad code** 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!`); });

mystic wing
#

don't have dbl and DBL

runic grove
#

thats not the problem

#

javascript is case sensitive

#

the problem is

#

that he has defined DBL already in another part of the code

#

we dont see

spiral steeple
#

^

empty yarrow
#

Hi! In the weebhook part, what should I put?

copper flame
#

``const DBL = require('dblapi.js');
const dbl = new DBL('', { webhookPort: 5000, webhookAuth: '1234' }, client);

// Optional events
dbl.on('posted', () => {
console.log('Sunucu sayısı gönderildi!');
})

dbl.on('error', e => {
console.log(Olamaz bir hata! ${e});
})``there's only one like that

empty yarrow
#

@spiral steeple path? Not dblwebhook?

copper flame
#

😭 please i am bored

spiral steeple
#

that was being dumb

#

Wtf

#

why is it adding a /

empty yarrow
#

:o

spiral steeple
#

I give up

#

http://ip:port/path

copper flame
#

i think i solved the problem

spiral steeple
#

Path is the path

#

just a placeholder