#topgg-api

1 messages Β· Page 146 of 1

tribal anvil
#

the code ^^

restive otter
#

I don't see why it raises NameError, you don't even reference to channel anywhere, what is possible is that it'd raise AttributeError, because you started the loop even before you attach the channel to the cog

tribal anvil
#

oh ok

#

is there a way to fix this??

sullen nymph
#

move update_stats.start to the very bottom of the init method

vale pine
#

is this gonna work?

#

bcs the test button does nothing

#

app.use('/voteapi', webhook.middleware(), (req, res) => {
console.log(req.vote.user);
});

#

@sullen nymph

vale pine
#

?

restive otter
#

attribute error: nonetype has no attribute send

#

You need to load the cog after the bot is ready

#

or just get the channel after the bot is ready

#

oh ok

#

so

#
for filename in os.listdir('./cogs'):
  if filename.endswith('.py'):
    try:
      client.load_extension(f'cogs.{filename[:-3]}')
    except commands.errors.NoEntryPointError:
      pass
#

inside

#

on_ready

#

it worked thanks

#

You could also do

@update_stats.before_loop
async def before_update_stats(self):
    await self.bot.wait_until_ready()
    self.channel = ...
#

oh well, no problem

#

how would i do an on vote

#

It might be complicated at first, but it's pretty easy once you get the hang of it

#

ok

floral pilot
#

Hello, how do I get this authorization? and where do I get

restive otter
#

You don't get it, you make it

vale pine
floral pilot
#

Sorry, I do not understand

restive otter
#

Think of it as a password, do you get the password from somewhere else? No, right? You create your own password

floral pilot
#

ah, so can i put any password?

vale pine
restive otter
floral pilot
#

It was not..

restive otter
#

Sorry?

floral pilot
#

is not sending the webhook on the channel after clicking test

restive otter
#

Well, that's not related to Authorization whatsoever

floral pilot
#

I will remove this, thanks for the help

lean wolf
#

Does anyone know how to setup the authorization stuff with Nginx?

restive otter
cunning garden
#

!play emi 112

restive otter
#

how do i make bot add reaction and the emoji

#

must be discord aset

restive otter
#

If you wanna pass it instead, ig you can do proxy_set_header Authorization $http_authorization;, not sure but give it a shot

#

not even sure if it's not passed by default, ig that's redundant shrug

lean wolf
#

@restive otter So I tried it but it didn't work, it would send with a right and wrong one.

#

Where would it be because I put it in the server section of the Nginx sites-enabled file

#

Hello @restive otter can you help me?

restive otter
#

Have you reloaded nginx?

lean wolf
restive otter
#

Which one did you do though?

#

Is this off-topic doe? monkaS

lean wolf
lean wolf
restive otter
#

Is this thing related to top.gg's webhook?

lean wolf
#

Yes

#

Im trying to get this to work

wicked thunder
#

HELLo

cursive finch
#

how do you make it send webhook to my channel when someone upvotes i cand understand documentation bc im not good at reading
what do i put in authorization

#

its like the 5th time im asking it

topaz axle
#

Hello, does anyone know how I should change my voting webhook so that it is comptaible with sharding?

#

Right now it runs the webhook on all of my separate shards, but this throws an error saying that address is already in use, but I need a client in order to use a webhook. Any ideas?

stone estuary
#

hello

#

how i can get DBLPassword

#

webhookAuth

rain heart
#

you create that yourself

#

has to be the same as the one on your bot page settings

stone estuary
#

what i'm do it here ?

rain heart
stone estuary
#

bro, you can't tell me ?

deep smelt
#

Hello, I would love to use your API to post a message when there is a new vote on my bot, but I can't. Could you help me or give me the code?

deep smelt
#

Yes I read but I do not understand, in addition I speak French so that does not make things easier

tough stream
#

does it take some time for changes to the webhook url to update? i saved it, it worked during testing, but the change didn't do anything at all for users

deep smelt
#

thanks !

#

Not Found

rain heart
#

have you replaced id with your bot id?

willow sphinx
tiny pike
#

How can I post the shard count with autopost?

vague tangle
#

// Make sure to install this with 'npm install dblapi.js`
const DBL = require('dblapi.js');
// The webhookPort can be whatever you want but make sure you open that port in the firewall settings (for linux for example you can use `sudo ufw allow 8000`)
// The webhookAuth is set by you, make sure you keep it secure and don\'t leak it
const dbl = new DBL(config.API_TOKEN, { webhookPort: 8000, webhookAuth: 'password' });

// When the webhook is ready log it to the console, this will log `Webhook up and running at http://0.0.0.0:8000/dblwebhook`
dbl.webhook.on('ready', hook => {
   console.log(`Webhook up and running at http://${hook.hostname}:${hook.port}${hook.path}`);
});

// This will just log errors if there are any
dbl.on('error', e => {
   console.log(`Oops! ${e}`);
})

// When the webhook receives a vote
dbl.webhook.on('vote', async vote => {
   // This will log the whole vote object to the console
   console.log("someone voted lol")
   console.log(vote)
   // Get the Discord ID of the user who voted
   const userID = vote.user;
   // If the channel to send messages in exists, we send a message in it with the ID of the user who votes
   vote.user.send("Thanks for voting! $20 has been added to your balance.")
})```
#

is there something i can replace dbl with?

#

with somethign that isnt depreciated?

#

any suggestions please

orchid stag
#

dblapi is this ^ It's been redone as a whole

vague tangle
#

alright

#

so should i just replace const DBL = require('dblapi.js'); with the new one?

orchid stag
#

Read the page

#

Make a webhook server

#
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```
vague tangle
#

ok

#

thanks

orchid stag
#

np

vague tangle
#
const express = require('express')
const Topgg = require('@top-gg/sdk')
const api = new Topgg.Api(config.API_TOKEN)

const app = express() // Your express app

const webhook = new Topgg.Webhook('password') // 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
  console.log("someone voted lol")

  // Get the Discord ID of the user who voted
  const userID = vote.user;
  // If the channel to send messages in exists, we send a message in it with the ID of the user who votes
  vote.user.send("Thanks for voting for Jimmybot! 20 treats have been added to your balance.")
 
}) // attach the middleware

app.listen(8000) // your port```
#

would this work

#

i tested it and I'm not getting a console log

vocal solar
#

how do i check if a user has voted for my bot? Do i need to use a datastore or can i check it through the api

woven coral
#

check it through the api, it's documented there

restive otter
willow sphinx
#

look up "nginx if statements are evil"

restive otter
#

Oh, it's even in their wiki lol

