#topgg-api

1 messages · Page 159 of 1

rain heart
#

not getting

hidden brook
#

yea both return the same thing

rain heart
#

they dont

#

posting is for posting stats

#

getting is for getting stats

#

they dont do the same thing

hidden brook
#

well when i get It only gives me shards

rain heart
hidden brook
#

{ shards: [] }

rain heart
#

you never posted anything to the api then

restive otter
#

Startbot

scarlet cobalt
#

One message removed from a suspended account.

cloud yew
calm agate
#

how to get the id of the user who voted the bot?

lilac nacelle
#

how can i make my bot dm a user who votes on my bot?

sterile moat
lilac nacelle
#

xd

coarse rune
#

Hi

#

Can i know some one who can help me and is using js and replit

#

Pls dm me if you know

coarse rune
#

Oh no i need it for api

mighty crater
#

ah

coarse rune
#

@mighty crater

mighty crater
#

What exactly do you need help with, what part of the API?

coarse rune
#

Like see i use replit and i want to make voting rewards

#

So my repl name is test

#

That's my code

#

And it does not work

graceful lily
#

I am getting this error in my console Top.GG API Error: 429 Too Many Requests I have regenerated the api token and even made it so that the bot updates the stats every hour yet I still get the error

vagrant karma
#

Why does my voting not work

#

Poketwo voting is being annoying and it’s not letting me vote

graceful lily
#

discord.js

mighty crater
#

rate limited catShrug

graceful lily
#

sad

mighty crater
graceful lily
#

plus cuz my bot has been growing too so yea understandable

narrow vector
#

How do I just check if someone has voted when they run a command?
I tried (python):

Voted = requests.get(f"https://top.gg/api/bots/:bot-id/check?userId={ctx.author.id}").json()["voted"]```
But I got an authentication error. How would I set the authentication with my API token in my code so it should respond properly?
sullen nymph
#
  1. Doing an API request on command usage is a bad idea, so it's probably better if you cache the results (or use a webhook altogether)
  2. Please use aiohttp instead of requests along with discord.py

Putting those aside, you need to set the Authorization header with your bot's top.gg token and send it in the request

narrow vector
#

What would setting the Authorization header look like in the code?

#

I'm new to aiohttp

sullen nymph
#

it's the same in aiohttp and requests, a headers argument that consists of a dictionary with your headers and their values

narrow vector
#

So like, response.headers['Authorization'] = "API Token"?

sullen nymph
#

Not response

#

in the .get method itself

#

since you need to send the header with the request

restive otter
#

eg requests.get(url,headers={"Authorization":authstuff})

oblique canopy
#

Is there API/Webhook support for Server Bumps, or is it just for Bot Bumps?

primal silo
sullen nymph
#

Yes

primal silo
#

ohh, ok ty

fleet tulip
#

is it possible to get the amount of votes a user has?

light orbit
#

hello

#

pls how can i get my auth webhook

jaunty plank
#

auth is like a password, you choose it.

light orbit
#

ok

light orbit
#

pls how can i make when someone make vote it send message from discord bot someone voted

rain heart
spice helm
steep karma
rain heart
#

port of the webhook http server

#

something you define yourself

light orbit
#

why when someone vote it doesn't do anything !!

steep karma
rain heart
#

you cannot use discord webhooks

steep karma
#

oh ok

light orbit
rain heart
#

discord webhook

#

I wasn't referring to you though

light orbit
#

oh sorry

kindred walrus
#

excuse me?

#

please explain

#

this is 1000% a memory leak

#

it'll add a listener to your code everytime someone votes

#

and you'll have node crash with maxEventListeners reached(22)

restive otter
#

Do bot owners no longer trigger webhook requests upon voting for their own bot?

green mantle
#

no they work

steep karma
restive otter
kindred walrus
#

is it fine if i slap people with the "learn js first" wall of text even though its not for bots?

restive otter
# green mantle no they work

Are you sure, as in you've tried it in the past 2 days? That's when it started not working for me, even though it works for everyone else who votes

light orbit
#
const discord = require('discord.js')
const Topgg = require('@top-gg/sdk')
const express = require('express')
const app = express()
const client = new discord.Client()
const webhook = new Topgg.Webhook("my auth webhook
")

client.on('ready', () => {
    console.log(`ready ${client.user.tag}`)
})
app.post("/dblwebhook", webhook.listener(vote => {
    console.log(vote)
    client.channels.cache.find(i => i.id === "858730735728328764").send(`**📩 -> \`<@${vote.user}>\` voted in https://top.gg/bot/805607988151975986/vote**`)
}))
app.listen(80)

why it doesn't do anything !!!

green mantle
restive otter
#

That's really odd. It just suddenly stopped working for me. Didn't even make any changes to any code at all

#

Both bot votes and server votes

acoustic badger
#

how this work?

lilac nacelle
#

anyone wanna share a fully working code for the on vote thing?

safe comet
proud rune
#

Wait,can i use top.gg API for nonBot purposes?

rain heart
#

No

#

Well you technically can, just not able to due to not owning a bot

balmy hamlet
#

Are library devs given a bypass for that?

sullen nymph
#

Nope. They're supposed to be owners of the libdev bot but teams are broken right now

balmy hamlet
#

I've had that question for weeks now lmao

real yew
#

How Can I Get Total Number Of Votes Of A User ?

hushed reef
#

I had to ask someone for their Top.gg API key and test my code on theirs before my account was even fixed laugh

real yew
lilac nacelle
safe comet
#

then? noobthonk

lilac nacelle
#

no luck

safe comet
#

show ur code

lilac nacelle
#

and where should i even put the code

safe comet
#

here???

lilac nacelle
#

nah like in the bot

#

xd

#

just in index.js

#

or what

safe comet
#

i think anywhere should be fine

lilac nacelle
#

ok

#

ok wait

#

@safe comet

#
const express = require('express')
const app = express()

const Topgg = require('@top-gg/sdk')
const w = new Topgg.Webhook('what should i even put here?')

app.post('/topgg', w.listener(vote => {
  console.log(vote.user)
}))

app.listen('8000', () => {
    console.log('App listening on port 8000');
});
lilac nacelle
safe comet
#

u should out the webhook password form ur bot/server

#

then paste the url from express in the uhhh
dashboard?
idk what its called

lilac nacelle
#

what url

safe comet
#

what r u trying to do?
r u getting a vote from server or bot
if bot i cant helo u with that since idk how that works
i only know server

lilac nacelle
#

if someone votes on top.gg it will print it in console

#

thats what im trying to do

#

bot

plucky lance
#

The webhook service is basically a webserver listening to incoming requests (from topgg).
The webhook URL you have to enter on topgg is the public IP or DNS of the machine your webhook service is running on.

safe comet
#

i dont have a bot so i dont know how to get the token/pass

plucky lance
#

