#topgg-api

1 messages · Page 100 of 1

sullen nymph
#

Make sure your port is open and forwarded properly

#

as well as firewall isn't blocking any requests

serene shuttle
#

uh Im an idiot lol I just realised the server Im specifying is for my actual bot, but the development bot Im testing it on is hosted locally facepalm

#

what url would I use for locally hosting?

sullen nymph
#

Your local machine's public IP :^)

rapid kettle
#

^ Make sure to port forward too

#

@serene shuttle

serene shuttle
#

port forward?

#

the port is open and listening, I'm not sure how to 'forward' a port though

rapid kettle
kindred walrus
#

just double checked token aswell

serene shuttle
#

is there a way to get when someone votes without using webhooks? cus I cannot figure out how to get this to work

kindred walrus
#

just to confirm there's definitely a response

spiral steeple
#

May want to check your firewall

#

it may be blocking requests before they even get to the server

kindred walrus
#

there IS a response

#

its not being blocked

#

both on my console AND on the website

#

@spiral steeple

oblique crane
#

-api

kindred walrus
#

Fixed: Problem was => im stupid

jaunty plank
#

oo

#

please explain @kindred walrus

#

did you not add http

#

please tell me it was that

kindred walrus
#

so, i didnt put http, that was number one. Then to check if it was running, i purposed port 3001 for the test server and pushed the dbl to 3002. Then i fixed http, but forgot to open 3002 port

jaunty plank
#

f

kindred walrus
#

its hard to be this intelligent, it creates gravity

restive otter
lean lava
#

its hard to be this intelligent, it creates gravity
@kindred walrus although it's a couple thousand of us but ite

spiral dawn
#
const discord = require("discord.js");
const client = new discord.Client();
    const DBL = require('dblapi.js');
    const dbl = new DBL(process.env.DBLTOKEN, {
        webhookPort: 5000,
        webhookAuth: process.env.WEBHOOKAUTH,
    });
