#topgg-api

1 messages · Page 51 of 1

clever rock
#

he wants some kind of knowing where the vote is from. and the vote body just responds with the user who voted to as far as Im aware of

arctic arch
#

there is also the bot id

restive otter
#

oh

clever rock
#

oh you can use that then

arctic arch
clever rock
#

thanks for clarifying that

restive otter
#

aight thanks for helping worked 😃

restive otter
#

How to setup the bot?

#

I have it in my server but what do i do now to show how much people i have in my server?

restive otter
#

you need with a command you can see how much people you have on the server?

plush ore
#

You need to grab the guild.members collection, filter the bots out and then get the size of collection

faint sleet
#

I've been having a problem, my token either doesnt work or idfk, regened it multiple times..

sullen nymph
#

What library?

#

Well, I guess you might have fixed it already

last cedar
#

the vote is not going through?

#

Webhook running at http://0.0.0.0:3000/dblwebhook

sand hazel
#

replace 0.0.0.0

last cedar
#

with?

#

my ip?

sand hazel
#

yeah

#

you don't actually expect 0.0.0.0 to be a real ip do you Thonk

last cedar
#

its just that im using a vps

#

so its a different ip than mine

plain timber
#

k then use your vps ip

last cedar
#

the public one?

#

or the private ip one

plain timber
#

the public one BlobFacepalm

last cedar
#

i tried

#

and its not working

spiral steeple
#

Is port 3000 even open

#

for you

last cedar
#

wait

#

idk

#

im using a vps

plain timber
#

yes we know

last cedar
#

i been using glitch for this but i moved to a vps

#

so its different

#

idk why its not working though

spiral steeple
#

Go to your console

#

type ifconfig

#

Dont screen shot and send it

last cedar
#

ok

spiral steeple
#

but, it should say inet addr somewhere

last cedar
#

ifconfig is not recognized ;/

#

through cmd

grand blade
#

on windows use ipconfig

arctic arch
#

that ip would be the private one

#

dont use that

last cedar
#

xD

sand hazel
#

what is this windows vps

grand blade
#

oh u right

spiral steeple
#

I use that one

grand blade
#

im useless bye

spiral steeple
#

I use the inet addr

last cedar
#

oof using chromebook too long

spiral steeple
#

Im on a chromebook too

last cedar
#

ahh u thot ima give those ips

sand hazel
#

what is that windows

last cedar
#

yes its windows

sand hazel
#

why u doing this on windows

grand blade
#

none of those i think

#

just go to google and type ip

spiral steeple
#

windows vps?

sand hazel
#

isn't your vps like linux

last cedar
#

no

#

glitch is

sand hazel
#

what

spiral steeple
last cedar
#

glitch is linux

sand hazel
#

you have a windows vps?

last cedar
#

yes

sand hazel
#

glitch is a container

last cedar
#

mk idc

sand hazel
last cedar
#

its glitch

spiral steeple
#

The one I use is my ipv4

sand hazel
#

just visit ipchicken or something

#

or curl it

plain timber
spiral steeple
#

Also, your host should tell you your ip(s)

grand blade
#

wait you can curl on windows?

sand hazel
#

no

last cedar
#

?

#

xD

arctic arch
#

curl is not a windows command haha

plain timber
#

lol

sand hazel
#

but I use WSL

last cedar
#

@spiral steeple used azure

#

wait a second

plain timber
#

just use edge or smth

#

idk if u can do that

last cedar
#

nvm same ip

plain timber
#

can u like set up a remote desktop thingy

arctic arch
last cedar
#

i already did

#

thats how im using it on my chromebook

plain timber
#

tonkku advertising ken's site

sand hazel
#

wait

spiral steeple
#

Nice

#

LOL

plain timber
#

fishy u idiot

sand hazel
#

this blur shit is useless

arctic arch
#

nice blur

last cedar
#

lol

sand hazel
#

thanks sharex

arctic arch
#

up the intensity

plain timber
#

anyways i saved it

spiral steeple
#

ip = got

plain timber
#

time to unblur it

last cedar
#

it doesnt look like its working

sand hazel
#

lmao u can see it w/o unblurring

plain timber
#

but ipv6 has letters rite

sand hazel
#

@arctic arch ay mate, where's the intensity

#

yeah

plain timber
#

idk whether its an 8 or a B

spiral steeple
#

LOL

last cedar
#

lmao ofc

sand hazel
plain timber
#

k probably B

last cedar
#

lol

spiral steeple
#

That's some nice blur

sand hazel
#

I played myself

plain timber
#

ya think

last cedar
spiral steeple
#

Wait

#

What was that activate windows

arctic arch
#

advaith thats equivalent to doxxing lmao

last cedar
#

??

spiral steeple
#

He doxed himself

sand hazel
#

where is the inteis8ty

plain timber
#

yeah fishy sent it

last cedar
#

lol

arctic arch
#

in a setting thing

plain timber
spiral steeple
#

Many did

arctic arch
#

yeah but you reuploaded it

last cedar
#

idk the port ;/

#

or the ip idk

spiral steeple
#

its what you set, the port

last cedar
#

still not working....

#

what port

#

i dont set anything wtf

spiral steeple
#

The one you set Thonk

last cedar
#

wdym

spiral steeple
#

the number after :

arctic arch
#

webhookPort

last cedar
#

oh idk

spiral steeple
#

thats the port it be listening on

last cedar
#

it can be anything?

spiral steeple
#

if its open

last cedar
#

