#topgg-api

1 messages ยท Page 52 of 1

plain timber
#

The long description is inside the body

#

And style doesn't need to be in head

plain timber
#

@proud sphinx wrong channel?

proud sphinx
#

Yes lmao

#

Oops

spiral steeple
#

I put a head tag in there, as I do with the footer on my website to change certaim things on the site when I need to

#

I dont really care if it's efficient if it works

warped delta
#

Selamlar !

golden wind
#

rip dblpy ๐Ÿ™

ebon dragon
#

how to post the shardcount to dbl? i did the same as the API said but i get errors

spiral steeple
#
1) Don't ask to ask
2) Provide your current code
3) Tell us your error, not just that it errors
4) Tell us the lib and lang```
ebon dragon
#

okay wait a bit

smoky plover
#

listen boys, im in a bit of pickle. the webhook for dbl uses a specific port, but now that I've sharded my bot there's a conflict with the ports, what 2 do

spiral steeple
#

I only run the webhook if the shard id is 0

smoky plover
#

ur a genius arent u

ebon dragon
#

TypeError: Cannot read property 'Id' of undefined

#

i used:

  setInterval(() => {
  dbl.postStats(bot.guilds.size, bot.shards.Id, bot.shards.total);
}, 5000);
spiral steeple
#

bot.shards is undefined

smoky plover
#

i used another way

ebon dragon
#

i know but how to fix

smoky plover
#
    const guildsSize = await this.client.shard.fetchClientValues("guilds.size");
    const totalGuilds = await guildsSize.reduce((prev, guildCount) => prev + guildCount, 0);
    this.client.dbl.postStats(totalGuilds);
spiral steeple
#

He's trying to post shard count too

ebon dragon
#

the server count post is working its not a problem

smoky plover
#

i never understood why you have to post shard count

spiral steeple
#

You dont have to

ebon dragon
#

why not? : D

spiral steeple
#

It's a choice

ebon dragon
#

okay

spiral steeple
#

There is no shards property of the client class

#

There is a shard property tho

proud sphinx
#

@spiral steeple @ebon dragon for sharding use Sharding Manager

patent inlet
#

i've just made a webhook code for logging votes, but it didnt log the vote...

plain timber
#

@patent inlet did you set up the webhook in the edit page?

patent inlet
#

@plain timber what do i put in there? which url?

plain timber
#

The URL to your webhook endpoint

#

Are you using dblapi.js?

patent inlet
#

gotcha, i think

#

ye

#

the authorisation field is optional rite?

plain timber
#

it's usually IP:5000/dblwebhook

#

Authorization is whatever you set as webhookAuth in the code

patent inlet
#

gotcha

#

@plain timber it didnt work

plain timber
#

Did you save and test?

patent inlet
#

yes

#

http://0.0.0.0:5000/dblwebhook

plain timber
#

Change 0.0.0.0 to the public IP of your server

patent inlet
#

ok

#

still didnt work BlobSweatAnimated @plain timber

plain timber
#

You saved it before you tested it right

patent inlet
#

yes

plain timber
#

Hmm

#

What if you make a post request with Postman

patent inlet
#

the testing said: Webhook tested! This may take a few seconds

patent inlet
#

@plain timber

plain timber
#

ok

patent inlet
#

Idk how to do that

plain timber
#
narrow zenith
#

dbgTrumpThonk looks good to use

spiral steeple
#

Why did someone ping me with the sharding manager

toxic hazel
#
def __init__(self, bot):
        self.bot = bot
        self.config = Config()
        self.token = self.config.dbl_token
        self.base_url = "https://discordbots.org/api"
        self.headers = {"Authorization": self.token}
        self.session = None
        self.updating = self.bot.loop.create_task(self.update_stats())
        

    def __unload(self):
        self.session.close()

    async def update_stats(self):
        """This will run every 5 minutes to update server count!"""
        self.session = aiohttp.ClientSession()
        while self == self.bot.get_cog('DBL'):
            total_servers = len(self.bot.guilds)
            end_url = f"/bots/{self.bot.user.id}/stats"
            body = {"server_count": total_servers}
            async with self.session.post(self.base_url+end_url, headers=self.headers, data=body) as response:
                text = await response.text()
            print(f"Posted Server Count!")
            
            await asyncio.sleep(60*5)```
#

This only posts once on startup^^

#

Anyone knows what i am doing wrong?

honest root
#

snorlaxsleepy how is dbl doing? Any updates for c# lib needed?

plain timber
#

@honest root yes, it needs support for getting votes and vote webhooks

honest root
#

I see, nothing needed to be done yaomingface

plain timber
honest root
#

I will take a look, I thought no one is using it

plain timber
#

iirc people have been using it

#

someone asked how to do vote stuff in C#

digital linden
#
const DBL = require("dblapi.js");
const dbl = new DBL(process.env.DBLTOKEN, bot);

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

dbl.on('error', e => {
 console.log(`Oops! ${e}`);
})

const dbla = new DBL(process.env.DBLTOKEN, { webhookPort: 5000, webhookAuth: process.env.DBLAUTH });
dbla.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbla.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});```
#

thats my api stuff

#

its wierd

#

weird

honest root
#

oh, its 7 month I haven't looked here LUL

plain timber
#

@digital linden what's weird?

digital linden
#

wait lemme get error

#

throw er; // Unhandled 'error' event

plain timber
#

more details pls

#

that isn't useful at ll

digital linden
#

uh'

#
events.js:183

      throw er; // Unhandled 'error' event

      ^


Error: listen EADDRINUSE :::5000

    at Server.setupListenHandle [as _listen2] (net.js:1360:14)

    at listenInCluster (net.js:1401:12)

    at Server.listen (net.js:1485:7)

    at DBLWebhook._startWebhook (/rbd/pnpm-volume/796e667b-22ab-4154-b10d-18c07f3647b5/node_modules/.registry.npmjs.org/dblapi.js/2.3.0/node_modules/dblapi.js/src/webhook.js:45:18)

    at new DBLWebhook (/rbd/pnpm-volume/796e667b-22ab-4154-b10d-18c07f3647b5/node_modules/.registry.npmjs.org/dblapi.js/2.3.0/node_modules/dblapi.js/src/webhook.js:27:12)

    at new DBLAPI (/rbd/pnpm-volume/796e667b-22ab-4154-b10d-18c07f3647b5/node_modules/.registry.npmjs.org/dblapi.js/2.3.0/node_modules/dblapi.js/src/index.js:69:22)

at Object.<anonymous> (/app/index.js:43:14)

    at Module._compile (module.js:653:30)

    at Object.Module._extensions..js (module.js:664:10)

    at Module.load (module.js:566:32)```
