#topgg-api

1 messages Β· Page 156 of 1

crystal cloak
#

Ok. Thanks.

restive otter
#

?

molten inlet
#

yo

#

using probot can i really put auto roles on a desired level

#

like if i leveled up on level 10 can i get a role "level 10"

restive otter
#

Hello
Can I use this api for my server?
Any requirements?

frosty light
#

Hi I'm looking to make a vote reward command , ie vote to use command , how can I do so , any example , I'm having issues understanding the docs

dense shale
#

did you want to reset the reward or keep it?

frosty light
#

Reset when vote expires

#

Like to use a command vote the bot

dense shale
#

but overall its simple. you have to get the Webhooks setup. the top.gg api will send then a event to the webhook if someone votes. the vote contains some informations like the userid of the guy who voted.
for the vote locking commands, if you use MongoDB you could use TTL to create documents that self destruct after a set time the flow should be then like this:

For the Vote locked Command:
Query the DB to see if a document for command author exist in your Vote Collection. if yes execute the command if no return

#

or did you want to send people to the top.gg page of the bot for voting?

#

then its even simpler. just send them a url with the bots page

frosty light
#

Uh , like you know the premuim command which u gotta vote to use

dense shale
#

then you need the first way ive mentioned (there are other methods but this one is crash resistant)

frosty light
#

Can I like use get_user_vote events or something , instead of webhook

#

I'm not much familiar with webhook tbh

dense shale
#

API queries are not really wanted

#

webhooks are easy.

#

you just recive a json formated payload that you can handle

restive otter
frosty light
#

Ohk

dense shale
frosty light
dense shale
#

imagine having 50k clients sending a request every second

dense shale
restive otter
dense shale
#

like its just simple MongoDB queries (if you use MongoDB other databases should also work, exept "Json DBs")

frosty light
#

Will JSON not work?

dense shale
dense shale
frosty light
#

Ohk

restive otter
dense shale
sullen nymph
dense shale
#

or ask shiv he maintains the top.gg py lib

restive otter
#

So? I can use the code there for when someone votes for a server?

#

And how to retrieve the dbl token

#

Does this only work for bots or can it work for server also?

sullen nymph
#

Ignored my link apparently to an up-to-date documentation

#

sad

#

topggpy has support for both server and bot votes

restive otter
#

Oh I should check ur link oki

#

Thx πŸ™

nocturne quarry
#

How to check if user voted my bot?

crystal cloak
#

Are there examples? I don't really get a perspective on this.

restive otter
#

FYI, if you installed it from pypi, the WebhookManager.run method returns a coroutine, on the other hand, the master branch one returns a Task. So the former needs to be awaited while the latter doesn't

nocturne quarry
sullen nymph
#

What library, what language

nocturne quarry
#

Discord.js, JavaScript

#

hi?

sullen nymph
nocturne quarry
#

Thanks

green mantle
#