willow sphinx
#

they lead to a bunch of bugs and it's a good idea to make that check on the application side and use nginx as a reverse proxy instead

restive otter
#

I see, didn't know about this. Thanks for telling

vestal field
#

Does top.gg API has any voting reward system? If so, do you mind sending the Direct link for the needed docs?

rain heart
vestal field
#

I searched on it about what I want

#

And couldnt find

rain heart
vestal field
#

😐 πŸ‘

#

Thx

zenith egret
#

Where do I get the URL that I want a webhook to be sent to so that I can receive it?

zenith egret
#

How do I get that

golden adder
golden adder
zenith egret
#

My laptop

golden adder
#

Then it's your IP. Google "my IP address"

zenith egret
#

Alright ty

golden adder
#

You should probably think about using a vps tho 😬

night ingot
#

Make sure it's the right port, and that it's open on your network as well

golden adder
#

What doesn't work? The server count posting or the webhooks?

#

I don't know python but it's set to post the server count every 30 minutes by default (recommended). Maybe try reducing that to 1 minute just to test. But set it back to 30 if it works.

night ingot
#

You don't need the asyncio.sleep since you're using tasks.loop

#

Yeah, read what the comments say

#

Don't just blindly copy and paste

golden adder
#

Every time a user votes, save the timestamp from the voting webhook event to your db then every time they run the command check the db for their ID and time since last vote. Or hit the api, but that's probably not ideal.

night ingot
#

You can see who voted at https://top.gg/api//bots/<your bot id>/votes
Remember to pass in your DBL token as a header as well. But yeah, you need your bot to be approved to access that

bright wasp
#

?

golden adder
#

Personally I prefer to use timestamps in my db to avoid spamming the api but that's up to you

night ingot
#

You need to create a webhook listener yourself to use webhooks

golden adder
#

||anything i can copy and paste?||

#

Read the docs

night ingot
#

self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)
You can use this to create one with the library. The port needs to be open for it to work though

deep smelt
vale pine
#

Hello i am trying to do a vote webhook my app for the webhook: https://tickety.top/voteapi and my settings in top.gg panel

is this gonna work?
bcs the test button does nothing
app.use('/voteapi', webhook.middleware(), (req, res) => {
console.log(req.vote.user);
});

vale pine
#

why this doesnt work

restive otter
#

because it shouldnt be app.use

#

and it should be app.post

vale pine
#

what does that matteer?

restive otter
#

because top.gg does post request

#

and not get request

vale pine
#

are you 100% sure,

restive otter
#

yes

vale pine
#

what happends

#

if i click

#

the test button

#

what should happen

restive otter
#

it should console.log your user id

#

change app.use with app.post and try it

vale pine
#

i changed it

#

hmm

#

i am curious if something has changed

#

didnt change any

#

@restive otter

restive otter
#

weird, i tried to post and it worked

vale pine
#

when did you tried it

#

try it now

#

again

restive otter
#

still works

#

is the password with the server and the top.gg are the same

vale pine
#

what do you mean

#

password?

restive otter
#

auth

vale pine
#

token?

restive otter
#

nono

#

1sec

vale pine
#

i don't use auth

#

how to use

restive otter
vale pine
restive otter
#

oh

vale pine
#

it is empty

#

how to enable it

restive otter
#

what about the url

vale pine
#

app.post('/voteapi', webhook.middleware(), (req, res) => {
console.log(req.vote.user);
});

restive otter
#

i mean the webhook url

vale pine
restive otter
#

ok so you need to fill your auth pass

vale pine
#

okay

#

i can put there for example

#

helloworld

restive otter
#

it should be like this

vale pine
#

how to validate it

restive otter
#

you can change topggauth123 to anything you want

vale pine
#

ow bruh

#

i putted there my token

#

πŸ˜‚

restive otter
#

lol

#

put a auth pass there

restive otter
vale pine
#

where do i put my token?

restive otter
#

you dont need to

#

because webhooks dont require token

vale pine
#

only the api

#

requires

#

okay

#

i get it

restive otter
#

yup

vale pine
#

now it retuns

#

wrong planet

restive otter
#

its fine

vale pine
#

like error 404

restive otter
#

because you are doing a get request

#

do what did i say

vale pine
#

gg

#

it works

#

it says undefined

restive otter
#

now idk why

vale pine
#

let me vote

#

huh it says

#

undefined

#

if i vote

#

@restive otter

#

app.post('/voteapi', webhook.middleware(), (req, res) => {
console.log(req.vote.user);
});

restive otter
#

console log req.vote

#

and click test

vale pine
#

bro i cant restart my bot hole the time

restive otter
#

Β―_(ツ)_/Β―

vale pine
#

but

#

i did it

#

and

#

it says

#

nothing

restive otter
#

weird

vale pine
#

nothing get logged

restive otter
#

idk why

vale pine
#

😭

restive otter
#

the webhook works for me

#

idk lol

vale pine
#

huh watt

#

how did you get that

restive otter
#

what version of @waxen widget-gg/sdk you use

#

discord

vale pine
#

idk

#

installed it yesterday

restive otter
#

look at package.json

vale pine
#

"@waxen widget-gg/sdk": "^3.0.9",

restive otter
#

its very weird

#

because it works for me

vale pine
#

app.post('/voteapi', webhook.middleware(), (req, res) => {
console.log(req.vote);
});

#

my current code

#

that does nothing

night ingot
#

Do you not need a port in the js lib?

restive otter
#

their webhook works but the user id doesnt get logged

night ingot
#

And you're reading the response as json?

vale pine
#

what de actual fuck

#

just getlogged

golden adder
#

I think you need a port

vale pine
#

Reis

#

i did console.log(req)

#

@restive otter

#

that happends when i do console.log(req)

restive otter
#

vote is empty

#

weird lol

vale pine
#

how is that possible

restive otter
#

idk

vale pine
#

can you tag someone you know

#

can fix it

#

@fresh plover

#

@restive otter

#

maybe is other code blocking it

#

const app = express();

app.set('views', __dirname + '/views');
app.set('view engine', 'pug');

app.use(favicon(__dirname + '/logo.png'));
app.use(rateLimit);
app.use(bodyParser.urlencoded({ extended: true }));
app.use(methodOverride('_method'));
app.use(cookies.express('a', 'b', 'c'));

app.use(express.static(${__dirname}/assets));
app.locals.basedir = ${__dirname}/assets;

app.use('/transcripts/id=:id', (req, res) => res.sendFile('/home/container/web/transcripts/' + req.params.id + '.html', function (err) {
if (err) {
res.render('errors/404');
}
})
);