plain timber
#

you are already running something on port 5000

#

are you on glitch?

digital linden
#

yea

#

for a test

plain timber
#

you need to use 3000 on glitch

digital linden
#

oof

#

so webhook auth 3000

plain timber
#

no

#

webhook port 3000

digital linden
#

oh ok

#

yeah i meant that\

#

      ^


Error: listen EADDRINUSE :::3000

    at Server.setupListenHandle [as _listen2] (net.js:1360:14)

    at listenInCluster (net.js:1401:12)

    at Server.listen (net.js:1485:7)

    at DBLWebhook._startWebhook (/rbd/pnpm-volume/796e667b-22ab-4154-b10d-18c07f3647b5/node_modules/.registry.npmjs.org/dblapi.js/2.3.0/node_modules/dblapi.js/src/webhook.js:45:18)

    at new DBLWebhook (/rbd/pnpm-volume/796e667b-22ab-4154-b10d-18c07f3647b5/node_modules/.registry.npmjs.org/dblapi.js/2.3.0/node_modules/dblapi.js/src/webhook.js:27:12)

    at new DBLAPI (/rbd/pnpm-volume/796e667b-22ab-4154-b10d-18c07f3647b5/node_modules/.registry.npmjs.org/dblapi.js/2.3.0/node_modules/dblapi.js/src/index.js:69:22)

at Object.<anonymous> (/app/index.js:43:14)

    at Module._compile (module.js:653:30)

    at Object.Module._extensions..js (module.js:664:10)

    at Module.load (module.js:566:32)


๐ŸŽซ๐ŸŒƒ Your app is listening on port 3000

Webhook running with path /dblwebhook

Listening

events.js:183

      throw er; // Unhandled 'error' event

      ^


Error: listen EADDRINUSE :::3000

    at Server.setupListenHandle [as _listen2] (net.js:1360:14)

    at listenInCluster (net.js:1401:12)

    at Server.listen (net.js:1485:7)

    at DBLWebhook._startWebhook (/rbd/pnpm-volume/796e667b-22ab-4154-b10d-18c07f3647b5/node_modules/.registry.npmjs.org/dblapi.js/2.3.0/node_modules/dblapi.js/src/webhook.js:45:18)

    at new DBLWebhook (/rbd/pnpm-volume/796e667b-22ab-4154-b10d-18c07f3647b5/node_modules/.registry.npmjs.org/dblapi.js/2.3.0/node_modules/dblapi.js/src/webhook.js:27:12)

    at new DBLAPI (/rbd/pnpm-volume/796e667b-22ab-4154-b10d-18c07f3647b5/node_modules/.registry.npmjs.org/dblapi.js/2.3.0/node_modules/dblapi.js/src/index.js:69:22)

at Object.<anonymous> (/app/index.js:43:14)

    at Module._compile (module.js:653:30)

    at Object.Module._extensions..js (module.js:664:10)

    at Module.load (module.js:566:32)

#

now this

#

oops twice

honest root
#

I mean the api call

plain timber
#

@honest root i dont see it in the docs

digital linden
#

advaith

#

its the same error

#

with 3000

plain timber
#

@digital linden you are already running a webserver on port 3000

digital linden
#

prob

#

i have a listener on

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

plain timber
#

you will need to connect it to dblapi.js by setting the webhookServer

honest root
#

I see, I guess no one bothered to update it, including me

plain timber
#

k then just define a variable as that

#

like

digital linden
#

another one too

#

const listener = app.listen(process.env.PORT, function() {
console.log('Your app is listening on port ' + listener.address().port);
});

plain timber
#

well uh

#

the 5000 one won't work

digital linden
#

olk

plain timber
#

only the process.env.PORT one works already

#

so just use webhookServer: listener

digital linden
#

ok

#

wait

#

so listener is in server.js

#

and my dbl is in index.js

#

which should I move over

plain timber
#

you dont need to move anything, you can just export the listener in server and require it in index

digital linden
#

ok

honest root
digital linden
#

I forgot how to do that with module.exports

#

wait

#

yeah @plain timber module.export.listener = listener; doesnt work

#

I required ('./server.js') in index

wise agate
#

dont use glitch

#

itll force your ports

#

it doesnt like you getting to specify

digital linden
#

oof

digital linden
#

@plain timber

#

so

#

i got uptimerobot to redirect to oof

#

doesnt work lol

patent inlet
#

anyone else having issues setting up the webhook for votes with js?

plain timber
#

@patent inlet did you try making the post request with Postman yet?? That will help you figure out the issue

#

I sent the link here

patent inlet
#

I saw the link but didn't understand what to do. @plain timber

plain timber
patent inlet
#

Alright. I'll try to do that later today and see how it goes!

untold marten
#

hmm

hybrid scarab
#

Hey so i get this error whenever i refresh my bot project

#
(node:16804) UnhandledPromiseRejectionWarning: DiscordAPIError: 404: Not Found

    at item.request.gen.end (/rbd/pnpm-volume/ea312467-098c-43a9-991b-9978d5747180/node_modules/.registry.npmjs.org/discord.js/11.4.2/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:79:15)

    at then (/rbd/pnpm-volume/ea312467-098c-43a9-991b-9978d5747180/node_modules/.registry.npmjs.org/snekfetch/3.6.4/node_modules/snekfetch/src/index.js:215:21)

    at <anonymous>

    at process._tickCallback (internal/process/next_tick.js:189:7)

(node:16804) 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: 2)

(node:16804) [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.
#

anyone know how to fix?

spiral steeple
hybrid scarab
#

yea how do i fix that tho...

plain timber
#

Looks like a d.js issue

hybrid scarab
#

and...

#

more details please

#

I've no clue what console what this console error means

runic grove
#

and we have no clue why youre getting that error

#

if you only provide us the error message the best we can do is simplify the error message for you

restive otter
#

so this is my code

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)
    )
});
``` and when somoene who votes isnt in the main server i get an error saying cant properly read tag of undefined
spiral steeple
#

Well

#

Yeah makes sense

#

Wait

plain timber
#

Why tf are you doing `${blah}`

#

Just do blah

restive otter
#

so what am i doing wrong?

shadow magnet
#

xd

patent inlet
hard moat
#

!play tchau pra quem namora

#

!play tchau pra quem namora

patent inlet
plain timber
#

K so @patent inlet either the ip is wrong or the server isn't running

patent inlet
#

it is running and the ip is correct lol

hard moat
#

!play abandonei a gabriela

patent inlet
#

@plain timber ^

hard moat
#

!play bass bosted songs for car 2019

plain timber
#

@hard moat you can't use bots here

sterile sleet
#

and don't use common prefixes please

plain timber
#

@patent inlet well that says it isn't

patent inlet
#

@plain timber im using the server to run my bot rn lool

plain timber
#

Well the webhook webserver probably isn't running

patent inlet
#

wdym?

digital linden
#

ANYONE HERE

#

Iu

#

How do I get another port on glitch using uptimerobot

clever rock
#

Not sure, but you can just specify an endpoint for uptime robot to ping to

digital linden
#

ok

#

Quantum

#

how do i specify an endpoint

#

like adding a :5000 to my link doesnt work

#

this also doesnt work

#

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

@clever rock

#

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

const dbla = new DBL(process.env.DBLTOKEN, { webhookPort: 5000, webhookAuth: 'o', webhookServer: listener });
dbla.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbla.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});```
#