idk if its open or not ;/

#

its called im a total noob to ports

arctic arch
#

then you need to open

last cedar
#

how

spiral steeple
#

idk how to do that on windows mmLol

arctic arch
#

google how to open ports and your host

last cedar
#

mk let me test..

#

and... its not working...

#

bruh its not working ;/

last cedar
#

@arctic arch i tried and it didnt work ;/

arctic arch
#

write what you tried to do here

last cedar
#

ok

#
const DBL = require('dblapi.js');
const dbl = new DBL(process.env.DBLTOKEN, {
    webhookPort: 3000,
    webhookAuth: process.env.PASSWORD
}, client);```
#

dont worry about the authorization part

#

also no response in console so i cant show that

#

@arctic arch i think thats all i tried

spiral steeple
#

wait

#

wait

#

srs tho?

#

you cant use process variables in something that isnt the process

#

DBL doesnt have your process

last cedar
#

@spiral steeple i said dont worry about the authorization. I blocked off the value

spiral steeple
#

Oh

#

You see

#

Its 2:36 AM

#

and Im tired, imma just go to bed

#

gl with that issue

arctic arch
#

set remote port settings to the same as local port

last cedar
#

what is u mean?

#

@arctic arch wdym i dont understand

clever rock
#

hosting on home network?

#

make sure its port forwarded properly

winter salmon
#

Ks8qqhx

trim venture
craggy sentinel
#

the tools section should have examples

last cedar
#

@clever rock im hosting on azure's vps

#

so idk why its not working ;/

restive otter
#

Check bot logs @last cedar

last cedar
#

🤔

#

wdym bot logs

restive otter
#

Web ligs

#

console logs

last cedar
#

and what about it?

#

do i need to ....?

restive otter
#

You installed all npm's? @last cedar

last cedar
#

yes

#

i have

restive otter
#

hmmm

#

idk

last cedar
#

😭 still doesnt work ;/

trim venture
last cedar
#

oof

restive otter
#

Hey

#

I voted my bot and every 10 sec my bot tell me that i voted!

#

How to change it?

#
Ssum has voted!!!

Ssum has voted!!!

Ssum has voted!!!

Ssum has voted!!!

Ssum has voted!!!
proud sphinx
#

@restive otter wtf it's not supposed to be like this, can you send the code

restive otter
#

How else can bots be sorted with dbl.getBots({sort: 'points'})

#

okey @proud sphinx

#
bot.on("ready", () => {
    console.log(`${bot.user.username} is ready on ${bot.guilds.size} servers!`);
    
    
    var interval = setInterval (function () {


        bot.user.setStatus('available')
        bot.user.setPresence({
        game: {
        name: `Your Moderator+ | /config`,
        type: "WATCHING",
        url: "https://discord.gg/ScUkhKR"
        }})
      
//      dbl.hasVoted("484290187279728657").then(voted => {
//      if (voted) console.log("Ssum has voted!!!")
//});
    
        setTimeout(function(){ 
    
        bot.user.setStatus('available')
        bot.user.setPresence({
        game: {
        name: `${bot.guilds.size} servers!`,
        type: "WATCHING",
        url: "https://discord.gg/ScUkhKR"
        }})
        }, 5000);

        }, 1 * 30000);

});
runic grove
#

nice ad

proud sphinx
#

@restive otter any field from the bot object

runic grove
#

that

#

doesnt even work

#

xd

restive otter
#

sry lol

#

@proud sphinx thanks!

spiral steeple
#

Well it shouldnt embed tbh, and its invalid

#

lol

#

I hate the auto embed on invites

restive otter
#

I am sending not embed

#

read up

spiral steeple
#

Not that

#

talking about the invite

restive otter
#

// dbl.hasVoted("484290187279728657").then(voted => {
// if (voted) console.log("Ssum has voted!!!")
//});

proud sphinx
#

@restive otter you literally did an interval to print every ten minutes if you voted

restive otter
#

Yes

#

but where

#

should I do it?

proud sphinx
#

Votes reset every 12 hours I think

#

Soooooo

restive otter
#

Yes

#

so?

proud sphinx
#

Why would you do it anyways

restive otter
#

I wanna send an user

#

that "Thanks for voting!"

#

but idk where should it be

#

that will be seen only once

proud sphinx
#

Use webhooks

restive otter
#

Hmmm?

#

what arewebhooks and howcani use them?

proud sphinx
#

It's in the docs

#

They notify you when someone votes

restive otter
#

oke6

#

@proud sphinx like this?

restive otter
#

If someone know how to bot dm when someone vote it please ping me

plain timber
#

@restive otter no, widgets have nothing to do with webhooks

#

There's a separate section in the edit page for webhooks

#

And what language is your bot in?

ripe linden
#

It’s looks like JavaScript to me from what he sent above

narrow zenith
#

i agree

restive otter
#

@plain timberjs

#

And how set a webhook

#

?

plain timber
restive otter
#

I know

#

but

#

it send milion of times

#

because it check and check

plain timber
#

You didn't even send any webhook code

restive otter
#

Oh

#

Okey

#

thanks

plain timber
#

dbl.hasVoted has nothing to do with webhooks

restive otter
#

u will try

#

i

#

@plain timber

#

I need set a webhook url?

plain timber
#

yes

#

if you use the example, it will send a url in the console when your bot starts @restive otter

#

if it has 0.0.0.0, change that to the server's public IP

restive otter
#

It is

plain timber
#

ok

#

as i said:
|| || if it has 0.0.0.0, change that to the server's public IP

restive otter
#

what you mean with changing to public ip

#

and where?

plain timber
#

you don't know your server's public IP?

restive otter
#

no

#

sorry I am not good in webhooks

#

You mean discord server ip or what? @plain timber

plain timber
#

no

#

the ip of the server your bot is running on

restive otter
#

oh

#

he is on glitch @plain timber

plain timber
#

oh

#

well then you'll need to change the webhook code to work with glitch

#

does your glitch project also use express?

restive otter
#

Nope

#

It's normal js

plain timber
#

how do you keep the project online then

restive otter
#

I use uptimebots

#

uptimerobots

#

it's 24/7

#

working good

plain timber
#

if you use uptime robot you need express code in your project

restive otter
#

Oh

#

wait a sec

plain timber
#

you probably have it

#

with the app.get and app.listen stuff

restive otter
#

@plain timber

plain timber
#

hm weird

#

well

#

change webhookPort to 3000

#

since glitch only lets you use 3000

restive otter
#

Okey

#

It's 3000 ^

plain timber
#

you changed it?

restive otter
#

yes

plain timber
#

ok so then in DBL, use this URL: https://PROJECTNAME.glitch.me/dblwebhook

#

change PROJECTNAME obv

restive otter
#

I can get it on my discordbots bot edit?

#

@plain timber

plain timber
#

wdym

tropic crypt
#

Patience

plain timber
#

its there at the bottom of the edit page

restive otter
#

yes

#

but

#

it still say

#

@plain timber sorry pinging but you are god

plain timber
#

ok

#

whats the problem

#

that's good

restive otter
#

what's next?

#

@plain timber

tropic crypt
#

... he just said it’s good ...

restive otter
#

so...

#

it should work?

tropic crypt
#

Yea.

plain timber
#

did you set the settings in your bot's edit page yet? @restive otter

restive otter
#

hmmm?

#

Yes

#

I set

#

the link

#

without password

tropic crypt
#

Advaith

restive otter
#

?

tropic crypt
#

Inv me to DBB in DMs

plain timber
#

k

#

and @restive otter you need to set the auth too

restive otter
#

auth?

plain timber
#

the password

restive otter
#

Okey

plain timber
#

the password goes in the Authorization box

restive otter
#

done

#

worked! @plain timber

#

THANKS MATE!

#

You are the best

plain timber
#

yw 😃

restive otter
#

@plain timber last thing

#

how dm the user?

#

I made

#

vote.user.send("test")

#

but it's not working

plain timber
#

vote.user is an ID

#

so you will need to get the user and then send it

restive otter
#

so

plain timber
#

if the user is cached, you can use client.users.get(vote.user).send(..)

restive otter
#

Thanks

plain timber
#

but you might want to fetch the user before that

restive otter
#

💙 u bro

#

fetch?

plain timber
#

yes in case they arent cached

restive otter
#

working

#

Thanks brooooo

plain timber
#

i think in d.js 11 its client.fetchUser(vote.user), in d.js 12 its client.users.fetch(vote.user)

#

yw blobsmile

restive otter
#

💙

last cedar
#

@plain timber now help me with MY problem lmao

plain timber
#

@last cedar well idk how to fix your problem

last cedar
#

wdym u dont know?

#

I'm using a cmd prompt

#

and I tried to use https://myip:3000/dblwebhook but its not working

#

@plain timber ^^^

plain timber
#

Ik

#

And idk why it's not working

last cedar
#

;/

sand hazel
#

http instead of https

#

the js dbl webhook doesn't have options for tls

toxic hazel
#
    @commands.command(name="dbl-update")
    @commands.is_owner()
    async def manual_update(self, ctx):
        """Command used to manually update server count on DBL!"""
        
        headers = {"Authorization": self.token}
        end_url = f"/bots/{self.bot.user.id}/stats"
        total_servers = len(self.bot.guilds)
        params = f"?server_count={total_servers}"
        async with self.session.post(self.base_url+end_url+params, headers=headers) as response:
            text = await response.text()
        embed = discord.Embed(title="Posted Server Count!", description=f"```json\n{text}\n```", color=discord.Color.teal())
        await ctx.send(embed=embed)```