That requires to add an inbound rule for the port (TCP) you specified in the code if the default policy is DROP.

lilac nacelle
#

eh?

#

is it just the domain i need to put in or what xd

plucky lance
#

If that hostname has your machine as target the webhook service is running, then yes.

lilac nacelle
#

ok but what about the code itself

plucky lance
#

If that’s the example from the docs it should be up to date and working

lilac nacelle
#

docs

plucky lance
#

As long as port 8000 is accessible

lilac nacelle
#

i mean i get the port 8000 log in console

plucky lance
#

That doesn’t automatically mean the port is open tho

#

Just test it by entering the hostname or IP of your server your webhook service is running on on topgg, click save and test.

lilac nacelle
#

webhook service

#

i dont have a webhook service

#

i think

plucky lance
#

The code is a webhook service

lilac nacelle
#

so i cant use it?

plucky lance
#

As I mentioned above this code is creating a webhook service/listener for incoming requests on your system

lilac nacelle
#

yes

plucky lance
#

Topgg is sending this request to your system if you have entered its IP/DNS on topgg

lilac nacelle
#

so my bots IP/DNS should be in top.gg?

plucky lance
#

If the webhook service is running it will receive the posted request

#

The IP/DNS of the machine the code you showed above is running on

#

The machine has a public IP and/or DNS you have to enter on topgg to “let them know” where to send the requests to

#

If you wanna receive a SMS the sender needs to know your number, too

proud rune
rain heart
proud rune
#

Oh

atomic sorrel
#

sooo i tried the top-gg autoposter thing

#

i put my token in but it gives this

#
TypeError: (topggtoken)  is not a legal HTTP header value```
rain heart
#

You didn't properly set the variable

#

Post your code

atomic sorrel
#

im still learning so i used the example from the docs...

but here ig


const poster = AutoPoster(process.env.TOPGG_TOKEN, client) 

poster.on('posted', (stats) => { 
  console.log(`Sucsessfully posted data onto top.gg! | ${stats.serverCount} servers`)
})```

just want to know whats wrong. so i can avoid myself from not making the mistake again
i have a feeling i did smthn wrong... but im still learning so yeah
deft hollow
restive otter
#

where do i get the token from?

spice helm
restive otter
#

ah

grim spear
#

Guys

#

Where do you think I went wrong I've been trying for 2 hours please can you help me

const DBL = require('top.gg');
const tokenn = ayarlar.dbl
const dbl = new DBL(tokenn, { webhookPort: 5000, webhookAuth: 'testingx!5x' });
dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
    let sunucu = client.guilds.cache.get("there is SERVER ID")
if(sunucu.members.cache.get(vote.user.id)) {
    client.channels.cache.get("there is channel id").send(`Thx ${vote.user.username}! I gave you role.`)
} else {
    client.channels.cache.get("THERE IS CHANNEL ID").send(`Thx ${vote.user.username}!`)
}
});
golden adder
#

Isn't that dblapi.js? That's deprecated.

#

Use the packages in the pins.

restive otter
#

How can I get top.gg api token? (Please answer.)

lilac nacelle
#

analytics

#

wait

#

no

#

webhooks

shadow palm
#

hi ahh i was testing the on dbl vote event in python and when i test voted for the first time, i got this error

/root/redenv/lib/python3.8/site-packages/topgg/webhook.py:141 in _run                                                                              │
│ ❱ 141             self.__app.router.add_post(webhook["route"], webhook["func"])                                                                    │
│ /root/redenv/lib/python3.8/site-packages/aiohttp/web_urldispatcher.py:1167 in add_post                                                             │
│ ❱ 1167         return self.add_route(hdrs.METH_POST, path, handler, **kwargs)                                                                      │
│ /root/redenv/lib/python3.8/site-packages/aiohttp/web_urldispatcher.py:1094 in add_route                                                            │
│ ❱ 1094         resource = self.add_resource(path, name=name)                                                                                       │
│ /root/redenv/lib/python3.8/site-packages/aiohttp/web_urldispatcher.py:1071 in add_resource                                                         │
│ ❱ 1071             raise ValueError("path should be started with / or be empty")  ```
#

i dont understand the path thing

#

it says path should be started with / but wouldnt i put the complete url for my webhook?

sullen nymph
#

No

#

If you put your Discord webhook URL there I'm praying for your soul

#

It's a route on your machine's IP:port

#

aka http://your.machine.ip.address:yourport/mypathhere

#

route = path

shadow palm
shadow palm
golden adder
#

Start praying shiv 😌

sullen nymph
#

Lol

sullen nymph
#

I thought you could redirect the request from Integromat to Discord webhooks directly

shadow palm
#

well i mean, there isnt any proper tutorials or anything and im a guy who really needs a proper turorial to understand how to do stuff the first time

shadow palm
#

i am pretty sure his way might cause a few (maybe many) problems in the future. idk its just me

sullen nymph
#

🤔 then you don't need integromat

shadow palm
#

im really sorry for being petty here, but if not then could u guide me how?

sullen nymph
#

You want just one middleman, aka your topggpy webhook. Top.gg would send requests to it, and you would handle them however you want to

#

The catch here is that Integromat would process the requests for you and do something, but since you want to do that with your webserver, you can scrap Integromat altogether. You want to receive the vote data directly in the webserver and process it manually

#

Say, save it in database or post a message in a Discord channel

shadow palm
#

so i put my vps ip then the port aka 5000, and then the route to my bot file?

sullen nymph
#

Not that route

#

Your local files don't have anything to do with it really. You set up a listener on some port, which would handle various paths (routes), which are set via the helper methods in topggpy

#

If you want bot webhook on ip:port/dbl, you set the path to /dbl

shadow palm
#

oh ok. then that should work? imma tias

#

(try it and see)

#

oh and ill have to put the same url in my topgg bot profile right?

sullen nymph
#

Bot profile?

#

In the Webhooks section, you mean?

#

As the webhook URL

shadow palm
#

yup

sullen nymph
#

Then yeah, refer to this...

#

Where tf is it

shadow palm
#

yeye ok thank u so much for bearing my dumb ass bj_pray

sullen nymph
#

Hey that says you're a bearable dumbass unlike some people

#

We both are dumb so it's ok

shadow palm
shadow palm
sullen nymph
#

o7

shadow palm
#

ummm im still getting the same error cryIgnore

heres what i did

self.bot.topgg_webhook = topgg.WebhookManager(self.bot).dbl_webhook("http://myip:5000/dbl", "password")```
and yes i did replace my ip with my actual ip.
golden adder
shadow palm
#

same thing as*

#

imma try that too

golden adder
#

Lemme know if that works

shadow palm
golden adder
#

Np 🙂

olive cargo
#

yo can i have some help im trying to make it send a message when ever someone votes for my server

const Discord = require('discord.js')
const client = new Discord.Client({})
client.login("TOKEN")

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

