#topgg-api

1 messages Β· Page 121 of 1

next flame
#

Yes

restive otter
next flame
#

What do you mean, it won't work anymore?

restive otter
#

It's not maintained anymore

next flame
#

But will "dblapi.js" return?

restive otter
#

Nope, it's @top-gg/sdk now

next flame
#

okok

next flame
#

How do I find out when someone voted for my bot?

restive otter
next flame
#

I mean, when someone voted for my bot, I want to know if there's a way to let me know!

jaunty plank
#

using webhooks

next flame
#

What use?

jaunty plank
next flame
#

I didn't understand, because it's not working!

wheat copper
#

Why am i seeing nothing in my console after voting?? i am basically using the code of the docs to test before i add more stuff...I am expecting the user who voted to be logged or am i misunderstanding?

gaunt quail
#
 fetch('https://top.gg/api', {
            method: 'POST',
            headers: {
                'Content-Type': 'application/json',
                'Authorization': "xxxxxx"
            },
        }).then(response => response.json())
            .then(data => console.log(data));
    }

there is any error here?

rapid kettle
#

the api url

#

lack of a body

jaunty plank
#

port forward if your hosting on a home network, allow through any firewalls you may have, use the correct url and auth header on the website, if using a weird hoster like heroku, glitch or repl youll need to use their methods for the url/port @wheat copper

wheat copper
#

im using something.host and i am using their subdomain ip service thing... my service is running on the 2000 port on the subdomain, i am using the correct url and auth password @jaunty plank

gaunt quail
rapid kettle
#

you'd need a body with the details

gaunt quail
#

wut is the details

kindred iron
#

sorry - this is a simple question, i know ..
how do i check if a user has voted for the bot or not?

jaunty plank
next flame
willow spindle
#

show code

next flame
#

@willow spindle

willow spindle
#

is this eris

next flame
#

no, discord.js

willow spindle
#

400: Bad Request means you're sending some values wrong

next flame
#

??

willow spindle
#

can you eval Client.shard.count

next flame
#

okok

willow spindle
#

πŸ€”

#

what about getAllSizeObjects("guilds")

next flame
#

Wait, I have an idea, I changed Client.shardManager .... for Client.guilds.cache.size, because it must be counting by shard

willow spindle
next flame
#

hm

#

The logs are in the wrong form, because I am Brazilian

willow spindle
#

πŸ‘

next flame
willow spindle
#

nice

next flame
#

Thank you @willow spindle

#

Is that wrong?

#

or is it so?

#

If my webhook site is not online, will it crash, or will it just ignore it?

regal harbor
#

you mean if you stop the bot and someone vote?

next flame
#

Yes

regal harbor
#

nothing is going to happen

next flame
#

@regal harbor Very thanks

#

As I see my ip, why am I hosting there!?

cloud void
#

Hi

fading knoll
#

well if you want to see the votes

#

const express = require('express')
const Topgg = require('@top-gg/sdk')

const app = express() // Your express app

const webhook = new Topgg.Webhook('topggauth123') // add your top.gg webhook authorization (not bot token)

app.post('/dblwebhook', webhook.middleware(), (req, res) => {
// req.vote is your vote object e.g
console.log(req.vote.user) // 221221226561929217
}) // attach the middleware

app.listen(2000) // your port

#

here

pale cradle
#

I need help with server count in python

#
class TopGG(commands.Cog):

    def __init__(self, bot):
        self.bot = bot
        self.token = 'XYZ'
        self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True)

    async def on_guild_post():
        print("Server count posted successfully")

def setup(bot):
    bot.add_cog(TopGG(bot))
vocal robin
#

Can I use https://discord.com/api/webhooks/---------- this as vote webhook?

restive otter
#

No

sleek pilot
#

404 error getting too

stone escarp
sleek pilot
#

me too owo ++

stone escarp
#

Oh you as well?

#

403 Forbidden

sleek pilot
#

thats working was and its not working now

#

yeah

stone escarp
#

I see maybe they having some issues

sleek pilot
#

maybe owo

#

aah the only solve way seems wait

next flame
#

How do I get the address of localhost?

#

To put on the webhook?

restive otter
#

no idea

next flame
#

?

forest harbor
#

No clue

cursive steppe
#

Do i replace client with "discord.js" after dbl token?

sullen nymph
#

why

#

it needs to be a client object

cursive steppe
#

Oh ok

#

What if i post fast like every 5 mins?

#

Is that not allowed?

sullen nymph
#

It is

#

60/60s is the global ratelimit for requests

cursive steppe
#

Oh alright

#

If I don't have shards etc, just doing
db.postStats(client.guilds.cache.size)
Will work?

#

Nvm i got it

#

Another Question:
I see db.webhook.on("vote")
Can i just do db.on("vote")?

sullen nymph
#

No

cursive steppe
#

Then how do i trigger an event when someone votes?

#

I didn't want webhook to send message but bot

sullen nymph
#

You use a vote event listener?

next flame
#

How do I vote with my own ip?

cursive steppe
sullen nymph
#

webhook.on("vote")

next flame
#

But "dblapi.js" is not working!?

sullen nymph
#

It works for now

#

But future changes to the API won't be supported in dblapi.js

next flame
#

Hm..

cursive steppe
#

Do i still have to use webhook.on even when i want to send messages through bot?

next flame
#

Okay, how do I now put it on the website's webhook @sullen nymph ?

sullen nymph
cursive steppe
#

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

#

What to put in password?

#

Where do i get the pass?

wintry oracle
#

i thought we can do other apis

random thunder
#

How to get api?

next flame
random thunder
#

How to get api key pls teach me

#

Because I'm making ranking sticks

#

@sullen nymph Pls

sullen nymph
#

Ranking what?

random thunder
#

Ranking sticks

#

Can you help me to get a api key?

#

@sullen nymph pls

sullen nymph
#

API key for what

#

Which API key and what do you mean by ranking sticks?