app.post('/voteapi', webhook.middleware(), (req, res) => {
console.log(req);
});

tiny pike
#

Can I post the shard count with autopost in py?

restive otter
#

You can install the sdk from the source, it has shard count autopost support. If you have set up a webhook, make sure to check the source code as there's a breaking change

#

Or just wait until shiv releases v1

lyric minnow
#

what are the rules withe the API

#

as in i would like to put my bot on top.gg, but i need to make sure that the bot follows the rules...

sullen nymph
lyric minnow
#

okie, thx

rare sluice
#

@Kayex

vast moat
#

There is also a guild section for top.gg where can i get the docs where it is written for guild. Like getting events when someone votes for the server

#

I am specifically looking for python docs

#

and please ping me while answering my question

rain heart
#

only bots

restive otter
#

well they have webhooks tho

lean wolf
#

How do I use the authorization header with Nginx?

delicate badge
#

Is that everything I need?

restive otter
#

i get a error when i do my command to see how many severs

#

show code

delicate badge
#

Can someone help me?

restive otter
delicate badge
restive otter
#

what error do you get

delicate badge
#

None

restive otter
#

you need to wait 30 mins

delicate badge
#

Shit

restive otter
#

also be sure that you filled the token part correctly

fading mica
#

If it says posted stats to top.gg it should work

cold root
#

umm

#

people

#

I got this```js
const DBL = require('dblapi.js');
const dbl = new DBL(apiToken, { webhookPort: 9008, webhookAuth: 'BTSsucksLikeWtf' });// in webhookport: 9008, replace the "9008" with your host's port. in "AnyPassword" u can choose a random password.

dbl.webhook.on('vote', (vote) => {
console.log(${vote.user} has voted me!)
const webhook = new Discord.WebhookClient("821184990104518716","la_KOaHOMUlybKlF897jozaBCL8kZDbMdlEx7LPsHL-xSpWGu1XDmFMp-3Io2B7cb1ZY")//replaces with ur webhook information
webhook.send(<@${vote.user}> (\${vote.user}`) has voted me!`)
});

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

#

and it does say its connected

#

but when I vote

#

it doesnt do anything

#

and no errors pop up

#

I tryed fixing it but I can't.

#

if u gonna help me please ping me.

#

πŸ™‚

delicate badge
#

@fading mica

fading mica
#

Refresh data?

fading mica
#

@delicate badge

delicate badge
#

Let me see

#

@fading mica nope and nope

fading mica
#

Also

#

Put that code in the script which u run the bot with

delicate badge
fading mica
#

Where did u place your code?

#

And did u put the correct token?

#

Under client.on ready?

delicate badge
fading mica
delicate badge
#

I’m a bit busy rn

fading mica
#

Client.on("ready", () => { console.log();
});
//place top.gg code here

fading mica
#

Bruh u dont have that code already? I thought u did lmao

#

Remove that and post top.gg code at the end of the script then

delicate badge
#

Okay

restive otter
#

When i run this file with node shard.js i get no error. I'm not exactly sure whats wrong other then that it is in the top.gg api area. If someone could help that would be awesome

restive otter
#

Nvm im dumb and figured it out

restive otter
#

-servercount

#

damn

sharp totem
#

Hey guys

#

I just set up my top.gg webhook

#

as per the instructions on top.gg

#

Now my bot will be receiving post request

#

but before that what will be my webhook url

night ingot
#

Are you hosting your bot on a VPS?

sharp totem
#

No

night ingot
#

Then I'm guessing you're hosting at home.
So the url would be <your home IP>:<port>/<your webhook path>

zenith egret
#

where's the port when I type ipconfig in commandprompt

#

i know the ip is the IPV4 thing

night ingot
#

There's no one singular port for your ip

#

you'll need to forward the port you want yourself

sharp totem
#

Something here?<your home IP>:<port>/<your webhook path>

zenith egret
#

how do I do that

night ingot
#

Look up port forwarding

restive otter
#

How would I show server count on the top.gg page?

rain heart
#

-servercount

abstract mothBOT
lean harbor
#

Hey I Am Using ./dblhook Currently For Voting Webhook

#

What Can I Use Now

restive otter
#

Is there any well explained tutorials on DSL/DBL api for Top.gg

fleet lantern
#

i need dashboard creator dm me

delicate badge
#

The API just breaks

#
const Topgg = require("@top-gg/sdk");
const { ShardingManager } = require('discord.js');
const config = require("./BotData/Settings/Settings.json")
const discord = require('discord.js');

const shards = new ShardingManager("./bot.js", {
    token: config.token,
    totalShards: "auto"
})
console.log('Sharding Manger Done.');
//On startup
shards.on("shardCreate", async (shard) => {
    console.log('Shard Startup Successful');
    console.log(`[${new Date().toString().split(" ", 5).join(" ")}]Launched shard #${shard.id} successfully`);

    // Top.gg Bot Stats API
    console.log('Loading Top.gg API');
    const client = new discord.Client() // Your discord.js or eris client (or djs ShardingManager)
    const AutoPoster = require('topgg-autoposter')

    const ap = AutoPoster('top.gg token here', client)

    ap.on('posted', () => {
        console.log('Posted stats to Top.gg!')

    })

    console.log('Bot online now.');

});