const app = express()
const webhook = new Topgg.Webhook('very-special-auth-thing') 

app.post('/voted', webhook.listener(async vote => {
  let channel = client.channels.cache.get('771606504544403466')
  let user = await client.users.fetch(vote.user)

  channel.send(`${user.tag} voted for the server!!`)
})) 

app.listen(2020) 
safe comet
#

any issue?

olive cargo
safe comet
#

did u vote/test voted

olive cargo
#

Tea

#

Tea

#

Fuck

#

Yea

safe comet
#

have u put the correct url for the webhook?

olive cargo
#

Uh yea I’m pretty sure

#

I’ll check over it when I get back home

safe comet
#

try console logging vote or something

olive cargo
#

When I press like the “test send” button it just error

safe comet
#

error in the code or something else?

restive otter
#

can you send an example code for the api in discord.py

restive otter
#

thnx

atomic sorrel
#
const express = require('express')
const app = express()

const Topgg = require('@top-gg/sdk')
const w = new Topgg.Webhook(process.env.topgg_webhook_auth)

app.post('/topgg', w.listener(vote => {
  console.log(vote.user)
}))

app.listen('8000', () => {
    console.log('App listening on port 8000');
});```
#

is there anything wrong with the code? cause when i tried voting, it dosent print anything.

sullen nymph
#

Use w not app ig

indigo phoenix
#

where can i get the token for the API?

sullen nymph
#

See pins

willow spindle
#

@proud cloud

proud cloud
#

@restive otter No ads thank you

indigo phoenix
#

While using the api to post guild count its keeps showing attribute error aexit
What does that mean?

restive otter
#

Traceback might be helpful

sullen nymph
#

Interesting

atomic sorrel
sullen nymph
#

What does the official example say?

lilac nacelle
#

Ok so basically for the vote thing
https://u.suck.rocks/QMYuAzgy

const express = require('express')
const { Webhook } = require('@top-gg/sdk')
const wh = new Webhook('authhere')
const app = express()
app.post('/webhook', wh.listener((vote) => {
    console.log(vote.user)
}))
app.listen(port) // the port of your machine (where your bot is hosted)
atomic sorrel
#

ooh k

lilac nacelle
#

took me a while to understand

#

but yeah this works

coarse rune
#

hi

#

can someone help me

#

i have the code and it works

lilac nacelle
#

whats up?

coarse rune
#

can someone help me to send a message to the user who voted

#

discord.js

lilac nacelle
#

sure

coarse rune
#

thanks

lilac nacelle
#
client.users.cache.get(vote.user).send("Thanks for voting!");
coarse rune
#

ok thanks

#

thanks a lottttttttt!!!!

lilac nacelle
#

no problem :)

coarse rune
#

in return i will add your bot to my server

lilac nacelle
#

thank you :)

rancid brook
#

Hxppy

#

COuld you help me?

indigo phoenix
rancid brook
restive otter
#

That doesn't change the fact that you should post the traceback

rancid brook
lilac nacelle
lilac nacelle
rancid brook
#

COuld we do it in DMs

lilac nacelle
#

sure

lilac nacelle
coarse rune
#

i sec

lilac nacelle
#

ok

coarse rune
#

TypeError: Cannot read property 'send' of undefined

#

@lilac nacelle

lilac nacelle
#

oh

#

can u send the code (without the auth thing)

coarse rune
#

ok

#

const webhook = new Topgg.Webhook(token) 

app.post('/top.gg', webhook.listener(async vote => {
  client.users.cache.get(vote.user).send("Thanks for voting!");
})) // attach the middleware

app.listen('8000')```
lilac nacelle
#
const express = require('express')
const { Webhook } = require('@top-gg/sdk')
const wh = new Webhook('authhere')
const app = express()
app.post('/webhook', wh.listener((vote) => {
    console.log(vote.user)

    client.users.cache.get(vote.user).send("Thanks for voting!");
}))
app.listen(port) // the port of your machine (where your bot is hosted)
willow spindle
coarse rune
#

@lilac nacelle

lilac nacelle
#

hm

#

weird

#

where did u put that?

#

in what file

coarse rune
#

Index.js

#

@lilac nacelle

lilac nacelle
#

hm

atomic sorrel
#

uh

TypeError: Cannot read property 'Api' of undefined```
code: 
```js
const { Webhook, Topgg } = require('@top-gg/sdk')
const api = new Topgg.Api(process.env.TOPGG_TOKEN)

client.on('ready', () => {
  api.postStats({
    serverCount: client.guilds.cache.size
  })
})```
lilac nacelle
coarse rune
#

Yes

#

Can u send me your code

coarse rune
#

Oh

#

Does not work for me

lilac nacelle
#

why

coarse rune
#

Idk

lilac nacelle
#

didnt u do what i send higher up?

lilac nacelle
coarse rune
#

Yea i did it

lilac nacelle
#

then it should work

#

u need the ip and port of where u host ur bot

violet sorrel
#

Can anyone help me to create vote command on discord.js if yes then dm me

atomic sorrel
ashen copper
#

for the topggpy built-in webhook do i only have to open the port in my firewall?

coarse rune
lilac nacelle
#

oh

ashen copper
#

oh

lilac nacelle
#

idk if u can

sullen nymph
#

so yes

ashen copper
#

yeah yeah i know i have to but is it purely my firewall that has to allow it

sullen nymph
#

Mhm

ashen copper
#

alright great

#

makes my life a lot easier

sullen nymph
#

Not sure what else would be required tbf KEKW

ashen copper
#

I dont know lmfaoo just making sure

quasi solar
#

wht comes in password section in

self.client.topgg_webhook = topgg.WebhookManager(self.client).dbl_webhook("/dblwebhook", "password")```
sullen nymph
#

Any text you want

quasi solar
#

ok

golden adder
#

It's your topgg token

sullen nymph
#

Nope

quasi solar
#

uhh r u sure @golden adder

sullen nymph
#

That's used in DBLClient. Webhooks' authentication is done via "passwords" that users create

quasi solar
#

ok

golden adder
#

Oh my bad oopsy

ashen copper
#

I might be misreading or missing something but what URL do I need to put in the webhooks section. Using the topggpy webhook so /dblwebhook, I tried putting in /dblwebhook in the URL but that didnt seem to do anything

#

cant figure it out for the life of me

sullen nymph
#

Are you sure the webhook is running and that you're not visiting the wrong port?