cursive steppe
#
const DBL = require("dblapi.js")
const dbl = new DBL(config.dbltoken, { webhookPort: 5000 }, client)

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

dbl.webhook.on("vote", async vote => {
let voter = await client.users.fetch(vote.user.id)
let voteem = new Discord.MessageEmbed()
.setTitle("Vote Recieved")
.setColor("RANDOM")
.setDescription(`${voter.tag} has just Voted for the Bot!\nThank You! :heart:\nPlease [Click Here](https://top.gg/bot/781506063882387506/vote) to Vote for the Bot.`)
client.channels.cache.get("787659734941040660").send(voteem)
})```
It doesn't works for some reason.
sleek pilot
sullen nymph
#

Yes

sleek pilot
#

wheres new docs?

#

i cant find

#

the API Docs link is forward old dblapi

sullen nymph
#

see @top-gg/sdk on npm

#

And pins here

sleek pilot
#

i cant find "must-vote-commands"

#

anyway thx

#

so, the only changes 2 yeah?

torn mountain
#

sa

sleek pilot
#

the must vote things is same

willow spindle
sleek pilot
#

the voted or not funct same as old dblapi?

#

phef thats not seems hard

fast agate
#

ah.... what do u need exactly

#

?

floral widget
#

Why does the webhook dosent work?

plucky compass
#

mine is also not working

fast agate
#

@floral widget @plucky compass python?

floral widget
#

yes

#

@fast agate

fast agate
#

hmm u use python 3.9?

plucky compass
#

javascript

still bobcat
#

Good evening what is the global code with the API?

jaunty plank
#

global code?

#

as in the actual endpoints for any lang?

still bobcat
#

I would just like a complete code with everything already done

jaunty plank
#

well, it kind of depends on your lib, language, and what you plan to do

still bobcat
#

I am a beginner so I will use: JavaScript, and I want to make sure that when a vote takes place, it is marked in a living room

jaunty plank
hardy umbra
#

help

#

the webhooks and stuff are not working

#

i'm using the new SDK

#

here's my code

jaunty plank
#

wheres the code being hosted?

livid egret
#

what should i write here?

hardy umbra
#

here's the code

jaunty plank
#

@livid egret the url to your webhook receiver.

#

typically in the format http://ip:port/path

hardy umbra
#
var express = require('express');
var app = express();
app.get('/', (req, res) => {
  res.sendFile(__dirname + '/website/index.html');
});
const Topgg = require('@top-gg/sdk')
const webhook = new Topgg.Webhook('password')
app.post('/dblwebhook', webhook.middleware(), (req, res) => {
  console.log(req.vote);
})
#

why won't that work?

#

then i type in the URL (https://thundebot.yodacode.repl.co/dblwebhook) and it doesn't work

jaunty plank
#

i dont see where you use app.listen()

hardy umbra
#

oh btw, this is the server listen part: ```js