#

Anyone knows why this would happen?

#

I tried the params argument of post() too but it gave the same results

humble bison
#

use the body @toxic hazel

#

{ server_count: 9999 }

spiral steeple
restive otter
grim hazel
#

hey

#

can anyone help me with the webhook.on part

#

the http://${hook.hostname}:${hook.port}${hook.path}

grim hazel
#

nvm

restive otter
#

@grim hazel using your host?

#

or heroku/glitch

grim hazel
#

no i got it working

restive otter
#

okey

grim hazel
#

the only problem now it wont send dm

#

or the message i set when i vote

restive otter
#

so

#

you need get member id

grim hazel
#

yes i did

restive otter
#

client.users.get(vote.user).send("here") @grim hazel

grim hazel
#

i used client.fetchUser(vote.user).send("ff")

restive otter
#

It worked?

grim hazel
#

nope

restive otter
#

try my one

grim hazel
#

it doesnt say anything

#

the same

restive otter
#

Hmmm

#

send me the code

#

(remember to test in your bot edit page)

grim hazel
#

you can?

restive otter
#

Sure, I can try vote it

#

send me a dm

grim hazel
#

wait

restive otter
#

but it tell you in logs that someone voted?

grim hazel
#

wait

#

lemme restart my bot

restive otter
#