ashen copper
#
bot.topgg_webhook.run(5000)```

I have this under the \_\_init\_\_ in my class
#

opened port 5000 in my firewall TCP and UDP

coarse rune
#

hi

#

TypeError: Cannot read property 'send' of undefined This is the error sent in the console but the message is also send so can someone help me and it is in Discord.js

fluid rock
#

Is it possible to retrieve the notifications of our bot with the api of top.gg?
And the announcements too?

short gust
#
Error: listen EADDRINUSE: address already in use :::8000
#

help

midnight berry
#

how to boost

#

Plus help me

lilac nacelle
arctic musk
restive otter
#

does each bot have its own topgg token

plucky lance
#

No

#

It’s your account token (only available if you have at least one bot on topgg)

timber wren
#

yo the server post always worked but suddenly I get this: AttributeError: __aenter__

sullen nymph
#

That's interesting

#

Can you post the full traceback

rancid brook
#

@lilac nacelle i have a question add me

green mantle
#

so @sullen nymph how do you plan on supporting discord.py v2 and v1 when that happens 👀

sullen nymph
#

I'm not even aware of the changes that are planned to be implemented this far

#

Is it really that bad that i'll need to support it separately lol

green mantle
#

idk, that depends on how they handle the depreciation of get_event_loop and asyncio.run creating a new event loop meaning bot.loop will likely have to change or become nullable

sullen nymph
#

🤷

ashen copper
#

okay well at least im getting an error this time;

OSError: [Errno 10048] error while attempting to bind on address ('0.0.0.0', 2060): only one usage of each socket address (protocol/network address/port) is normally permitted

  1. No my bot is not running twice since I am using a seperate beta bot only on this PC
  2. I changed the port to 2060 and allowed it through my firewall + router/modem
  3. This happens every time so even when I change the port and try for the first time

What to do....

green mantle
#

what OS?

ashen copper
#

windows 10

green mantle
#

run netstat -a

ashen copper
#

yeah its listening

#

i ran it again with 5050 and it opened that one

#

i put the .run() right after i defined bot and its nowhere else in my code

#

so

green mantle
#

if that port is already listed as listening on netstat before you run the port is taken

#

unless @sullen nymph feels like adding SO_REUSEADDR

ashen copper
#

nahnah as soon as i run the bot it shows up

#

gimme a min

#

imma clean up my code and put everything in a separate file instead of having to import from other cogs since i was gonna do that anyway

#

might be trying to rerun the piece of code

sullen nymph
#

Sounds like it

ashen copper
#

I was thinking abt that during work and I knew i had to do it anyway

#

was fine in the beginning with 2 helper functions but now its too messy

sullen nymph
#

😂

ashen copper
#

Alright the error is gone now but with one_dbl_test there is no output, I put 0.0.0.0:2060/dslwebhook as the webhook URL is that correct?

sullen nymph
#

0.0.0.0 is supposed to be replaced with your machine's IP address and the URL must start with http://

ashen copper
#

alright alright, wasnt entirely clear to me

#

thanks i shall try rn

#

alright seems to work just fine, didn't work at first and then i had the brilliant realisation that i forwarded the port to my server and not my PC that I'm running the beta version on

#

🤦

#

Thank you very much shiva

sullen nymph
#

🤣

spark mulch
#

What'd be the best way of checking when someone votes? For example my bot sends me a DM saying @ xyz voted...

spark mulch
#

OK thanks

wintry tulip
#

What’s been happening to the topgg webserver lately? For the past week like once a day I’m getting returned 503 errors when auto posting my bot server count.

coarse rune
#

ok

restive otter
wintry tulip
#

Alright

novel flower
#

Hello I am new in development I would like to know which ones were TOP.GG api and how to find it

#

My code error Top.GG API Error: 401 Unauthorized (You need a token for this endpoint)

willow spindle
#

you need an approved bot on top.gg

restive otter
#

how to get the dbl token

willow spindle
restive otter
#

oh k

novel flower
#

I have ad my bot in Top gg once this is done what do I do?

#

@willow spindle

willow spindle
#

wait for approval

novel flower
#

I received no email I don't know what to expect

willow spindle
novel flower
#

but ok i wait ...

slow sonnet
#

it takes about 3 weeks or more

novel flower
#

Ok

crisp socket
#

Other than port 5000, what other one can be used?

sullen nymph
#

Whichever that's open and not occupied

crisp socket
#

Between which two again

#

1024 and?

green mantle
#

Well you can technically assign anything in a unsigned 16 bit integer range but anything bellow 1024 requires admin / sudo to bind to as they're classed as reserved ports

crisp socket
#

Okie

short gust
lilac nacelle
elder bison
#

hi i need help with settings up a webhook for my discord bot on topgg

#

this link leads me to an error page of 404

#

so i asked here, which was the second option

sullen nymph
#

Are you replacing :your-bot-id with your bot's ID

elder bison
#

oh lol

#

lemme do that rq

#

@sullen nymph

#

my bot id

#

doesn't work

sullen nymph
elder bison
sullen nymph
elder bison
#

ah

#

yea it takes me there but idk how to actually set one up

sullen nymph
#

Seems like your bot's top.gg ID

#

What library do you use?

elder bison
#

wdym

sullen nymph
#

What library do you use for your bot?

elder bison
#

node.js

sullen nymph
elder bison
#

@sullen nymph so i am to insert this information first

#

and it would look like the webhook url will be made alr or?

#

and how do i know like what port to use

sullen nymph
#

Berry for the love of fucking God add some kind of tutorial in your docs...

sullen nymph
#

Refer to that as your URL template. You choose any port you want

elder bison
#

yup

#

so the server ip and port can be any in the world? or is it from a list

sullen nymph
#

Server IP is your machine's IP address

elder bison
#

oh like my pc ye? What about port

elder bison
#

oh ok

sullen nymph
#

If you're gonna host locally, make sure the port is forwarded to your PC in your router settings

elder bison
#

@sullen nymph ok so i followed an npm thing and they said DBHtoken

#

i entered my token but it said that its not defined

sullen nymph
#

Wrong package

elder bison
sullen nymph
#

Bullshit, it's not official

sullen nymph
elder bison
#

oh lmao but its by a good bot developer

#

alr

#

sry for inconvenience

sullen nymph
#

If it was it'd be updated

#

Except 💀

#

I wouldn't call someone who says that something is official out of the blue a "good" bot dev

elder bison
#

@sullen nymph a question should my port be 3000 because of this

#

webhook port

restive otter
#

hello where do I have my API key

sullen nymph
elder bison
#

wot

#

so do i just stick with what im doing?

#

i did*

#

my own router port

#

blah blah my ip

sullen nymph
#

Host on port 3000 but send requests to 443 (aka https://xxx.xxx.repl.co/)

#

Are you hosting locally or not?

elder bison
#

i believe yes

sullen nymph
#

If you're running shit on replit.com then no you're not and you don't need to forward ports

elder bison
#

so i just stick with what i have?

sullen nymph
#

I assume so

elder bison
#

oke

#

ok @sullen nymph i followed the steps but it didnt console log my id when i voted

#

hmm

spark mulch
#

What url do I enter for my webhook url?

elder bison
sullen nymph
spark mulch
#

is there any public service where I can have a hosted webhook url for me

slow sonnet
#

I don't think so

restive otter
#

hello where do I have my API key

#

How to get a message from bot telling that someone voted on top.gg

topaz kraken
restive otter
#

ah ok

timber wren
#

@sullen nymph welp i dont get a traceback only this attributerror AttributeError: __aenter__

#

I only want to post the server count

restive otter
#

That might be because it's getting the __aenter__ from the tuple instead. @sullen nymph maybe you wanna use AsyncExitStack instead?

topaz kraken
#

Read the docs and you also need your bot approved first

restive otter
#

Kk

#

@topaz kraken after my bot gets approved can u guide me how to?

timber wren
#

he told you to read the docs

slow sonnet
#

After your bot gets approved

timber wren
slow sonnet
#

Lol my bad

timber wren
#

npnp

sullen nymph
#

That's interesting. 3.9 can't reproduce

#

What's your Python version? @timber wren

restive otter
#

Were you making a request to non-bots endpoint?

#

If you were, you should be able to reproduce it

sullen nymph
#

I mean I just had ratelimiter.py running with a custom function that did ratelimiters = global_rl if True else (global_rl, bot_rl) with async with ratelimiters

restive otter
#
context_managers = (global_rate_limiter, bot_rate_limiter)
async with context_managers:
    ...
``` doesn't seem to equal ```py
async with (global_rate_limiter, bot_rate_limiter):
    ...