//spawning
shards.spawn(shards.totalShards, 10000);```
tepid thunder
#

please fix the vote webhook system see in this logs 1 guys vote logs 6-7 times

tepid thunder
sullen nymph
#

How are you receiving the requests?

tepid thunder
#

also i ma getting 200 reponce

#

here is the logs

sullen nymph
#

What the fuck

tepid thunder
#

:/

sullen nymph
#

How long has this been happening?

tepid thunder
#

from last 1 month

sullen nymph
#

Try responding with a 204 instead

tepid thunder
#

i reported this before

restive otter
#

can yall give me a gist of what happens

#

here

sullen nymph
sullen nymph
#

Your code looks fine

tepid thunder
#

ohk will try with 204

#

its happen like this

sullen nymph
#

Are you voting or pressing Test?

tepid thunder
#

its voting

#

not testing

#

thats not me

#

in the ss

#

see this i also try to vote and for me too its get multiple votes

#

also getting multiple rewards

restive otter
#

i have a question , Can I use a discord webhooks to get the votes ?

sullen nymph
#

No

restive otter
#

ok yes i just found out lol

#

and what about the webhook auth
do i have to make one ?

restive otter
restive otter
#
class TopGG(commands.Cog):
    """Handles interactions with the top.gg API"""

    def __init__(self, bot):
        self.bot = bot
        self.token = 'my dbl_token' 
        self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='auth password', webhook_port=5000)

    @tasks.loop(minutes=30.0)
    async def update_stats(self):
        """This function runs every 30 minutes to automatically update your server count"""
        ch = self.bot.get_channel(ch_id)
        await ch.send('Attempting to post server count')
        try:
            await self.dblpy.post_guild_count()
            await ch.send('Posted server count ({})'.format(self.dblpy.guild_count()))
        except Exception as e:
            await ch.send('Failed to post server count\n{}: {}'.format(type(e).__name__, e))

    @commands.Cog.listener()
    async def on_dbl_vote(self, data):
          ch = self.bot.get_channel(ch_id)
          await ch.send(data)
    @commands.Cog.listener()
    async def on_dbl_test(self, data):
        ch = self.bot.get_channel(ch_id)
        await ch.send(data)

def setup(bot):
    global logger
    logger = logging.getLogger('bot')
    bot.add_cog(TopGG(bot))

i Used This Example From The Docs
It Works Completly Fine With Posting the server counts
but when it comes to the on_dbl_vote and on_dbl_test , it doesn't trigger anything
Can Someone Help Me With That !

night ingot
#

Are you sure you entered the correct IP, and that the port 5000 is open on your network?

restive otter
#

i used replit

#

would that work

#

I successfully got the api to work and I feel accomplished

mild flame
#

Hey new

vestal field
#

webhook is not sending the voting log

#
const Topgg = require("@top-gg/sdk");

const webhook = new Topgg.Webhook("mywebhookishere");

app.post("/dblwebhook", webhook.middleware(), (req, res) => {
  // req.vote wil lbe your vote object, e.g
  console.log(req.vote.user); // 395526710101278721 < user who voted
});

app.listen(3000);```
#

is there anything missing?

merry spear
#

hello i have a question how long i need to wait to my bot is verification

rain heart
lusty terrace
#

+collect

plain garden
#

+collect

restive otter
sullen nymph
#

What's the URL you set on top.gg

hollow flax
#
token = "token"
path = "https://top.gg/bot/735462457061015623/webhooks"
hook = dbl.DBLClient(token=token, bot=bot, webhook_path=path)

@bot.event
async def on_dbl_vote(data):
    print(data)

The on_dbl_vote dont work ...how can i run it ? Hey dont give me any data, if i voting the bot.

sullen nymph
#

uh what

restive otter
sullen nymph
#

Your webhook_path needs to be a route

restive otter
#

oh a root ?

sullen nymph
#

and I mean your own one, a local one

#

not you

restive otter
#

so i can't use https ?

#

oh ok ;-;

sullen nymph
#

You can and you should with repl

sullen nymph
restive otter
#

it doesn't work though ;-;

sullen nymph
#

Sec

#

What's the URL you set

hollow flax
restive otter
#

https://name.repl.co/dblwebhook

#

this what i set it for

hollow flax
restive otter
sullen nymph
#

Fucking hell do y'all have any experience with webservers to at least know what a route is

sullen nymph
restive otter
#

huh ?

hollow flax
# sullen nymph Do you know what a webhook is

i dont understand it rightly...thats my problem.

token = "token"
path = "https://top.gg/bot/735462457061015623/webhooks"
hook = dbl.DBLClient(token=token, bot=bot, webhook_path=path)

@bot.event
async def on_dbl_vote(data):
    print(data)

i dont know what i need, that this is working...

sullen nymph
#

A webhook in web development is a method of augmenting or altering the behavior of a web page or web application with custom callbacks. These callbacks may be maintained, modified, and managed by third-party users and developers who may not necessarily be affiliated with the originating website or application. The term "webhook" was coined by Je...

#

The webhook_path that you need is a /route that comes after the IP and port OR domain in your URL

#

In http://0.0.0.0:5000/route
/route is the webhook_path here

#

and also your DBLClient isn't a webhook by itself, so it's better to name it appropriately, something like dblpy

#

or dbl_client

#

And, as it seems

#

someone hasn't read the docs

#

see the webhook example

#

In order to run the webhook, at least webhook_port argument must be specified (number between 1024 and 49151).

hollow flax
# sullen nymph someone hasn't read the docs

Thanks for your help. But you can really let go of that presumption, claiming that I haven't read the docs. I said that I have problems understanding it. Now I have understood it to some extent and will try the docs you sent here.
I will let you know if I made it.

sullen nymph
#

Don't pay much attention to those, my soul has had enough of today to feel exhausted as hell

#

Anyhoo, to rephrase my point, you need to set webhook_port to something to actually run it

#

Stuff like path and auth is optional, but recommended

toxic thorn
#

Hi, I think I was already trying to solve this issue here but didn't really manage to resolve it. All of the sudden I started getting those "user aborted request" error from I don't know where, which keep happening until the app crashes with "possible memory leaks" issue. Any ideas about it's origin?

hushed reef
sullen nymph
#

Yeah

hushed reef
#

the fuck pepeMeltdown

sullen nymph
#

I'm planning to add on_autopost_success and on_autopost_error events as a replacement for on_guild_post

hushed reef
#

hasn't been working for me for awhile now

#

the cog is being loaded too

sullen nymph
#

Try posting manually

#

Make sure your bot's .user.id matches the top.gg token

hushed reef
#

oh, is the first arg of DBLClient() supposed to be an int?

restive otter
sullen nymph
#

Oh hold on I'm dumb

restive otter
#

;-; ok

sullen nymph
#

Try posting manually via commands.ext task

hushed reef
#

odd

#

i can't get it to work manually either

sullen nymph
#

No errors?

#

Like, are you getting a success response?

plain garden
#

hm

analog osprey
#

Hi

restive otter
sullen nymph
#

E

restive otter
#

and .... now i have another question ;-;
{'bot': 'bot_id', 'user': 'user_id', 'type': 'test', 'query': '?test=data&notRandomNumber=8', 'isWeekend': False}
what does the query and isWeekend refers to ?

rain heart
#

query
https://top.gg/bot/yourbotid/vote?allthatishere=query

#

isWeekend returns true if it is Friday-Sunday

#

can be used for things such as double rewards

wintry ember
#

Where can I find a webhook password?

restive otter
vivid trail
#

youtube api is fun, rip realtime however maybe theres a new one for the new feature

topaz axle
#

I have just implemented sharding on my bot and it is currently using two shards, but on top.gg it says only 1 is being used. Is this something to worry about?

minor warren
#