k

grim hazel
#

i used heroku

#

so for the url

#

yes

#

i tested it

#

it doesnt send anything

restive otter
#

heroku

#

hmmm

#

@grim hazel without port

grim hazel
#

really?

restive otter
#

port = 80 @grim hazel

#

heroku port is only 80

#

so in your code change port to 80

grim hazel
#

does the same thing with 80

#

and without port

restive otter
#

wait a sec

grim hazel
#

sure

restive otter
#

So

grim hazel
#

already

#

it does the same

restive otter
#

send me the code @grim hazel

grim hazel
restive otter
#

it send you a console log that someone voted? @grim hazel

restive otter
#

idk how use webhooks in dyno @grim hazel

#

i use glitch

#

it's easier

grim hazel
#

¯_(ツ)_/¯

#

thanks for trying tho

restive otter
#

I will try it

#

fixing it

#

read heroku api

#

maybe you need install some webhooks

polar mirage
#

If it's showing that in the console

#

It means you're receiving the request

#

So probably just something wrong in your code

#

👀

restive otter
#

It's not in console

#

idk heeoku

#

I think is an error

#

it show up a message in console = Voted for the bot ID: @grim hazel

#

or sth like this

grim hazel
#

huh

#

what do you mean 'it show up a message in console = Voted for the bot ID: @grim hazel'

#

wait

restive otter
#

if you vote

grim hazel
#

the test on edit

restive otter
#

for the bot

#

it should appear

#

User with ID ${vote.user} & with a name of ${tsuki.user.get(vote.user).username} just voted for tsuki

#

in console

grim hazel
#

wait

#

the test webhook

restive otter
#

Yes

grim hazel
#

is that a test vote

restive otter
#

I told you to test

#

yes

grim hazel
#

oh

#

yes

#

i did now

#

but it doesnt send anything in the console

#

nor messages

restive otter
#

so it's dbl problem

#

or herok

#

u

#

so idk

grim hazel
#

i think cuz of path

restive otter
#

ye

wet sequoia
#

I setup a webserver for vote webhook, how do I get the JSON Object?

restive otter
#

File name you wanna json @wet sequoia

wet sequoia
#

I just know that when someone votes and DBL sends a webhook request it sends a JSON with userId

#

I don't have a json file

restive otter
#

hmmm

wet sequoia
#

ahh nevermind got it after reading docs again

#

it sends as POST

runic grove
#

yeah

restive otter
#

yes lol

wet sequoia
#

but whats the field name