@sullen nymph ```py

bot.topgg_webhook = topgg.WebhookManager(bot).dbl_webhook("/dblwebhook", "password")
bot.topgg_webhook.run(5000) # this method can be awaited as well

What in the good god is that class setup style ![notlikeduck](https://cdn.discordapp.com/emojis/701504231269597214.webp?size=128 "notlikeduck")
sullen nymph
#
bot.topgg_webhook = topgg.WebhookManager(bot)
bot.topgg_webhook.dbl_webhook("/dbl", "dblpass")
bot.topgg_webhook.run(5000)

ezpz

green mantle
#

no but like

#

wtf is the point in that method

sullen nymph
#

The dbl_webhook?

green mantle
#

Like, sure that would be a sort of valid constructor if that was Rust which doesnt have default arguments but that is a very unpythonic method of doing that

#

especially considering that .dbl_webhook("/dbl", "dblpass") looks like you can stack these when in reality they override each other because py self._webhooks["dbl"] = _Webhook( route=route or "/dbl", auth=auth_key or "", func=self._bot_vote_handler, )

sullen nymph
#

Anything you want to suggest? Because this is the only feasible way I could think of that made sense Shrug

green mantle
#

just stick it in the class constructor?

#

bloblul Almost like init was made for that job

elfin anvil
#

is there a tutorial on how to chk if who voted.......

#

like setting up the webhook

spice helm
green mantle
#

to other services with hassle

sullen nymph
elfin anvil
#

thx

spice helm
#

Lmao

green mantle
#

ffs

sullen nymph
#

Do you expect me to read every dev's mind

#

I legitimately have issues with naming stuff

#

eh...

#

Now do that in one line and tell me if it looks comprehensive

green mantle
#

It looks better than needless OOP mmLol

sullen nymph
#
WebhookManager(bot, dbl_path="/dbl", dbl_auth="pass", dsl_path="/dsl", dsl_auth="pass")
green mantle
#

Alternatively if you really wanted to make it object based, make a dataclass called WebhookDetails or smth

nocturne quarry
sullen nymph
#
  • they're just helper methods. I expose the internal Application instance so whoever wants to use that is free to
green mantle
#

yes they're helper methods but they're not massively user friendly or pythonic

#
bot.topgg_webhook = topgg.WebhookManager(bot)\
  .dbl_webhook("/dblwebhook", "password")\
  .dbl_webhook("/ahh", "password")\
  .dbl_webhook("/f", "password")\
  .dbl_webhook("/b", "password")
#

like that's what your code looks like it should support

#

In reality it doesnt

sullen nymph
#

My question is what benefit does one get by trying to create multiple listeners for the same webhook type on a different path

green mantle
#

fingergunz Considering you stripped out the test event as a builtin adding these helper functions that look like they should behave one way but act the other

green mantle
#

dont add constructor or builder methods when they arent needed bloblul

elfin anvil
nocturne quarry
spice helm
sullen nymph
nocturne quarry
#

Im getting ignored angeryBOYE

green mantle
#

which is why adding needless methods is a πŸ‘Ž

sullen nymph
#

If you want one webhook, you have a helper method to add a simple handler for you. If you don't, work with the webserver property or don't use the webhook manager altogether

#

How are they needless

green mantle
#

also considering the arguments in said helper function has required arguments but then has some random default checks

#
def dsl_webhook(self, route: str, auth_key: str):
        """Helper method that configures a route that listens to server votes.
        Parameters
        ----------
        route: str
            The route to use for server votes.
        auth_key: str
            The Authorization key that will be used to verify the incoming requests.
        """
        self._webhooks["dsl"] = _Webhook(
            route=route or "/dsl",
            auth=auth_key or "",
            func=self._guild_vote_handler,
        )
        return self

"Why does my webhook not work with ''???? "

elfin anvil
sullen nymph
#

Not sure what I thought when adding the default values

spice helm
crystal cloak
restive otter
#

Can you send the code?

crystal cloak
#
dbl_token = 'token'
bot.topggpy = topgg.DBLClient(bot, dbl_token, autopost=True, post_shard_count=True)

bot.topgg_webhook = topgg.WebhookManager(bot).dbl_webhook("/dblwebhook", "password")

async def webhook():
    await bot.topgg_webhook.run(5000)

asyncio.run(webhook())
restive otter
#

Don't use asyncio.run, that'll close the event loop once it's done running it

#

You can use loop.run_until_complete, no need to wrap the run method though

crystal cloak
#

ok I will try

crystal cloak
restive otter
#

If it works it works

#

You can also use bot.loop, did I mention not to wrap the run method

#

Oh i did

crystal cloak
#

Oh okay. It seems working. Thanks!πŸ‘

spice helm
elfin anvil
#

thx

restive otter
elfin anvil
#

can anyone pls send link of top.gg doc for python

#

there are 2 i beleive

#

i have 1

restive otter
topaz axle
#

I am trying to activate my voting webhook, but im getting this error. My token was working before, any ideas?Top.GG API Error: 401 Unauthorized (You need a token for this endpoint)

loud token
#

you can try reloading your token ig

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.

stuck forge
#

Oh wait wrong channel

cosmic pendant
#

Can someone help me figure out why the autoposter isn't working? I'm assuming it's set up correctly because it's not giving an error message anywhere but Idk what else I'm supposed to do

gloomy jacinth
#

I tried adding a webhook, but it said it couldnt save. Why is this

restive otter
gloomy jacinth
#

does my bot need to be fully submitted first or something?

restive otter
stiff orbit
#

just put this
.then(res => res.json())

verbal monolith
#

-botinfo

abstract mothBOT
#

tickNo Please include a bot mention or ID

verbal monolith
#

-botinfo @sinful musk

restive otter
scarlet cobalt
oblique lance
#

how do i make a vote count

#

like if someone vote it will come in a channel with his vote count

main prairie
#

have some kind of counter (like a database table) that you increment each time a user counts.
Also IIRC there's a way to get the last 1000 votes from top.gg

tiny summit
#

-bots

restive otter
#

-bots

sullen nymph
#

Do you guys just follow everything others do

#

There's a #commands channel for this, you know

rain heart
#

what shiv said

hushed reef
#

how to api droolingpepe

ionic halo
#

Why aren't my webhooks working?
My code:

class Topgg(commands.Cog):

    def __init__(self, client):
        self.client = client
        self.dbl_token = os.environ.get('DBL_TOKEN')
        self.password = os.environ.get('DBL_PASSWORD')
        self.dbl_client = dbl.DBLClient(
            self.client, self.dbl_token, autopost=True, webhook_path='/dblwebhook', webhook_auth=self.password, webhook_port=5000)

    @commands.Cog.listener()
    async def on_dbl_vote(data):
        """An event that is called whenever someone votes for the bot on top.gg."""
        print(f"Received an upvote:\n{data}")

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

My top.gg stuff:

sullen nymph
ionic halo
#

πŸ€” how do I know which url to use?

sullen nymph
#

It's your physical server's IP address

ionic halo
#

ok

vague zinc
#

Im having issues with Dm'ing users only going by their user ID in python

rain heart
#

you can't dm people who have their dms disabled or aren't in a mutual server with your bot

vague zinc
#

im testing with dming myelf

#

and my help command DM's but thats by using ctx.author.send()

#

but this function does not hold reference to a context object so im trying to attain user from ID so that i can DM

#

but even if i test it with bot.get_user(ctx.author.id).send(message)

#

it doesnt send anything nor does it error

spice helm
#

I think you need to await bot.get_user and then await the .send on a seperate line

vague zinc
#

that didnt work

#

I stuffed it with a bunch of prints and it seems to stop at await bot.get_user(ctx.author.id)

spice helm
#

Oh right, is it timing out while making a request to discord maybe?

vague zinc
#

Object NoneType can't be used in await expression

#

Is the error i get when printing the exception

#

for await bot.get_user(ctx.author.id)

#

but even if i remove the await

#

it doesnt do anything

spice helm
#

I think either your bot variable is different or it isn't finding a user, i think that function returns None when it can't find a user

vague zinc
#

yup its returning None

#

But all it takes is an int id

#

which im feeding it

#

both return None even though i use that same variable to store and access user info in other areas : /

spice helm
#

If you're using ctx.author.id to pass into get_user object, you're using a user object to get the same user object, you could try await ctx.author.send

vague zinc
#

the other area i want to use it will be an ID string that ill cast to int

#

but that didnt work either so

#

: /

spice helm
#

Try fetch_user, i think you need intents / member cache for get_user

vague zinc
#

fetch was the way to go πŸ‘Œ

sullen nymph
#

get_user isn't async so you don't await it

pine moss
#

guys someone help

#

how do you check hypixel skyblock networths with the bot

#

*bots

rain heart
#

-wrongserver

abstract mothBOT
#

Hey! We think you have our server mistaken. We do not provide support, help, or advice for any bot. You need to click on the "Get Support" button on the bot's page of the bot you need support for, not the "Join Discord" button at the top of our website. If there isn't a button that says Support Server or you were banned from the bot's support server, then we can't help you. Sorry :(

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.

restive otter
#

@vague zinc

#

await ctx.author.send("your message")

steady delta
#
import topgg

# This example uses topggpy's webhook system.
# The port must be a number between 1024 and 49151.

dbl_token = 'Top.gg token'  # set this to your bot's Top.gg token
bot.topgg_webhook = topgg.WebhookManager(bot).dbl_webhook("/dblwebhook", "password")
bot.topgg_webhook.run(5000)  # this method can be awaited as well

@bot.event
async def on_dbl_vote(data):
    """An event that is called whenever someone votes for the bot on Top.gg."""
    if data["type"] == "test":
        # this is roughly equivalent to
        # return await on_dbl_test(data) in this case
        return bot.dispatch('dbl_test', data)

    print(f"Received a vote:\n{data}")

@bot.event
async def on_dbl_test(data):
    """An event that is called whenever someone tests the webhook system for your bot on Top.gg."""
    print(f"Received a test vote:\n{data}")

where was the dbl_token used here?

#

@anyone

#

i mean... can't you just tell? πŸ˜…

#

i came here because i couldn't find xd

#

but its still dbl there?

#
import dbl

# This example uses dblpy's webhook system.
# In order to run the webhook, at least webhook_port argument must be specified (number between 1024 and 49151).

dbl_token = 'top.gg token'  # set this to your bot's top.gg token
bot.dblpy = dbl.DBLClient(bot, dbl_token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)

@bot.event
async def on_dbl_vote(data):
    """An event that is called whenever someone votes for the bot on top.gg."""
    print(f"Received an upvote:\n{data}")

@bot.event
async def on_dbl_test(data):
    """An event that is called whenever someone tests the webhook system for your bot on top.gg."""
    print(f"Received a test upvote:\n{data}")

this was the one old and in the docs

#

the token was used

sullen nymph
#

Fucking hell

sullen nymph
steady delta
sullen nymph
#

Sure, they don't conflict with each other

steady delta
#

like

dbl_token = 'Top.gg token'  # set this to your bot's Top.gg token
bot.topggpy = topgg.DBLClient(bot, dbl_token, autopost=True, post_shard_count=True)
bot.topgg_webhook = topgg.WebhookManager(bot).dbl_webhook("/dblwebhook", "password")
bot.topgg_webhook.run(5000)  # this method can be awaited as well
#

oh ok ok

#

thanks

sullen nymph
#

Autopost is a while True loop that uses DBLClient.post_guild_count every X minutes, whereas the webhook is an actual webserver

#

So yeah

crystal bay
#

-api

steady delta
#
bot.topgg_webhook = topgg.WebhookManager(bot).dbl_webhook("/dblwebhook", "<password>")
bot.topgg_webhook.run(5000) 

this doesn't work for me sadly

restive otter
#

The one on PyPi has the run method that returns a coroutine, on the other hand, the one on GitHub returns a task. So, you can pass it on loop.run_until_complete or similar APIs

sullen nymph
#

1.1.0 soon gang

restive otter
steady delta
#

nvmmm it workedd

#

thx

restive otter
#

well you can just use ngrok or similar

lavish star
#

can you help me this command is not working

restive otter
#

stop using dblapi.js and use @waxen widget-gg/sdk

thorny matrix
#

how do I add the server voting api to my discord bot? πŸ€”

rain heart
#

Servers doesn't have an api

#

Use webhooks

thorny matrix
#

how?

#

any video or docs

#

@rain heart

rain heart
pine moss
#

hey how are you guys!

jaunty steppe
rain heart
#

probably

jaunty steppe
#

cool beans

strange thorn
#

Hello, how can I list the people who voted for my bot on my website.

#

I wonder if there is a sample php code?

rain heart
strange thorn
#

thank you, but I guess what I want is not in this document.

manic notch
strange thorn
plucky lance
#

You just have to do a simple cURL request via. PHP, decode the JSON response and there you go.

#

The endpoint is written down in the docs above.

#

(to receive the list of the last voters)

restive otter
#

Mebers+ is not verifi

willow spindle
#

?

tall willow
#

can anyone help me?

#

ready event is working but vote event is not working when i vote

plucky lance
#

Scroll up a little and you will notice to use a different library

tall willow
#

what

#

i dont understand

tall willow
plucky lance
#

stop using dblapi.js and use @waxen widget-gg/sdk

tall willow
#

but then i cant get the data when smb vote

#

top-gg/sdk is not showing me like dblapi

plucky lance
#

If I’m up to date dblapi is depreciated

tall willow
#

:Δ±

#

so how can i get my server ip?

plucky lance
jaunty steppe
tall willow
jaunty steppe
#

http://[host]:[port]/[path]

#

I haven't looked at the njs docs but I believe it runs on all interfaces, with the path /dblwebhook (user specified) with the port in app.listen

#

so you'd be serving at http://<your external IP>:3000/dblwebhook

tall willow
#

hmm

rain heart
#

are you referring to for example getting stats from a bot that the global ratelimit also applies to the bot endpoint ratelimit?

#

if so, then yes

stable magnet
#

im trying to use ngrok and node but cannot figure out how to setup webhooks for votes, when I hit test I get 403 Forbidden
in my ngrok console

#

my code

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

const app = express()

const webhook = new Topgg.Webhook(process.env.TOPGG_API_TOKEN)

app.post("/dblwebhook", webhook.listener(vote => {

  console.log(vote.user) 
}))

app.get("/dblwebhook", function (req, res) {
    res.json({text:"Test"});
  });

app.listen(8000)
rain heart
#

your token is wrong

#

TOPGG_API_TOKEN is not your top.gg token

#

it is authorization for your webhook

#

like a password that lets your webhook know "yes it came from there and that's correct"

stable magnet
#

omg, im so dumb

#

i have been trying so many things

#

lol thank you very much!

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.

restive otter
#

How can I make a vote log for my bot. ?

#

-help

#

-api

#

@abstract moth

rain heart
#

Mods only

#

Read the docs in the pinned messages

edgy cedar
#

does the api have server routes, for example servers/:server_id/check to check if a user has voted for the server? ive tried looking on the docs but it doesnt have any info about server routes

jaunty plank
#

only webhooks.

edgy cedar
#

thank u

green violet
#

how can i take my api key?

restive otter
sullen nymph
#

You grab it with your hands, your PC, your mouse, and your keyboard (optional)

willow spindle
bold inlet
#

tamam Γ§ΓΆzdΓΌm

#

etiket iΓ§in k.b

elfin pine
#

how i can get how many votes a user has to my bot? (python library)

restive otter
#

topggpy >> blobweary

sullen nymph
stable magnet
#

so im trying to port forward for voting webhooks, but it just sets to this, do i just put app.listen(80) in my code?

#

and do http://thatdevice'sIP:80/dblwebhook in the webhook url box?

rain heart
#

you dont need :80 when your port is 80

#

http:// always defaults to 80

sand viper
#

-api

stable magnet
#

ok but then when I do app.listen(80)

#

it gives me an error

rain heart
#

cant help you without the actual error

stable magnet
#

one sec

#
Error: listen EACCES: permission denied 0.0.0.0:80
sand viper
#

@rain heart how I do
I don't understand all things
I new in top.gg

rain heart
rain heart
stable magnet
rain heart
#

set your port to 8000

#

in your code

stable magnet
#

πŸ‘

sand viper
stable magnet
#

read the error,

sand viper
#

Error

stable magnet
#

no

#

im telling u to read ur error

#

bc its obvious what is wrong

sand viper
#

What I do

stable magnet
#

dont define express more then once

elfin anvil
#

do we have to host the webhook to get the ppl who voted?

#

# This example uses dblpy's webhook system.
# In order to run the webhook, at least webhook_port argument must be specified (number between 1024 and 49151).

dbl_token = 'top.gg token'  # set this to your bot's top.gg token
bot.dblpy = dbl.DBLClient(bot, dbl_token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)

@bot.event
async def on_dbl_vote(data):
    """An event that is called whenever someone votes for the bot on top.gg."""
    print(f"Received an upvote:\n{data}")

@bot.event
async def on_dbl_test(data):
    """An event that is called whenever someone tests the webhook system for your bot on top.gg."""
    print(f"Received a test upvote:\n{data}")```