@fluid rock mdrok your api is amazing

fluid rock
#

yes

pure shell
#

How can I give something to a user when they vote for the bot? I mean, how do I give them coins for votes?

rain heart
lean harbor
#

How To Fix The Webhook Glitch

sullen nymph
#

Which library are you using?

lean harbor
#

I Am Using Superagent

willow spindle
#

elaborate please

odd summit
#

What can one do if they get a bot's topgg token?

rocky bough
#

Post fake stats and potentially get the bot owner banned from Top.gg

odd summit
#

Hmm ty

rocky bough
#

That's unlikely to happen though since staff will try to contact the owner and the owner will reset their token

restive otter
#

yea

gilded swan
warm walrus
#

Wcash

rain heart
gilded swan
#

thanks

tepid thunder
#

@sullen nymph hey still its happning

willow spindle
#

did you respond with 2XX

tepid thunder
willow spindle
#

hmm

#

@elfin solstice

elfin solstice
#

@tepid thunder did you close the connection

#

we only retry on 3 things

  1. Network Exceptions
  2. 5xx Status Code
  3. Timeout of 5 seconds hit
tepid thunder
elfin solstice
#

i don't write python

#

either way

#

its working for everybody else

#

its definitly something on your side shrug

tepid thunder
elfin solstice
#

yea and i tell you thats wrong

#

something is wrong on your side for sure 02shrug

tepid thunder
#

no it wont append this before this is happning after you rewrite the vote/webhook codes or whatever

elfin solstice
#

yea cause before the rewrite it was literally hella broken

#

retrying was broken

#

it only accepted 200 as response

#

and more

#

randomly dropping votes

#

etc. etc.

#

its working and i can only tell you to ensure your code is not running for longer than 5 seconds

#

thats most likely the issue here

night ingot
tepid thunder
night ingot
#

Try using return aiohttp.web.Response(text=json.dumps({'status': 'success'}), status=204) instead

tepid thunder
#

@night ingot like this

night ingot
#

Yeah, I suppose you could just do text='success' as well, if you don't want to return a json object. But shouldn't matter

tepid thunder
#

ohk let me push and check it

#

again

#

@night ingot nope its sending errors

night ingot
#

how are you importing aiohttp? Just import aiohttp?

tepid thunder
#

yes

night ingot
#

that's pretty weird

#

yeah I think @sullen nymph is gonna have to help you. I'm clueless tbh

tepid thunder
#

check this too

#

also the votes still getting multiples

night ingot
#

aiohttp definitely has a web attribute, so I'm not sure why that's happening

gilded swan
#

the api.getVotes() will notify when a user upvote?

rain heart
#

it gets the last 1000 votes

gilded swan
#

ohh

#

why the dbl sdk npm does'nt have upvote notify code?

rain heart
#

you need to make a webhook for it

gilded swan
#
app.post('/dblwebhook', wh.middleware(), (req, res) => {
  // req.vote is your vote object e.g
  console.log(req.vote.user) // => 321714991050784770
})
``` ohh, this code will notify?
rain heart
#

if you have set the webhook url on your bot page settings

#

http://ip:port/dblwebhook

gilded swan
#

alright, thanks :)

supple karma
#

What is the response in POST stats ?

#

ping me :)

willow spindle
#

hmm?

rain heart
#

none

#

as you're just posting

#

not getting

supple karma
#

and how will i get to know that i am rate limited ?

willow spindle
#

you will get 429

supple karma
#

ah yes ... thanks :P

gilded swan
#
const { Webhook } = require('@top-gg/sdk')
const express = require('express')
const User = require("../mongoose/User.js");

module.exports = async (client, config) => {
  
if (!config.api.dblWebhookToken) return console.log('Please enter top.gg webhook api (optional)')
  
const app = express()
const wh = new Webhook('myBotAuth')

app.post('/dblwebhook', wh.middleware(), async (req, res) => {
  
  const findUser = await client.users.fetch(req.vote.user);
  if (!findUser) return;
  
  let userdb = await User.findOne({user: findUser.id});
  if (!userdb) return;
  
  userdb.tofus = userdb.tofus + 100;
  
  console.log(`${findUser.tag} upvote! +1`)
  
})

app.listen(3000);
  
console.log(`top.gg upvote notify ready`)
}
``` is this code right?
#

i try voted, but not send on log

#

(nothing happen)

restive otter
#

hello i have some questions !
is their a way that i can detect a server votes ? , if so , can i use webhooks for that ? , and does that server have to be mine or it can be someone elses?

jaunty plank
#

top.gg webhooks are not compatible with discord webhooks.

restive otter
jaunty plank
#

yes

restive otter
#

oh okeh thank you

tribal anvil
#

My servers aren't updating and its not sending messages to the channel?

#
import dbl
import discord
from discord.ext import commands, tasks
from discord.ext.commands import Cog
import asyncio
import logging


class TopGG(Cog):
    """Handles interactions with the top.gg API"""

    def __init__(self, bot):
        self.bot = bot
        self.token = '' # set this to your DBL token
        self.dblpy = dbl.DBLClient(self.bot, self.token)
        self.update_stats.start()


    # The decorator below will work only on discord.py 1.1.0+
    # In case your discord.py version is below that, you can use self.bot.loop.create_task(self.update_stats())

    @tasks.loop(minutes=30.0)
    async def update_stats(self):
        """This function runs every 30 minutes to automatically update your server count"""
        channel = self.bot.get_channel(828240894800560128)

        await channel.send('Attempting to post server count')
        try:
            await self.dblpy.post_guild_count()
            await channel.send('Posted server count ({})'.format(self.dblpy.guild_count()))
        except Exception as e:
            await channel.send('Failed to post server count\n{}: {}'.format(type(e).__name__, e))