#
$_POST["<field>"]```
restive otter
#

What?

#

php

wet sequoia
#

is it $_POST["data"] or whot

restive otter
#

wait a sec

#

idk

#

in php

wet sequoia
#

it sends a POST request but I need the name of it yk

restive otter
#

your pass?

last cedar
#

for some reason idk why the webhook doesnt work

restive otter
#

JS? @last cedar

last cedar
#

I tried to use my server's ip address and an open port

#

and yes

#

ofc its d.js

restive otter
#

host?

#

ip/glitch others?

#

@last cedar

runic grove
#

you need to set up a webserver

restive otter
#

^

runic grove
#

d.js by itself aint enough

last cedar
#

u mean express?

restive otter
#

ye

last cedar
#

but im on my computer

#

i mean vps server

restive otter
#

host it on glitch

#

with express

last cedar
#

nah ;/

restive otter
#

why not?

last cedar
#

glitch DOO DOO

restive otter
#

No u

wet sequoia
#

@runic grove do you know $_POST['what comes here']

#

for webhook

last cedar
#

I can only get my bot to 7 hours of uptime

restive otter
#

So host a web server only on glitch

last cedar
#

but without glitch I can go up tp 16

runic grove
#

no i dont know php

restive otter
#

to have up

#

ip

last cedar
#

;/

restive otter
#

then

last cedar
#

ok ig?

restive otter
#

yourproj = proj name

last cedar
#

i already know that -_-

restive otter
#

😞

last cedar
#

thats why Im getting up FOR computer

restive otter
#

lol

#

but why?

#

you need have pc 24/7

last cedar
#

yes i do -_-

#

vps

restive otter
#

oyeye

last cedar
#

lol

long yarrow
#

hey so I'm confused on what these settings do, and yes I've read the docs. Do these correspond to options.webhookPath and options.webhookAuth respectively?

#

oh and ping if you reply

indigo shoal
#

Authorisation is webhookAuth and url is your public ip

#

We hook path is the path to you webhook

#

@long yarrow

long yarrow
#

ah

#

thanks

restive otter
#

Auth, your pass for voting webhooks @long yarrow

#

and

#

url your p ip

long yarrow
#

oof

#

thanc

restive otter
#

Can someone help me?

restive otter
#

Sure @restive otter! What's your problem?

gaunt fox
#

Bug (I think?): Webhook test in the bot editing page doesn't work until after you save and submit edits, then click edit again afterwards and the test works

spiral steeple
#

You just have to hit submit for it to update

restive otter
#

yes lol

rigid shuttle
#

can someone please gimme a tut (video if there is some and updated) to how to use the api in node cause it's 5 hours that i'm testing and nothing working >.>

narrow zenith
#

Message deleted; i fucking hate dyslexia

rigid shuttle
#

don't worry ..

#

so anyone wanna help ?

indigo shoal
#

Don't think there is a video, but there's examples on the api docs

rigid shuttle
#

ye but i don't recieve anything in the console GWsetmyxPeepoWeird

indigo shoal
#

-bots 363035228198928407

abstract mothBOT
#

User not found

indigo shoal
#

You don't have a bot...

rigid shuttle
#

i'm a developeer of @glacial delta and i can proof it if nedded

glass garden
#

Discord.js right?

rigid shuttle
#

yep

glass garden
#

Any commands so far?

rigid shuttle
#

ye a lot

#

i just wanna make a role reward feature but dunno what's the event

#

(i don't own the bot either the app on the site)

glass garden
#

So just

#

Server count?

runic grove
#

uhm

#

im pretty sure you would also need the token

rigid shuttle
#

ye the owner gived me the api (site) token

glass garden
#

Hm

#

For server count

#

Isn't it a like dbl.poststats?

#

const dbl = new DBL(tokenhere)

#

I think

#

Don't really remember

#

Of course you need the DBL package

rigid shuttle
#

@glass garden

#

.postStats(serverCount, [shardId], [shardCount])

runic grove
#

welp

rigid shuttle
#

this ?

runic grove
#

time to reset your token

rigid shuttle
#

not working i tihnk

runic grove
#

it better not be

glass garden
#

store your server count

#

in a var

#

then do

#

dbl.postStats(varwithservercount)

#

you can ignore the shard

#

I guessing you dont use it

rigid shuttle
#

i do but what i want to is know when a user has upvoted the bot

glass garden
#

oh

#

dont you need

#

webhook for that?

#

do you need to know when or if a user upvoted?

rigid shuttle
#

when a user has upvoted
thank you much before GWqlabsLove

#

GWpingPingedPong please when you answer

glass garden
#

@rigid shuttle

#

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

#

On the docs

rigid shuttle
#

i'll try thank you ^^

glass garden
#

This is web hook

#

Not reg api

rigid shuttle
#

so should i use something special when calling the dbl class ? (new DBl())

restive otter
#

i need API for nsfw hentaigif

#

anyone have it

tidal burrow
#

this is not even the right place for this

#

also google is your friend

rigid shuttle
#

@glass garden it's says that webhook is not defined so he can't read the on function GWczoLoliShrug

restive otter
#

im trying to vote lock a command and i seem to fail..

        if (voted);
    });
#

isnt it supposed to work?

restive otter
#

im actually trying to get the user's id

#

(the code is in a command btw)

plain timber
#

@rigid shuttle you didn't include the webhook settings in the new dbl

rigid shuttle
#

i did
two seconds

const dblClient = new dblapi(config.dbl_token,{ webhookPort: 5000, webhookAuth: 'password' },bot)
bot.VoteClient = dblClient
dblClient.webhook.on('vote', vote => { console.log(`User with ID ${vote.user} just voted!); }`)});
bot.on("ready",()=>{
    console.log(dblClient.webhook)
    bot.BetterChannels = new discord.Collection();
    bot.guilds.forEach(guild=>{
        guild.channels.forEach(chnl=>{
            bot.BetterChannels.set(chnl.id),chnl;
        })
    })
    bot.generateInvite(8).then(i=>{
        console.log(i)
    })
})
restive otter
#

@rigid shuttle its working?

rigid shuttle
#

nopê webhook is not defined

restive otter
#

you installed dbl @rigid shuttle

rigid shuttle
#

yep

restive otter
#

What is bot.VoteClient = dblClient? @rigid shuttle

spiral steeple
#

It is what it says

#

bot.VoteClient will equal dblClient

restive otter
#

hmmm

rigid shuttle
#

it's just let me use dblClient as bot.VoteClient on every file

restive otter
#

is the password same as web one? @rigid shuttle

rigid shuttle
#

i think no

restive otter
#

so set it

rigid shuttle
#

i'll do it

restive otter
#
 dbl.hasVoted(message.author.id).then(voted => {
        if (voted) console.log("You hav voted!!!")
    });

im trying to make a vote lock command but i cant seem to find a way to get the persons id .. the one who run the command ... i tried message.author.id but it doesnt work

rigid shuttle
#

@restive otter Still not working GWseremePeepoThink

#

@restive otter dblClient.getVotes().then(votes=>votes.find(v=>v.id == msg.author.id))
i think this will work

restive otter
#

i dont think so

#

idk

ripe linden
#

@restive otter it will be better to just store all the people that voted in a database

knotty grail
#

guys did anything happen with the api for nodejs

#

Error: Cannot find module 'dblapi.js'

sand hazel
#

no?

knotty grail
#

even after I ran npm install -g dblapi.js --save

humble bison
#

you dont need -g

#

thats why its saying not found

#

dblapi.js isnt a global module

knotty grail
#

oh

#

the error I get now is version not found: mongodb@3.2.0

humble bison
#

not a dbl api issue

knotty grail
#

I tried to install it before but it didn't help, is it necessary?

sand hazel
#

It's your own code, you don't know what's necessary?

knotty grail
#

the error happens when I try to install dblapi

#

with npm, not run my bot

sand hazel
#

mongodb is not a prerequisite of dbl, check your package.json for dependencies or peer deps

knotty grail
#

ok will do

restive otter
#

Isn't there just a way to check if someone has voted by their id

#

Like on the dbl has voted . Inside the () can't you put something that gets fee user's id

sand hazel
#

/bots/{botid}/check

restive otter
#

I need the users Id not the bots

#

I also tried userid but didn't work

#
        if (voted) console.log("You hav voted!!!")
    });```
#

Users.(Userid) ?

sand hazel
#