How do i set the webhoook link in this code?
elfin anvil
sullen nymph
#

webhook_path is the route

#

which, in the example, is /dblwebhook

elfin anvil
#

right?

jaunty plank
#

http://ip:port/dblwebhook
fill in ip and port with the relevant info

#

if you have ssl, then you can use https

sullen nymph
#
  1. http, not https (unless you have your server validate SSL certificates);
  2. IP and port are separated with a colon, not a slash;
  3. Correct, your path/route is /dblwebhook, simply prepended to the IP:port part
elfin anvil
#

Thank you πŸ™‚

sullen nymph
elfin anvil
jaunty plank
#

yes

elfin anvil
#

ohk πŸ‘πŸ»

#

sorry for disturbing πŸ˜…

sullen nymph
#

No worries xd

inner folio
stable magnet
#

that is what i was telling him

#

that was his error not mine

#

..

stuck plinth
#

Am I a developer?
Yesssssssssss

restive otter
#

how do i integrate voting webhooks using javascript? (also pls ping)

restive otter
#

oh thx

#

how did i miss an entire section of the api documentation

gusty kiln
#

hi

terse anchor
#

Lol

jovial kiln
#

What is the point of that?

knotty plover
#

Hello again πŸ˜• Sorry, but this is for Server Count (java script)?