def setup(bot):
    global logger
    logger = logging.getLogger('bot')
    bot.add_cog(TopGG(bot))```
wintry tulip
#

Hey im confused on how I am supposed to use the webhook to get when someone votes for my bot. There are not many python examples on the internet that show how to do this

nocturne magnet
#

Yea no examples for this

#

I need it too

sullen nymph
#

What have you tried so far

wintry tulip
#

I’ve tried to use the β€œon_dbl_vote” thing in the documentation but I started reading about the webhooks and now idk what to do

night ingot
#

What part confuses you?

wintry tulip
#

the link i need for the webhook

night ingot
#

The link will be your public IP, the port you're running the webhook listener on and the path

#

so <public IP>:<port>/dblwebhook for instance

wintry tulip
#

im running my bot on a server though, so should i replace the public ip with the hostname?

night ingot
#

it'd be the IP of the server then, yeah

wintry tulip
#

Ok i'll try that

night ingot
#

remember that the port you've chosen needs to be open as well

sullen nymph
night ingot
#

right ^^

brisk meteor
#

How to make the bot assign the user a role after leaving a reaction?

restive otter
#

mahn

#

can someone help me with posting shard counts ?

#

oh nvm i figure it out

restive otter
#

ooof

#
self.dblpy = topgg.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth= auth, webhook_port = 5000)

doesn't work with topgg module
but with dbl it works fine

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

why is that ?

#

i upgraded dblpy also

sullen nymph
#

Well where are you getting that example from

restive otter
#

idk i just updated the lib , and tried that

restive otter
#

the webhook works but it gives me 404 , but only when i used topgg module

sullen nymph
#

cough v1.0 has significant changes I haven't documented very well publicly

#

Unless you can read the whats_new file (Sphinx format) it's probably worth giving a try to read the source code since everything that's supposed to be used has a docstring

restive otter
#

ok i'll try

jade birch
#

How can i make when someone vote me the bot send message in the channel in my server

#

Ping me when u want to help me

glad rose
#

what do i do in api?

hollow latch
#

c

restive otter
restive otter
#

:/

calm agate
#
(node:3088) UnhandledPromiseRejectionWarning: Top.GG API Error: 504 Gateway Time-out
    at Api._request (C:\Vox\Hideaki\node_modules\@top-gg\sdk\dist\structs\Api.js:76:19)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async Api.postStats (C:\Vox\Hideaki\node_modules\@top-gg\sdk\dist\structs\Api.js:96:9)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:3088) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:3088) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
manic tapir
#

fix it

#

lol

cold root
#

uhhhh

#

guys

shadow scarab
#

...

cold root
#

Is it even close how it should actiauly be looking like?

#

also idk if 0.0.0.0 is what is should be.

#

idk my port... 😦

#

do I need to do a portforward?

cold root
rain heart
#

0.0.0.0 is not a proper ip

cold root
#

ya

#

ik

#

wait

#

Idk my port

rain heart
#

then why are you entering the 0.0.0.0 in there?????

cold root
#

my is is... wait do u need it?

cold root
#

my bot said so

rain heart
#

ignore what your bot says

cold root
#

the code for it is

rain heart
#

0.0.0.0 means "Being able to connect from anywhere"

#

ignore that

cold root
#
console.log(`Webhook up and running at http://${hook.hostname}:${hook.port}${hook.path}`);```
rain heart
#

You might have seen webhooks mentioned in your apps' settings and wondered if they're something you should use. The answer, in a nutshell, is probably yes.
Webhooks are one way that apps can send automated messages or information to other apps. It's how PayPal tells your accounting app when your...

cold root
#

bruh

#

ik what webhooks are

#

just my first time working with APIs.

#

so wait, how do I know my port?

#

I cant find any...

#

I tyed like 50 ports today

#

and olike 80 yesterday

#

Is there a software that like... looks ur ip is all ports, and finds it for you?

rain heart
#

you're really confused about basic networking, about how ports work etc

#

please read more about how a port works and networking in general, as that is quite important for working with webhooks.

cold root
#

how do you know I am? ...

#

wait

#

I do know how the work

#

its a connection between computers

#

devices

rain heart
#

0.0.0.0 is not a proper ip
"list all ports" is not a thing when choosing ports

cold root
#

But how do I know MY port?

rain heart
#

You need to open it, please read up on how basic networking works

cold root
#

fine.

restive otter
#

@cold root hey bro

#

I need some help on Economy commands

restive otter
#

which api do i pick'

#

?

night ingot
#

The one for your library

harsh nexus
restive otter
#

do i put iy in a idex.js file#

#

?

crimson stratus
#

what

#

are you ready

toxic thorn
#

I read the news site about slow/failing votes and it states it's fixed. I'm getting dozens of reports that people didn't get vote rewards and I got log for only like 1/5 my test votes. Sooo, still undergoing some problems?

toxic thorn
#

seems it's getting better, it were dozens of reports about not counting votes from past few hours tho

next ginkgo
#

hey.... i cant autopost server count it gives an error : "object Lock can't be used in 'await' expression" can anyone help??

scarlet cobalt
#

One message removed from a suspended account.

sullen nymph
#

e

scarlet cobalt
#

One message removed from a suspended account.

sullen nymph
#

Or clone the Git repo but it has significant changes that might break your bot

sullen nymph
#

P.S. v1.0 (aka the one on GitHub) fixes that

next ginkgo
#

hmm..... i will downgrade python version

pseudo light
#

Do you know how to check if someone voted for my bot using top.gg/sdk without a vps ?

heavy crater
#

my bot is in 15 servers but it still show N/A why??

solemn eagle
#

πŸ‡΅ πŸ…ΎοΈ πŸ‡¬

rain heart
abstract mothBOT
#

@heavy crater

To have your bot's server count displayed on Top.gg, please read the documentation on server/shard posting.

rain heart
pseudo light
#

thank you

crisp stream
#

how do I connect the votes with the webhook it didnt work with me

crisp stream
cold root
#

umm

#

hi

spice helm
#

Hi, i've posted my server count using bot.dblpy.post_guild_count() on my discord.py bot, it raised no errors but servers don't appear and the widgets won't show anything, is there anything i have to enable?

cold root
#

um

#

are these my ports?

green mantle
#

the ports that are in use it seems

spice helm
#

Ah it's showing up now, i think i had to put await before that

green mantle
#

it's a coroutine so would be a good idea fingergunz

restive otter
#

@restive otter

acoustic lark
#

Should this API work I have tested it and it is not working (I use discord.py)

`#DBL API
class TopGG(commands.Cog):

def __init__(self, bot):
    self.bot = bot
    self.token = "My DBL token" # set this to your DBL token
    self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True) # Autopost will post your guild count every 30 minutes

@commands.Cog.listener()
async def on_guild_post(self):
    print("Server count posted successfully")

def setup(bot):
bot.add_cog(TopGG(bot))
#DBL api end`

#

Sorry that the code it looks like a mess

sharp totem
#

I want to check if a user has voted for server

#
  url = f"https://top.gg/api/bots/{server_id}/check?userId={user}"

will this help?

sullen nymph
#

DSL doesn't have an API

sharp totem
#

So no way?

sullen nymph
#

Not without webhooks and storing them locally

short leaf
#

does anyone know how to get the money here?

rain heart
#

-api

abstract mothBOT
#