client.on("ready", () => {
    console.log("Ready!");



    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!`);
        vote.user.addRole('644095266651111434');
        const exampleEmbed = new discord.RichEmbed()

            .setColor('#de1fff')

            .setTitle("" + vote.user + "just upvoted Ellie.")
        let myGuild = client.guilds.get('618759363263201280');
        let joinchannel = myGuild.channels.get('640602559425413130');
        joinchannel.send(exampleEmbed);
    });```
#

it's not sending the test
and it isnt saying the webhook is running

#

(i havent touched anything but the token and authorisation)

jaunty plank
#

your webhook events dont need to be in the client ready events

spiral dawn
#
const discord = require("discord.js");
const client = new discord.Client();
  
    const DBL = require('top.gg');
    const dbl = new DBL(process.env.DBLTOKEN, { webhookPort: 5000, webhookAuth: process.env.WEBHOOKAUTH });

    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!`);
          vote.user.addRole('644095266651111434');
          const exampleEmbed = new discord.RichEmbed()
      
              .setColor('#de1fff')
      
              .setTitle("" + vote.user + "just upvoted Ellie.")
          let myGuild = client.guilds.get('618759363263201280');
          let joinchannel = myGuild.channels.get('640602559425413130');
          joinchannel.send(exampleEmbed);
      });```
#

fixed

#

still not sending the message when testing webhook

jaunty plank
#

is the ready event going off tho?

spiral dawn
#

ye

#

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

jaunty plank
#

did you put your webhook url on the website?

spiral dawn
#

ye

jaunty plank
#

did you use your actual ip, not 0.0.0.0

spiral dawn
#

no

#

that's the ip it's decided to say

#

i had no involvement with http://0.0.0.0:5000/dblwebhook

jaunty plank
#

0.0.0.0 is just a placeholder

spiral dawn
#

how would i set the ip

jaunty plank
#

for the lib you dont need to, its just a placeholder.

#

for the website you just need to put
http://botsserverpubip:5000/dblwebhook

spiral dawn
jaunty plank
#

if your hosting this on a home network youll need to portforward.
you also need to let port 5000 past any firewalls

spiral dawn
#

hosting on glitch

jaunty plank
#

discordapp webhooks dont work with dbl

spiral dawn
#

what

jaunty plank
#

your making a webhook server

spiral dawn
#

so how do i send the messages saying that there was an upvote

#

on my bot

jaunty plank
#

your bot does that

spiral dawn
#

will it when i test it?

jaunty plank
#

if you put the proper url in, not a discord one

spiral dawn
#

what's the proper url?

jaunty plank
#

with the proper path /dblwebhook

#

with glitch, theres a few hoops you end up having to jump through due to the major restrictions of the platform

spiral dawn
#

?

jaunty plank
#

belive so.

spiral dawn
#

it's 404ing

#

when i attempt to visit

jaunty plank
#

the webhook server 404's any get requests(if you put it in your browser)

spiral dawn
#

i didnt actually make a directory called dbl webhook tho

jaunty plank
#

the lib does

#

also http

#

i think*

spiral dawn
#

so if i run a test it will work?

jaunty plank
spiral dawn
#

what port

median badger
#

Ports dont work

#

Don't try

#

It won't let you connect

jaunty plank
#

process.env.PORT or something?

spiral dawn
#

wdym

jaunty plank
median badger
#

@jaunty plank just use 3000

#

But you won't be able to connect using the port

jaunty plank
#

the correct way is process.env.PORT

median badger
#

So you cant do url:port

spiral dawn
#

it's logging a vote, not sending the message

jaunty plank
#

ay

spiral dawn
#

oh wait

#

i had add role before the message so it errored

jaunty plank
#

ah

#

but yeah, there ya go

#

just so your glitch url isnt public

#

and the one up above a bit

spiral dawn
#
vote.user.addRole('644095266651111434');
                  ^
TypeError: vote.user.addRole is not a function```
jaunty plank
#

you cant access a user like that

spiral dawn
#

o?

jaunty plank
#

the vote.user is just the user id

#

you have to fetch or get the user

#

before editing the user.

#

you also actually will need to get a guildMember to give a role

spiral dawn
#

how can i achieve this

spiral dawn
#

guild.members.fetch(vote.user).addRole('644095266651111434');

#

correct?

jaunty plank
#

dont think you can directly do .addRole to the fetch since its a promise

#

guild will also have to be gotten.

hybrid marsh
#

how do I get the id of someone who voted and the time?

willow solar
#

Hey

#

Hello, every time i use the bot status API from discord bot list, it doesn't updates

#

First one is from the bot

#

second is from google

#

at the same time

#

Can someone help me?

fiery shadow
#

What lang do you use?

willow solar
#

Language?

fiery shadow
#

For your bot

willow solar
#

Programming language?

#

DBScript

#

idk if this can be considered as a language

#

but yeah

#

i use BDScript

calm briar
#

what even is that

fiery shadow
#

unfortunate, i cannot help you then.

willow solar
#

It's from a app Called Bot Designer For Discord

#

DBD

#

or BDFD

#

I make my bots in mobile

fiery shadow
#

So it is JavaScript basically

jaunty plank
#

i think your image is just cached

fiery shadow
#

maybe show us your code

jaunty plank
#

the images shown are just images generated by top.gg

fiery shadow
jaunty plank
#

🤔

#

which is generated by the api iirc

fiery shadow
jaunty plank
fiery shadow
#

we will see

willow solar
#

Wait

#

The command is in portuguese ;-;

#

I'm brazilian

#

i don't think you guys are gonna understand

fiery shadow
#

google translate might help out LULW

willow solar
#

ok

#

$title[Ajuda!] $color[fffa00] $description[🙋**|** Olá! Você precisa de ajuda? Entre no meu site na seção de comandos agora! 🖇**|** Link: https://allukabot94.webnode.com/comandos/ Espero que aproveite o tempo que passar comigo! Ah, para visualizar o site inteiro entre em: https://allukabot94.webnode.com/ **Vote em Mim!** https://top.gg/bot/728368312874172466/vote **Meu status do Discord Bot List:**] $image[https://top.gg/api/widget/728368312874172466.png] $footer[Me adicione e entre no meu servidor de suporte! Agradeço!]

#

Still not updated

fiery shadow
#

links went sadboihours

willow solar
#

?

#

i just need help

#

it shows my bot is offline

#

and doesn't update the upvotes

fiery shadow
#

Wait, ill look over it.

#

Your Bot is on 5 Guilds right?

willow solar
#

No

#

27

#

@fiery shadow

fiery shadow
#

Can you show me a ss of your Guild Post code?

willow solar
#

?

#

Idk what is that

#

@fiery shadow

#

Wym

fiery shadow
#

dbl.on('posted', () => {
console.log('Server count posted!');
})
Do you have this in your Bots code? (I assume you use JavaScript)

#

@restive otter can you please go to #memes-and-media, this isnt the right place to chat.

willow solar
#

dbl.on('posted', () => {
console.log('Server count posted!');
})
Do you have this in your Bots code? (I assume you use JavaScript)
@fiery shadow No

#

DBScript

#

Ok

#

bye

#

I just wanted help

fiery shadow
#

well, bye i guess.

willow solar
#

cuz the image

#

was not updating

fiery shadow
jaunty plank
#

its cached

#

every new(new device, or clear cache) time you open it, it will update

fiery shadow
#

^

#

i still wanted to see the code behind it

jaunty plank
#

behind a widget?

spiral steeple
#

You can add a ?v=xxx to force update it if you want

#

I mean technically it can be anything, but ?v= is just kinda universal

jaunty plank
#

for some reason, i was thinking redirect to get around the caching

spiral steeple
#

lol

jaunty plank
#

but that makes a lot more sense

echo verge
#
    let vote = false
    dbl.hasVoted(message.author.id).then(async voted => {
      await vote == true
    });
    return console.log(vote)```
always returns false
pale summit
#

Preciso de um sistema de anunciar tipo #anunciar para anunciar para todos os membros do ds como faço, eu faço pelo dbd discord bot designer

Version Inglish

I need an #announce advertising system to advertise to all ds members as I do, I do it for the dbd discord bot designer

#

Ds > Discord

#

way of speaking

echo verge
#

hey?

#

can you tell what's wrong

#

above

pale summit
#

;-;

#

Tradutor -:

echo verge
#
    let vote = false;
    if(dbl.hasVoted(message.author.id)) {
      vote = true;
    }
    if(!dbl.hasVoted(message.author.id)) {
      vote = false;
    }
    console.log(vote)```

always returning true
#

:/

restive otter
#

forgot ""

#

IDK

echo verge
#

uh

restive otter
#

Yandere dev 2.0

restive otter
#

Lol

viral valley
#

Hey

#

i need help on how do i generate the DBL_API_KEY

#

bc the website is kind of mest up

hardy acorn
viral valley
#

alright

hardy acorn
#

Is it possible to check if a bot is online using the API?

#

Because on bot's profile you can see his status, so I thought maybe you can use the API.

olive arrow
#

You can just use discord's API lol

hardy acorn
#

Can you check if the bot is online?

#

Because I can't find it in their docs ;)

small zephyr
#

Can you chech if the bot is online

true talon
#

no

spiral steeple
#

That data isnt in a database, it's fetched from luca and cached most likely, so they dont have any way to serve it over the api

north tree
#

hello can i ask anything?

#

i need help for api modules. top.gg and dblapi.js . what does top.gg?

#

thanks, I thought a module

median badger
#

dblapi is

restive otter
#

dblapi.js is the official @north tree

north tree
#

ty

willow spindle
#

@restive otter it is unofficial wrapper

north tree
#
dbl.on('posted', () => {
  console.log('Sunucu sayısı başarıyla DBL gönderildi!');
})

dbl.on('error', e => {
 console.log(`oha! ${e}`);
})
////POST STATS

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

i use this, but my bot restart every 30 minute. how can i fix this

true talon
#

why does it restart

north tree
#

IDK too

restive otter
#

do you have any error in your console?@north tree

restive otter
#

Can someone explain how shards work?

#

since i don't know

rapid kettle
restive otter
#

oh ye

rapid kettle
#

This is for top.gg api only, as stated in the topic

restive otter
#

phone sucks

#

Sorry

willow solar
#

When i try to use the API image that shows the servers that the bot is in, it shows: "undefined"

#

why?

#

it's like:
[servers| undefined]

median badger
#

Are you posting stats

#

To tbe api

sullen nymph
#

Widget shows undefined because you never posted server count

royal veldt
#

how do i set the status of my bot to say how many servers its in?
i tried searching that up but it didn't come up

willow solar
#

how can i do this

sullen nymph
#

-servercount

abstract mothBOT
#

To have your bot's server count displayed on DBL, please read the documentation on server/shard posting. Click here to see the docs.. You may also find #312614469819826177 useful; however it is strongly discouraged as most of the examples are extremely outdated.

royal veldt
#

is that in python?

sullen nymph
#

any language that supports HTTP requests

royal veldt
#

ok

#

another question

#

so in my code what should i put

willow solar
#

what am i suposed to do with this?
/bots/{bot.id?}/stats

royal veldt
#

it says field - server_count?

#

@sullen nymph

#

it says field - server_count?

#

what should i do with that

sullen nymph
#

You don't have an approved bot to get an API token yet

royal veldt
#

oh ok

#

so i need my bot to be approved first

#

and then i can do that right?

sullen nymph
#

bot.id is the part thag you replace with your bot's ID

#

Yeah

royal veldt
#

ok thank you!

willow solar
#

how can i do thid

#

this

royal veldt
#

👍

sullen nymph
#

what it means by "field" is a JSON key

willow solar
#

i don't understand anything

#

i'm trying only to get the image for my bot's website

sullen nymph
#

Are you using an official top.gg library by any chance?

#

Do you need help with the widget or server count

willow solar
#

Do you need help with the widget or server count
@sullen nymph i want the widget to show how many servers my bot is in

sullen nymph
#

What's your bot written in?

willow solar
#

what language?

#

DBScript

#

@sullen nymph

sullen nymph
#

No idea what that is

willow solar
#

og

#

oh*

#

Bot Designer For Discord

#

it's the only way to make bots on mobile

sullen nymph
#

In any case, you'll have to send a POST request to https://top.gg/api/bots/YOUR_BOTS_ID/stats

royal veldt
#

Where do u find ur Bot Id

#

is that the token?

willow solar
#

@fringe dust

royal veldt
#

Where do u find ur Bot Id

sullen nymph
#

-id

abstract mothBOT
#

An ID is a unique number which is used to identify a user, bot, channel, or message. To obtain an ID, right click on it and click "Copy ID"; this can be done from mobile by holding down.

Should you not see the option to acquire an ID, you need to enable "Developer Mode" which can be done from your user settings, under "appearance".

royal veldt
#

-id

willow solar
sullen nymph
#

Yes, that link

royal veldt
#

@sullen nymph can i send u a link to my server, and u can join it and DM me my bot's id?

willow solar
sullen nymph
#

And please refer to the docs as to what to send in the request body as I'm on phone

#

Do you not see the message Luca sent?

willow solar
#

Wait

sullen nymph
#

@willow solar A browser sends GET by default

#

You'll need to make your program send a POST request

willow solar
#

You'll need to make your program send a POST request
@sullen nymph IDK HOW

#

to

#

do

#

it

royal veldt
#

-id

sullen nymph
#

Unfortunately, me neither KEKW

willow solar
#

;-;

sullen nymph
#

Probably the program you are using has a way to send POST request or has top.gg support

royal veldt
#

i have no clue what Luca sent

sullen nymph
#

but I don't think you'll be able to do it with it

royal veldt
#

i don't know how to find that

#

can u help?

sullen nymph
royal veldt
#

i do

#

i read it over and over agin

#

but i don't understand

#

what do i right click on?

sullen nymph
#

Did you turn Developer Mode on?

royal veldt
#

where do i do that?

sullen nymph
#

(Also, let's move this to #of)

#

For a living fuck's name

echo verge
#
    const dbl = new DBL(dbltoken, client);
    let hasVoted = false;
    try {
      hasVoted = await dbl.hasVoted(message.author.id);
    } catch (err) {
      hasVoted = false;
    }
    console.log(hasVoted)```
#

always returns false

#

when user votes recently and uses the command

#

this returns a false, even for users that have voted... then, after 5-10 minutes/sometimes a bot restart, it returns true. Is there a time that it takes to process the vote?

echo verge
#
const options = {
      url: `https://top.gg/api/bots/552367827370377218/check?userId=${message.author.id}`,
      json: true,
      headers: {
        'Authorization': 'api token'
      }
    };
    get(options).then(async body => { 
      if(body.voted == 1){
        console.log("true")
      }
      else{
        console.log("false")
      }
#

this also returns false

#

is the api delay?

worn vault
#

how can i get the number of votes my bot has?

#

in discord.js

restive otter
#

idk

worn vault
#

y ya answering then

onyx badge
#

Supongo que puedes hacer webscrapping, pero creo que hay una API de top.gg, no lo intente aun pero parece algo facil de hacer @worn vault

worn vault
#

no te entendi una verga 👍

onyx badge
#

Entiendo...

worn vault
#

como hago eso de webscrapping

sullen nymph
#

English-only in this channel

onyx badge
#

sry shiv

#

@worn vault, well.. are you using djs/py ?

sullen nymph
#

This channel is for top.gg API, it's ok

onyx badge
#

@sullen nymph now that you are here, the top.gg API gives the bots votes right?

worn vault
#

djs

#

and srry @sullen nymph

sullen nymph
#

You can send a GET request to https://top.gg/api/bots/YOUR_BOTS_ID, parse the response as JSON, and get the points or monthlyPoints keys

onyx badge
#

@worn vault ^

sullen nymph
#

Or use dblapi.js which might simplify life

worn vault
#

with what package can i send a get request¿

onyx badge
sullen nymph
#

Anything that sends HTTP requests

onyx badge
#

fs

#

request

sullen nymph
#

Something thai isn't deprecated tbh

onyx badge
#

Can't spoonfeed so eyeshake

worn vault
#

alright

#

imma use request then

#

ty

sullen nymph
#

Could use built-in fetch but sure

onyx badge
#

yeah, actually imma use top.gg api aswell to track votes Thonk

sullen nymph
#

request is deprecated iirc

onyx badge
#

it is?

#

it works fine

worn vault
#

f

#

and superagent¿

sullen nymph
#

Log in on the website

onyx badge
worn vault
#

alright

#

imma login

sullen nymph
onyx badge
sullen nymph
#

catshrug not a js dev myself

onyx badge
#

Dnt know why I said request

#

anyhow

worn vault
#

done

#

i can see it now

worn vault
#

i tried to use superagent and it says Error: Unauthorized

#

@sullen nymph

#

what do i do

fierce owl
#

How to get server count for my bot ?

sullen nymph
#

@worn vault See the authorization part in the docs

worn vault
#

and how do i use my authorization token with superagent

sullen nymph
#

Send it in request headers

worn vault
#

?

#

@sullen nymph u there¿

sullen nymph
#

No idea, not a js dev

worn vault
#

cuz i go to the superagent docs and it says that

#

to set headers

#

imma try it

#

it worked

#

nice

plush pier
#

api of server voting???

onyx badge
plush pier
#

what's this?

#

Is there an api for Server votting and people will get rewards in the server?

onyx badge
plush pier
#

😭

sullen nymph
#

Is there an api for Server votting and people will get rewards in the server?
@plush pier not as of yet

#

It may be planned though

frosty basin
#

is there an api for some good jokes

#

i have one but its jokes lame af

median badger
dusky ravine
#

join all

restive otter
#

Hey when i start my bot i get this error:
Code:

const server_count = client.guilds.cache.size;```
```js
 client.on("ready", async () => {
    console.log("ready");
    
    setInterval(() => {
        dbl.postStats(server_count);
    }, 1800000);
 
  
}); ``` Error: 
`[dblapi.js autopost] Failed to post stats: {"error":"Required parameter server_count or shards missing"}`
#

Help?

#

try server_count,1,1

#

okay

#

Its undefined

#

Bruh

#

oh

#

it worked when i did frist

#

first added it to my bot**

#

Please ping if you can help

vapid cape
#

did you define server_count?

#

also, if you use the autoposter you dont need to use postStats

restive otter
#

did you define server_count?
@vapid cape Yest

#

that is what it said to do

#

as the error

#

server_count

#

also, if you use the autoposter you dont need to use postStats
@vapid cape how to do the auto poster?

#

Please ping me

vapid cape
#

when you create the dbl instance

#

you add your client as the last parameter

#

for example

#

new DBL("your topgg token here", client)

restive otter
#

okay

#

then it will auto? @vapid cape

vapid cape
#

yes

restive otter
#

okay

vapid cape
#

you dont need the setInterval nor the postStats anymore

restive otter
#

ah

#

testing it

#

@vapid cape dblapi.js autopost] Failed to post stats: {"error":"Required parameter server_count or shards missing"}

vapid cape
#

show full code

restive otter
#

okay

#
const Statcord = require("statcord.js");
const Discord = require("discord.js");
const path = require('path');
const glob = require('glob');
const fs = require('fs');
const DBL = require("dblapi.js");


// Require the config.json file, and define our Client.
const config = require('./config.json');
const client = new Discord.Client();
const statcord = new Statcord.Client("statcord.com", client);
client.config = config;
const dbl = new DBL('my token', client);

// Create two Collections where we can store our commands and aliases in.
// Store these collections on the client object so we can access them inside commands etc.
client.commands = new Discord.Collection();
client.aliases = new Discord.Collection();


client.on("ready", async () => {
    console.log("ready");
    
    // Start auto posting
    let initalPost = await statcord.autopost();
 
    // If there is an error, console.error and exit
    if (initalPost) {
        console.error(initalPost);
        process.exit();
    }
}); 
    ```
#

its the top part

#

its 100 lines so

#

and that isnt important at bottom

thorny swift
#

Hi

restive otter
#

@vapid cape

vapid cape
#

whats your dblapi.js version?

restive otter
#

ill get it

#

@vapid cape "dblapi.js": "1.2.1"

vapid cape
#

current version is 2.4.0

restive otter
#

oh

#

changed

#

restarting

sweet idol
#
    at IncomingMessage.<anonymous> (C:\Discordb0ts\FalkenB0t\node_modules\dblapi.js\src\index.js:118:25)
    at IncomingMessage.emit (events.js:333:22)
    at endReadableNT (_stream_readable.js:1201:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)```
restive otter
#

@vapid cape

sweet idol
#

what do I need to do to disable the dbl code?

#

I've been trying to locate the code for that, but not finding it very weel

vapid cape
#

you want to disable dblapi.js?

rapid kettle
#

it’s just new DBL()

restive otter
#

@vapid cape fixed now Thanks for the help!

rapid kettle
#

and all the webhook stuff (dbl.webhook)

sweet idol
#

@vapid cape yes, this bot was written by someone else, but they stopped working on it and let me have the code. So the DBL stuff is their entry on the site, not mine.

rapid kettle
#

it’s just new DBL() and all the webhook stuff (dbl.webhook)

#

if you’re using dblapi.js

vapid cape
#

look into your bot's files and remove all calls to dblapi, including ^

sweet idol
#

what .js would have that code?

vapid cape
#

most likely index

sweet idol
#

I don't see it in index.js or functions.js (which is the biggest file)

vapid cape
#

what other files are there?

sweet idol
#

ahhh

#

there's dbl code in ready.js

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

module.exports = async (client) => {
    const dbl = new DBL(client.config.topgg, client)
    dbl.postStats(client.guilds.size)

    console.log("Bot Online - Server Indexing Starting...");
  console.log(`Logged in as ${client.user.tag}!`);
  client.user.setActivity(`Connecting ${client.guilds.cache.size} Servers`);
//indexes all servers
client.getNetwork()
//updates every 30 mins
setInterval(() => {
    dbl.postStats(client.guilds.size)
  client.user.setActivity(`Connecting ${client.guilds.cache.size} Servers`);

}, 1800000)

}
#

is this entire module exclusively for dblapi / the site?

vapid cape
#

yes

sweet idol
#

this is a networking bot with a small sql db.

bold raptor
#

How would I setup the webhook for my bot?

jaunty plank
#

depends on the language

bold raptor
#

My discord bot is in NodeJS

#

@jaunty plank

jaunty plank
brazen burrow
#

@restive otter Why r u everywhere i go

restive otter
#

@restive otter Why r u everywhere i go
@brazen burrow umm cuz im a bot developer and i join important server

sullen nymph
#

-api

abstract mothBOT
#

TOP.GG API ONLY!!!
ANY OFF-TOPIC CONVERSATION WILL BE DELETED AND MUTED
This channel is only for SUGGESTIONS/HELP/BUGS to do with OFFICIAL API LIBRARIES and API DOCS found at: https://top.gg/api/docs

brazen burrow
#

You mean nfsw servers also?

sullen nymph
#

Keep this channel on topic

brazen burrow
#

-api

#

ok

bold raptor
#

So I'm trying to do that vote thingy with the webhook but it doesn't seem to work 🤔 . Is there anything wrong with my code? https://srcb.in/4f5d68bb1c

rapid kettle
#

you can autopost and have webhook with one line

#
const flat = new DBL(
    'token',
    { webhookPort: 5000, webhookAuth: 'password' },
    <client>
);```
#

also, are you sure the ports are forwarded?

bold raptor
#

@rapid kettle wdym?

rapid kettle
#

where are you hosting?

bold raptor
#

a payed hosting service

#

@rapid kettle

rapid kettle
#

VPS?

bold raptor
#

No

#

@rapid kettle

inland crag
#
const DBL = require("dblapi.js");
const dbl = new DBL('Your top.gg token', client);
 
// Optional events
dbl.on('posted', () => {
  console.log('Server count posted!');
})```
Does this post the Guilds en client users
rapid kettle
#

guild only

#

it doesnt post client users

restive otter
#

Nani!?

inland crag
#

alright ty

#

and shards?

#

how does that work

restive otter
#

Is this the thing that auto updates the server counter?

        dbl.postStats(client.guilds.size, client.shards.Id, client.shards.total);
    }, 1800000);
});
rapid kettle
#

yes.

restive otter
#

ok thanks

bold raptor
#

So I want to send a message to a specific channel when someone votes for my bot. I know that I would need to use a webhook but the problem is I don't know how to use it. Could someone maybe help me?

vapid cape
#

which language?

bold raptor
#

NodeJS @vapid cape

vapid cape
#

you need a webserver

#

you can use something like express.js and manually set the routes, or you can use dblapi.js which does it for you

bold raptor
#

@vapid cape I installed the dblapi.js package and I figured out how to do the server posting but the webhook documentation didn't make sense to me.

vapid cape
#

where is your bot hosted?

bold raptor
#

It's called FatCat hosting. It's a payed hosting service.

vapid cape
#

do they give you an ip address?

bold raptor
#

Yes @vapid cape

fluid onyx
#

for the webhook what does the hook.path need to be?

bold raptor
#

@vapid cape How do I change the IP address for the webhook?

vapid cape
#

you need to go to your bot's edit page in top.gg

#

and configure the webhook there

#

the URL field should be your bot's ip address and port

#

like this http://xxx.xxx.xxx.xxx:yyyy/dblwebhook

#

where x is the ip address and y is the port number

restive otter
#

i want api

vapid cape
#

you need to check with your host what is your bot's ip address and port

bold raptor
#

k @vapid cape Thanks!

lusty topaz
#

can ya'll her me

fluid onyx
#

ah okay

lusty topaz
#

what

#

so can yall her me

signal hawk
lusty topaz
#

she do a owo can you her me

#

she do a owo can you her me

untold vortex
#

does my bot need to be verified on top.gg to get a token?

signal hawk
#

Yes

young haven
#
C:\bot\events\ready.js:19
                        dbl.postStats(client.guilds.size, client.shards.Id, client.shards.total);
                                                                        ^

TypeError: Cannot read property 'Id' of undefined
    at Timeout._onTimeout (C:\bot\events\ready.js:19:52)
    at listOnTimeout (internal/timers.js:549:17)
    at processTimers (internal/timers.js:492:7)```
median badger
#

client.shards isnt defined

young haven
#

client.shards isnt defined
@median badger how do you define it?

median badger
#

are you sharding?

young haven
#

are you sharding?
@median badger yes

median badger
hollow talon
#

how to do send a request to check if a user voted on js

bold raptor
#

so I'm trying set up the webhook and for example if my server ip was 111.111.111.11 and the port was 4284 how would I state that in the web hooks option?

sullen nymph
#

http://111.111.111.111:4284/

median badger
#

how to do send a request to check if a user voted on js
@hollow talon with node fetch

bold raptor
#

Oh, thanks! People tell me to put a /dblapi or smth at the end

sullen nymph
#

if your webhookPath is not /, then you'll have to

#

(if you use dblapi.js, that is)

bold raptor
#

I'm using the dblapi.js

#

package

#

so http://111.111.111.11:4284/dblwehook 🤔

sullen nymph
#

wehook = webhook
but by default, yeah

bold raptor
#

Ok

sullen nymph
#

I assume you are not editing the webhookPath option

bold raptor
#
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});``` so in this if the port was `4284` I would change the Port to `4284` and the Auth to the Auth I changed on the bot's page right?
#

So confusing or I'm just stupid 🤔

sullen nymph
#

Both guesses are correct, if you mean the "Authorization" field with "Auth"

bold raptor
#

Yes

sullen nymph
#

mhm, then you got it right

bold raptor
#

Oh, thx!

#

Wait, why does my server say Webhook running at http://000.000.000.00:4284/dblwebhook 🤔

sullen nymph
#

the 0.0.0.0 just means "running on all IPs" aka you can access it globally and locally

bold raptor
#

Oh

#

kk thx!

#

So with this piece of code if I'm correct, it should console.log the users id and send a mention to them in a channel.

    console.log(`User with ID ${vote.user} just voted!`);
    const channel = client.channels.cache.get('744930900441038999');
    channel.send(`<@${vote.user}> just voted for flat!`);
});```
sullen nymph
#

Make sure the port 4284 is open and forwarded to the correct machine

#

and that firewall isn't blocking any requests

bold raptor
#

wdym Open?

sullen nymph
#

Open to incoming traffic

bold raptor
#

Oh

#

Oh yay! It works! Thanks!

astral plaza
#

Do you need your DBL token to be able to let your bot see the votes?

#

And announce that user ahas voted

sullen nymph
#

for webhooks or using the API?

#

Webhook doesn't require a token

astral plaza
#

Webhooks

#

But

#

How can I make a vote command?

#

I'm using JS

#

Or

#

Can I put the user in a db (user who voted) then check if he voted then delete the db and give him (items)

sullen nymph
#

Sure, you can

astral plaza
#

But where do I put to add the DB?

#

Can it be put in the webhooks?

sullen nymph
#

a webhook is just a listener for HTTP requests

#

a function will be executed where you can use your database and store the user's ID

astral plaza
#

Yes where do I put that

sullen nymph
#

With dblapi.js, you can use dbl.webhook.on('vote', data => stuff here)

astral plaza
#

Oh but that's in the webhooks but thanks a lot

sullen nymph
#

Oh, you wanted to use the API?

astral plaza
#

I just wanna make a vote command

sullen nymph
#

What is it supposed to do?

astral plaza
#

Give you an item if you voted

sullen nymph
#

Eh, I'd suggest using the API but you could be ratelimited pretty quickly if your bot is big

astral plaza
#

Hmm any alternative ways then?

#

It's in 17 servers now

sullen nymph
#

Well, webhooks KEKW

astral plaza
#

With dblapi.js, you can use dbl.webhook.on('vote', data => stuff here)
@sullen nymph I'll follow that

#

Or can I get ratelimited

sullen nymph
#

webhooks don't have ratelimits as it's you listening to requests instead

#

so unless you implement ratelimits into your webhook, it's okay

astral plaza
#

Btw what would the user be called

sullen nymph
#

"the user"?

astral plaza
#

Or can I put message

#

Like

#

Uh

#

dbl.webhook.on('vote', message => stuff here)

#

Can I do this?

sullen nymph
#

nah, there's a JSON returned where user key is an ID of the user who voted

astral plaza
#

Mhm how can I get the user I'd

#

ID from the JSOn

sullen nymph
#
dbl.webhook.on('vote', data => data.user)```
#

or ["user"]

astral plaza
#

And user is an id

#

To make sure

sullen nymph
#

mhm

astral plaza
#

So for the db imma use quick.db because not something big

db.add(vote_${data.user}, 1)

#

Would it be like that

#

I just don't wanna make mistakes

#

Sorry if I'm annoying

#

const dbl = new DBL(yourDBLTokenHere, { webhookAuth: 'password', webhookServer: server });

How to get the DBL token?

sullen nymph
#

or on your bot's Edit page near the very bottom of the page

astral plaza
#

Alright

#

Thank you

sullen nymph
astral plaza
#

@sullen nymph sorry to ping, how do I get the webhookAuth and webhookServer

sullen nymph
#

webhookAuth is the Authorization field's value you set

astral plaza
#

It says password where do I get this password

#

And server

sullen nymph
#

It's a "password" in quotes, since you create it yourself

astral plaza
#

Ah so I type the password

sullen nymph
#

like a password you would enter when creating a new account on social media platforms

astral plaza
#

Should it be private? (I guess so)

sullen nymph
#

Preferably

astral plaza
#

And for the server?

sullen nymph
#

since it will be used to verify requests from top.gg

restive otter
#

xd

sullen nymph
#

It's an optional express server (or something else, I'm not a JS dev)

astral plaza
#

So I don't need t

#

It*

sullen nymph
#

Yeah, it's optional

#

aka not a must

astral plaza
#

Mhm

#

Thank you

sullen nymph
#

aye no problem

zealous steeple
#

I already put the code (https://top.gg/api/docs#jslib) but it still does not show the number of servers, what can I do? Any other code to put or how

And also install the api

astral plaza
sullen nymph
#

What does your code look like?

astral plaza
#

Give me a sec

#

@sullen nymph

#

Ping me if you'll answer

austere swallow
#

you need a port or a server option

#

check the official example on the github/npm listing @astral plaza

astral plaza
#

okay

#

What is the github @austere swallow

austere swallow
astral plaza
#

Thanks

sullen nymph
#

A question for discord.py users who are using dblpy.

Do you consider replacing instances similar to "Client/Bot" in the dblpy documentation with simply "Client object" an unnecessary/confusing change?

#

For example,

        An instance of a discord.py Bot or Client object.``` being replaced with 
```    bot:
        An instance of a discord.py Client object.```
restive otter
#

how do i get a webhook?

rapid kettle
#

@restive otter what language

restive otter
#

I come from Indonesia, I am not fluent in English. sorry
I use google translate to ask questions on this server

rapid kettle
#

I mean programming Lang

restive otter
#

I use eris

zealous steeple
#

I already put the code (https://top.gg/api/docs#jslib) but it still does not show the number of servers, what can I do? Any other code to put or how

And also install the api

rapid kettle
#

Any errors?

#

and what’s ur code

bold raptor
#

^^^ I can only help you when you give us the code

zealous steeple
#

Any errors?
@rapid kettle nop

rapid kettle
#

code?

zealous steeple
#

const Discord = require("discord.js");
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL('Your top.gg token', client);

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

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

rapid kettle
zealous steeple
#

yes

bold raptor
#

Then it should work

zealous steeple
#

ehhhmm dont work

bold raptor
#

Does it console.log Server count posted ?

#

cause it should

zealous steeple
#

I host my bot in heroku, and it does not give the "console log" when it gives the ping and neither when it receives the files (the bot works perfectly)

bold raptor
#

Did you deploy the newest code?

zealous steeple
#

yes

white forge
#

!help

trail sigil
#

-botcommands @white forge

abstract mothBOT
#

@white forge

Hey! Bots aren't given permissions to send responses in this channel. Please use #commands or #265156322012561408 to run commands. In addition, bots with commonly used prefixes cannot read or send messages in any channel. This is done to prevent spam and bot abuse.

crisp portal
#

Do I need to set up a web server to use webhooks, or can I just open the specified port, and point my webhook URL to the external API of my server?

restive otter
#

You don't need a web servwr

#

Probably

#

I never fiddled with API

harsh drum
#

It doesn't have a class DBLClient - this is copied and pasted directly from the examples with no modification at all

median badger
#

@sullen nymph

sullen nymph
#

Do you have any folders or files named dbl

harsh drum
#

Nope

#

I just pip installed dblpy

#

No issues importing it

#

But apparently it doesn't work

sullen nymph
#

pip show dblpy

harsh drum
#

Also your docs are incorrect, you have to put self as an argument to async def on_guild_post (docs didn't have that)

#

Ok will do

sullen nymph
#

that's...

#

🤔

harsh drum
#

Because we're in a cog (a class)

#

Yeah that's where I'm getting it from

sullen nymph
#

aye those need to be updated

harsh drum
sullen nymph
#

I suggest referring to the GitHub repo for now KEKW

dawn topaz
#

Using the javascript library I assume that setting the client parameter will post automatically on process startup?

sullen nymph
#

You'd also need fhe listener decorator

harsh drum
#

pip show ^

sullen nymph
#

Weird

harsh drum
#

Ok I'll look at the github

sullen nymph
#

Are you sure you aren't confusing your Python versions?

#

Using the javascript library I assume that setting the client parameter will post automatically on process startup?
@dawn topaz I don't exactly remember, but it will start posting server count automatically every 30 minutes

dawn topaz
#

Then I'm going to make a safe bet and say it probably does do a post on startup 👀

#

Seems like something it would do

sullen nymph
#

catshrug haven't worked with dblapi.js

dawn topaz
#

because earlier my dev version posted its 1 server 1 shard stats to the site and I was freaking out :L

median badger
#

I've went through dblapi, it posts on bot ready and then per 30 min @dawn topaz

dawn topaz
#

hm thanks for the info👌

#

that parameter was giving me a headache by having the dev version post its stats :/

harsh drum
#

Ok turns out that it was only my linter not finding things

#

The code runs fine

sullen nymph
#

That's...

#

Your linter is drunk

sullen nymph
#

-api @restive otter

abstract mothBOT
#

@restive otter

TOP.GG API ONLY!!!
ANY OFF-TOPIC CONVERSATION WILL BE DELETED AND MUTED
This channel is only for SUGGESTIONS/HELP/BUGS to do with OFFICIAL API LIBRARIES and API DOCS found at: https://top.gg/api/docs

sullen nymph
#

And please refrain from posting slurs.

lament cedar
#

does someone know how to create a server invite with a discord.js bot?

unborn canyon
restive otter
abstract mothBOT
#

tickNo This user has no bots

sullen nymph
#

-api

abstract mothBOT
#

TOP.GG API ONLY!!!
ANY OFF-TOPIC CONVERSATION WILL BE DELETED AND MUTED
This channel is only for SUGGESTIONS/HELP/BUGS to do with OFFICIAL API LIBRARIES and API DOCS found at: https://top.gg/api/docs

lament cedar
restive otter
#

Hello,
I want to make if user vote my bot then he will get coins. how can i make this?

median badger
#

@restive otter are your ports open

#

And did you provide the ip in top.gg

restive otter
#

Means?

#

where?

median badger
#

Edit

#

Webhook

#

You need to provide the ip/port and path

restive otter
#

oh

#

kk

#

wait

median badger
#

And if you are hosting locally you would need to have port forwarding on your router

#

because it requires a web server

restive otter
#

@median badger

#

Not working

#

.....

median badger
#

And if you are hosting locally you would need to have port forwarding on your router

restive otter
#

how

median badger
#

I suggest getting a vps if you dont know what you're doing

restive otter
#

what is DBL Api Key ?

verbal basin
#

how do i know if someone votes on my server

#

like the user

#

who votes on my server

#

so for example someone votes on my server, i want it so it would notify me and tell me who voted.

restive otter
#

what is DBL Api Key ?
@restive otter discord bot list, idk

#

tf

#

why quote with ping if you can't help

#

so for example someone votes on my server, i want it so it would notify me and tell me who voted.
@verbal basin dbl.on smth

restive otter
#

Also @verbal basin you can't vote servers

#

The api only works for bots rn

vapid sapphire
#

Also @verbal basin you can't vote servers
@restive otter you now can vote for servers I don’t know if there is an API for it yet tho

sullen nymph
#

There isn't

somber wadi
sullen nymph
#

Correct

restive otter
#

Hi

zealous steeple
knotty garnet
#

you shouldn't have ur token in first place

#

in this case, it's the top.gg token

zealous steeple
#

xd I know but when I put that code plus the token of my bot does not work

sullen nymph
lusty nacelle
#

how do i make my bot can be seen by other people on discord bot web site ?

split plinth
lusty nacelle
#

you submit it to top.gg
it's what i am asking '_'

tawny elbow
lusty nacelle
vapid sapphire
#

It explains it’s self, you need to add a description of your bot

lusty nacelle
#

the problem is idk what to put anymore

hot sundial
#

ye

vapid sapphire
#

Please move to #general this is got the api only

lusty nacelle
#

OK

heady musk
#

hi

#

i need help in setting up my bot's vote webhook

vapid sapphire
#

Your bot needs to be approved on top.gg before you can do that @heady musk

heady musk
#

iam

#

but on the other acc

#

can you help me with that ?

maiden sail
#

Y don't u use the other acc '

#

._.

signal hawk
#

@heady musk login to the website on your account that the bot is on and click the "edit" button on the bot page

heady musk
#

then ...

signal hawk
#

I cant help you with more than that as I dont know the api very well

#

you can ask for more help here and wait for someone to answer

heady musk
#

ok thx

#

i need help in setting up my bot's vote webhook

sullen nymph
#

What library do you use for your bot?

heady musk
#

discord.js

sullen nymph
heady musk
#

ok

vapid sapphire
#

https://SERVER-IP:SERVER-PORT/path

heady musk
#

from where i can get it ?

vapid sapphire
#

From your bot host

heady musk
#

in the code

#

i can change the port

#

webhookPort

#

that one

#

@vapid sapphire

vapid sapphire
#

You can put whatever port you want as long as it’s open on your server

heady musk
#
const DBL = require('dblapi.js');
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});
#

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

#

this link when it is sent in the console

#

I should put this link in the " edit bot "

#

correct?

rapid kettle
#

0.0.0.0 is just a thing for all accessible IPs to that server

heady musk
#

so what shall i do ?

rapid kettle
#

so you need to get the server’s public IP

vapid sapphire
#

Yes as long as all the numbers in the ip are mot 0

heady musk
#

http://0.0.0.0:5000/dblwebhook

#

it's link this

rapid kettle
#

0.0.0.0 is just all available IP addresses

heady musk
#

how do i get the " server.public.ip.here "

rapid kettle
#

is it a VPS?

heady musk
#

no

#

you know GLITCH ?

rapid kettle
#

you can’t setup webhooks on glitch

heady musk
#

why :(

#

so when i get a vps

rapid kettle
#

because you don’t get a static / dedicated IP

heady musk
#

how can i get the ip

rapid kettle
#

it should be on the server panel

heady musk
#

ok thanks very match

nova stratus
#

!botlar

#

!yardım

#

/yardım

#

--yardım

#

Oeo

#

Owo h

#

--yardım genel

signal hawk
#

-botcommands @nova stratus

abstract mothBOT
#

@nova stratus

Hey! Bots aren't given permissions to send responses in this channel. Please use #commands or #265156322012561408 to run commands. In addition, bots with commonly used prefixes cannot read or send messages in any channel. This is done to prevent spam and bot abuse.

sullen nymph
#

So, a little bit of a "survey" for dblpy users here.

I'm considering switching from webhook_x arguments to a simple webhook keyword-only argument and adding a Webhook class that will accept path, port, and auth properties.

Do you consider this a valid breaking change, or do you want to be able to use either?

restive otter
#

Brehhh

opaque jetty
#

Sounds really good shiv @sullen nymph

true talon
#

even if I don't use dbl.py I'll answer: make both usable so users don't have to switch from one system to another and new users can more easily setup it with the new one, if that makes sense

sullen nymph
#

Backward compatibility gang :^)

fading inlet
#
const client = new Discord.Client({
    disableEveryone: true,
    disabledEvents: ["TYPING_START"]
});

//Botlist API Code
const DBL = require("dblapi.js");
const dbl = new DBL('token', { webhookPort: 5000, webhookAuth: 'password' }, client);

This gives me that error:
[dblapi.js autopost] The provided client is not supported. Please add an issue or pull request to the github repo https://github.com/top-gg/dblapi.js
But I dont know whats wrong?

true talon
#

make sure the client is ready

#

that could be the error

fading inlet
#

prob. ready event

true talon
#

ready event yeah

fading inlet
#

Thanks, the error message is gone. Will test it now on my vps 👍

#

Sorry, I was wrong, the error message is still there @true talon. I just overread it.

#

Its now in my ready event. I am sharding my bot. Is this relevant?

#

I know that this worked before:

const dbl = new DBL('token', client);
#

But then I would not have a webhook. Still it says the client is not supported. Even tho it is the same client as in the previous working code.

fading inlet
#
const client = new Discord.Client({
    disableEveryone: true,
    disabledEvents: ["TYPING_START"]
});

//Botlist API Code
const DBL = require("dblapi.js");
const dbl = new DBL('token', { webhookPort: 5000, webhookAuth: 'password' }, client);

This gives me that error:
[dblapi.js autopost] The provided client is not supported. Please add an issue or pull request to the github repo https://github.com/top-gg/dblapi.js
But I dont know whats wrong?
Maybe someone else has an idea?

dapper lodge
#

how do i get a bot???

#

plss help

sullen nymph
#

-api

abstract mothBOT
#

TOP.GG API ONLY!!!
ANY OFF-TOPIC CONVERSATION WILL BE DELETED AND MUTED
This channel is only for SUGGESTIONS/HELP/BUGS to do with OFFICIAL API LIBRARIES and API DOCS found at: https://top.gg/api/docs

sullen nymph
#

wrong server to ask

lavish compass
#

true

icy hazel
#

-botcommands @icy hazel

#

-api

median badger
#

mod only

icy hazel
#

ok

median badger
#

for obvious reasons

cerulean heath
#

how do I set bot status with the api

icy hazel
#

```console.log(somthing);

client.user.setActivity(`Serving ${client.guilds.cache.size} servers`);

});```

cerulean heath
#

```console.log(somthing);

client.user.setActivity(`Serving ${client.guilds.cache.size} servers`);

});```
@icy hazel ik that but how do I set this

icy hazel
#

that cant happen

cerulean heath
#

wdym

icy hazel
#

until your bot gets verified

cerulean heath
#

well ppl can vote for it

#

and I can set the servers and use api

#

and I can find it when I am not logged in

icy hazel
#

i

#

got a ping

cerulean heath
#

Sooo I think it is verifed

icy hazel
#

no ppl cant vote

#

if you give the bot top.gg link it will say

cerulean heath
icy hazel
#

404 error

#

ok

#

idk

cerulean heath
#

so there is no way for the bot owner to set it

icy hazel
#

idk i didnt even get my bot verified ahhh so slow

#

ask some mods

#

abot it

#

*about

cerulean heath
#

how do u have no roles

icy hazel
#

i didnt get my bot verified

#

it still

#

stuck at waiting 4 verification lol

#

For 2 WEEKS actually i have to wait 4

cerulean heath
#

I waited for a few months

icy hazel
#

.

cerulean heath
#

how do I set bot status with the api
@cerulean heath ?

wanton marten
#

i can see it

#

lets take this to #support @cerulean heath

cerulean heath
#

i can see it
@wanton marten I need to set the status not see my bot dont u set the status on the website with the api

wanton marten
#

no it pulls the status of your bot from discord is your bot showing online or is it even up

cerulean heath
#

it shows as online

frozen jewel
#

Hello!

#

When someone votes for my bot, it works, but how can I get the username and tag?

#

For example, I am: losh531#0001

#

Anyone?

willow spindle
#

Fetch it from your client's users

restive otter
#

@Losh531™#0001

#

@frozen jewel

frozen jewel
#

Yes

#

@restive otter

#

How

sullen nymph
hearty lintel
#

so with tonkku gone who's going to be taking care of dblapi.js? i've had a pr which he was reviewing but now its obv gone blank

willow sphinx
#

I'll take a look at it on Monday but I'm not familiar with that codebase

#

I'm sure we'll figure something out for that soon

hearty lintel
#

sweet, thanks Xetera!

restive otter
#

Somebody help me!

#

What is this?

#

@restive otter whats that program

#

Also dbl key in the api section

#

this?

#

Yeah

#

@restive otter

#

[object Promise] ?

#

Thats code

crimson gazelle
#

but that’s DBLAPI

restive otter
#

No one helping me

restive otter
#

Await

restive otter
#

Hey,
I want to make if someone vote my bot on Top.gg Then he will get reward!
How can i do this?

river bone
#
const app = express();
const bodyParser = require('body-parser');
const { topgg_tok, web_auth } = require('../config');
const DBL = require('dblapi.js');

app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
const port = 3333;
const server = require('http').createServer(app);

module.exports = {
    exe: async (kay) => {

        const dbl = new DBL(topgg_tok, { webhookPort: port, webhookAuth: web_auth, webhookPath: '/topgg/webhook', webhookServer: server }, kay);
        dbl.on('posted', () => {
            console.log('Top.gg recieved guild count');
        });

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

        dbl.webhook.on('ready', hook => {
            console.log(`Webhook running with ${hook.path}`);
        });

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


        app.post('/topgg/webhook', (req, res) => {
            const body = req.body;
            const headers = req.headers;

            if (headers && headers.authorization === web_auth) {
                res.status(200).send();
                console.log('##########recieved webhook');
                // work //
                });
            }
            else {
                res.status(403).send();
            }
        });


        server.listen(port, () => {
            console.log('Listening to webhooks on server');
        });

    },
};``` can someone help me with this its not recieving webhooks when i press test
hearty lintel
#

@river bone dblapi.js automatically adds the route, don't do the app.post its probably stopping at tht before it can get to dbl or something?

river bone
#

ok let me try

#
const app = express();
const { topgg_tok, web_auth } = require('../config');
const DBL = require('dblapi.js');
const port = 3333;
const server = require('http').createServer(app);

module.exports = {
    exe: async (client) => {
        const dbl = new DBL(topgg_tok, { webhookPort: port, webhookAuth: web_auth, webhookPath: '/topgg/webhook', webhookServer: server }, client);
        dbl.on('posted', () => {
            console.log('Top.gg recieved guild count');
        });
        dbl.on('error', e => {
            console.log(`Top.gg Oopsie! ${e}`);
        });
        dbl.webhook.on('ready', hook => {
            console.log(`Webhook running with ${hook.path}`);
        });
        dbl.webhook.on('vote', vote => {
            console.log(`User with ID ${vote.user} just voted!`);
        });
        

      server.listen(port, () => {
         console.log('Listening to webhook on server');
      });

    },
};```
#

still got nothing

hearty lintel
#

well now you've removed the entire server.listen @river bone ?

river bone
#

uh

hearty lintel
#

i suggest adding a like

app.get('/', (req, res) => {
  res.json({ hello: 'world' })
})```
for the time being to make sure your http can actually be reached
river bone
#

its just inside the module

#

oh ok

hearty lintel
#

oh nvrm sorry i didnt see it

#

just looked like another event lol

river bone
#

aight 😂

hearty lintel
#

after you add the .get try to just go to in your browser and make sure you get a response

#

if you don't then it's a web server issue

river bone
#

kay

#

http://<ip>:3333/topgg/webhook

#

this should be the url right?

hearty lintel
#

right so try and go to http://<ip>:333/ and make sure u get the hello world

river bone
#

kay

#

ok so how to resolve web server issue 😕

hearty lintel
#

well is the server exposed?

crude wharf
#

New bot inside me

#

-bots

#

boi show dere name u dumb luca

#

-bots

#

shit

#

-bots 129908908096487424

#

screw u luca

#

ima take botinfo insted

#

-botinfo 744467455866437743

restive otter