knotty plover
#

Thx

#

^^

coarse rune
#
const Topgg = require("@top-gg/sdk")
const express = require("express")

const app = express()

const webhook = new Topgg.Webhook(Not giving you)

app.post("/dblwebhook", webhook.listener(vote => {

  console.log(vote.user) 
}))

app.get("/dblwebhook", function (req, res) {
    res.json({text:"Test"});
  });

app.listen(8000)```
#

this is my code

#

it gives me the error webhook.listener is not a function pls help

blazing helm
#
const Discord = require("discord.js");
const { MessageEmbed } = require("discord.js");
const { Color } = require("../../config.js");

module.exports = {
  name: "dicksize",
  aliases: ["dick", "pp", "ppsize"],
  description: "Show Member PP Size!",
  usage: "Dicksize <Mention Member>",
  run: async (client, message, args) => {
    //Start
    message.delete();
    let sizes = [
      "8D",
      "8=D",
      "8==D",
      "8===D",
      "8====D",
      "8=====D",
      "8======D",
      "8=======D",
      "8========D",
      "8=========D",
      "8==========D",
      "8===========D",
      "8============D",
      "8=============D",
      "8==============D",
      "8===============D",
      "8================D",
      "8==================D"
    ];

    let Member =
      message.mentions.members.first() ||
      message.guild.members.cache.get(args[0]) ||
      message.member;

    let Result = sizes[Math.floor(Math.random() * sizes.length)];

    let embed = new MessageEmbed()
      .setColor(Color)
      .setTitle(`Pp v2 Machine`)
      .setDescription(`${Member.user.username} pp Size Is\n${Result}`)
      .setFooter(`Requested by ${message.author.username}`)
      .setTimestamp();

    message.channel.send(embed);

    //End
  }
};```
sullen nymph
balmy hamlet
#

this dude just straight on posted some random code without even asking for anything

fickle pewter
sullen nymph
#

Why are you continuing this

hushed reef
#

Can you guys stop shitposting? This is a channel dedicated to top.gg API only, not posting NSFW.

#

@mighty shuttle

mighty shuttle
#

Keep it SFW and keep it related to Top.gg's api

old glacier
sullen nymph
celest gorge
#

Hello, how do I run code whenever someone votes for my bot with python?

rain heart
celest gorge
rain heart
#

see above

celest gorge
#

Does top.gg has an api wrapper?

rain heart
#

yess

#

see above

sullen nymph
celest gorge
#

oh thank you!

sullen nymph
#

Top.gg docs haven't been updated yet

celest gorge
#

Hello, how can I test a vote webhook?

obsidian robin
blazing helm
#

hi

spice helm
restive otter
#

Does my bot need to be approved ? If.I want to send a message everytime someone votes for my sever?

rain heart
#

yes

sullen nymph
#

Server no

rain heart
#

oh they mentioned server

#

mb

sullen nymph
#

Kekw

green violet
#
bot.command({

  name: "$alwaysExecute",

  aliases: ['votetracker',],

  code: `

**Thanks for voting!**

{You have received 2.500 Luna Coins!}

$setGlobalUserVar[wallet;$sum[$setGlobalUserVar[wallet];2500]]

$globalcooldown[12h;]

$onlyIf[$jsonRequest[https://top.gg/api/bots/$clientID/check?userId=$authorID;voted;;Authorization:{my top.gg api}==1;]]

$dm[$authorID]

`

})β€Š
#

does this endpoint exist and work?

restive otter
sullen nymph
#

Such endpoint exists but I have absolutely no fucking clue how your request is formed

green violet
#

interesting

sullen nymph
restive otter
#

Oh so I can do it?

sullen nymph
#

Aye, you can

restive otter
#

May u pls lead me to the docs?

sullen nymph
restive otter
#

TYY

willow sphinx
sullen nymph
#

LMFAO

#

That honestly looks more confusing than a JS script would

willow sphinx
#

what am I even looking at

rain heart
#

looks like dbd

#

or whatever that is otherwise

willow sphinx
#

have fun finding resources to solve your problems

green violet
#

oki

cedar halo
#

Can someone help me I’m trying to make my bot send a message to a Channel when someone votes for the bot

cedar halo
jaunty plank
cedar halo
#

How do I make it to a channel not console log

jaunty plank
#

you can use the standard discord.js stuff.
Channel#send(content)

cedar halo
#

Also how do u get the webhook auth

jaunty plank
#

its like a password you make it

cedar halo
#

Oh ok

covert crescent
#

Hello, how do I run code whenever someone votes for my bot with js

#

..

reef delta
#

With webhooks

idle wigeon
#

Omg buttons OP

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.

idle wigeon
#

Ooooh i was on wrong channel

#

Didnt notice srry

restive otter
#

Can someone pls help me , I’m tryna make my webhook send a message when someone votes for my server , how to get the server token?

quasi marsh
#

I joined a few minutes ago with the same question but I didn't ask anything, I just decided to cry

smoky marten
#

The Authorization token

sullen nymph
#

Probably yeah

eager gorge
shy vortex
#

ok

#

but may I ask

#

what is ur issue and second

#

use code blocks

restive otter
rapid scroll
#

one could argue that this is a real programmig language

leaden arch
#

Gg

rain heart
#

@novel summit don't advertise please

#

thanks

mossy gazelle
#

Hi, i'm trying to migrate to new top.gg api from dbl.api and have a question. I ave access to the api secret, but i don't have a dashboard to send webhook response to. Besides, i can't also provide an ip as i'm using Heroku.

#

Can anyone help?

restive otter
#

So I can’t make it send a message when someone votes for a server?

sullen nymph
#

If that's what you meant by server token, it's a password created by you

mossy gazelle
#

Me?
I understood that part. But what will i put in URL Field?