app.listen(30485, () => {
console.log('Open on *:30485');
});```

#

there it is

sullen nymph
#

8080

jaunty plank
#

^

hardy umbra
#

ok

#

Still nothing

#

main page

#

for the web server

#

nothing logs in the console

#

like it's supposed to

#

any ideas?

sullen nymph
#

Fun

hardy umbra
#

that's the exact code

#
var express = require('express');
var app = express();
app.get('/', (req, res) => {
  res.sendFile(__dirname + '/website/index.html');
});
const Topgg = require('@top-gg/sdk')
const webhook = new Topgg.Webhook('password')
app.post('/dblwebhook', webhook.middleware(), (req, res) => {
  console.log(req.vote);
})
app.listen(8080, () => {
  console.log('Open on *:8080');
});
sullen nymph
#

Did you make sure to save the file and restart the repl

hardy umbra
#

yeah lol i might be stupid but not that stupid

#

i restarted it

#

do you want to join?

sullen nymph
#

I'm good

hardy umbra
#

is there any reason it wouldn't be working?

#

i've tried http://, https://, including the port, removing the port, etc, changing the pawssword

sullen nymph
#

Not exactly sure why it's not working

#

Do you have another server running on the same repl?

hardy umbra
#

no

#

i'm using the new sdk

#

and it uses express middleware

#

here are the only other pages:

#
app.get('/', (req, res) => {
  res.sendFile(__dirname + '/website/index.html');
});
app.get('/status', (req, res) => {
  res.sendFile(__dirname + '/website/status.html');
});
ripe ether
#

is dblapi.js not maintained anymore?

hardy umbra
#

it's deprecated

#

i tried that before

ripe ether
#

whenever i use it, it says invalid api token

hardy umbra
#

that also didn't work

ripe ether
#

it used to work

#

but hwy

hardy umbra
#

i've looked at the docs

#

and done everything they say

livid egret
jaunty plank
#

yep

hardy umbra
#

this is what it shows

ripe ether
#

but why does dblapi.js always return an error saying invalid token?

#

it didnt used to

hardy umbra
#

ok can you wait your turn please?

#

thx

jaunty plank
#

multiple people can ask questions here at once

hardy umbra
#

ok

#

but nobody is answering mine ;-;

#

i feel lonely ;-;

jaunty plank
#

we have been helping yours for awhile now

hardy umbra
#

well nothing is working

jaunty plank
#

you dont need to set the port in the url on the site

#

iirc

sullen nymph
#

Remove the port and set it to https

jaunty plank
#

^

#

repl follows its own set of rules.

hardy umbra
#

OH FINALLY

#

TYSM TYSM TYSM TYSM TYSM TYSM TYSM TYSM TYSM TYSM

sullen nymph
#

Magic

hardy umbra
#

I thought it would be like that

#

i guess it was a combination of no port, and https

sullen nymph
#

Mhm

ripe ether
#

for dblapi.js i have this as the setupline: js const dbl = new DBL("my_token", { webhookPort: 5000, webhookAuth: 'password' }); yet it always says invalid token, even though these tokens worked like a week ago when i tested them. did something change?

sullen nymph
#

Regenerate yours πŸ€”

ripe ether
#

I did, still wont work

sullen nymph
#

Interesting

ripe ether
#

im just asking to see what could have gone wrong, even when my token is correct

#

wait

#

it gives that long error

#

but it still receives the votes

#

quite peculiar

livid egret
#

why dbl [vote / test] event doesnt work?

jaunty plank
#

it can not work for a ton of reasons

livid egret
jaunty plank
#

improper auth, url, unreachable server(firewalls, lack of port forwarding), improper configuration, etc

livid egret
#

oh let me check firewall

#

that was the problem 😐

#

@jaunty plank tnx

jaunty plank
#

np

elder sonnet
#

Hi, How can I post the server where are my bot? I have this event

dbl.on(34, () => {
  console.log('Server count posted!');
})
client.on('ready', () => {
    setInterval(() => {
dbl.postStats(client.guilds.cache.size)
}, 1800000)
});
jaunty plank
#

whats dbl.on(34)

rapid kettle
#

dbl.on(34)???!?!

sullen nymph
#

I have the same level of confusion as you

elder sonnet
#
const DBL = require('dblapi.js');
const dbl = new DBL("my token", { webhookPort: 9999, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
// Optional events
dbl.on(34, () => {
  console.log('Server count posted!');
})

dbl.on('error', e => {
 console.log(`Oops! ${e}`);
})
dbl.getStats("718059057490952256").then(stats => {
    console.log(stats) // {"server_count":2,"shards":[]}
});


// <-- PROPIEDAD LOGIN: -->
client.on('ready', () => {
    setInterval(() => {
dbl.postStats(client.guilds.cache.size)
}, 1800000)
});
rapid kettle
#

dbl.on(34)????????????????????????????????????????????

elder sonnet
#

I speak spanish

#

Eso ponia en DBL API docs

elder sonnet
rapid kettle
#

Did they?

elder sonnet
#

I show you wait

rapid kettle
#

That’s .on('posted')

elder sonnet
#

I don't understand you

#

I from Spain

dull thicket
#

can someone pleaseee help me setup an even for my python bot to know when someone has voted for the bot on top.gg?

ripe ether
#

howcan i get my bot's votes with the api?

lucid drift
lucid drift
full zinc
#

how use webhook upvote log?

dull thicket
full zinc
#

and dont work

lucid drift
dull thicket
#

how would I get a website for it?

lucid drift
dull thicket
#

i dont know how to do anything lol

lucid drift
dull thicket
#

should use the discord webhook?

outer lodge
#

How do I do the webhook thing for my bot?

lucid drift
lucid drift
outer lodge
#

I mean how do I setup?

dull thicket
#

so what are the basics to set a thing up so I can see when my bot gets a vote?

lucid drift
dull thicket
outer lodge
#

Oh ok

split geyser
outer lodge
#

well my bot will apparently reviewed soon so I'll probably get it done soon

dull thicket
#

like in here?

#

self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)

lucid drift
ripe ether
dull thicket
#

wait do I need a website for getting the recent vote my bot got?

#

Im confosed

ripe ether
#

to receive votes, you need to set up a website, yeah

#

to receive the webhooks

dull thicket
#

so what do I put here?
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)

lucid drift
ripe ether
#

ah, i see, makes sense, thanks!

dull thicket
#

are you using python andromda?

lucid drift
dull thicket
#

have you done this before?

lucid drift
outer lodge
#

I guess I'll just have to wait until my bot gets verified and which wont be too long since it's already on 90%

lucid drift
#

so its been too long for me to completely remember, i just remember the path you should go down

dull thicket
#
    async def on_dbl_vote(self, data):
        """An event that is called whenever someone votes for the bot on top.gg."""
        print("Received an upvote:", "\n", data, sep="")```
#

how would I get this to work?

#

do you know that?

lucid drift
#

webhooks are not commands,
and i had a website that top.gg sent post requests to, then i had that website post the information to a free database, then had my bot read from the database

dull thicket
#

oh ok

lucid drift
# dull thicket ``` @commands.Cog.listener() async def on_dbl_vote(self, data): "...

this is roughly what i used

@app.route('/voter', methods=['POST', 'GET'])
def voter():
  if request.method == 'GET':
    arg = request.args.get('Access')
    if not arg:
      return render_template('notallowed.html')
    else:
      return render_template('voter.html')
  else:
    auth = request.headers.get('Authorization')
    if not str(auth) == 'AUTH_TOKEN':
      return render_template('notallowed.html')
    req_data = request.get_json()
    userid = int(req_data['user'])
    weekend = req_data['isWeekend']
    amount = 500
    if weekend:
      amount = amount*2

    database.addbalance(userid,amount)
    database.addvote(userid, amount)
    return render_template('voter.html')
harsh hedge
#

Bot background code?

willow spindle
harsh hedge
#

Example of bot list background css

#

Pls

willow spindle
#

we won't spoonfeed you

umbral pier
#

I can't get the api to post a webhook to my bot anyone else having that issue ?

rain heart
#

What does the webhook url look like? is it from discord?

umbral pier
#

No its from my http lib

local http = require("http")
http.createServer(function (req, res)
for x, c in pairs(res) do
    print(x, c)

end
  for k, v in pairs(req) do
  print(k, v)
    if tostring(k) == 'headers' then
      for y, z in pairs(v) do 
        print(y, z)
        for a, b in pairs(z) do
            print(a, b)
        end
      end
    end
  end
    res.statusCode = 200
    res.statusMessage = ""
    res:setHeader("Content-Length", 0)
    res:finish()
end):listen(80, "0.0.0.0")
rain heart
#

make manual requests through postman and see if that works

umbral pier
#

It does

rain heart
#

make sure you preseed save before pressing test

umbral pier
#

Yeah i did that too

#

does this url format matter ?

rain heart
#

i highly suggest using a different port than 80

#

use 5000 or smth

#

and the second format is correct

umbral pier
#

didnt want to have to open an other port 😭

rain heart
#

You cannot use 2 ports at the same time

umbral pier
#

πŸ˜…