restive otter
sullen nymph
#

Oh wait hold on

#

Yup

restive otter
#

I'm suggesting this

from contextlib import AsyncExitStack

ratelimiters = global_rate_limiter,

if url.startswith("/bots"):
    ratelimiters += bot_rate_limiter,

async with AsyncExitStack() as stack:
    for ratelimiter in ratelimiters:
        await stack.enter_async_context(ratelimiter)

    ...
#

If you don't like the import, maybe you can make an async null context manager

timber wren
#

Btw this is the code and it always worked *

@tasks.loop(minutes=30)
async def update_stats():

    try:

        await client.topgg.post_guild_count()

        print(f"Posted!")

    except Exception as e:

        print(f"Failed! \n{e.__class__.__name__}: {e}")```
restive otter
#

Oh yeah, AsyncExitStack isn't available on py3.6. Are you planning to support it still, shiv?

#

Considering d.py will drop support for py3.7 and earlier

green mantle
#

you should do because discord.py still supports 3.6

#

v2 jumps straight to 3.8 minimum required version but that will require a redesign of the sdk to support properly i feel

restive otter
#

We'll see the breaking changes, eventually

green mantle
#

If it's going to follow the asyncio stuff, bot.loop will either be removed or become nullable which means the sdk wont be able to rely on that or assume the loop before it's in a async context

#

along with le tradition depreciation of get_event_loop, loop kwarg etc...

restive otter
#

Seems it hasn't officially supported 3.10+ though

green mantle
#

v2 will likely support anything beyond 3.8

#

I mean the sdk will want to conform to the changes regardless because best practice™️ and loop kwarg and get_event_loop is gonna cause you issues in the world of 3.8+

restive otter
#

I'm just guessing the implementation of the run method is still gonna be "get or make", try to get the running loop, if RuntimeError raised or the loop is closed, make a new one.

green mantle
#

it cant / shouldnt be

#

because you will pretty much always run into the two event loop same thread issue

restive otter
#

We probably have to shift to another channel bloblul

green mantle
#

because asyncio.run is supposed to become the standard way of starting an async runtime context (libs shouldnt do it) it always makes the loop so anything created outside of the async context wich uses get_event_loop or makes it's own loop will break

#

hence why all the loop kwargs got depreciated with this to discourage use of get_event_loop

#

most of the changes are happening because people cant be trusted to manage and cleanup their async code, people realising that developers cant be trusted with low level event loop systems bloblul

sullen nymph
#
    rl1 = AsyncRateLimiter(10, 5, callback)
    rl2 = AsyncRateLimiter(5, 3, callback)
    for _ in range(60):
        async with rl1 if False else rl1, rl2:
            print(_)

I can't check for its compatibility with py 3.6..3.9

green mantle
#

🤨

#

I mean, thats certainly one way to remove the limited constant folding python has

#
def foo():
    return 1 if False else 2, 1
  5           0 LOAD_CONST               1 (False)
              2 POP_JUMP_IF_FALSE        8
              4 LOAD_CONST               2 (1)
              6 JUMP_FORWARD             2 (to 10)
        >>    8 LOAD_CONST               3 (2)
        >>   10 LOAD_CONST               2 (1)
             12 BUILD_TUPLE              2
             14 RETURN_VALUE
def foo2():
    if False:
        return 1
    else:
        return 2, 1
 12           0 LOAD_CONST               1 ((2, 1))
              2 RETURN_VALUE
sullen nymph
#

I can technically just divide the HTTP requests into separate functions

#

I'd like to keep support for 3.6 for now

green mantle
#

what are you trying to do?

sullen nymph
#

Guess what KEKW

hushed reef
#

can i offer a suggestion

sullen nymph
#

Sup?

hushed reef
#

drop 3.6 and write it as a breaking change

#

it's not worth it

#

because 3.6 is going to reach eventual deprecation at some point in the future, although not right now

#

plus what you're doing is gonna be a no-no later on

sullen nymph
#

Eh fuck it we're dropping 3.6

hushed reef
#

yeah it's just genuinely not worth the hassle

green mantle
#

I mean by that point

#

the current setup only supports 3.7 well

#

3.8+ can be considered pretty un-pythonic in terms of the async ecosystem beyond that

#

i also cant see why you even need to drop 3.6?

#

like what are you doing that requires what 3.7 gives you

sullen nymph
restive otter
#

Thought you chose the ternary

sullen nymph
#

It refuses to work properly

green mantle
#

... and you need this why? for the sake of 2 context managers?

sullen nymph
#

Yes

#

One isn't always present (bot endpoint one) whereas the global one is

restive otter
#

You can have an async null context manager to keep support for 3.6

#

Or maybe chillfish knows another way?

hushed reef
#

then just handle the bot endpoint one differently

green mantle
#

I mean looking at the code

#

you're not using AsyncExitStack for what it was originally intended for, you're using just as a way of applying 2 context managers with one being optional?

restive otter
sullen nymph
#

It doesn't work anyway so KEKW

green mantle
#

why dont you just like... code a basic setup yourself :P

restive otter
#

Do manual acquire mmLol l

green mantle
#
import asyncio


class CtxMany:
    def __init__(self, managers):
        self.managers = managers

    async def __aenter__(self):
        return await asyncio.gather(*[
            manager.__aenter__() for manager in self.managers])

    async def __aexit__(self, exc_type, exc_val, exc_tb):
        return await asyncio.gather(*[
            manager.__aexit__(exc_type, exc_val, exc_tb) for manager in self.managers])

basically waht you're trying to do

#

ah feck missed the unpack

restive otter
#

And a method isn't awaitable exdee

#

Looks neat though

green mantle
#

which method isnt awaitable

#

technically we can actually simplify this a bit more i think

restive otter
green mantle
#

what about it

#
import asyncio


class CtxMany:
    def __init__(self, managers):
        self.managers = managers

    def __aenter__(self):
        return asyncio.gather(*[
            manager.__aenter__() for manager in self.managers])

    def __aexit__(self, exc_type, exc_val, exc_tb):
        return asyncio.gather(*[
            manager.__aexit__(exc_type, exc_val, exc_tb) for manager in self.managers])
#

oh yes i see

#

didnt call it

restive otter
#

You can't await a method mmLol

#

Now we're talking

sullen nymph
#

Is anyone feeling like making a PR for this or do I stay up longer

green mantle
#

I believe in you

sullen nymph
#

I don't believe in myself but thanks KEKW

hushed reef
#

oh my god

#

indented returns

#

what the fuck

restive otter
#

Cuz "Limit all lines to a maximum of 79 characters."

hushed reef
#

is that some PEP bullshit

restive otter
#

Yep

hushed reef
#

this is why i hate PEP

#

coding convention standard my ass

sullen nymph
static pilot
#

Will there ever be an endpoint for bot announcements?

hushed reef
#

that's honestly a veld question

green mantle
#

yikes

#

100 is regarded as more reasonable

restive otter
#

I personally don't

sullen nymph
#

120 >

restive otter
#

I let black with the default config does it job 🍭

#

Which is IDK, prob 88 chars

green mantle
#

88 chars is the default ye

hushed reef
#

my sweet spot is 110

green mantle
#

110 is too long

#

i barely do 100

#

100 is just the limit that word wraps text in pycharm's copy paste font and size 10

#

also just about the limit of github markdown as well on desktop

hushed reef
#

this extends a bit past 110 (is at 113) but i like this length

#

i will never really go past 110 though

#

because then i'll start breaking it down into shorter lines

green mantle
#

blobpain miss using one line if statements like that

hearty lintel
hushed reef
sullen lotus
#

Escucha "Tu Timidez" 🥰 → https://youtu.be/20yijqIJx18

🎵 Escúchalo en todas las plataformas digitales de música: https://lnkfi.re/BailaConmigo

📻 Sencillo producido por DJ Dayvi & Victor Cardenas

🌎 Sigue a Harmor Music
►Facebook: https://www.facebook.com/HarmorMusic/
►Twitter: https://twitter.com/harmormusic
►Instagram: https://www.instagram....

▶ Play video
#

good moosic

static pilot
#

thanks @hushed reef

hushed reef
#

for?

static pilot
#

asking

errant nimbus
#

ok

coarse rune
#

This is occuring when i am pressing send test. Pls help

#

Also can u pls help me to solve it

golden adder
#

What's your webhook url?

gentle python
#

;s

coarse rune
solemn token
#

Have top.gg a python library for stats?

sullen nymph
#

yes, topggpy

coarse rune
solemn token
craggy birch
#

how do I check if a user has voted? I'm very new to webhooks

hushed reef
#

just use the API route for vote checks

#
GET: https://top.gg/api/bots/{bot_id}/check?userId={user_id}
craggy birch
#

thanks

wintry glade
#
2021-07-01T18:23:51.238171+00:00 app[worker.1]: Traceback (most recent call last):
2021-07-01T18:23:51.238173+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/topgg/client.py", line 151, in _auto_post
2021-07-01T18:23:51.238174+00:00 app[worker.1]:     await self.post_guild_count(
2021-07-01T18:23:51.238174+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/topgg/client.py", line 212, in post_guild_count
2021-07-01T18:23:51.238175+00:00 app[worker.1]:     await self.http.post_guild_count(guild_count, shard_count, shard_id)
2021-07-01T18:23:51.238175+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/topgg/http.py", line 190, in post_guild_count
2021-07-01T18:23:51.238184+00:00 app[worker.1]:     await self.request("POST", "/bots/stats", json=payload)
2021-07-01T18:23:51.238185+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/topgg/http.py", line 121, in request
2021-07-01T18:23:51.238186+00:00 app[worker.1]:     async with ratelimiters:
2021-07-01T18:23:51.238186+00:00 app[worker.1]: AttributeError: __aenter__
#

what the heck is this?

restive otter
#

Update it

wintry glade
#

ok, thanks

cunning basin
#

help

#

my bot have's photo

timid walrus
old kernel
real yew
subtle pulsar
#

How can I fix this error?TopGGAPIError [Top.GG API Error]: 403 Forbidden (You don't have access to this endpoint)

jaunty plank
sullen nymph
#

That would've been a 401

#

They're trying to access an endpoint the token doesn't have access to

idle quartz
#

How do I make the web hook so it posts a message every time someone votes for my bot on top.gg?

#

(Pls ping me in response)

craggy birch
#

did you seriously copy and paste my question

dusky silo
#

😒

jolly veldt
#

i need help

const express = require('express');

const app = express();

app.get('/', (req, res) => {
  res.send('Hello Express app!')
});
app.post('/vote', (req,res) => {
console.log(req.body)
console.log(req.headers)
// res.end()
})
app.listen(3000, () => {
  console.log('server started');
});

this no work? it says it has an error during test

tepid bison
#

Pro tip: you should say THE ERROR here too, if it has more details.

neon stirrup
#

you fixed it?

#

Help:
UnhandledPromiseRejectionWarning: Error: 403 Forbidden

jolly veldt
jolly veldt
hallow night
#

hey there i cant get the on_dbl_vote working (python), am i required to setup the webhook like given in example in docs or running the sole function in a event should work?

#
bot.topgg_webhook = topgg.WebhookManager(bot).dbl_webhook("/dblwebhook", "password") bot.topgg_webhook.run(5000)```
Like is it necessary to have this setup before i can use `on_dbl_vote` event?
tepid bison
#