sullen nymph
#

Whatever the hell the URL to your Heroku app is KEKW

mossy gazelle
#

As i don't have a fixed ip and also using worker process of heroku

sullen nymph
#

I'm not familiar with Heroku URLs

mossy gazelle
#

Ohkay

livid lynx
#

/networth egirl_pex orange

#

.networth {egirl_pex} [orange]

sullen nymph
#

Try harder in another server

livid lynx
#

/networth Egirl_pex orange

#

.networthleaderboard

#

.networthegirl_pex orange

sullen nymph
#

Are you okay

livid lynx
#

.networth egirl_pec orange

#

.networth egirl_pex orange

#

.networth {egirl_pex}[orange]

sullen nymph
#

@sacred shell

remote sapphire
eager gorge
#

?

magic harbor
inland marsh
#

yes

#

why

magic harbor
#

ah ok

inland marsh
magic harbor
covert crescent
#

pls give me the voting api for discord.js

sullen nymph
#

You have the API, you just need to implement it

jaunty salmon
restive otter
#

?help

#

.help

#

!help

rain heart
#

-botcommands

abstract mothBOT
#

Hey! Bots aren't given permissions to send responses in this channel. Please use #commands to run commands.

floral egret
#

How to see my top.gg webhook password

#

Is my webhook url my top.gg webhook password/auth?

signal hawk
#

No not the url

blissful bluff
#

does reply function not work?

#

it doesnt post my reply

#

;-;

floral egret
brittle spoke
#

wym reply function @blissful bluff

blissful bluff
brittle spoke
#

oh thats a known issue

#

but not an api thing

blissful bluff
#

ohh sorry

#

i didnt saw the channel xD

#

btw is there way to reply?

#

the literal reply thingy

smoky marten
floral egret
#

Will I create the authorization on my own

rain heart
#

Yes

floral egret
#

okay

fresh token
#

How to fetch if someone votes on top gg

smoky marten
gusty socket
#

webhook nasΔ±l kullanabilirim

coarse rune
#

how do i make the webhook poster post automatically after some time discord.js

bronze epoch
#

Hello, I'm not able to log the votes for my bot, Is their some specific docs to follow?

sharp totem
#

How to get the votes of my bot which are not yet expired, that is all votes made within last 12 hours

#
https://www.top.gg/api/:bot_id/votes

I need only non expired votes

#

This brings all the votes in the month right?

sharp totem
#

Check what?

#

There is nothing to check if it is a vote within 12 hours

kindred swift
#

Is it possible to use the api to post announcements on the bot site on top.gg?

#

Like these announcements?

ruby grotto
#

my bot is waiting for approval since 2 weeks

kindred swift
green violet
#
module.exports.command = {
  name: '$alwaysExecute',
  Aliases: ['votetracker',],
  code: `
  
$dm[$authorID]
**Thanks for voting!**
{SOME REWARDS HERE}
$setGlobalUserVar[wallet;$math[$setGlobalUserVar[wallet]+5000]]

$Globalcooldown[12h;]
$onlyIf[$jsonRequest[https://top.gg/api/bots/$clientID/check?userId=$authorID;voted;;Authorization:{replace with ur top.gg api key]==1;]


$suppressErrors`
}

on api key what i put and is the code correct?

sullen nymph
#

see pins

hushed reef
#

oh my god

floral egret
#

I have added the code and the auth too, but when someone votes the BOT it doesn't show

smoky marten
jaunty plank
#

Minimum wait time is 3 weeks.

#

It's currently closer to 4 weeks

kind barn
#

@floral egret check the url in the bot's page
Must be like: vps_ip:port/dblwebhook

#

Check also to allow incoming connections by the firewall

brittle grove
#

What language is top.gg api written in?

willow sphinx
#

current one in javascript next one in C#

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

floral egret
smoky marten
#

the "Webhook URL"

floral egret
#

In my one it is empty

smoky marten
#

and you have to put it

floral egret
#

What will I put there? Where will I get that link that I have to put there?

#

@smoky marten

smoky marten
spring flicker
#

Is there anyway to contribute for the top.gg packages

#

like uploadfiles or?

#

Oh wait with a pull request?

#

ah ok

spring flicker
#

Is the 1 the amount of how much the user has voted this or 1 = voted this 12 hours and 0 = not voted this 12 hours

sullen nymph
#

It's boolean in integer form

restive otter
#

0 is false otherwise true

spring flicker
#

yes that was my second option

willow sphinx
#

yeah all of those confusing things will be fixed with the new version of the api coming soontm

restive otter
#

pog, wonder if supporter, mod, etc would be flags

limber warren
#

bro how to make a api dbl

willow sphinx
restive otter
latent narwhal
#

how to check number of votes?

fresh token
#

how do i get the topgg api token

#

Hm

#

Lemme check ty

#

Thats a one very long token

#

Thanks

restive otter
#

hi i have a question are nuke bots allowed

#

like to publish

#

but is it against discord tos

#

then why are there other nuke bots

#

just one tip don't let them use it in the test server cuz that whole test server will be nuked

coarse rune
#

does someone use discord.js. If yes react

restive otter
coarse rune
restive otter
#

whats your question

restive otter
#

ia_think_thonk not sure why

sullen nymph
#

Sounds like old version

sinful pawn
#

Is there a widget for servers too? (like bots having a picture where it shows upvotes and stuff)

fresh token
#
topken=os.getenv('topken')
topgg=topgg.DBLClient(client, topken)

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

this doesnt print anything when someone votes

sullen nymph
#

Did you literally miss the part with WebhookManager in docs

#

Oh right they're not updated

fresh token
#

e?

#

what do i need to do

fresh token
#

is there no way to do it without a webhook

sullen nymph
#

A webserver is what actually receives the votes in real time so without it there isn't

fresh token
#

damn i need to find one 😩

sullen nymph
#

wdym find one

#

Do you know what a webhook is

spring flicker
#

You can just do that using express

surreal widget
#

just got accepted any documentation for d.py?

surreal widget
#

what is the import for python? dbl topgg or something else?

sullen nymph
#

topgg

surreal widget
#

weird it doesnt recognize topgg when i put it

#

let me restart vsc

sullen nymph
#

Install topggpy

surreal widget
#

yeah i did

#

just when i wrote topgg it didnt want to work so now i restarted it and it seems fine

#

yeah its good now thank you

sullen nymph
mossy gazelle
#

Will this code work?

/* THIS POSTS STATS TO Top.gg */
const Topgg = require("@top-gg/sdk");