rain heart
#

that's not how networking works

#

try to listen on port 5000 and it should work

umbral pier
#

alrigth ty gonna try it out

#

so the language im using isint supported by the api is it possible to make get requests to the api using http ?

jaunty plank
#

thats how api requests work, yes.

umbral pier
#

Just making sure since i cant find any examples of get requests in the docs

#

thanks

rain heart
#

might be useful for getting the endpoints

umbral pier
#

thanks

#

does that look right ?

rain heart
#

=id?

#

/check should be enough

#

as you're passing the bot id through /bots/botid/check

#

ohh wait

#

it says query string, mb

umbral pier
#

npnp

rain heart
#

should be something like /botid/check?userid=123456789101 for example

umbral pier
#

Yeah seems good, im getting a response {"error":"Not Found"}

rain heart
#

make sure to use the DBL token in the authorization header

#

Not 100% sure, but i highly assume that it is

umbral pier
#

hmm yeah might be why i can't get anything but not found as a response even with proper data

rain heart
#

make sure to use the correct request method

#

as indicated on the corresponding endpoint on the docs

umbral pier
#

Yes sir

#

anyone use an http server for webhooks ?

jaunty plank
#

yeah, i do.

pulsar palm
#

same

umbral pier
#

So i been trying really hard to get the body of the data from tog.gg

#

I legit printed all of my req and res table and i cannot find anything relevant.

#

Can anyone point me in the right direction? I was told it should be called params or body but i cant find any of those.

jaunty plank
#

what are you using for your http server?

umbral pier
#

im using luvit

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

how to get the password

#

webhookAuth: 'password'

#

password of what

umbral pier
grand agate
#

no page found

umbral pier
#

-_-

grand agate
#

Bot Id wait

#

the authorization?

pulsar palm
grand agate
#

should I give Id in password?

pulsar palm
#

no

grand agate
#

Authorization?

pulsar palm
#

no, just right click your bot (name), Copy ID, the replace [yourbotid] with your bot's ID you just copied.

vast oriole
#

Hey guys

#

Why my api library is undefined

lucid drift
jade creek
#

is there any example for sharding with new top-gg.sdk

jaunty plank
#

the autoposter has one, if using the autosharder

const AutoPoster = require('topgg-autoposter')

const poster = AutoPoster('topggtoken', client) // your djs client/shardingmanager or eris client
umbral pier
#

anyone got status 301 before ? i know its for redirects but why ?

'on_connect'    { headers = { { 'Date', 'Mon, 14 Dec 2020 04:56:13 GMT' }, { 'Transfer-Encoding', 'chunked' }, { 'Connection', 'close' }, { 'Cache-Control', 'max-age=3600' }, { 'Expires', 'Mon, 14 Dec 2020 05:56:13 GMT' }, { 'Location', 'https://top.gg/api/bots/id/check?userid=181447655434485760' }, { 'cf-request-id', '07013444690000ecee24ad0000000001' }, { 'X-Content-Type-Options', 'nosniff' }, { 'Server', 'cloudflare' }, { 'CF-RAY', '6015564d7f2eecee-YUL' } }, statusCode = 301 }
'on_end'

hearty lintel
#

what're endpoint or domain are you using exactly?

umbral pier
hearty lintel
#

well even that domain shouldn't be redirecting

#

what's your exact endpoint?

umbral pier
#

it works in chrome

hearty lintel
#

try change the ?userId to ?userid does that work?

umbral pier
#

It has to be cap I

hearty lintel
#

it looks like that's what it's trying to redirect you to

#

but that doesn't make sense either way

umbral pier
#

so i just switched it to https

#

I got a different error now

#

its status code 401

hearty lintel
#

you're unauthorized

umbral pier
#

yeah must be my ssl certificate

hearty lintel
#

?

umbral pier
#

do you know if the connection needs to be https ? I made it https because i thought it may be the source of the redirecting

hearty lintel
#

yeah it will redirect if it's not https due to cloudflare enforced https

umbral pier
#

oh damn ok..

hearty lintel
#

the 401 is unrelated, are you passing your authorization header?

umbral pier
#

I dont think i need to since i dont need it in chrome

#

but no i am not

hearty lintel
#

what?

#

you need the token to be passed in a header

hearty lintel
#

go to https://top.gg/api/docs#mybots and copy and paste your authorization token from your bot into your requests header for Authorization

umbral pier
#

no header is passed when using the api this way

#

but it works

hearty lintel
#

you're logged in so it does

jaunty plank
#

your logged in

umbral pier
#

oooooooo

hearty lintel
#

from your backend it doesn't

umbral pier
#

yeah theres no docs for this lib im using so its kinda hard to do anything

#

gonna take like 30 mins to find how to do it for node.js and then convert it to my lib

nocturne magnet
#

Hey is anyone able to help me set up web hooks for a on vote event

#

It’s great how when I type in here it dies

jaunty plank
#

what lib/lang

nocturne magnet
#

Python

#

3.8.6

jaunty plank
#

maybe when berry comes back, not a py user pandasad

nocturne magnet
#

Welp

pulsar palm
nocturne magnet
#

Ik

#

Dbl doesn’t work with it tho

#

So I move back down to 3.8.6

#

It also has access to older libs

steady cove
#

rip berry pls get back online

umbral pier
#

Shouldn't this work as headers ??

headers = {['Authorization'] = "key"}
sullen nymph
#

Why is that string in a list

umbral pier
#

the key string ?

tawdry bone
#

@supple karma yo

sullen nymph
#

Yes

#

Why is it in a list

tawdry bone
#

morning shivaco

#

remember me?

#

πŸ˜‰

umbral pier
#

because my key isint a variable so i replaced it with key before posting it here @sullen nymph

sullen nymph
#

I rather not

#

Why is the KEY in a LIST

#

The value is fine

umbral pier
#

well in lua arrays and lists are the same really

#

sooo thats why if i did [ ] it would be the same

sullen nymph
#

Arrays and lists...

#