Then sorry I can't help

ashen copper
restive otter
#

a

obtuse quarry
#

can someone help me with getting the webhook part of top.gg to accept my webhook?

#

i dont understand what i'm doing

restive otter
#

im trying to do this vote tracking for my server but...

#

Says changes were done, but the test doesnt work

median trout
#

hello, i am getting this error in topggpy

#
Failed to post server count
AttributeError: __aexit__
#
class Handlers(commands.Cog):
    def __init__(self, hyena, colours):
        self.hyena = hyena
        self.colours = colours
        self.unmute_temp_mutes.start()
        self.update_stats.start()
        self.hyena.add_check(self.toggle)

    @property
    def category(self):
        return ["None"]

    @tasks.loop(minutes=30)
    async def update_stats(self):
        """This function runs every 30 minutes to automatically update your server count."""
        try:
            await self.hyena.topgg.post_guild_count(len(self.hyena.guilds))
            print(f'Posted server count ({self.hyena.topgg.guild_count})')
        except Exception as e:
            print('Failed to post server count\n{}: {}'.format(type(e).__name__, e))
#

ignore other things

#

just the update_stats task im talking about

restive otter
#

Update it

median trout
restive otter
#

It's fixed on v1.3.0, if you're already on that version, then it's a different story mmLol

median trout
#