module.exports = {
    
    /**
     * Starts to post stats to Top.gg
     * @param {object} client The Discord Client instance
     */
    init(client){
        if(client.config.apiKeys.topgg && client.config.apiKeys.topgg !== ""){
            const stats = new Topgg(client.config.apiKeys.topgg, client);
            setInterval(function(){
                stats.postStats(client.guilds.cache.size);
            }, 60000*10); // every 10 minutes
            const topgg = new Topgg(client.config.apiKeys.topgg, { webhookPort: client.config.votes.port, webhookAuth: client.config.votes.password });
            topgg.webhook.on("vote", async (vote) => {
                const dUser = await client.users.fetch(vote.user);
                const member = await client.findOrCreateMember({ id: vote.user, guildID: client.config.support.id });
                member.money = member.money + 40;
                member.save();
                dUser.send(client.translate("misc:VOTE_DM", {
                    user: dUser.tag
                })).catch(() => {});
                const logsChannel = client.channels.cache.get(client.config.votes.channel);
                if(logsChannel){
                    logsChannel.send(client.translate("misc:VOTE_LOGS", {
                        userid: dUser.id,
                        usertag: dUser.tag
                    }));
                }
            });
        }
    }

};```
sullen nymph
#

Try it and see

#

You have the data format example in docs.top.gg, send a manual request to your webhook

brave pumice
#

is there any ratelimits

#

about updating servers coutn

sullen nymph
#

60/60s for /bots/* endpoints along with 100/1s global

mystic arch
#

What am I doing wrong here?

// Require discord.js package
const { Client, Collection } = require("discord.js");

// Create a new client using the new keyword
const client = new Client();

// npm install @top-gg/sdk
// Posts stats to top.gg
const AutoPoster = require('topgg-autoposter');

const ap = AutoPoster('insert token here', client);

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

I'm getting this error:

TypeError: AutoPoster is not a function
    at Object.<anonymous> (index.js:46:12)```
knotty garnet
#

compare with yours

mystic arch
#

Fixed it

#

Was the { AutoPoster } part

knotty garnet
#

always refer to the docs as the first troubleshooting measure

mystic arch
elder siren
#

How do I authorize?

#

my token

restive otter
elder siren
#

I want to post my server count

#

But that wont work so I think the reason is cuz I need to authorize

restive otter
#

are you using @top-gg/sdk?

elder siren
#

no

restive otter
#

can you show me the code of what you're trying to do

elder siren
#

I dont have any code

#

I dont understand what to do when POSTING to an API

#

I have said this

#

I am 100% new to web related stuff and that includes APIs and HTTP Headers

restive otter
#

what lang, forgot to ask

elder siren
#

py

#

do they have a wrapper?

restive otter
#

i'm not good with py stuff unfourtunately

restive otter
#

pip install dblpy

elder siren
#

Do I not need to authorize for the wrapper

restive otter
#

yes but the docs should tell you

elder siren
#

ik

restive otter
#

Wonder why you're asking then. I mean I'm late, but w/e, just telling you that dblpy is deprecated, use that instead

west gazelle
#

Where is there api?

brittle spoke
#

right above you...

west gazelle
#

is the id my bot id

verbal locust
#
const DBL = require("dblapi.js");
const dbl = new DBL(process.env.DBL_TOKEN, { webhookPort: 5000, webhookAuth: process.env.AUTH_PASS });
client.on("message", message => {
    if (message.content == "+check") {
    dbl.hasVoted(message.author.id).then(c => {
        if(c) {
            message.channel.send("Yes, you voted me on Top.gg")
        } else {
            message.channel.send("You haven't voted me on Top.gg")
        }
    })
    }
})```
#

is it true

balmy hamlet
#

idk, it is true that idk what you're asking for tho

old egret
#

How do I post my stats to my top.gg page? (guild count)

#

It says 497 while I have 535

brittle spoke
#

use the current version in pins

restive otter
#

Kisi ke paas code ha kya

#

Anybody have code for website

#

Who have code ping me

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.

old egret
#

How do I post my stats to my top.gg page? (guild count)

#

It says 497 while I have 550

smoky marten
old egret
#

I was using dblapi.postStats until now and it suddenly stopped working

smoky marten
#

Which dblapi ?
also Thus should be the code

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

const api = new Topgg.Api('Your top.gg token')
client.on("ready", () => {
    setInterval(() => {
        api.postStats({
            serverCount: client.guilds.cache.size,
            shardId: client.shard.ids[0],
        });
    }, 5*60*1000 );
});
client.login("BOT_TOKEN")
old egret
#

Alr, thanks

smoky marten
#

np

restive otter
#

@abstract moth

hardy grail
#

Do anyone can help with how do I implement top.gg webhooks ? there are many grey areas in the documentation 😦

sullen nymph
#

What do you mean grey areas?

stuck socket
#

Can you update the library name on API page

#

on the page dblpy is given, but the lib is now called topggpy

sullen nymph
#

It'll be changed soon

stuck socket
#

stats were not updating using the old one, so you should do it ASAP

hardy grail
#

in here ?

sullen nymph
#

qwe9j2170puiojwqekl

#

You need a webserver hosted on a physical machine with access to the internet

#

not a Discord webhook

hardy grail
#

is it mandatory to use webhooks .. cant i just use API normal ?

restive otter
#

If you don't need to track votes in real time, sure, why bother using it?

hardy grail
#

coz i am told by people that if i want to track who voted my bot then i need webhooks for it

#

i just want to give some bonus to people who voted my bot.

restive otter
gusty elbow
#

Does the API return if the bot is online

sullen nymph
#

No

gusty elbow
#

Oh

#

Ok

hasty mica
#

how do i translate a webhook message to input data for my bot

rain heart
#

by parsing the json data the webhook returns

hardy grail
#

its quite easy with using API rather than webhooks

elder siren
#

Getting this error when using the python wrapper TypeError: object Lock can't be used in 'await' expression

sullen nymph
#

Use the other wrapper

#

topggpy

elder siren
#

is it the same syntax?

sullen nymph
hardy ruin
#

For code relating to webhooks would I stick it into index.js?

graceful merlin
#

in the new API "@ top-gg / sdk" I can't call (req, res) anymore?

willow spindle
#

you can use middleware

graceful merlin
#

ok

restive otter
#

How do I show my server and member count on my top.gg page?

hasty mica
#

Do you have to use a webhook for python only? Or is it for all of them?

willow spindle
#

no and yes

willow spindle
winter tusk
#

new Webhook('auth')
My bot auth token in topgg or the auth password?

winter tusk
nocturne quarry
#

Yes

#

There is nothing but you create one yourself

#

Put on the field what password u want and copy it to the new Webhook('password here')

winter tusk
#
  app.post('/dblwebhook', wh.listener(async (vote) => {
    (await client.users.fetch(ID)).send(text)
  }))```
#

Anything wrong

pastel drift
#

How can I get the monthly vote count for my bot using python?

sullen nymph
#

monthlyPoints before that

sullen nymph
#

Oh I should update the changelog for this probably

glossy spear
#

If you are trying to set up vote rewards use this methods it's way easier and less complicated