And in this case you use a dictionary

#

You don't fucking use lists in a dictionary here

umbral pier
#

no thats a thing in the lib im using but its ok its not a big deal

sullen nymph
#

I literally just tried it and it doesn't work if you use a list so

slim hemlock
#
       // DBL Vote    
      const DBL = require("dblapi.js"); 
      const dbl = new DBL("my dbl token", { webhookPort: 3031, webhookAuth: "dbl token" }, client);

      dbl.webhook.on('ready', hook => { console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`); 
    });
    channel12 = "[#787341583376580608](/guild/264445053596991498/channel/787341583376580608/)"
      dbl.webhook.on('vote', vote => { console.log(vote) 
        message.channel12.send(`User with ID ${vote.user} just voted!`);

u = client.users.cache.get(vote.user); 
const voteembed = new Discord.MessageEmbed()
.setTitle("Thank You for Voting!!!")
.setDescription(`Can you please vote for me again in 12 hours? \n To vote for me again, Please follow this link \n **[Click here to vote for me](https://top.gg/bot/761998174432395285/vote)**`)
if (u) u.send(voteembed) });```
#

my this no send dm, nor send any message in mentioned channel

#

@nimble fossil

#

someone pls help

pale fulcrum
#

What’s your problem

barren apex
slim hemlock
#

@pulsar palm @pale fulcrum

dense shale
pulsar palm
#

@slim hemlock why haven't you used the new dbl SDK,

slim hemlock
#

that will dm a particular user onlu

dense shale
pulsar palm
#

@slim hemlock read the latest pin

slim hemlock
#

(userid)

#

ok

#
// DBL Vote    
       const express = require('express')
       const  Topgg = require('@top-gg/sdk')
       const webhook = new Topgg.Webhook('topggauth123')
      const dbl = new DBL("token", { webhookPort: 3031, webhookAuth: "token" }, client);

      dbl.webhook.on('ready', hook => { console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`); 
    });
    channel12 = "[#787341583376580608](/guild/264445053596991498/channel/787341583376580608/)"
      dbl.webhook.on('vote', vote => { console.log(vote) 
        message.channel12.send(`User with ID ${vote.user} just voted!`);

u = client.users.cache.get(vote.user); 
const voteembed = new Discord.MessageEmbed()
.setTitle("Thank You for Voting!!!")
.setDescription(`Can you please vote for me again in 12 hours? \n To vote for me again, Please follow this link \n **[Click here to vote for me](https://top.gg/bot/761998174432395285/vote)**`)
if (u) u.send(voteembed) });```
#

its ok now?

#

@pulsar palm

dense shale
#

its not needed lol

slim hemlock
#

???

dense shale
#

not you

slim hemlock
#

please modify my code and respost

dense shale
#

also you still need to fetch the channel

#

replace channel12 = "[#787341583376580608](/guild/264445053596991498/channel/787341583376580608/)" with channel12 = client.channels.cache.get("787341583376580608")

slim hemlock
#

ok ty

#

what else to be replaced?

#

@dense shale

dense shale
#

fetch the user incase its not cached

slim hemlock
#
const webhook = new Topgg.Webhook('topggauth123')
      const dbl = new DBL("token", { webhookPort: 3031, webhookAuth: "token" }, client);

      dbl.webhook.on('ready', hook => { console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`); 
    });
    channel12 = client.channels.cache.get("787341583376580608")
      dbl.webhook.on('vote', vote => { console.log(vote) 
        message.channel12.send(`User with ID ${vote.user} just voted!`);

u = client.users.cache.get(vote.user); 
const voteembed = new Discord.MessageEmbed()
.setTitle("Thank You for Voting!!!")
.setDescription(`Can you please vote for me again in 12 hours? \n To vote for me again, Please follow this link \n **[Click here to vote for me](https://top.gg/bot/761998174432395285/vote)**`)
if (u) u.send(voteembed) });```
#

this is my code now

#

@dense shale

dense shale
#

i told you what to do, im not allowed to spoonfeed

slim hemlock
#

ur allowed to tell other mistakes SA2223_wtf

dense shale
#

try and see if it works lol

slim hemlock
#

ok

hearty lintel
#

@slim hemlock you seem to be using like two different libs, check the pins for the new library and one of the examples shows you how to setup webhooks

slim hemlock
#
const express = require('express')
const Topgg = require('@top-gg/sdk')

const app = express() // Your express app

const webhook = new Topgg.Webhook('topggauth123') // add your top.gg webhook authorization (not bot token)

app.post('/dblwebhook', webhook.middleware(), (req, res) => {
  // req.vote is your vote object e.g
  console.log(req.vote.user) // 221221226561929217
}) // attach the middleware

app.listen(3000) // your port``` won't this put who posted in console.log?
#

@hearty lintel

hearty lintel
#

if you have your server set up properly yes

slim hemlock
#

i need in a channel ;-;

#

oh i can replace console.log to message.channel12.send and give channel 12 a value

#

right? @hearty lintel

hearty lintel
#

idk how your code works but what i can tell you is req.vote.user is the user's ID

#

do with that what you will that should be all the info you need

slim hemlock
#

uff, k

restive otter
#

webhookAuth: 'password'

#

password kΔ±smΔ±na nasΔ±l doldurmalΔ±yΔ±m

#

Bi şifre seç ve oraya yaz

#

Sonrada botunun edit sayfasΔ±na git ve en altta webhook password var

#

Oraya yazdığın şifreyi oraya yaz

#

tamam teşekkürler

#

speak enG

#

@restive otter peki yourDBLTokenHerekΔ±smΔ±nΔ± nasΔ±l doldurmalΔ±yΔ±m

strong zinc
#

How i can get my Top.gg Token ?

rain heart
chilly furnace
#

How do I get the Webhook URL when using dblpy so I can check for Votes?

#

Since It has a builtin Webhook System

brittle spoke
#

@gaunt steeple

#

again

gaunt steeple
#

sup

#

late to this party

brittle spoke
#

yep

restive otter
#