wait

median trout
#

lemme try it again

restive otter
vast crystal
#

Hello, I had a question since the rework of the website I can't find my top.gg API key, where could I find it pls ?

golden adder
vast crystal
#

I got this when I click on the webhooks button is that normal ?

#

okay it's all good, I've refreshed the cache and now it's working

#

Thank you

sullen nymph
#

You're welcome

lilac nacelle
#

it is tho

brisk girder
tacit zodiac
#

hello i have question how do i show the servers that my bot is in . The bot is already approved by discord ? tnk

golden adder
#

Check the pins for the documentation.

runic atlas
#

Hi I have a problem with my bot, about votes, every time someone votes for it it doesn't send the webhook, much less the vote message

rain heart
#

@runic atlas please reset your webhook token

runic atlas
runic atlas
rain heart
#

that was a discord webhook token in the code

#

censor it before asking again

runic atlas
#

oh

#

Right, thanks

tight oyster
foggy acorn
# runic atlas

lmao cant open webhooks tab on my bot.
gives me this image as well (replied)
ive tried: clearing my cache (3 times), and using 3 different browsers. (same result on all of them)

normal cairn
#

command | all] [#channel | role]

vast crystal
restive otter
#

Is there a documentation for the api ?

#

I found it in the topic lol

fickle knoll
#

How can I add this bot to my server

willow spindle
#

what bot

hot maple
#

why top.gg sever takes long respond

hot maple
#

top gg take long respond time

willow spindle
#

@trail sigil

#

evryone

#

are you 11

sick igloo
#

wow

#

not based

#

as the head of Based DPT. i -

#

okay

turbid marsh
#

i cant see webhooks announcements Analytics Votes Widgets all of them give me the same 404 message

true dagger
#
const { AutoPoster } = require('topgg-autoposter')
    const ap = AutoPoster('my_token_was_here', client)

error: Unsupported client.

Any ideas?

somber moss
#

try to do bot mabey

#

or Client with capital C

true dagger
#

i define my bot as client

drowsy storm
#

How to make a topgg api

rain heart
runic atlas
#

hello can anyone help me to activate my bot's voting messages by webhook? I'm not getting

restive otter
true dagger
#

Done that multiple times

restive otter
true dagger
#

I got a bunch of stuff in between

restive otter
#

Oh

true dagger
#

Mostly setting presence and stuff like that.

restive otter
#

I see. Well, You should define client before adding that code. Did you?

true dagger
#

I have a command handler, client is defined, yes.

runic atlas
restive otter
true dagger
#

It's under events

#

I meant, the format.

restive otter
#

Use in main file

true dagger
#

I'll give that a go

restive otter
#

Ok

true dagger
restive otter
# true dagger Same thing
const client = new Discord.Client()  

const { AutoPoster } = require('topgg-autoposter') 

const ap = AutoPoster('Your Top.gg Token', client) 

ap.on('posted', () => {

 console.log('Posted stats to Top.gg!')
 })```
true dagger
#

I have exactly that, just without

const client = new Discord.Client()  

and

ap.on('posted', () => {

 console.log('Posted stats to Top.gg!')
coarse rune
#

Me

true dagger
restive otter
#

Weird

true dagger
#

appreciate ya trying <3

sullen nymph
#

What do you define client as

true dagger
drowsy storm
#

hello can anyone help me to activate my bot's voting messages by webhook? I'm not getting

runic atlas
drowsy storm
#

@runic atlas

runic atlas
drowsy storm
#

How to get a webhook password

#

And token webhook

#

@runic atlas ?

runic atlas
#

in the webhooks option

drowsy storm
#

In this page ? @runic atlas

#

Hello ? @runic atlas

#

@runic atlas heyy?

runic atlas
#

yes

#

sorry the delay was messing with my code

drowsy storm
#

Ok

#

@runic atlas im getting a webhook password from this page

#

?

#

@runic atlas !!!????

drowsy storm
#

Ware @runic atlas ?

runic atlas
#

delete this image

#

the image contains your webhook token and authorization

drowsy storm
#

Deleted

upper lark
#

You should delete the image you send before.

drowsy storm
#

ok

#

@upper lark done

#

But iwant get a webhook data information

#

@upper lark

#

@upper lark hello?

#

@runic atlas hey?

#

😑

upper lark
#

Hey what are you trying to achieve exactly with the webhook?

drowsy storm
#

Send a vote message

upper lark
#

So what you do is create a webhook yourself you want top.gg to send a request to everytime someone votes your bot. You then paste that webhook URL in the webhook settings of your bot and boom.

drowsy storm
#

How to create

upper lark
#

I'm not going to give you a tutorial on how to setup a webserver and do those things.

#

But if you are using javascript you could use express to setup a webserver and create your webhook. Thats all I'm gonna give you.

drowsy storm
#

but iwant top.gg webhook im pasted the webhook link but not working

#

@upper lark

upper lark
#

You pasted a top.gg webhook link?

#

Thats not going to make your bot automatically post a notification when someone votes??

coarse rune
#

Hi

#

I already have vote rewards but i want to know how to make vote reminder

half compass
#

@coarse rune can u teach me how u made vote rewards?

half compass
#

@upper lark how to I make vote rewards in mobile?

#

For my bot

upper lark
#

@half compass You can use the webhook functionality for that. You can configure a webhook in the webhook tab of your top.gg bot settings.

coarse rune
#

Which language do u use @half compass

half compass
coarse rune
#

ok

#

can i ask where do u host your bot /

#

?

half compass
pseudo light
#

Hello
I would like to put the servercount of a bot on a website. I tried with fetch("https://top.gg/api/bots/ID/stats") and then retrieve the data but I got this in json: {"error": "Unauthorized"}.

This is because no one is logged in, from my website. How can I fix this?

rain heart
pseudo light
#

I think I'm not good at reading the docs ^^

#

I'll try, thanks

#

this ?

sullen nymph
#

Yes

pseudo light
#

ok thanks

#

ok it works

#

but now everybody can see my bot's token

sullen nymph
#

Save it in a file that's hidden

pseudo light
#

how ?

sullen nymph
#

Well, first of all, how does everyone see your token

pseudo light
#

if they look at the source code

sullen nymph
#

Look... where?

#

GitHub?

pseudo light
#

yes

sullen nymph
#

Use .gitignore

pseudo light
#

thank you

#

I do not really know how to use .gitignore

#

but i'll try

restive otter
#

help me

#

how can i create a bot

fiery vector
#

Oh you're spamming all the channels?:D

#

anyhow, just got redirect from #support with this issue I encountered on top.gg

#

Hi all! Hoping to find some support here:) I'm trying to add my colleague to the team I just created, but I dont seem to be able to do so...

Inspected the browsers network traffic and apparently this call (containing our team ID) fails with a 500 (and no response message):

PUT https://top.gg/api/client/teams/199833927912218624/invites``` 

This is the payload (correct imo)

{"role":2,"userId":"591901029969166352","useDiscord":true}


Is there another way to add `591901029969166352` to my team?
sullen nymph
#

No luck there since it's an issue with top.gg, unfortunately

#

Teams have been broken for a while now

fiery vector
#

alrighty, no workaround exists for my colleague to get to the bots analytics?

sullen nymph
#

Sadly, nope. One (and pretty much the only way) is for you to send them to your colleague manually

fiery vector
#

hehe yeah indeed

#

arent the analytics exposed by the topgg api?

sullen nymph
#

I don't think they are or will be, unless you literally scrape the webpage itself somehow

#

and that doesn't sound possible from what I remember

coarse rune
hallow night
#
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)```
In this do i have to edit the `webhook_path`?
restive otter
#

Up to you. /dblwebhook is perfectly fine though. You'd better migrate to topggpy by the way

small wraith
#

Wie bekomme ich das N/A neben meinem bot weg bzw was bedeutet es?

broken stirrup
#

Is there a tutorial on how to display your bots server count on the website?

broken stirrup
restive otter
#

Hello how to check if a user has voted or not. Discord.js btw

hushed reef
restive otter
hushed reef
#

Did you try it

restive otter
#

Opening my project

half compass
restive otter
#

kinda busy today

hallow night
#

Another question as i cant get the on_dbl_vote working, do i need to have a webhook setup in my bot's page to get it working

restive otter
#

And in a hurry

restive otter
half compass
#

Sorry but what do we you want to do?

restive otter
#

I mean do you have the vote tracker in your bot

small wraith
#

Hi.Ich möchte in Python gerne die top.gg libarys verwenden.Allerdings benutze ich nicht

@bot.commands
def Command:
....

Sondern:

if message.content.startswith("Command")
...

Kann ich die libarys trotzdem benutzen?

coarse rune
#

So you have to get the webhook auth first

#

And then you have to setup the app and listen for the webhook

small wraith
#

Hi, I would like to use the top.gg libarys in Python, but I don't use it

 @ bot.commands
 def Command:
 ....

Rather:

 if message.content.startswith ("Command")
 ...

Can I still use the libraries?

coarse rune
#

Amd then after voting you have get the user and add your reward

half compass
hushed reef
#

yes, you can still use the python API wrapper despite the way you declare commands

small wraith
sullen nymph
coarse rune
#

Ok give me your webhook link

coarse rune
half compass
#

Btw I I it but it's not automatic

#

I used integromat

warm pelican
#

Is there a topgg python api?

wicked storm
#

l can't vote any bot in pc but l can in mobile how?

untold ferry
sullen nymph
warm pelican
small wraith
#

Because i have no @bot

restive otter
#

Sending the code might be helpful. What do you mean by not working though? Did it raise errors? If so, send the errors as well.

small wraith
restive otter
#

What did I just see....

small wraith
warped portal
#

can someone please explain to me how to add the server number to my bot?

restive otter
#

How do i make this example, work for servers instead of bot? Everything i see is for bots, bots and bots. Nothing server related.

#

That doesn't seem to require any bot instance.

#

And the payloads are similar, you can technically use it for servers, ig.

#

yes, but how?

#

what am i to put here?

compact ivy
#

cant access my webhook interesting

warped portal
#

i cant run any npm commands

warped portal
#

ok got it all sorted out

drowsy storm
#

How to create my own DBL webhook

plucky lance
#

Run a webhook service and enter it’s IP/DNS on topgg.
Or use already existing libraries.
Examples and more infos can be found in the docs.
Those are pinned in this channel.

normal finch
restive otter
#

It wont allow me to test anything

true dagger
#

What are the dependencies exactly for autoposter? I keep getting unsupported client error

const { AutoPoster } = require('topgg-autoposter') 
const ap = AutoPoster('my_token_was_here', client) 

ap.on('posted', () => {

console.log('Posted stats to Top.gg!')
 })
true dagger
#

I got top-gg/sdk & topgg-autposter installed. Pretty much it

small wraith
#

Hi i use Python but different than the others.
I use not @bot.command
it's best to look at it yourself
https://github.com/Tobias2021/dcbot_german

Can i use Nevertheless the API because in the Page the example ist Not working

GitHub

mein deutscher dc bot:Dieses script kann für jeden bot verwendet werden es muss nur der Token eingetragen werden - Tobias2021/dcbot_german

dusk talon
#

Hello, it's possible to know if a user has vote for a server ? I tried to find but I only see for a bot.

sullen nymph
#

That's such a poorly managed project

sullen nymph
small wraith
sullen nymph
small wraith
sullen nymph
#

bot = discord.Client(...)

#

discord.ext.commands.Bot subclasses discord.Client so both are allowed

small wraith
small wraith
#
bot = discord.client
@bot.event
    async def on_dbl_vote(data,message):
        await message.channel.send("Vote")

why is this not working

sullen nymph
#

Why message there lol

#

Also, you are supposed to use an existing instance of discord.Client

restive otter
#

Seeing your code, you can just do ```py
class MyClient(discord.Client):
async def on_dbl_vote(self, data):
...