winter tusk
#

My router gets the post from topgg, but the callback function is not called. app.post('/topgg', webhook.listener(async (vote) => { (await client.users.fetch(ID)).send(text) }))

winter tusk
glossy spear
winter tusk
#
const voteWebhook = new Webhook(process.env.TOPGG_WEBHOOK_AUTH)
  
  app.post('/topgg', voteWebhook.listener(vote) => {
    console.log(vote.user)
  })
#

Whats wrong here? Router logs path "/topgg" got a post request. But the callback isn't called

sullen nymph
glossy spear
#

its a different method im using a third party website called "integromat" from there i set up requests to send to the webhooks on discord

sullen nymph
#

Ah, I see

#

yeee less headache for me

glossy spear
#

lol

winter tusk
#

am I like blocked from the server?

#
const voteWebhook = new Webhook(process.env.TOPGG_WEBHOOK_AUTH)
  
  app.post('/topgg', voteWebhook.listener((vote) => {
    console.log(vote.user)
  })
  ``` Whats wrong here? Router logs path "/topgg" got a post request. But the callback isn't called
#

Is the webook_auth the api key?

balmy hamlet
#

there's no api key

winter tusk
#

"Token for this bot"

balmy hamlet
#

Idk I haven't used their api for a long time

winter tusk
balmy hamlet
#

you're better off just waiting for someome else

coarse rune
#

Can someone pls tell me if my code is correct

#
const express = require('express')

const app = express() // Your express app

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

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

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

ok

coarse rune
#

so can someone help pls

winter tusk
coarse rune
winter tusk
#

@coarse rune did u change the URL in topgg?

coarse rune
winter tusk
#

the url to which topgg posts votrs

polar birch
winter tusk
coarse rune
#

i am actually new to coding on top.gg

winter tusk
#

Change that url in topgg/bot/id/analytics to http://<ur_ip>.<port>/dblwebhook

coarse rune
#

ok...

winter tusk
winter tusk
#

Lmao @coarse rune

#

No

#

That one

#

Change /topgg to /dblwebhook for ur case

#

I did that thing and still didn't work for me ;-;

coarse rune
#

Oh ok

winter tusk
#

@Thecubingmaster123#4384 found the problem

#

The webhook auth is not the bot token

#

It is wat u set

winter tusk
#

that's the webhook auth

humble raptor
#

need a free udemy course!

hasty mica
#

Do you have to use a webhook for python only? Or is it for all of the languages?

sullen nymph
#

Depending on what you want to do

hasty mica
#

Collect the data for on_dbl_vote

sullen nymph
#

Then yes you need the webhook for that

#

A webhook is what actually receives the vote data in real time so it's not limited to a specific language

hasty mica
#

Yes but many api references i saw for topgg included a new discord Client event, so i was curious to see that in other languages

#

Ind im also a bit confused

#

Bc it seems like it was way easier that way

#

But the api got updated

#

And now only 1 reference is right

sullen nymph
#

I've been busy lately so I have no time to update the top.gg docs for the Python SDK right now. I should be able to make a PR for that later this week, however.

Well, the node SDK has its own event emitter, but the Python one utilizes your discord.py Client for that

green violet
#

can someone send me the fullfilled api with /check/userid=

rain heart
ashen monolith
#

Does the serverCount stat expire over time at all?

sullen nymph
#

Nope

ashen monolith
#

Thanks @sullen nymph

rotund eagle
#

i can't figure what to do in server webhooks part

#

and i am not able to assign the reward roles too

#

pls help me

#

what requests?

#

@shut flume

#

i have already created teh server'

balmy hamlet
#

I'm not sure you guys are on the same page

lean harbor
#

I Am Getting This Error

hollow owl
#

im making a simple top gg api lib. its ok to publish it?

#

Or i have to put "This is an unoffical lib" in desc?

sullen nymph
#

It's preferred that you put a disclaimer that your library isn't official

cunning basin
#

i need help

#

what i put on authorization

willow oracle
#

Click on this to show your authorization key

spice helm
#

I dont think those are the same, you make your own authorisation

willow oracle
#

custom authorization for the webhooks

willow oracle
spice helm
#

Yeah

willow oracle
#

you are welcome

wintry tartan
#

ISelfBot me = await DblApi.GetMeAsync();
on this line i get a error on ISelfBot, it says the type or namespace name could not be found

#

any help on that?

#

C# btw

velvet osprey
#

Guys i have following issue with the api (Cannot access 'client' before initialization)

wintry tartan
#

no help for us today pal

uncut ember
#

There a problem With Your Bot Client id

prisma olive
#

@cobalt ruin

cobalt ruin
#

Hiii

prisma olive
#

Hi!

#

Sorry for pinging you.

#

I was just trying to find you profile. πŸ˜†

restive otter
bronze flower
#

hi guys I was beendet from the AniGame server four spaming in spam chanal wtf topggThumbsDown topggThink topggAngry

rain heart
#

-api @bronze flower

abstract mothBOT
#

@bronze flower

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.

rain heart
#

also

#

-wrongserver

abstract mothBOT
#

Hey! We think you have our server mistaken. We do not provide support, help, or advice for any bot. You need to click on the "Get Support" button on the bot's page of the bot you need support for, not the "Join Discord" button at the top of our website. If there isn't a button that says Support Server or you were banned from the bot's support server, then we can't help you. Sorry :(

tight needle
#

Excuse me, i've tried the different sources of documentation i could find which are:

  1. https://github.com/top-gg/python-sdk#using-webhook (Code below is using this one)
  2. https://docs.top.gg/libraries/python/
  3. https://topggpy.readthedocs.io/en/latest/webhooks.html#webhookmanager

But i still can't get the bot to react to on_dbl_vote. Can someone please tell me what am i doing wrong?

import topgg

# This example uses topggpy's webhook system.
# The port must be a number between 1024 and 49151.

client = commands.Bot(command_prefix=get_prefix, help_command=None, case_insensitive=True)

dbl_token = "notHere"  # set this to your bot's Top.gg token
client.topggpy = topgg.DBLClient(client, dbl_token)
client.topgg_webhook = topgg.WebhookManager(client).dbl_webhook("/http://myIP:19950", "Tester123")
client.topgg_webhook.run(19950)  # this method can be awaited as well

@client.event
async def on_dbl_vote(data):
    print("Check")
    """An event that is called whenever someone votes for the bot on Top.gg."""
    if data["type"] == "test":
        # this is roughly equivalent to
        # return await on_dbl_test(data) in this case
        return client.dispatch('dbl_test', data)

    print(f"Received a vote:\n{data}")

@client.event
async def on_dbl_test(data):
    """An event that is called whenever someone tests the webhook system for your bot on Top.gg."""
    print(f"Received a test vote:\n{data}")
bronze epoch
#

Hello, How can i log the votes? Is there a document which could help?
I tried using the topgg/sdk api but it didnt work

rain heart
#

That's your path, NOT the full url

tight needle
rain heart
#

See the docs

tight needle
#

Thank you very much for pointing out the mistake! I appreciate it 7_smile

sullen nymph
#

Maybe I should make it error out on http in the path string

#

Oh. Or just output the current routes with full URL

fathom herald
#

Missing

sullen nymph
#

We all miss sometimes. It's okay to miss, we're not perfect. Just learn from your miss and move on

sick grove
#

bruh wrong send

topaz mural
#

Can we make automated top.gg voting rewards for the top.gg API with JS?

sullen nymph
#

Yes, see webhooks

solid crest
#

Authorization is setup correctly too (either in code and on top.gg webhook section) however this shouldn't make the not found

solid crest
rain heart
#

404

#

meaning not found

#

now look at your path parameter?

#

Notice something?

rain heart
rain heart
solid crest
rain heart
#

yup you cant make get requests

#

post requests is what your webhook only listens too

#

use reqbin to make a test request

solid crest
rain heart
#

now

#

add a auth header

solid crest
#

or?

rain heart
#

remove the basic

solid crest
rain heart
#

the authorization is wrong then

#

check your code shrug

solid crest
rain heart
#

check the headers from the request, press the "Headers"

solid crest
sullen nymph
#

octet-stream, fun

#

Send a json to it

solid crest
#

ah hwait

#

nvm

#

ok hang on

sullen nymph
#

Remove the Authorization: part from the Authorization tab

sullen nymph
#

No, not all of it

solid crest
#

ahh ok ok

sullen nymph
solid crest
sullen nymph
#

wtf

weary hearth
#

lol

solid crest
#

ye exactly lol

#

the thing is

#

it used to work till a month ago

#

hadn't changed code or settings on top.gg

unique harbor
#

Hi, is there an endpoint to post votes instead of using the website ?

sullen nymph
#

Nope

solid crest
#

any way to fix it maybe? my thingy?

sullen nymph
#

idk try restarting it or using another auth

solid crest
#

restarted so many times

solid crest
#

tried using another auth but still nope

full mesa
#

Just to be clear, the limit is 100 per second?

willow sphinx
#

that's the hard limit that will get you banned from cloudflare

#

so I recommend you don't get too close to it

full mesa
full mesa
#

Thank you

elfin anvil
#

Do I need to integrate this with flask? and how do i do tht(discord.py)

import os
from main import client 
dbl_token = os.getenv('toptoken')# set this to your bot's top.gg token
client.dblpy = dbl.DBLClient(client, dbl_token, webhook_path='/', webhook_auth='password', webhook_port=8080)

@client.event
async def on_dbl_vote(data):
    """An event that is called whenever someone votes for the bot on top.gg."""
    print(f"Received an upvote:\n{data}")

@client.event
async def on_dbl_test(data):
    """An event that is called whenever someone tests the webhook system for your bot on top.gg."""
    print(f"Received a test upvote:\n{data}")

@client.event
async def on_guild_post():
    """An event that is called whenever autopost successfully posts server count."""
    print(f'Posted server count ({client.dblpy.guild_count})')```
sullen nymph
#

No it should be running already

bronze epoch
#

Hi, I tried to update the server count, But its showing an error, So what can i do?

old egret
#

Is there a way to check how many times a user has voted using the topgg api?

rain heart
#

no, you'll have to track it yourself

rain heart
bronze epoch
#

I tried with the top.gg/sdk package, the bot automatically crashed no idea why

#

i used those other packages, it showed error in the console

rain heart
#

Still cant help without any errors to show shrug

bronze epoch
#

sorry was afk, let me send now

#

Error: Error: 401 Unauthorized

smoky marten
bronze epoch
#

nope, its correct

cunning basin
#

i need help

sullen nymph
#

Me too

cunning basin
#
TopGGAPIError [Top.GG API Error]: 403 Forbidden (You don't have access to this endpoint)```
#
const api = new Topgg.Api('my token of top.gg')
let voted = await api.hasVoted(message.author.id)```
#

on monday that correct, now ocurred a error

#

the same code

knotty sparrow
#

how can i setup the url for the webhook system?

plucky lance
#

The URL is the public IP address of the machine the webhook service is running on.
Or even a domain name if the target is it's public IP address.

restive otter
#

In discord.js how I will make top.gg vote require command

#

Which package will help me

plucky lance
#

And don't randomly ping people. Patience!

restive otter
restive otter
shy vortex
#

which i think is much easier

#

lol

ashen monolith
#

Hah yeah, don't over engineer things when you don't have to.

plucky lance
#

That just returns users who have voted the current month and no previous one

plucky lance
#

I would also rely way more on my own database then the topgg API

steady steeple
#

I'm currently looking at

import dbl

# This example uses dblpy's webhook system.
# In order to run the webhook, at least webhook_port argument must be specified (number between 1024 and 49151).

dbl_token = 'top.gg token'  # set this to your bot's top.gg token
bot.dblpy = dbl.DBLClient(bot, dbl_token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)

@bot.event
async def on_dbl_vote(data):
    """An event that is called whenever someone votes for the bot on top.gg."""
    print(f"Received an upvote:\n{data}")

@bot.event
async def on_dbl_test(data):
    """An event that is called whenever someone tests the webhook system for your bot on top.gg."""
    print(f"Received a test upvote:\n{data}")

I'd like to create a vote required command. Where can I get a webhook from to use?

coarse rune
#

Hi can someone help me make like a timer for voting

shell shuttle
#

how to setup webhook inside python bot?

shell shuttle
dawn perch
shell shuttle
#

also, is there a way to detect server votes?

rain heart
#

webhooks

shell shuttle
# rain heart webhooks

look i want to detect votes for a server and give perks to the user who voted for the server..... how?

rain heart
#

see docs above

shell shuttle
#

give perks meaning give coins

scarlet cobalt
#

One message removed from a suspended account.

rain heart
#

yes, see docs above

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

shell shuttle
#

what url do i put here to make my bot detect the votes

#

me being confused AA_Kitten_Cry

#

everything is bot votes how tf do i detect server votes helppp

willow spindle
shell shuttle
willow spindle
#

what did you put

#

what language

shell shuttle
willow spindle
shell shuttle
rain heart
#

not working doesn't tell us much

shell shuttle
shell shuttle
rain heart
#

now check your dsl_webhook parameters

#

see something on the url and the first parameter

shell shuttle
#

route, password

rain heart
sullen nymph
#

Fuck's sake I need to update those docs

restive otter
#

is there an owo channel here?

sullen nymph
#

No

rain heart
abstract mothBOT
#

@restive otter

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.

shell shuttle
rain heart
#

bruh

#

"Path"

#

not url

#

on your URL on the top.gg site, add /dsl