how to make a vote webook

#

i mean i installed e package

#

wat do i do now

heady cloak
restive otter
#

wdym

torpid wyvern
#

d

still girder
#

no

restive otter
#

hi

#

How can I show the servers

#

I don't understand more than api

rain heart
#

read the api

#

topic

restive otter
#

How do we get the webhook URL
help me

#

Webhook url is your server url lol

#

Where you host your webhook server

atomic spindle
#

hello actually i was trying to add discord bot api widgets on my wiki but servers and library api is not working properly it's saying undefined

#

can anyone help ?

#

lib undefined and servers undefined

#

it's a verified bot

brittle spoke
#

@atomic spindle I believe they were meant go remove that

atomic spindle
#

okay

#

but i saw it works

#

like i saw its working for owo bot and all

uncut quartz
#

what is wrong with that link

#

I am trying to get the bot to see if they voted

hearty lintel
#

//

#

but shouldn't cause an issue, what's the error?

uncut quartz
#

nvm

#

found it

#

huh

#

How do u authorize the API

#

within the link

rapid kettle
#

header

hearty lintel
#

@uncut quartz pass the Authorization header with your token

rapid kettle
#

'Authorization': 'top.gg token'

#

iirc

narrow elm
#

can someone help me with a message that gets sent when someone votes on my bot?

blazing flint
#

Is there a bot that I can add xp on my own like if do !add xp 5

restive otter
#

this is not api related

wheat copper
#

what am i supposed to see in my console when i test webhook?

misty blade
#

get_weekend_status() returns true or false right?

umbral pier
#

does the secret get sent when you do tests ?

willow spindle
#

yes

misty blade
#

ok thanks

floral widget
#

Why does the webhook dosent work?

rain heart
#

discord webhooks do not work btw

#

you need to make one yourself

restive otter
#

hi

harsh charm
#

Hey

jovial perch
#

Hey

hot axle
#

Hey

stoic plover
#

Do I need to respond with 200 http response code to top.gg's post request? Or can I be lazy and just ignore it after receiving the data I need

#

*for voting webhooks

hot axle
#

well it'd be a lot better to send a response back

stoic plover
#

Is it necessary in this case though

hot axle
#

um

#

like it may not be strictly necessary

stoic plover
#

You know what it'll take me 5 seconds I'll just do it

hot axle
#

but it's just a couple lines of code

#

yea

charred ridge
#

How do I configure the Webhooks?

hot axle
#

you can set up the url at https://top.gg/bot/your-bot-id/webhooks

charred ridge
hot axle
#

you can put whatever password you want

#

you can use it to verify the request

hot axle
#

you gotta put the url of the endpoint you want requests to go

charred ridge
#

🀨

hot axle
#

like

#

you gotta set up some web server to receive requests from top.gg

charred ridge
#

I don't have a web server, so you can't

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

const appo = express();
const server = http.createServer(appo);
const dbl = new DBL(process.env.DBL, { webhookAuth: '', 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');
});

So i've got this here but What is the url i need to do in my bots page?

hot axle
#

i think by default the path is /dblwebhook or something

#

So you should put http://your-server-ip/dblwebhook

sharp hollow
#

So this is on repl.it, how do i know the ips?

hot axle
#

shouldn't you have your server address?

sharp hollow
#

Yeah

#

The name of my server

hot axle
#

yea thats it

sharp hollow
#
http://example.militia21.repl.co/dblwebhook

is this the url?

hot axle
#

yeah i suppose

#

just in case you can set a custom path in the server options

restive otter
#

any other way to do the webhook thing rather than ip?

#

tag me when answering

spark rock
restive otter
#

?

#

domain?

#

im guessing you meant if you can use webhooks with anything other than urls, which the answer to is no

#

yes, a domain name

#

like can i use my github pages site?

#

no

#

oh so a domain is specifically needed

#

you need an actual webserver running and handling requests

#

also no

#

a domain is just a pointer to an ip

#

using express?

restive otter
#

but you have to use a url that points to your webserver

#

there's no other way around it

#

ok so if my webhook uri is for example,
https://something and so on , i can receive requests specifally from that?

#

well, yes and no, the way you put it is way too abstract

the url has to be tied to your webserver, now it can be a direct ip:port or domain:port, doesn't matter which one

#

ni

#

no

restive otter
#

github sites is only for hosting static pages, you need an actual machine, a server

#

like where the bot is hosted?

#

correct

restive otter
#

found 1 moderate severity vulnerability
run npm audit fix to fix them, or npm audit for details

how do i fix this while installing dblapi.js?
i ran npm i dblapi.js

restive otter
dense compass
#

Why?

torpid wyvern
#

d

#

C

hallow knot
#

You shouldn't have to watch ads just to see that you already voted for a bot

hot axle
#

bruh agreed

sullen nymph
#

Wrong channel for feedback

hallow knot
#

I dont see any channel called feedback

sullen nymph
#

:p

zealous jay
#

Can anyone tell how does top.gg webhook work?
it's like u need to add ports etcc

#

Why do I need to add port etc ?

hot axle
#

you know web servers and stuff?

zealous jay
#

Yes

zealous jay
#

Or anyone can give me a practical demo ?

hot axle
#

for example

#

lmao wait

#

If you got an express app:

// Some stuff

app.post('/dblwebhook', (req, res) => {
  const { user } = req.body;
  console.log(`A user by the ID "${user}" just voted!`);

  // Handle some other stuff
});
#

then you can register that endpoint on your bot's webhook

zealous jay
#

I saw this same example on npm docs

zealous jay
#

we need tocreate our own webserver ?

hot axle
#

yeah

#

or some languages got a library to make it easier

#

javascript got dblapi.js

zealous jay
#

yeah

#

I use JS

#

do u have any demo ?

hot axle
#

wait a sec

zealous jay
#

Ok

zealous jay
#

?

#

I saw this already

hot axle
#

those are the docs

#

theres an example

zealous jay
#

Yeah

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

#

Which password ?