visual oxide
restive otter
#

Man's using dblpy yet referring to topggpy docs

sullen nymph
#

🤣

#

I should make a separate documentation for dblpy that simply yells "THIS IS DEPRECATED. MOVE TO TOPGGPY INSTEAD"

restive otter
pearl lava
#

Does anyone know how to show on the page how many servers my bot is on?

visual oxide
visual oxide
visual oxide
#

uh, idk about that, sry

sullen nymph
#

"by default" as in what

stable summit
#

how would i give a role for voting for my bot?

visual oxide
dusk talon
#

what's the /dblwebhook ?

#

I'm trying to get the user how has vote for my server but I don't find where in the docs so I tried this but I don't know what's is the /dblwebhook

restive otter
#

It's called path, reading an article about anatomy of a URL would help.

dusk talon
#

okay thanks

#

It's realy necessary to do that for getting the vote.user ?

rocky sedge
#

Hi, when I look in the topggpy documentation, I see that the event "on_dbl_vote" do not return WHO voted
is there a way to see that ?

restive otter
#

It does provide you the ID of the user.

rocky sedge
#

oh ok no it's inherit from VoteDataDict

restive otter
#

Ye, it only shows the type hints it has. But, it does inherit VoteDataDict which has user attribute. So, you can do data.user/data["user"], either works.

restive otter