also doesnt work

clever rock
#

I dont use http

digital linden
#

oof

clever rock
#

so I cant tell how on http

digital linden
#

but how do u do a web hook

clever rock
#

perhaps read the docs

#

I use fastify

digital linden
#

ok

clever rock
digital linden
#

thx

spiral steeple
#

Do you even need to make a server tho Thonk

clever rock
#

for my use case I prefer a separate handler

#

so that on my bot I will just send a request to that server and return the cache to me

#

and even the bot is down, as long as that server isnt down votes will still register

spiral steeple
#

Just make the bot not do the down

#

Easy fix

clever rock
#

Im doing maintenance from time to time

#

so no

plain timber
#

@digital linden you can only use one port, 3000 (which is exposed as 443, the standard port)

spiral steeple
#

I do maintenance but I dont need to turn my bot off Thonk

plain timber
#

You can get the port by process.env.PORT

clever rock
#
  • I can loadbalance once I get bigger
#

and handle up to 70-100k reqs per second

spiral steeple
#

You plan on getting 70K votes a second?

clever rock
#

every .on message I send request on that server

spiral steeple
#

Oh

#

Well

#

have fun

bold edge
#

I'm sure he will, he's a certified developer so he knows his stuff.

spiral steeple
#

Being cert doesn't mean you know everything

#

it means you got 300 servers and 120+ votes in a month mmLol

bold edge
spiral steeple
#

Yes

#

I know I applied Thonk

#

I don't care for it, the badge would be nice tho

#

๐Ÿ‘Œ

bold edge
#

Your bot is in 300+

spiral steeple
#

Yes

#

It's not hard to do.

bold edge
#

What isn't hard to do?

spiral steeple
#

Get 300 guilds.

bold edge
#

Can be if people don't invite it.

spiral steeple
#

Then you don't have a big enough audience, or the bot isn't up to par.

bold edge
#

I see

spiral steeple
#

I know some bots that tailor toward a specific audience, which is fine.

bold edge
#

Yeah I get you

restive otter
clever rock
patent inlet
#

@clever rock can you help me out with the issue I'm having please?

#

I can't get a response from the webhook even though my server is up and running as it's hosting my bot

clever rock
#

check your ports properly

#

also google and some testing is your best friends

patent inlet
#

How can I even check my ports?

alpine jasper
#

.

clever rock
#

google how to check open ports

cyan ruin
trim venture
restive otter
#

is there a reason that when i request my upvotes with _votes = await self.dblpy.get_upvote_info(days=2) (d.py-rewrite) that it would return with a 404 error?

#

i upvoted technically yesterday so there should be at least one upvote for the bot to pull, right?

patent inlet
#

@plain timber @clever rock hey guys

#

so from asking around i've found out i have to make a http server...

clever rock
#

yes you need

#

but the pings arent needed

patent inlet
#

im sorry but i really dont know how to do this...

clever rock
#

you can either use dbl api official library OR you can backread and take a look at the github link I sent which is my own handler for the dbl api

#

which I run as a separate process

patent inlet
#

alright

#

where's the official lib anyways?

proud sphinx
#

In the DBL docs

patent inlet
#

i cant see how to setup the server tho BlobSweatAnimated

#

with a http port i mean

clever rock
#

dbl docs is as simple as requiring it on your bot

#

dbl official api I mean

#

give it the port to listen to tada its done

proud sphinx
#

@patent inlet it's never too late to learn

patent inlet
#

i think i found the part, 1 sec

#

it needs express right?

clever rock
#

no

#

dbl api handles everything for you

#

you dont need to require anything

patent inlet
#
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');
});
#

am i missing something here? lol

clever rock
#

2 serveers?

patent inlet
clever rock
#

you dont

#

do

#

express and http

#

if you use dbl api

#

or are you hosting in glitch?

patent inlet
#

no i have a server

clever rock
#

ok first of all

#

you dont need express and http

#

second of all you just need to require dblapi.js
then look on examples and base it there

patent inlet
#

but this code isnt working for me:

const dbl = new DBL(dbotsKey, { 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!`)
})
clever rock
#

but this code isnt working for me isnt a helpful question
provide:
error message if possible
steps what you did
steps you tried

patent inlet
#

no error message in the console

#

that's my servers IP address FeelsSadMusic

clever rock
#

what is the log when the bot booted

patent inlet
#

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

clever rock
#

ok 2nd, did you actually open port 5000?

patent inlet
#

its open as a TCP port tho

#

idk much about protocols

clever rock
#

ok how you did test it again?

proud sphinx
#

@patent inlet TCP is great

patent inlet
#
#

what response do u guys get from dbl website when u test the webhook in the edit page?

clever rock
#

https://apitester.com/ try doing this

patent inlet
#

mine says Webhook tested! This may take a few seconds

#

do i need to add header? or just URL?

#

or any post data?

clever rock
#

just use the same on what you used on your dbl

#

just test it

proud sphinx
#

@clever rock insomnia is also a great tester

patent inlet
proud sphinx
clever rock
#

oh yes my co dev uses that

#

if its open it should provide something like this but it woudnt be the same like in mine cause I dont use dblapi.js

patent inlet
clever rock
#

0.0.0.0?

#

did you actually use 0000?

patent inlet
#

no

#

if i did i wouldnt hide the ip address

clever rock
#

seems like it cannot comunicate with your server

patent inlet
#

should i make another bot on glitch instead to log the votes then?

clever rock
#

you dont need really a bot

patent inlet
#

a webhook

clever rock
#

you just need a server listening for it

patent inlet
#

ohh...

clever rock
#

which is what my api handler does

patent inlet
#

i mean, i want the bot to post the logs to a channel

clever rock
#

yeah you could do that but, lmao another bot application

patent inlet
#

i cant do it any other way?

clever rock
#

well my handler does not support that new vote posting on it but you could just make a webhook handler for discord

#

when someone votes, just hook it then send it to a channel via webhooks

patent inlet
#

i have no clue how to do that

#

lol

clever rock
#

your choice, although I dont really see the need to make it post to a channel if someone votes but thats entirely on what you want to do

patent inlet
#

its to offer rewards for the votes...

#

i dont know how to just hook it or send it to a channel via webhooks

clever rock
#

then you could just check if the user voted

#

if Im assuming right

#

you just want to check if the user voted right?

#

and if he/she voted you would give rewards right?

patent inlet
#

Yeah that can be done

#

But it would've been easier for the votes to be logged and then rewards handed out accordingly

clever rock
#

You could try using the handler I made since you cannot use dblapi.js on your server due to some reason. I also dont know why it times out and returns 0000 on the api tester just backread to find where is the link for it

patent inlet
#

I checked it out already lol

#

Just don't get a single part of it

#

๐Ÿ˜‚ ๐Ÿ˜‚

clever rock
#

clone the code, put it on glitch

  "scripts": {
    "start": "node  server.js"
  },

add this on your package.json below the "main"

#

make a file named sever.js alongside the index.js

const Haruna = require('./index.js')
const Client = new Haruna(1200, 'Your Password', 7000000)

paste this then done

#

change the 1200 to process.env.PORT if I remember correctly

#

thats the port to listen to

#

spoonfeeding to the max level spoonfeed

patent inlet
#

I only clone index.js right?

clever rock
#

no

#

you clone the whole github code

#

:V

patent inlet
#

Into glitch? Monka
I'll have to do it manually then right?

clever rock
proud sphinx
#

Glitch doesn't have git

patent inlet
#

Ah, my bad

proud sphinx
#

Oh

#

Really

#

But it can't copy to a current codebase you have to create a new project

patent inlet
#

What if the env file has no port?

#

Someone mentioned earlier that glitch uses 3000

clever rock
#

you dont need to specify anything that

patent inlet
#

Idk though

clever rock
#

just slam env.process.PORT

#

I tested this api on glitch

patent inlet
#

Alrighty

#

I'll be back on my pc in a couple of mins

#

I've just tried twice to clone it to glitch but my browser crashed... @clever rock

#

Do you have a glitch project I can remix instead?

clever rock
#

maybe but I think I havent updated that code to latest

patent inlet
#

Lemme try a different browser

#

Probably gonna be same issue tbh

#

Nope. It worked

clever rock
#

now backread on how I said to set it up

#

make sure you provide the right details

patent inlet
#

done

clever rock
#

when it starts it will say started up bla bla

patent inlet
#

{"statusCode":404,"error":"Not Found","message":"Not Found"}

clever rock
#

nah just go straight to dbl

#

put it on webhook link and provide the credentials you set in the webhook, then save then hit test

patent inlet
#

what would the webhook link be?

clever rock
#

you see the glitch show on top?

patent inlet
#

yes

#

just that link?

clever rock
#

click that and it will open a new tab, get that link then add /vote/

#

read the readme for api endpoints

patent inlet
#

https://project-name.glitch.me//vote/

#

or just https://project-name.glitch.me/vote/

clever rock
#

2nd one

patent inlet
#

it just says Webhook tested! This may take a few seconds

clever rock
#

look on logs

patent inlet
#

wow

#

it worked!

#

so how do i put that in my bot now SheepWew

clever rock
#

if you want to know how to check for votes, look on examples client.js

patent inlet
#

awesome!

clever rock
#

if you need more info just dm me

patent inlet
#

damn imma be late for college

#

lmaaoo

#

how can i make a webhook to post to a channel from that glitch project tho? thinkSpasm

clever rock
#

you could require the webhook part of discord.js

#

although if we are gonna talk about that #development is the place

patent inlet
#

hmm...

#

will i only need glitch to get that done?

#

if so, i might be able to do it in college

#

my teachers gonna be like 'what u doing' again lmao

clever rock
#

you can use it at your bot since that would work just fine although that would be for #development as I said now

#

since you said you just want to check if the user voted

#

that thing does that just fine

patent inlet
#

oh.... it doesnt actually hook every vote? blobfrowning

clever rock
#

sighs, it will record anyone who votes for your vote

#

its a handler

#

"handler" it does everything for keeping your dbl votes, removing them from database, and adding them on database

#

all you need to do is to put the right links, then request to it

#

thats it, it isnt hard to comprehend

#

I have put the examples on checking a user if the user voted for your bot as well, which is what you said you want

patent inlet
#

True true

#

I just thought it might hook each vote when voted. My bad

#

Sorry for all the trouble but thanks so much for your help! BlobHuggle @clever rock

plain timber
#

Wdym hook each vote

#

It will run the code for every vote

#

You write the code that it runs

arctic ridge
#

Hello, I've an error with the API, can u help me pls.

  async postStats(serverCount, shardId, shardCount) {
        ^^^^^^^^^

SyntaxError: Unexpected identifier
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/storage/614D-AD9E/Water/node_modules/dblapi.js/index.js:1 :80)```
clever rock
#

async postStats?

arctic ridge
#

Yes ๐Ÿคทโ€โ™‚๏ธ It's in the dblapi file

clever rock
#

u sure bro?

client.on('ready', () => {
    setInterval(() => {
        dbl.postStats(client.guilds.size, client.shards.Id, client.shards.total);
    }, 1800000);
});
#

also I suggest learning more about async await and functions as well. From your error and the way you asked I can say you arent used to them,

#

that isnt an error with api but an error due to your lack of knowledge in syntax I believe

runic grove
#

the error is coming from dblapi.js

clever rock
#

oh yeah didnt notice that

unreal swallow
#

With the webhook url, it it possible to use a standard home pc without having to do anything like portforwarding?

crimson geode
#

how to do @everyone not ping in discord.js?

sullen nymph
#

Wrong channel. Ask in #development.
Client has an option disableEveryone

gray copper
#

sometimes people come at me complaining that they voted but the vote wasn't recorded

#

what should i do?

spiral steeple
#

Fix your code?

#

Make sure it logs them

gray copper
#

no?

#

issue with the nodejs library or the dbl api directly

spiral steeple
#

console.log(vote.user)

#

when someone complains

#

check your console

#

if it logs, then it went through

#

If it doesnt, then well common sense

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

const whitelist = [
                  ]


exports.run = async (client, message, args) => {
  const dbl = new DBL(process.env.DBL_TOKEN, client)
  const voted = await dbl.hasVoted(message.author.id)
  console.log(voted)
  
  const whitelisted = whitelist.includes(message.author.id) || whitelist.includes(message.guild.id)
  
  if(!voted || !whitelisted)
    return message.channel.send(`you didn't vote
`)
//other code
}```
#

can someone at least tell me if there's anything wrong with my code?

spiral steeple
#

Why do you create a new DBL every time? I think you can define that above

#

I use a webhook for my votes so Idk about the rest

plain timber
#

@gray copper webhooks are more reliable

gray copper
#

what if i don't specify a client?

plain timber
#

Then it won't automatically post stats @gray copper

sudden rampart
#

the code you have will spam dbl

plain timber
#

@sudden rampart p sure it only runs when the command is used?

sudden rampart
#

and passing the client starts a loop of posting stats

plain timber
#

Ah

gray copper
#

fixed i guess

trim venture
plain timber
#

@trim venture can you send your code?

sullen nymph
#

That looks like dblpy issue Thonkang

trim venture
#

I used the example code.

plain timber
#

Try not using dblpy

#

Make the http request yourself

restive otter
clever rock
#

making a request to post the server count yourself is easy instead of relying on libs

sullen nymph
#

dblpy is outdated anyway

trim venture
#

Ok, I will give a try.

trim venture
#

I'm trying a lot of thing, but how can I do it??

#

I'm getting that error over and over again.

summer wolf
#

Can anyone explain me how dblpy works ?

#

and how to get who upvote

autumn glade
#

hmm

trim venture
#

I got some interesting error, while I'm tried to upgrade discord.py using pip. I can't upgrade aiohttp, because it says that it is already up to date. What can I do?

atomic stratus
#

how would i get a discord.js bot send a message to more than one server it is in, discord.js (any ideas)

rocky fossil
#

Pretty sure that's api abuse

#

If you want to just make an announcement do so in your bot support server or smth

#

Nice edit of your message.

atomic stratus
#

you know you can sent message to specific channels what about specific servers

rocky fossil
#

Well with your Client, it has a guilds property which is a collection of all the guilds your bot is in mapped by the guild id.

#

guilds have channels, and you would pick a channel to send a message in.

atomic stratus
#

when i use guild it says guild is not defined

rocky fossil
restive otter
#

A

trim venture
#

๐Ÿ˜ข ๐Ÿ˜ข ๐Ÿ˜ข Help me! Please! I don't have any idea. I didn't find any .license file ๐Ÿ˜ข

#

(macos)

restive otter
#

So check line 64

obtuse flicker
#

@trim venture check the last line in the error. It says it can connect to the website. Make sure you have a stable internet connection that can access the website

trim venture
#

I have a stable internet, I know it because my bot is running on my mac.

runic grove
#

cannot connect to [...] discordbots.org [...] ssl:None Thonk

obtuse flicker
#

Do you get the error constantly?

#

Try running it again

trim venture
#

I tried it a lot of times. And I added an ssl thing in the http.py but it didn't work.

loud gulch
#

aiohttp >>

shut ibex
#

Raw http request >>

bleak coyote
#

packet send >>

naive kestrel
#

how can i put servers counter on my bot's html page?

#

I've read the page relating to the API, but although I have entered the code in my program, I still don't see it

#

im using python 3

plain timber
#

Any errors?

naive kestrel
#

nope, program works fine

crisp veldt
#

how do I make it shows my sever count in the widget

plain timber
#

@crisp veldt do you post the server count to DBL?

crisp veldt
#

no i have no idea lol

#

i use discord js

plain timber
crisp veldt
#

I used this but it wont work XD

#

๐Ÿ˜ฆ

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

instead of playing roblox why dont you try to create the request yourself

crisp veldt
#

ok

regal warren
#

LMFAO

restive otter
#

XD

#

@crisp veldt you set the token?

restive otter
#
 dbl.postStats(bot.guilds.size, bot.shards.total);

                                           ^


TypeError: Cannot read property 'total' of undefined
runic grove
#

is your bot sharded?

restive otter
#

hmm?

#

and this too:

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

                                           ^


TypeError: Cannot read property 'Id' of undefined
runic grove
#

if your bot aint sharded it aint gonna have shards

restive otter
#

and how to shard it?

runic grove
#

you only need dbl.postStats(bot.guilds.size)

restive otter
#

okey

#

thanks

ripe linden
#

you put a capital

sullen nymph
#

Cannot read property 'Id' ***of undefined***

ripe linden
#

I know, I was just pointing that out for when he later shards

crisp veldt
#

epic

#

ok

shadow rose
#

How can I make a system when it's time to vote for the bot to notify me on PV?

tulip mesa
#

My bot is now sharding using 2 running processes, I was wondering if anyone could tell me how to post my combined server count since it is currently only posting the count from 1 shard?

spiral steeple
#

Broadcast eval, in d.js anyways

restive otter
#

hi

hexed glade
#

Is it possible to detect when someone vote for my bot but without having to check every player?

restive otter
#

Yes @hexed glade but I still dont know yet

#

Like EnderBot or Discord Miner they use that method

hexed glade
#

Yep

#

Koya too

restive otter
#

Yeah

hexed glade
#
  console.log(`User with ID ${vote.user} just voted!`);
});
#

@restive otter ๐Ÿ˜ƒ

clever rock
#

Just a bit of recommendation, is it possible for the webhook api to return the username as well? this would be useful for users that runs the webhook listener on a separate server so that at least we can know the user who voted without making our own request to get the data from d.api

restive otter
#

How can i get vote count

#

?

runic grove
#

read the api docs

restive otter
#

I dont find it. blobowo

spiral steeple
runic grove
#

it was linked 3 messages before but ok

restive otter
#

Not the docs

#

the vote counter

#

in the Javascript Library

#

Thats i dont found..

spiral steeple
#

Then you didnt read the bot reference

hexed glade
#

How to get webhook with java library?

plain timber
#

You need to receive the POST request DBL sends to you

mossy yacht
#

Sorry bit new to webhooks and such, I noticed it says I need the dbltoken for posting server count and get votes and such, which works and i can access dbl.getVotes() etc, but then I realised I need the webhook ones to be more efficient, aka dbl.webhook.on('vote', vote => {}) so Im going about setting up the webhook and such, but im wonder if I even need to? or does the dblapi.js handle all that? and I just need to do dbl.webhook.on('vote', vote => {})

plain timber
#

@mossy yacht you need to include the webhook settings when you are making the dbl client

mossy yacht
#

Ohhh ok, so if I supply that and give the necessary ports open on the server etc, DBL handles the actual webhook part for me?

plain timber
#

well you'll also need to set the URL and auth in the edit page

#

but yeah pretty much

mossy yacht
#

yeah done that, ok awesome thank you ๐Ÿ˜ƒ

plain timber
#

yw ๐Ÿ˜ƒ

mossy yacht
#

Halp Error: listen EACCES: permission denied 0.0.0.0:80

#

I tried adding webhookServer: server ip like i saw in another example

#

and got this Error: The server is not an instance of http.Server

#

@plain timber i need yo wisdom

#

Think I fixed it

#

Ok it stopped erroring but the ready event wont trigger

plain timber
#

@mossy yacht dont use webhookServer unless you want dblapi.js to run the webhook on an existing nodejs webserver

#

Don't put an IP in it

mossy yacht
#

Ok then what do I do about this error Error: listen EACCES: permission denied 0.0.0.0:80

clever rock
#

use other port

mossy yacht
#

huh, okie dokie will give it a try

digital linden
#

Hop hop hgop\

#

iwait

mossy yacht
#

also just fyi I added this from the example for the server bit of it

const app = express();
const http = require('http');
const server = http.createServer(app);```
digital linden
#

ADVAITH

#

THANKLS TU

mossy yacht
#

also do I add the port to the URL on DBL page serverip:5000/dblwebhook

digital linden
#

hey umj

spiral steeple
#

:5000 is the port part.

#

ip:port/path

digital linden
spiral steeple
#

0.0.0.0 is localhost

digital linden
#

ik

spiral steeple
#

so whatever the localhost ip is

digital linden
#

im using glitch to vps\

mossy yacht
#

ahh ok I see

digital linden
#

ยฏ_(ใƒ„)_/ยฏ

mossy yacht
#

im on google cloud console

#

but it worked Webhook running at http://0.0.0.0:5000/dblwebhook ๐Ÿ˜ƒ

digital linden
#

?

mossy yacht
#

Thanks guys

digital linden
#

i mean I guess it works

#

BUT THERE IS NOT A web i can redirect tio

#

GLITCH DOESNT HAVE AN IP

#

doesnt work

#

@plain timber

spiral steeple
#

I think glitch has predefined ports that you can you

#

process.env.PORT

#

I think

#

I dont think that they have all ports open tho

digital linden
#

ik

#

I am already using port 300

#

0

#

I need to be able to open a new one

#

Any idea how to use httpproxy

mossy yacht
#

What should I expect once I click this

#

nvm found out

#

hmm im testing the webhook but not getting any logs, yes im logging vote event

plain timber
#

@digital linden you need to set webhookServer to the express server listener, and remove webhookPort, also it's just project.glitch.me no :5000 or :3000

digital linden
#

ok

#

but

#

i needd to use 3000 for "hosting"

#

@plain timber will it interfer?

plain timber
#

What

digital linden
#

like

plain timber
#

If you set webhookServer to the express listener then they'll both run on the same server

digital linden
#

ah

#

that works?

plain timber
#

It shouldn't screw anything up

digital linden
#

ok

plain timber
#

Yeah

digital linden
mossy yacht
#

@plain timber im getting Webhook running at http://0.0.0.0:5000/dblwebhook on ready event but testing the webhook does nothing :/

plain timber
#

https://project.glitch.me/dblwebhook

digital linden
#

ok

plain timber
#

@mossy yacht did you set the URL (with the correct ip instead of 0.0.0.0) and auth in the bot edit page, and save?

digital linden
#

thanks it worked

#

โค

#

lol

#

advaith u helped me so many times xd

mossy yacht
#

yes on DBL page its serverip:5000/dblwebhook and auth is the same

plain timber
#

@mossy yacht what if you use https://getpostman.com and try sending a post request to the URL

#

That should give you details on what happens

mossy yacht
#

okie dokie

mossy yacht
#

How do I use this? im trying to send post request but its just sitting there saying its sending

#

@plain timber

plain timber
#

Maybe the server isn't responding?

mossy yacht
#

maybe its blocking it idk, im not amazing at google vm instances lol

clever rock
#

you can try to host your vote api on glitch although you need an handler for it

mossy yacht
#

yeah but my database is on google cloud and can only be access by VM's inside the project

clever rock
#

you can store the votes on something like an sqlite database

#

for ease of setup and access

mossy yacht
#

that still doesnt help me

#

then my bot is seperated and i then need a way to send all the info to google cloud still

clever rock
#

it would because you can just make it "api like"

#

and since its api like

#

it do support sharded bots

mossy yacht
#
  1. that links just an error
  2. this already sounds more complicated
  3. I fixed it, just had to open the port whoops
clever rock
#

ofc it would

#

its just an example

#

and it is not complicated if theres a ready made one already heheheh

mossy yacht
#

its complicated to me because i have no idea what your on about

clever rock
#

api

mossy yacht
#

I'd rather just open a port and then have it on the same server as the whole bot

clever rock
#

dont tell me you dont know an api?

mossy yacht
#

I know what an API is

clever rock
#

thats what Im talking about

mossy yacht
#

but my problem isnt apis

#

it was connecting to my server which ive now done

clever rock
#

you can host the api along side your bot as well l

#

eitherways

#

you would understand it if you get big enough to shard

mossy yacht
#

uh huh okie dokie

#

welp postman can now connect, and give 403 forbidden but still wont work with testing it

clever rock
#

just google 403

mossy yacht
#

I know what 403 is its literally in the title

#

forbidden

#

meaning authorization didnt work

clever rock
#

then just fix it if you know that ๐Ÿ‘€

mossy yacht
#

but idk how to add auth to postman

clever rock
#

just put it on headers?

#

or try the test on dbl

mossy yacht
#

Do you have to have such a dickish attitude?

clever rock
#

Im not trying to be dikish

mossy yacht
#

I have been, thats literally what ive said the past 2 times

clever rock
#

this is who I am

mossy yacht
#

i run the bot and ready event works, i test the vote thing with test button and get nothing\

clever rock
#

ok so you said it connects on postman

#

you already tried the test after you verified it conects with postman?

mossy yacht
#

yes

clever rock
#

they adding authorization in headers

mossy yacht
#

well connects, but still no auth

#

id assume so idk I dont control the dbl test button

clever rock
#

test button works

#

Ive used it several times

mossy yacht
#

ok then whyd you ask?

clever rock
#

because usually

#

I forget to save it

#

thats where it wont work

mossy yacht
#

ah fairo

#

how do I add the auth to headers

#

ive never touched any of this so thats meant nothing to me

#

except all I see is a place to put key value and drop down for authorizations

clever rock
#

I personally use node-fetch so about postman I cant tell but maybe on docs theres a way on adding headers to the req

mossy yacht
#

does that tell you whats going wrong etc?

clever rock
#

usually it should be

#

lemme grab an example code

spiral steeple
#

If you're using the dbl lib, it shouldnt be that hard.

clever rock
#

he is using postman

#
const fetch = require('node-fetch')
fetch('http://{hostname}:{port}/hasVoted/', {
    headers: { 'authorization': 'Your Password', 'user_id': '1234567890' }
}).then((response) => {
    if (response.ok) {
        response.json().then(console.log) // Logs False if user didn't vote, TRUE if user did vote.
    }
})

in nodefetch appending headers is like this

#

I hope that would help

mossy yacht
#

huh.. Idk what I changed but its working now .-.

#

managed to get a bad syntax error from postman since auth was correct now, and then yeah just restarted the bot and tried again lol

clever rock
#

good for ya

junior cloud
#
bot.on('message', message => {
let votechannel = message.guild.channels.find(`name`, "chaosbotvotes");
dbl.webhook.on('vote', vote => {
  votechannel.send(`User with ID ${vote.user} just voted!`);
});```

at Client.bot.on.message (/app/index.js:284:13)
#

wat

#

TypeError: Cannot read property 'on' of undefined

#

wat

plain timber
#

@junior cloud which line is line 284?

junior cloud
#

that

plain timber
#

Which

junior cloud
#

wait 1 sec ima look

#

xD

plain timber
#

You sent multiple lines

junior cloud
#

dbl.webhook.on

#

it's the on

plain timber
#

You didn't include the webhook settings in the new dbl

junior cloud
#

wai wai what

#

where is that?

#

can you give me the link?

plain timber
#

???

#

What link

#

Its in your code

#

You want the docs link?

junior cloud
#

yea

#

I am too dumb to find em myself

plain timber
junior cloud
#

i should get some sleep

plain timber
#

Same it's 2 am

clever rock
#

nested listeners

#

that would cause you a lot of issues

restive otter
restive otter
#

In DBL api, have a way to execute some code when some user votes? In the same moment

sudden rampart
#

webhooks

digital linden
#

dude

#

@restive otter thats THE POINT of webhooks

#

and most of the dblapi

royal fiber
#

Will it take some time when i upvote the bot and it will send a log to my channel?

#

And i thought of doing with the webhook, but how to define the webhook token?

restive otter
#

Okay so I put ```py
import dbl
import aiohttp
import logging

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

def __init__(self, bot):
    self.bot = bot
    self.token = 'I put my token here'  #  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)``` but it isn't sending the guild count to the site (yes I also have the thing in `def setup`)
#

@restive otter js?

#

python

#

Okey

sullen nymph
#

You should make a HTTP request yourself. Dblpy is outdated.

restive otter
#

...

trim venture
#

Is this an API abouse that my bot edits a message 5 times with 3 second delay per edit?

dawn fjord
#

No, this channel if for questions regarding the dbl api @trim venture

royal fiber
#
const DBL = require('dblapi.js');
const path = require('path')
const fs = require('fs')
const { Client } = require('discord.js')
const bot = new Client({ disableEveryone: true })
const Discord = require('discord.js')
const client = new Discord.Client();

const dbl = new DBL('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjQ3OTk4MzIwNjkzMDU3OTQ1NiIsImJvdCI6dHJ1ZSwiaWF0IjoxNTUxODg2OTIyfQ.uyA7r1DpyjD55mNXuNqaBbxRGsfG9xJ0Nsbiv-DMZJg', { webhookPort: 5000, webhookAuth: 'AppleIsTasty' });
dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at https://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});

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

dbl.on('error', e => {
 console.log(`Oops! ${e}`);
})```

My code!
#

Its not working

#

Ping me when you have a answer!

spiral steeple
#

Well thats one nice token

#

Token and auth

#

Damn I could send 1 billion servers mmLol but I wont thats mean

foggy harness
#

So... what exactly isn't working? How is it borked?

spiral steeple
#

@royal fiber one, regen your token

#

Two you need to provide a client to post stats with the lib

#

And three, dont copy paste examples

restive otter
#

Can't you abuse the servercount using the dbl api? Like posting an int instead of the number of servers

runic grove
#

i think you can, but if youre caught youre gone

foggy harness
#

@royal fiber

spiral steeple
#

You can, if they catch it they remove the bot

#

Which is why you need to regen your token

tidal burrow
#

legend says you'll be banned from dbl if you abuse server count

royal fiber
#

@foggy harness yea?

foggy harness
#

You said tag me when there's an answer. Tarpergon gave you 3, so I tagged you

cerulean token
#

so, with the JS dblAPI is there a upvote event?

#

nvm

#

whats a webhook Port

#

and Auth

#

I literally just want a Discord Webhook on my server to run when theres an upvote. I've never heard of webhookPort or auth

plain timber
#

@cerulean token DBL will send a post request to your server, you will have to send it to discord

cerulean token
#

I have no idea how

plain timber
#

The port is the port you want the webhook webserver to run on, 5000 should be fine

cerulean token
#

whats a port tho

plain timber
#

The auth can be any password you want, but it has to be the same in your code and your bot's edit page

cerulean token
plain timber
#

No

#

The edit page on DBL

cerulean token
#

oooh

plain timber
#

At the bottom you can set the webhook URL and auth

cerulean token
#

ok. How do I make it send it to a Discord webhook?

plain timber
#

You'll need to handle that in your code

cerulean token
#

Is it anything special, or just like a normal Discord webhook

plain timber
#

In the dbl.webhook.on('vote' , ...) function

cerulean token
#

aaah ok

#

Thank you

plain timber
#

Change the highlighted line to whatever you want to do

#

Yw

#

BTW the URL is http://IP:PORT/dblwebhook (change IP to your IP and PORT to the set port)

cerulean token
#

why does it need the IP

plain timber
#

It will probably log a URL with 0.0.0.0, change that to the servers ip

cerulean token
#

public IP, right?

plain timber
#

So it can send the request

#

Yes

#

Or a domain that goes to it if you want

cerulean token
#

aah

#

If it's a public IP doesn't that mean any IP could technically work? Or am I wrong lol

plain timber
#

?

#

Wdym

#

It has to be your server's public IP

cerulean token
#

can it be a VPN ip?

#

on the edit page, it says URL

#

what is this

#

The url to the Discord webhook?

royal fiber
#

please help me i can't set my vote logs in my discord server!

ocean shell
#

Any possibility for hmac payload in the future? Patreon's system is a good example of this.

royal fiber
ocean shell
#

Looks like there has been some discussion, but any actual plan Thonk

royal fiber
#

@ocean shell can you help me please?

ocean shell
#

No. 1) I don't use js 2) No idea what that is 3) Zero context

royal fiber
#
const dbl = new DBL(process.env.DBL_TOKEN, { webhookPort: 5000 webhookAuth: 'AppleIsTasty' });
dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at https://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});```
#

my code!

#

its not running

ocean shell
#

Don't know, ask one of the mod

royal fiber
#

they just don't reply!

clever rock
#

do you even know how to open port?

#

did you test if that port is open?

#

a lot of factors contribute on that

#

if you want to us to help you better a simple its not running or why my code dont work will not enable me to help you

royal fiber
#

how shall i know the port

#

i host my bot in glitch

clever rock
#

for glitch the port is set on process.env.PORT

royal fiber
#

ok

#

let me try

clever rock
#

then it means you cannot make your own webhook on that port because you already use it

#

so you may ask how then?

#

my answer is, simply you cant. You may need a new server, or remove the keep alive ping

royal fiber
#

if i remove the keep alive ping then how will my bot stay online?

clever rock
#

either hope someone votes for your bot once per 12 hours

royal fiber
#

ok i got it

#

instead of there id?

clever rock
#

grab the user via its id from client.users

royal fiber
polar mirage
#

Yes

#

Can't do web stuff without web dyno

royal fiber
#

i can't use?

polar mirage
#

You need to turn on

#

Web dyno

royal fiber
#

how to do it??

polar mirage
#

Uhh

#

On the dashboard

royal fiber
#

by paying with credit card?

polar mirage
#

Or with a procfile

#

Web dyno is free

#

For 450 hours

#

A month

royal fiber
polar mirage
#

Exactly

#

Worker

#

Not web

royal fiber
#

what to do??

#

can you explain me better?

polar mirage
#

Turn on web dyno

#

Instead of worker

royal fiber
#

can you tell me how its done step by step?

#

i am dming you!

polar mirage
#

Bruh

#

Worker isn't the default so you have a procfile right?

royal fiber
#

ya

polar mirage
#

Which probably looks like

#

Worker: node index.js

royal fiber
#

i am having this two

polar mirage
#

Then whats the problem bruh

#

Turn on the web one

royal fiber
#

ooo ok

#

what will be the port?

#

process.env.PORT?

polar mirage
#

Yes

royal fiber
#

in the config vers i need to add something??

polar mirage
#

Are you setting up webhooks

royal fiber
#

yaa

polar mirage
#

If so I guess the auth you will use

royal fiber
#

i am doing this!

polar mirage
#

Webhookauth

#

Is supposed to be asecret

#

So uhh

#

Change it

royal fiber
#

ok

polar mirage
#

And put it as an env var instead

royal fiber
#

the webhooks are working but with this error

polar mirage
#

It's not an error

#

It's just showing the request

#

It will always do that

royal fiber
#

why this eroor??

polar mirage
#

Don't know

#

Gonna eat lunch

#

Good luck

sand mason
ornate abyss
#

why you using heroku for js bot lol

#

use glitch

polar mirage
#

Comparing a pile of shit with another pile of shit

restive otter
#

how can i create a webhook and get her auth code and this things for the votes log

#

?

spiral steeple
#

Assuming your webhooks gender are we? mmLol you have the dblapi lib? Well js's lib actually works idk about the others

#

Also what lang

digital linden
#

thats what glitch is

spiral steeple
#

Offtopic but ok

digital linden
#

aye

leaden lagoon
royal fiber
#

I want to host my bot in glitch, so if i do that then to run the bot i need to use the process.env.PORT to the listener, but go run the vote logs with dbl api i also need to use process.env.PORT i tryed but glitch cannot use thir port for both the events.

Any Fix? Mention me when you have an answer!

ornate abyss
#

No u

vagrant patrol
#

How to get discord bot key

runic grove
#

Your dbl api key will be on the "Edit" page

plain timber
#

@royal fiber you already have a webserver running, you will need to tell dblapi.js to it it by removing webhookPort and setting webhookServer to the express listener

vagrant patrol
#

THANKS

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

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

This is my code, i host my bot in glitch, but my webhook never comes to ''ready''

Have i did any mistake?
cyan ruin
#

Don't use glitch

#

That's the problem

slate ether
#

xd

royal fiber
#

Thts not the solution..

slate ether
royal fiber
#

Jst tell me why its not working..

cyan ruin
#

Seems to be the solution to me

#

as the example code works fine

royal fiber
cyan ruin
#

then follow what he said

royal fiber
#

I did

#

But it donesn't work

cyan ruin
#

i said dont use glitch as it's full of problems but

#

can you give me an error if there is one?

royal fiber
#

No error

#

๐Ÿ˜ฐ

cyan ruin
#

Oof

#

reeks like glitch

royal fiber
#

Can i contact admins?

#

They can help me better i guess

cyan ruin
#

have you tried removing server?

royal fiber
#

Removeing server?

cyan ruin
#

const server bit and just having the webhook code

#

Oh wait no

#

I see

#

uhh

royal fiber
#

๐Ÿ‘€ ok

cyan ruin
#
const DBL = require('dblapi.js');
const dbl = new DBL(process.env.DBL_TOKEN, { webhookAuth: process.env.DBL_PASSWORD, webhookServer: 8080 });

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

try this?

royal fiber
#

Ok let me start my pc

#

Lol

cyan ruin
#

coding on mobile

royal fiber
#

Nope

#

I get an error

#

@cyan ruin

cyan ruin
#

error?

royal fiber
cyan ruin
#

@runic grove

royal fiber
#

This server is not an instance of http.Server

cyan ruin
#

i see

#

hmm

runic grove
#

link it urself

cyan ruin
#

cyber

#

what problems do you notice

runic grove
#

that the server is not an instance of http.Server

cyan ruin
#

smh

royal fiber
#

How to fix it?

#

๐Ÿ˜ž

#

Please?

clever rock
#

just make your own webhook handler

#

eziest fix

royal fiber
#

Any way to run that code?

#

Because i don't know how to make webhook handler

spiral steeple
#

Saya has one it's pretty nice ๐Ÿ‘Œ

royal fiber
#

@spiral steeple what you are talking about?

spiral steeple
#

@clever rock that is what your thing does right?

#

Ah that desc clarifies

clever rock
#

yes

royal fiber
#

That Is for your bot

#

I want to make for my bot