hot axle
#

that's a password the thing can use to verify that requests come from top.gg

#

if you set it, you gotta also set it on the webhook options of your bot

zealous jay
#

Didnt get u

hot axle
#

like

#

There you can set the endpoint

#

And you can also set a password

#

which will be sent with the request, and will be used to verify the request

zealous jay
#

Ok

#

and for this```js
webhookServer: server

#

How many types are there ?

hot axle
#

oh that's if you want to use it to an existing server

#

if the webhook is the only thing you got you can leave that in blank

zealous jay
#

what if it is a new server

hot axle
#

just leave it there

zealous jay
#

and for what is it used ?

#

I meant this webhook

#

is used for what ?

hot axle
#

for detecting votes

zealous jay
#

Yeah

#

So it's like an event ?

hot axle
#

yeah

#

top.gg sends a request to your server when a user votes

zealous jay
#

Ok

#

when it sends request to my server

#

then what does my server do after it receives the request ?

hot axle
#

You can do whatever you want with the info

zealous jay
#

Oh

hot axle
#

You receive stuff like the user id

zealous jay
#

So I can set roles etc

hot axle
#

yea

zealous jay
#

many things like that ?

#

and there is a bot called DBLVote

#

DBL Vote#2244

hot axle
#

never heard of that one

#

so i dunno

zealous jay
#

Ok

#

and

#

what all information does it send

#

to my server ?

hot axle
#

Thats on the docs

zealous jay
zealous jay
#

THis ?

hot axle
#

yea

zealous jay
#

@hot axle Also there is any dashboard ?

#

In the URL ?

hot axle
#

wdym?

zealous jay
#

I meant

#

in our page

#

/dblwebhook

#

is there any dashboard ?

hot axle
#

um

#

wdym?

zealous jay
#

Like

#

is there any UI ?

hot axle
#

but where do you mean

#

in your server?

zealous jay
#

Yes

hot axle
#

nope

#

dblapi.js just makes a simple endpoint i think

zealous jay
#

Oh ok

#

Lol I found a game

hot axle
#

lmao cool

merry stump
#
self.dblpy = dbl.DBLClient(self.client, self.token, webhook_path='/dblwebhook', webhook_auth='pass', webhook_port=5000)```
#

should i set webhook path to something else?

zealous jay
#

U can if u want

merry stump
#

like?

#

coz for some god damn reason, top.gg API wont work

zealous jay
#

lol

zealous jay
#

or just /

#

Or u can keep it as it is.

merry stump
#

ok

#

is there any way to use other api to check top.gg vote

#

like using aiohttp

willow spindle
#

yes

zealous jay
#

@willow spindle Sorry for ping

#

But I have 1 doubt

#

is DBL Vote bot official bot of top.gg ?

willow spindle
#

no

zealous jay
#

Ok

#

and one more thing

#

does this bot

#

use the dbl.webhook.on event ?

#