This channel is ONLY for the Top.gg API!
This channel is only for: suggestions/help/bugs to do with official API libraries and API docs found at: https://docs.top.gg
Any Off-Topic conversation may get deleted and muted.

If you need help with development about your bot or development in general, feel free to use #development.

half stratus
#

Sa

frigid urchin
#

-servercount

restive otter
#

ok

hollow field
#

Good evening,
I always get an error when I work with the server count. I use Python 3.9, can someone help me?

midnight plume
#

are you trying to use multithreading + asyncio?

#

I don't think that's how it works-

hollow field
#

I have copied it 1 to 1 from the website

cinder ledge
#

it should be updated probably

restive otter
#

hey, how does webhooks work?

exotic hinge
#

How do I send a message whenever someone votes using webhooks? I use python

exotic hinge
#

i keep getting this

#
at=error code=H14 desc="No web processes running" method=POST path="/dblwebhook" host=messagetracker.herokuapp.com request_id=04e2dd7e-d912-40de-9c11-5d1d04cf7fcf dyno= connect= service= status=503 bytes= protocol=https
opal panther
#

how do i tell it what url to use? (instead of IP)

winter tusk
#

Hmm so I need express to receive the vote and I cant directly do like api.on('vote', () => {})?

restive otter
#

check pins

winter tusk
#

in the pins

#

topggauth123

restive otter
#

the password you choose

winter tusk
restive otter
#

yeah

winter tusk
#

New to express

#

Sad

winter tusk
sullen nymph
#

wdym server link

#

Do you mean a Discord server/webhook or a physical webserver

winter tusk
#

localhost:port

#

Webserver

sullen nymph
#

http://0.0.0.0:port/path
where 0.0.0.0 is your machine's IP address
port is whatever port you run the webserver on
path is the route to use specifically for top.gg requests

#

as for the Authorization/password, you create it yourself

winter tusk
#

How

sullen nymph
#

since that's what it is, a password you use to confirm that requests are coming from top.gg

#

Well, how do you create a password? You come up with one, and then enter it somewhere

winter tusk
#

How do u create a password exactly

#

Store a random password in .env

sullen nymph
#

Are you using the top-gg/sdk package or express

winter tusk
#

Then use it where

winter tusk
#

And express

winter tusk
#

express recieves the vote

sullen nymph
#

So I guess you're using topgg.Webhook

#

where topggauth123 is just the example

#

You store the password wherever you want and enter it in the Webhook constructor

winter tusk
#

:0

#

@sullen nymph I should enter the webserver url here right?

sullen nymph
#

Yup

winter tusk
#

ty

#

And

#

wait

#

Where do I get the url?

#

localhost:port?

winter tusk
#

tu

#

Ty

winter tusk
#

@smoky swift @fresh plover

#

...

sullen nymph
#

If you're using the default example, it will be /dblwebhook

brittle spoke
#

dude really ghost pinged bean .-. also why not just ping shiv?

brittle spoke
#

quit acting dumb I saw KEKW

#

plus they have logs

winter tusk
# sullen nymph If you're using the default example, it will be `/dblwebhook`
const topgg = require('@top-gg/sdk');
  const express = require('express');
  const app = express();
  const webhook = new topgg.Webhook(process.env.TOPGG_WEBHOOK_PASSWORD);
  
  app.get('/', (req, res) => {
    res.send('hello world');
  });
  
  app.post('/dblwebhook', webhook.middleware(), (req, res) => {
    res.send('one req');
    console.log(req.vote);
  });
  
  app.listen(3000); ``` 
URL: m.y.i.p:3000/dblwebhook
Passwords are same.
#

doesn't log

#

I tested the webhook by pressing the testwebhook

#

localhost:3000 website says helloworld

#

myip:3000 website doesnt losd

sullen nymph
#

Don't forget http://

winter tusk
#

:0

sullen nymph
#

Make sure port 3000 is open

winter tusk
#

It has http://

sullen nymph
#

Router settings + firewall settings

winter tusk
#

Wot

#

I just run it on my MOBILE

winter tusk
#

How to check the router settings

#

Btw how do I get my ip address? @sullen nymph

#

I just got it in mongodb, network access

sullen nymph
#

Since you are hosting it locally you could either get it via ipconfig or websites like "what's my IP address"

sullen nymph
#

Forward port 3000 to to your device

winter tusk
#

how to get the time remaining to vote?

#

will api.getUser(id) return that?

#

@sacred shell @proud cloud

#

@fresh plover @smoky swift

pine heart
#

ping 4 mods where 3/4 are on dnd niceKEKW

winter tusk
#

what's dnd?

#

Do not distrub

sullen nymph
#

Do Not Disturb

winter tusk
#

O

#

@sullen nymph how to get the time remaining to vote?

#

:)

sullen nymph
#

You pinged me once

winter tusk
#

uhh

pine heart
#

you have to store that yourself in a db or whatever

sullen nymph
#

That was more than enough. Stop pinging everyone and be patient.

winter tusk
#

how to get the time remaining to vote? Does api.getUser(id) return that

sullen nymph
#

The API doesn't show when a vote expires

pine heart
winter tusk
sullen nymph
#

That'd require webhooks, which isn't exactly what's being discussed

pine heart
#

ohhhhh sry then

sullen nymph
pine heart
#

I thought u were talking about webhooks

sullen nymph
#

Still helpful tho Tog you're cool

pine heart
#

dont mind me

winter tusk
#

So I need to create webhooks

winter tusk
#

@sullen nymph hello sry for ping, u there?

sullen nymph
#

more or less

reef delta
sullen nymph
#

I got a ping here apparently

#

and I might be able to guess why and from whom

#

@craggy sentinel oi bro mind taking a wee look in logs for a ghost ping here?

rain heart
#

@sullen nymph Dash#7374 ghostpinged you

sullen nymph
#

Of course he fucking did

#

So is he gonna get a warning to stop ghost pinging or what

rain heart
#

@winter tusk if you need help for anything, be patient and wait for responses, ghostpinging just doesn't help

#

If you continue ghostpinging, i will mute you

winter tusk
#

:0

winter tusk
#

Is there any way to check the time remaining to vote for an user either manually or via the api? I can't use webhooks without webhooks how can I?

rain heart
#

you can't

#

only through a webhook it is possible

winter tusk
#

No suggestion channel?

#

@rain heart I'm new to webhook thing, is there any way I can use the webhook without express

rain heart
#

i doubt it will be implemented, as you can simply do that with webhooks

winter tusk
#

I cant use express coz.
herolu only allows 1000 hours (41 days) per month host, if I use express, I need 2 working thing called dyno, and only 20.5 days hosting will be available

#

Heroku*

rain heart
#

nope

#

unless you change to a proper host

winter tusk
#

NO PAYMENT

#

only free

rain heart
#

none

winter tusk
#

digital ocean?

#

I have github student pack

#

It offers something

sullen nymph
#

DO offers credits, which you can use to rent a VPS

winter tusk
#

What tut mean?

sullen nymph
#

DigitalOcean's sorta currency

winter tusk
#

Btw I didn't intent to ghost ping u.

#

Intend*

#

I sent a msg

#

waited 3 mins

#

U didnt reply

#

I wanted u not to see that msg anymore

#

So I deleted

#

Sad

winter tusk
#

Perma?

sullen nymph
#

You usually rent a VPS on a monthly basis

#

that VPS will cost you X credits per month

winter tusk
#

@rain heart Ig I got something, can u say does that work?
api.getVotes() returns all the votes,
so if a user is there, Can I say that he still has the vote cooldown?

rain heart
#

you can also do a direct check

#

check the docs

winter tusk
#

hasVoted()?

rain heart
#

yes

winter tusk
#

@rain heart well another thing in my mind.
On Bot login, getVotes() and then upload to db.
SetInterval 30mins, and checkAgain getVotes(), if the array length differs and one voted is missing, I can say that user's cooldown is over right?

rain heart
#

can't help with that, have no js knowledge

winter tusk
#

sad

sullen nymph
#

getVotes gets last 1000 votes for this month

#

Not feasible here

winter tusk
#

if I get 1000 members, some1 would donate and I can get a fking VPS

#

One single soul would donate

sullen nymph
#

Possibly

quick needle
quick needle
restive otter
#

@quick needle guys I don't see the create Web hook option in my discord server?

#

What do I do

rain heart
#

you cannot use discord webhooks

#

you need to make your own webhook

restive otter
#

@quick needle oh sorry

#

Thought u were a helper

restive otter
rain heart
#

read the docs

restive otter
rain heart
#

because you need to use code to make one

restive otter
#

Guys, how can I see who voted for my bot on top.gg? Please ping me when you respond.

#

@rain heart

rain heart
restive otter
#

I have been looking there for a while but I don’t see what I am looking for, where can I locate it on the docs?

#

@rain heart?

rain heart
#

is the best i can give you

restive otter
#

Ok

untold cradle
#

It would help people if you put your code also

sullen nymph
#

Send your code

delicate badge
abstract kernel
#

Hey

#

Can anyone help me

#

Δ° want to learn who woted my bot

#

Δ° saw webhooks on the Website but i can't understand anything

#

How can i setup the webhooks?

#

Δ°f anyone can help me plz ping me

mystic iron
#

poto

keen arch
#

(node:8044) UnhandledPromiseRejectionWarning: Error: 401 Unauthorized

Why do i see this in my log when i run a command which checks if a user has voted for my bot?

frail fable
#

Why can notπŸ™ƒ

frail fable
restive otter
#
const Topgg = require("@top-gg/sdk"); 

const express = require("express"); const app = express();

 const webhook = new Topgg.Webhook("your webhook auth"); 

app.post("/dblwebhook", webhook.middleware(), (req, res) => { 
db.add(`balance.${req.vote.user}.wallet`, 5000)
console.log(req.vote.user);  
 }); app.listen(80);```