Yeah you can use hasVoted, /bots/{botid}/check accepts a query param of the user id

#

hasVoted wraps that

restive otter
#

Hah I'm confused .. where do I out the bots/botid?

sand hazel
#

does hasVoted() not work?

restive otter
#

If I leave it blank ?

sand hazel
#

no

restive otter
#

It says that an id Is needed

sand hazel
#

Yeah, pass the userid

#

Does it not work?

restive otter
#

I don't know how to pass it that's the thing

sand hazel
#

and

restive otter
#

It didn't work

sand hazel
#

Define didn't work

#

What's the result, can you console log the input

clever rock
#

Could you show your code

#

as much as possible and how you do it

restive otter
#

if(command === `${prefix}voted) { dbl.hasVoted(message.author.id).then(voted => { if (voted) { console.log(message.author + "has voted!!!"); message.channel.send("You voted in the last 24h!"); } }); return; }

#

This should work @restive otter

polar mirage
#

But what if we spam the command

clever rock
#

rate limit

restive otter
#

add db limit

restive otter
#

@restive otter I don't want to check if I have voted or not I want to make it so a command can only be run when you have voted .. and if you haven't it will send a message saying that you need to vote

restive otter
#

(It was working before for months,)

arctic arch
restive otter
#

I've temporary disabled that cog to see if it happens again.

restive otter
#

@restive otter check docs

sullen nymph
#

@restive otter When does that error appear!

#

?

restive otter
#

I don't know, randomly

sullen nymph
#

Mind sending code?

#

Well, honestly, I would recommend posting to DBL api directly with aiohttp

#

dblpy is kind of outdated

restive otter
#

Sorry for posting 26, later XD
Forgot that we were talking here

#

Feel free to mention me

#

@restive otter i tried the vote command u said

 if(cmd === 'voted') {
  dbl.hasVoted(message.author.id).then(voted => {
    if (voted) {
    console.log(message.author + "has voted!!!");
    message.channel.send("You voted in the last 24h!");
    }
    });
 }

and it says forgot to ctch a promise rejection let me catch the rejection 1 sec

#

@restive otter you wanna sth when for one voted to your bot, to dm? @restive otter

#

all i want is to vote lock a command

#

what you mean with lock command?

#

@restive otter

#

lets say that i have a command.... for example the prefix command .. I want to make it so in order to use the command you need to upvote the bot else it wont work

#

oh

#

so

#

check if member has voted in the last 1000 votes @restive otter

#

wait I will send you it

#

ok

polar mirage
#

But he doesn't want that?

#

Pretty sure he wants it to be an active vote as in voted within the last 12h

restive otter
#

true

#

so how do we do it?

polar mirage
#

It doesn't return timestamps of votes

#

And using hasVoted is a bad idea as people could spam the command

#

Which would spam dbl

restive otter
#

what should i use then?

polar mirage
#

So preferably you use webhooks to know ~exactly when people vote

restive otter
#

all i did was follow the guide

#

i have alrerady set that up

#
dbl.webhook.on('vote', vote => {
  client.channels.get('545963588251156480').send(new Discord.RichEmbed()
      .addField("New vote on", `DBL for <@${vote.bot}>` )
      .setColor('RANDOM')
      .addField("User ID:", `${client.users.get(vote.user)}`)
      .setTimestamp()
      .addField(`Attempt to mention `, `<@${vote.user}>`)
      .addField(`Tag`, client.users.get(vote.user).tag )
      .setThumbnail(client.users.get(vote.user).displayAvatarURL)
    )
#

this posts a messsage when someome votes

polar mirage
#

If you have the webhooks then why are u doing this lol

restive otter
#

..

polar mirage
#

Save it to a DB

restive otter
#

I want to vote loc a commmand

polar mirage
#

^^

#

Everytime someone votes

#

Write the timestamp to DB

#

With the users ID

restive otter
#

idk how to write a timestamp in db

polar mirage
#

When they use the command check in DB if that user has a vote within 12h

#

Do you not know how to write it to a DB or do you not know what a DB is

restive otter
#

dont u mean quick.db ?

polar mirage
#

That works

restive otter
#

ye idk how to use that

polar mirage
#

I never used quick.db so I don't either

restive otter
#

hmm

polar mirage
#

Read their docs I guess

restive otter
#

any other suggestions of things i could use?

polar mirage
#

Is your bot online 24/7

restive otter
#

yes

#

its on a paid vps

polar mirage
#

You could just put them in an array then

restive otter
#

hmm

polar mirage
#

But it would be lost if your bot shuts down

#

If you want to make things more professional you should figure out how to use a DB

restive otter
#

okay

plain timber
#

@restive otter there are many different databases, quick.db is one

#

But I've heard quick.db isn't good

restive otter
#

@plain timber i use quick.db

#

its quite easy to use

#

and its good

spiral steeple
#

Easy isnt always best*

restive otter
#

^

untold marten
#

where i can get a token?

hexed bone
#

On the discord developer site

untold marten
#

api token

#

not bot

hexed bone
#

oh

untold marten
#

DBL token

hexed bone
#

on the dbl bot page

untold marten
#

where?

hexed bone
#

I don't know

#

I think your bot needs to be accepted

restive otter
#

/^

restive otter
#

hallo

#

@restive otter so I'm here

spiral steeple
#

I am here

restive otter
#

hi there

spiral steeple
#

Hi

restive otter
#

Hi here im Jared

spiral steeple
sand hazel
#

starting to look like general

restive otter
#

eh I guess

#

might as well be since most people come here looking for help(I think)

spiral steeple
#

Nice

#

Leak

#

Delete and regen

restive otter
#

fack

spiral steeple
#

Dont post your token pls

restive otter
#

sorry @restive otter

#

ha, wasn't mine son.

spiral steeple
#

Oh

#

Well

#

Tell whose ever it was to regen

restive otter
#

okay calm down, it was Jared's we're trying to figure it out.

#

I regened it it's fine

spiral steeple
#

Good mmLol

restive otter
#
const DBL = require('dblapi.js');
const dbltoken = 'ha not this time son';
const dbl = new DBL(dbltoken, { webhookPort: 5000, webhookAuth: 'GarbageIsNotTheBest' });
dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
  console.log(vote);
  // Do what you need to do
});```
#

no leaks

spiral steeple
#

Got that nice webhook auth mmLol

#

Not much you can do without token

restive otter
#

that doesnt matter

#

XD

#

plus it's the wrong password i see what you did there goat

#

XD

#

:p

#

got em

humble bison
#

on the /bots endpoint with the fields param, does All fields actually work for getting all fields, or do we just set it as ''?

sand hazel
#

I wouldn't imagine an API implementation that would accept All fields, just don't include it if you don't want any specific fields

humble bison
#

well the api lists All fields as default @sand hazel

#

i'll try empty though

sand hazel
#

I would imagine that as a pseudo rather than actual

#

Then again, this API had some questionable implementation in the past, I wouldn't be surprised

humble bison
#

hm, okay

restive otter
#

to upload my bot - do i have to use this codes in my code?

#
import dbl
import discord
from discord.ext import commands

import aiohttp
import asyncio
import logging


class DiscordBotsOrgAPI:
    """Handles interactions with the discordbots.org API"""

    def __init__(self, bot):
        self.bot = bot
        self.token = 'dbl_token'  #  set this to your DBL token
        self.dblpy = dbl.Client(self.bot, self.token)
        self.bot.loop.create_task(self.update_stats())

    async def update_stats(self):
        """This function runs every 30 minutes to automatically update your server count"""

        while True:
            logger.info('attempting to post server count')
            try:
                await self.dblpy.post_server_count()
                logger.info('posted server count ({})'.format(len(self.bot.guilds)))
            except Exception as e:
                logger.exception('Failed to post server count\n{}: {}'.format(type(e).__name__, e))
            await asyncio.sleep(1800)


def setup(bot):
    global logger
    logger = logging.getLogger('bot')
    bot.add_cog(DiscordBotsOrgAPI(bot))```
runic grove
#

no

#

you cant even make use of it before your bot is approved

#

(i think)

restive otter
#

i cant upload my bot and this code updates a few things of the bot on the website

#

also i mean before i have this code into my codes it doesnt work

runic grove
#

???

sullen nymph
#

Your bot will get approved once a website moderator approves it

restive otter
#

and what could be a reason not to approve it?

#

how long takes the approvement?

runic grove
junior lintel
#

I'm having some issues with the vote function

#

I wat to log them in a discord channel

#

therefore the bot would need to send the data in a discord channel.

#

I don't know how to go ahead with this tho.

#

I've tried this: ```js

dbl.webhook.on('vote', vote => {
client.channels.get('545963588251156480').send(new Discord.RichEmbed()
.setColor('RANDOM')
.addField("User ID:", ${client.users.get(vote.user).id})
.setTimestamp()
)
});```

#

My knowledge about web hooks is very bad.

#

Do I have to set my webhook URL to anything specific for it to work?

sand hazel
#

Your exposed endpoint

junior lintel
#

To which part of it?

restive otter
#

@junior lintel lol Just make it like

let embed = new Discord.RichEmbed()
      .setColor('RANDOM')
      .addField("User ID:", `${client.users.get(vote.user).id}`)
      .setTimestamp();

dbl.webhook.on('vote', vote => {client.channels.get('545963588251156480').send(embed)}

sand hazel
#

to the ip and the path

#

That's not valid and will return undef

restive otter
#

wat

sand hazel
#

${client.users.get(vote.user).id} exists inside the vote callback scope

#

You moving out of it will cause it to be undef

restive otter
#

yeah

#

oof

#

didn't see lmao

sand hazel
#

@junior lintel http://yourip:port/path

restive otter
#

Lol why isn't rr on the list?

sand hazel
#

Reasons, not gonna mention it

restive otter
#

alright

rustic torrent
#

when i try to check votes, i use this:
https://discordbots.org/api/bots/490644041806118923/check?userid=354741784061935619
But its tells me:
{"error":"No query userId, add ?userId= to your request"}

#

o nm i got it

#

capitalization

#

is auth neccessary for checking votes?

sudden rampart
#

yes

rustic torrent
#

ugg

spiral steeple
#

Auth is needed for everything

#

or they'd get spammed

glass garden
#

How long does the api take to update server counr?

spiral steeple
#

Should be quite fast.

glass garden
#

Xd

#

I sent my testing bot info

#

which was only in 1 server

#

now my bot looks fishy

restive otter
#

can someone tell me how do i know if someone from a certani guild has voted for my bote

#

bot

#

im new to this pls help

plain timber
#

@restive otter have you read the docs

restive otter
#

no

plain timber
#

well then read it BlobFacepalm

restive otter
#

Well it says this Instead of requesting our API to see the users who have voted for your bot, we now have webhooks! Webhooks will send a post request to a URL of your choice when your bot has been voted for.

#

where can i find an example

plain timber
#

you can either use webhooks or an API request

#

what language do you use?

restive otter
#

c#

#

let me check the api doc

plain timber
#

hm

#

i dont think the c# lib supports votes

#

so make the HTTP request yourself

restive otter
#

ther is nothing related to voting apparently

humble bison
#

just run a web server

plain timber
humble bison
#

look for POST reqs

plain timber
#

or just run a webserver for webhooks

humble bison
#

do your stuff

restive otter
#

where shall i put that link 🤔

plain timber
#

do you know how to make http requests or run a webserver

restive otter
#

i know how to run a webserver

#

but i never programmed for web servers

#

is this the base url

#

oh it worked thank you

junior lintel
#

I've set my secret, port and ip correctly.

runic grove
#

???

#

are you trying to get dbl to send a request to a localhosted webserver?

junior lintel
#

I don't believe that glitch is localhosted, so no

restive otter
#

@junior lintel it's good, if you host on glitch it will work

#

you will get that is 0.0.0.0:5000 but it will work

arctic arch
#

replace 0.0.0.0 with your public ip

restive otter
#

Ye done it @arctic arch

#

but he see in logs that it's still 0.0.0.0

arctic arch
restive otter
#

yes

#

/dblwebhook

junior lintel
#

so I just put my ip as the name of the project or?

#

Giving the port 3000 makes it call back this error: Error: listen EADDRINUSE: address already in use :::3000

restive otter
#
level 100 blob typing (advaith)Today at 6:26 AM
hm
i dont think the c# lib supports votes```
that and don't use the official c# library, it's full of deadlocks and tonkku refuses to use any other libraries in the docs
#

you're better off writing your own, that thing is a mess and full of deadlocks

#

complexity > productivity

plain timber
#

@junior lintel that means you are already running a webserver, possibly through express. you will need to use webhookServer to connect dblapi.js to the express server.

#

you can only run 1 webserver per project

#

but dblapi.js can connect to an existing one

restive otter
#

How do I use the api?

#

@restive otter thx

#

Would It go in the index.js

plain timber
#

you can use it wherever you want

#

why would the file name matter

restive otter
#

@plain timber im using a command handler

plain timber
#

ok?

#

i dont think you even said what you want to do with the api

#

there are tons of different things you can do

restive otter
#

like

#

@plain timber what are some cool things u can do

plain timber
#

you can get information about a bot or a user, you can check if someone voted for your bot, and you can post your bot's server and shard count to the site

#

you can also set up a vote webhook and run code as soon as a user votes

#

but i don't think you can use the api until your bot gets approved and listed on the site @restive otter

restive otter
#

Wait

#

hmm

#

Server Count for the dbl site sounds cool

restive otter
#

@restive otter

trim venture
#

Hi! I used the example to make my bot server number thing on the website. But it doesn't works. Any idea?

restive otter
junior lintel
#
import discord
from discord.ext import commands

import aiohttp
import asyncio
import logging


class DiscordBotsOrgAPI:
    """Handles interactions with the discordbots.org API"""

    def __init__(self, bot):
        self.bot = bot
        self.token = 'dbl_token'  #  set this to your DBL token
        self.dblpy = dbl.Client(self.bot, self.token)
        self.bot.loop.create_task(self.update_stats())

    async def update_stats(self):
        """This function runs every 30 minutes to automatically update your server count"""

        while True:
            logger.info('attempting to post server count')
            try:
                await self.dblpy.post_server_count()
                logger.info('posted server count ({})'.format(len(self.bot.guilds)))
            except Exception as e:
                logger.exception('Failed to post server count\n{}: {}'.format(type(e).__name__, e))
            await asyncio.sleep(1800)


def setup(bot):
    global logger
    logger = logging.getLogger('bot')
    bot.add_cog(DiscordBotsOrgAPI(bot))```
restive otter
#

``
dbl.postStats(bot.guilds.size, bot.shards.id, bot.shards.total);

                                       ^

TypeError: Cannot read property 'id' of undefined
``
Why lol?

azure pollen
#

cos the proprty id doesnt exist in 'shards'

restive otter
#

Hi, when you fix the command m!trade and m!sell?

craggy sentinel
#

@restive otter You have the wrong channel and the wrong server entirely

Try asking in the bot's support server if they have one.

junior lintel
spiral steeple
#

because 0.0.0.0 is local host, the port you defined is 3000, the default path is dblwebhook

junior lintel
#

how am I meant to put it up on the webhook then?

spiral steeple
#

You get the ip of the host

junior lintel
#

And then I post it on discordbots?

#

Because I've already done that.

#

No response.

spiral steeple
#

Did you set the webhook up right?

junior lintel
#

I followed the example

spiral steeple
junior lintel
#

oh poop

#

might have just found the issue

#

the port was at 5000

plain timber
#

403 means either wrong token or your ip is banned

ebon dragon
#

How can I customize my bot's DBL website? Not the description

sand hazel
#

with css?

ebon dragon
#

Maybe, I don't know

spiral steeple
#

The answer is yes

ebon dragon
#

I'm not good at css

#

Oh

spiral steeple
#

Time to learn then

ebon dragon
#

Okay but how can i link the ccs to my dbl website?

spiral steeple
#

By using the style tag in the head tag.

#

Have fun. I need to go to bed

ebon dragon
#

Thanks

plain timber
#

@spiral steeple you can't put a head tag inside the long description

#

The head tag goes at the top of the sites code, before the body