dbl.webhook.on('vote', vote => {

#

This ?

willow spindle
#

i don't know about this bot. Ask their developer

zealous jay
#

Oh Ok thnxs

willow spindle
crystal bay
#

hello

#

where i can found my top.gg token

hearty lintel
distant oxide
#

?help

crystal bay
#

thanks ❀️

distant oxide
#

!help

crystal bay
#

can you help me

#

how ?

hot axle
#

N/A is your server count

#

So if you haven't posted anything its not gonna be there

crystal bay
#

okey now it's working

#

thank you so much

hot axle
#

no prob

crystal bay
hot axle
#

cool

#

my bot never got verified because discord won't accept my id

#

cri

willow spindle
#

try passport

hot axle
#

yea tried that too

#

freakin stripe

visual lodge
#

How to get the upvotes of bot using python api wrapper of top.gg?

hot axle
visual lodge
#

But i dont see any of the options like upvotes...:/

hearty lintel
#

@visual lodge .points is total and .monthlyPoints is monthly

visual lodge
willow spindle
#

can you read the docs

restive otter
prisma path
jaunty plank
#

@restive otter the dblapi lib will always log 0.0.0.0, as 0.0.0.0 just means "any ip at this location"

uncut quartz
#

@prisma path through da api

prisma path
#

what exactly should i do

uncut quartz
#

read the doc it explains it very well

fast agate
crystal bay
#

now it's working
thank you so much

restive otter
hot axle
#

post the server count

restive otter
#

okay

#

and how to style

#

my bot page

#

nice

#

?

#

like with the html update etc

hot axle
#

you can add css to markdown

restive otter
#

Is there a docs for that'

hot axle
#

well not docs

#

but you can learn css by yourself

bitter iris
#

const AutoPoster = require('topgg-autoposter')

const ap = AutoPoster('topggtoken', client) // your discord.js or eris client

// optional
ap.on('posted', () => { // ran when succesfully posted
console.log('Posted stats to top.gg')
})

#

im using this in my index.js file but i get ReferenceError: Discord is not defined

willow spindle
#

then define it...?

hasty mortar
#

LOL

bitter iris
#

TypeError: Class constructor Client cannot be invoked without 'new' when trying to use the topgg-autoposter

jaunty plank
#

Yeah, you need an instance of client.

plucky lance
#

... which requires to load the djs lib, too for example and use the created var (probably client) as arg in the autoposter method

#

as the comment says

merry stump
wise badge
#

a

restive otter
#

const dbl = new DBL(censored, { webhookPort: 5000, webhookAuth: 'password' }); when i paste my token i get error: "censored" is not defined

raw token
#

I get {"error":"Not Found"} when sending POST /api/bots/stats with good content-type and authorization token + json as body

#

Do I have to wait for the bot to be approved to send count ?

sullen nymph
#

Correct

raw token
#

Okay, thx
I can't configure the webhook too..

stiff breach
#

    @commands.Cog.listener()
    async def on_dbl_test(self, data):
        """An event that is called whenever someone tests the webhook system for your bot on top.gg."""
        print("Received a test upvote:", "\n", data, sep="")
#

this is not work

#

someone knows why

viral fable
#
const DBL = require("dblapi.js");
const dbl = new DBL('Your top.gg token', client);


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

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

Do i have to just put it in my bot file and it will start showing server count i mean do i have to do something on website?

plucky lance
#

You can implement the code into ur bots code or load the djs for example to start a second instance of your app to report to top.gg

wide herald
#

dbl.on is not a function

#

how to fix ?

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


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

this is my code

#

I replaced token with my gg token :P

#

so don't ask for that

#

can anyone help ?

stiff breach
oblique trench
#

whats the difference between node-fetch and node-superfetch?

restive otter
#

Helloooo000o0o0o0ooOooo0OoOOoOo

#

Nvm

hot axle
#

y tho

stiff breach
#

@fast agate

fast agate
#

yoouuu

#

talk with shiv

#

he can help u

civic crow
#

What is the name of the npm packet?

rapid kettle
#

@top-gg/sdk

sullen fox
#

can someone send me a link on how to track votes

radiant tendon
sullen fox
#

ty

radiant tendon
#

go topics then votes

#

i think that's the correct one

#

wait that's the wrong one

#

my bad

radiant tendon
sullen fox
#

DiscordJS

#

Also, is there a way to trigger the vote event without someone voting so i can test?

uncut granite
#

Is there any tutorial how to use the API for Python?

radiant tendon
#

i think that gives all the information you need

radiant tendon
#

the docs are there

sullen fox
#
dbl.hasVoted("406880301449478144").then(voted => {
    if (voted) console.log("User has voted!!!")
});
``` the above works, but the below does not
```js
dblWeb.webhook.on('vote', vote => {
    console.log(`User with ID ${vote.user} just voted!`);
});
const dblWeb = new DBL("token", {
    webhookPort: 5000,
    webhookAuth: 'password'
});
const dbl = new DBL("token", client)
#

Discord.js

radiant tendon
#

mhm

#

then do the above i guess

#

would that work for you?

sullen fox
#

yea but i want to see when someone votes

#

not if theyve voted within the last 12 hours

radiant tendon
#

does it show any errors?

sullen fox
#

nope

#

when i test the webhook, nothing pops up

hot axle
#

have you registered the webhook url?

radiant tendon
#
dblWeb.webhook.on('vote', vote => {
    console.log(`User with ID ${vote.user} just voted!`);
});``` we are talking about this line of code right?
sullen fox
#

yea

#

wdym registered url

radiant tendon
#

does it work when you remove .webhook ?

sullen fox
#
dblWeb.webhook.on('ready', hook => {
    console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
``` this works tho
radiant tendon
#

strange

hot axle
#

yeah cuz its running

#

hmm

#

like

#

you're in the webhooks page right?

radiant tendon
#

i think someone has to vote the bot for that to work

hot axle
#

nah

#

theres a button to test

radiant tendon
#

oh yeah

#

i forgot about that one

hot axle
#

so the thing is

#

@sullen fox you're in the webhooks page right?

sullen fox
#

yes

hot axle
#

so

#

have you filled the input where you put the endpoint

sullen fox
#

every box on the webhooks page is filled

hot axle
#

k

#

is it possible to access your server?

#

like, outside of your network

sullen fox
#

wdym

hot axle
#

cuz

#

where are you running the code?

sullen fox
#

from my computer rn

#

but i host my bot on AWS

hot axle
#

well if you haven't port forwarded your server its not possible to access it

sullen fox
#

how do i do that for both

hot axle
#

um

#

you gotta configure your router

#

there are tutorials on yt

sullen fox
#

ight

wise badge
#

anyone know how to make the embed thumbnail show as the pinged user? (discord.py)

radiant tendon
#

that should be possible

#

but i think this is a question for #development , @wise badge

wise badge
#

alr

radiant tendon
#

since this channel is for top.gg api

wise badge
#

oh i thought it was discord's api

slow dust
#

hi

lyric vine
#

how do you make vote rewards for a bot using the top.gg api

slow dust
#

should I use data.user or data['user']?

rapid kettle
#

either works

slow dust
vast plinth
lyric vine
#

anyone able to help on a vote command?

spring parrot
#

Hello do you have api fortnite shop french please?

willow spindle
lyric vine
#

ima take it as no one can help then

#

back to finding legit nothing on how to use get_user_vote

civic crow
#

What is the event for if someone votes

spring parrot
jaunty plank
civic crow
#

@top-gg/sdk

jaunty plank
civic crow
#

and for me?

jaunty plank
#

oh yes you, clicked the wrong one

jaunty plank
#

was meant for tijme

lyric vine
#

cos i wanna check if someone has voted and use it for rewards

civic crow
#

What is the right one then?

lyric vine
#

oh ok

civic crow
#

Ohh

jaunty plank
#

i dont know the py lib salt pandasad

#

shiv will be around at some point

civic crow
#

But app.post('/dblwebhook') is not an event right?

jaunty plank
#

its an express endpoint

#

since the webhook uses express now

civic crow
#

Ahh, you have to use the webhook

jaunty plank
#

for receiving vote events yes.

civic crow
#

Thanks

eternal moth
#

whats the method to remove more than one element at the start of an array?

rapid kettle
eternal moth
#

.shift() only takes off one

#

ayy true, wrong spot

slow dust
#

do i have to change anything in

self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)

to make it auto trigger the

@commands.Cog.listener()
    async def on_dbl_vote(self, data):

Please help me set this up

rain heart
#

this should work afaik, make sure to change the webhook_auth though to something else

#

has to be the same in your bot page settings though

slow dust
#

thank you. I'm using 3.8

#

still struggling with this api... node sdk is pretty straightforward tbh

crystal bay
#

hello

#

how to send a message " thanks for voting " like that

#

with the bot

hot axle
#

use the webhooks

marble eagle
#

how can i let my discord bot acess eve echoes market to just gather info

sullen nymph
#

See channel topic

shut bone
#

oops

iron light
#

I

sharp cradle
regal harbor