Is this correct for rewards?
sullen nymph
#

Why are you converting everything into a string

sullen nymph
#

If you do, try refreshing it

restive otter
sullen nymph
#

Idk, is it? Why not try and see for yourself?

restive otter
#

hmmok

#

Iam asking just for confirmation

keen arch
sullen nymph
#

It can. That's why webhooks are highly recommended

rose yarrow
#

I am planning to make some cmds require voting to use, avt 3 cmds from each category of my bots cmds, which will be the best way to check if a use voted, currently i am just using the api to see the bot voted, i have a webhook for vote logs i could just maybe store the users id in my db and check later with my db

#

So what would be the best way

#

Req the api or using my own db

#

I am thinking abt the db option as if a user spams the cmd, i can
Get ratelimited

sullen nymph
#

Correct. Storing the votes locally is the most viable option in this case

rose yarrow
#

Ye ill just do that

#

Better than having to request the api everytime

#

Thanks for the answer

sullen nymph
gusty hamlet
#

@sacred shell multiple channels

pseudo light
#

I want to see when someone vote for my bot but it doesn't work :

const Topgg = require('@top-gg/sdk');
const express = require('express');
const app = express();
const webhook = new Topgg.Webhook(config.AUTH_PASS); 
const api = new Topgg.Api(config.tokenDBL);

app.post('/dblwebhook', webhook.middleware(), (req, res) => {
    console.log(req.vote.user + " has voted")
}) 
app.listen(<Port>)
#

What do I have to write here

#

YES I KNOW NOW !!!!

#

I'm so happy...

hushed reef
#

😁

pseudo light
#

But I can't send something to the user.
I tried :

client.users.cache.get(req.vote.user).send("Thanks")

I have this error :

......(I don't see the error ^^')

#

Oh it works

#

I don't know why it didn't work before

#

I want to hug everyone i'm so happy ^^

sullen nymph
#

I'll have a good laugh if you're gonna become the person who fixes their errors by themselves by the time someone responds

slow shuttle
#

how do you get your bot's status to show on dbl as online?

rain heart
#

You can't as of now

slow shuttle
#

ah is it a feature relating to the bot being in here?

rain heart
#

No, just not changeable

wet drift
#

what else is there then guild count post?

rain heart
#

shard

sullen nymph
#

Shard count

wet drift
#
    @commands.Cog.listener()
    async def on_dbl_vote(self, data):
        await self.bot.owner.send(str(data))
#

doesnt work

#

bot.owner does work

rain heart
#

you need to make a webhook

#

read the full docs

wet drift
#

oh

#

how do you create a webhook

slow shuttle
#

bruh

sinful copper
wintry kernel
#

Are there any webhooks for server voting?

#

If it does exist, could someone point me to the docs link foe server related endpoints, as I'm not able to find it

#

Never mind, its just an alternate payload

nocturne quarry
#

hi

#

I am unable to post server count to top.gg it says 401 error

night ingot
#

That means you have the wrong token

nocturne quarry
#

Now I'm trying axios and says 401 error

night ingot
#

Did you provide your token in the headers?

nocturne quarry
#

no I just provided Authorization key

#

Is it required?

night ingot
#

For posting server count you need to provide the token

nocturne quarry