#topgg-api

1 messages · Page 161 of 1

hushed reef
#

hmm, if you have the autoposter object linked to your d.JS or Eris client it should work fine then

#

do you mind posting your autoposter code?

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

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

It's showing 1 server count on the Top.gg website for my Bot.

hushed reef
#

the server count and shard count will be automatically posted every 30 minutes when this happens

#

have you tried also logging the current server count stats in the console to concur if it is actually updating?

meager wigeon
#

For Top.gg or my bot in general?

hushed reef
#

within the autoposter event

meager wigeon
#

oh like ${stats.serverCount}

console.log(`Posted stats to Top.gg | ${stats.serverCount} servers`)```

Smth among those lines ^.
hushed reef
#

yeah

#

it may help with seeing if your server count is being updated or not, because caching might be involved so every 30 minutes you could potentially just be sending the same cached server count

#

and that wouldn't be very poggers if that were to be the actual case NM_sadge

meager wigeon
#

Yeah

#

It logs in the console fine although it show's it's in 1 server when my bot isn't in 1 server, I'll just wait 30 minutes to see if it's updated or not

#

¯_(ツ)_/¯

hushed reef
#

could be related to the client then because IIRC (stats) is just passing the instance from the d.JS client properties

#

that may be hypothetically cached or just simply not updating at all

#

but my brain is pretty mushy and gooey now, @hearty lintel is honestly the guy to ask about this, JS is not my expertise

hearty lintel
#

yeah top.gg stats take a bit to update just wait

meager wigeon
#

alright

#

Alright, I'll give it some time, thanks for your help guys.

hushed reef
#

cheers

storm vale
#

HOW CAN YOU SEE who has voted through webhook

storm vale
#

??

wind vector
#

all it takes is one look through the docs

hearty glen
#

Why doesn’t this work

#
@client.event
async def on_dbl_vote(vote):

  print(f"{vote.user} has voted for me.")
sullen nymph
#

Because:
a) you aren't running WebhookManager;
b) your firewall is blocking requests;
c) you didn't set up your route for DBL votes properly (or at all);
d) if hosting locally, your port isn't forwarded to your device

hearty glen
#

pandasad ah ok

#

I think it’s a.

#

So I’ll try and fix that

grizzled shale
#

@hushed reef how did you get that in 8 days thing on your profile. ive seen a few bots using that now and am confused about what it is

hushed reef
#

it's a UNIX timestamp format

meager wigeon
lean tinsel
#

How can I get someone to vote for a bot to be mentioned in Chat?

#

@hushed reef

tardy osprey
lean tinsel
#

can you help me ?

tardy osprey
#

sorry to bother you but have you had a chance to look into that error?

lean tinsel
#

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

app.listen(3000)
#

Why don't you work with me?

tardy osprey
glad bone
keen ice
#

will the api work in python

ionic crater
#

what do i put into webhook_path and webhook_auth?

sullen nymph
#

@tardy osprey Can you try logging dblpy.bot?

deft hollow
#

Guys

#

I want help about

#

Api

#

How can get it?

rain heart
tardy osprey
#

it looks like the DBLClient isnt even used in the code i have for the webhook

sullen nymph
#

I'm confused just as much as you are KEKW

tardy osprey
#

wait

#

ok so i just realized that maybe the first webhook manager i opened wasnt killed when i restarted my vps, going to go check that

#

not 100% sure, but i think this may be what is causing it

#

only problem is im not exactly sure how to kill it, do you know how?

#

nope not the issue rip, i opened it on another port just to test and still the same error

tardy osprey
#

i tried changing the route from dbl_webhook to dblwebhook as well as closed and reopened the python application that was using that port, it fixed the error but... now im not getting any output in console at all

#

is there any way to see if my vps is getting any connection at all other than on_dbl_test

sullen nymph
#

netstat or something

tardy osprey
#

i can see that it is open with netstat, i just cant tell if im actually getting anything from top.gg

tardy osprey
#

i have no idea what could be going on with this anymore, i can clearly see the connection is open when using netstat -tulpn | grep LISTEN, but im getting nothing printed and i dont know how i would test that the connection is working other than with on_dbl_test

gleaming temple
#

There's a humble request if your bot i not approved till yet then just quit top.gg it has no support and it could decline your bot even if your bot goes offline for 2 mins. top.gg hai hai

lyric smelt
#

How do I post server count? My discord.js bot is clustered

restive otter
#

this is in webhooks

brittle ivy
rain heart
#

what do you mean api vote?

sullen nymph
lavish marten
#

Hello, I'm getting 500 Internal Server Error when I try to like a comment, it doesn't happen with all bots

small wraith
rain heart
#

Both known issues

lavish marten
#

Just fix it then TE_4head

ionic crater
#

hi. i need help setting up webhooks in python

rugged light
#

Can someone curse me?

ionic crater
#

?

rugged light
#

type the words "owo curse @rugged light " pleaseee

ionic crater
#

owo curse @rugged light

#

could you help me with my webhooks pls?

rugged light
ionic crater
#

dunno how to do them

#

completely clueless how to get the url

rugged light
#

i'm so sorry :<

ionic crater
#

in

from discord.ext import commands

import dbl


class TopGG(commands.Cog):
    """
    This example uses dblpy's webhook system.
    In order to run the webhook, at least webhook_port must be specified (number between 1024 and 49151).
    """

    def __init__(self, bot):
        self.bot = bot
        self.token = 'TOKEN'  # set this to your DBL token
        self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='PASSWORD', webhook_port=8080)

    @commands.Cog.listener()
    async def on_dbl_vote(self, data):
        vote_data = data
        voter = await self.bot.fetch_user(vote_data['user'])
        channel = self.bot.get_channel(ID)
        """An event that is called whenever someone votes for the bot on top.gg."""
        print("Received an upvote:", "\n", data, sep="")
        await channel.send(f"Thank You {voter.mention} For voting!")

    @commands.Cog.listener()
    async def on_dbl_test(self, data):
        """An event that is called whenever someone tests the webhook system for your bot on top.gg."""
        test_data = data
        tester = await self.bot.fetch_user(test_data['user'])
        channel = self.bot.get_channel(ID)
        print("Received a test upvote:", "\n", data, sep="")
        await channel.send(f"Tested the webhook and working {tester.mention}")


def setup(bot):
    bot.add_cog(TopGG(bot)

what do i put for webhook_path and webhook_port?

#

im very confuzzled

#

pls help

sullen nymph
#

The route that comes after domain or ip:port in the URL

#

The port is... well, a port that the HTTP listener (aka webhook) runs on

ionic crater
sullen nymph
#

Yeah well

#

You create it

#

Not get it

ionic crater
sullen nymph
#

Well why do you think you can pass webhook_path in the first place

#

(P.S. please upgrade to topggpy)

You create a route that handles bot votes, which is /dblwebhook in this case

#

so your URL is http://ip:port/dblwebhook

ionic crater
sullen nymph
#

topggpy is the new dblpy and it's actually maintained

ionic crater
#

but it does not seem to be working sad

#

could i pls have a hand?

sullen nymph
#

I

#

Said

sullen nymph
#

Also leaked your IP

#

Your URL is NOT the webhook_path

#

Your webhook_path is only a PART OF your URL

hallow night
#

delete the pic

#

your ip is visible

final wren
#

guys

#

hey

#

What is this

#

i read something but still didnt get it

sullen nymph
#

A password that will be used in the vote requests to your webhook

autumn tinsel
#

Hey, I know this is a nooby question but how do i get my bot token? Trying to make a bot which checks if you have voted for a server on the site. tried https://top.gg/bot/:yourbotid/webhooks but replacing my botid but gave me a 404 error

rain heart
#

Reload the page

#

Also, servers doesn't have a api

jaunty plank
#

@ionic crater where are you hosting the webhook receiver?

ionic crater
#

my pc

jaunty plank
#

did you port forward?

#

in order for the webhook to be sent to you from outside your network youll need to port forward

ionic crater
#

this is what i have

autumn tinsel
jaunty plank
#

port forwarding happens in your router, not in your code.

ionic crater
#

the json things with lol inside were tests

rain heart
#

servers doesn't have an api

autumn tinsel
ionic crater
#

or maybe i am being dumb

#

who knows?

#

i certainly do not

autumn tinsel
#

Aw man... this might take a while.

Thanks for the help tho.

#

:D

ionic crater
#

what language do you use?

autumn tinsel
#

Python

ionic crater
#

kewl

#

i use python too

#

if you figure out how to use webhooks, pls let me know

sullen nymph
#

What URL did you set on top.gg for the repl

#

Not repl

autumn tinsel
ionic crater
sullen nymph
#

You'd be surprised how many bot developers here have zero clue about webhooks

#

192.168.x.x seriously

sullen nymph
#

That's your local IP

#

Use your public one

autumn tinsel
#

OMG i got a lot to learn.

ionic crater
# sullen nymph That's your local IP
Traceback (most recent call last):
  File "c:location", line 13, in <module>
    app.run('my ip', 5000)
  File "C:\Users\dylan\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\flask\app.py", line 922, in run
    run_simple(t.cast(str, host), port, self, **options)
  File "C:\Users\dylan\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\werkzeug\serving.py", line 1008, in run_simple
    inner()
  File "C:\Users\dylan\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\werkzeug\serving.py", line 948, in inner
    srv = make_server(
  File "C:\Users\dylan\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\werkzeug\serving.py", line 780, in make_server
    return ThreadedWSGIServer(
  File "C:\Users\dylan\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\werkzeug\serving.py", line 686, in __init__
    super().__init__(server_address, handler)  # type: ignore
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1520.0_x64__qbz5n2kfra8p0\lib\socketserver.py", line 452, in __init__
    self.server_bind()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1520.0_x64__qbz5n2kfra8p0\lib\http\server.py", 
line 138, in server_bind
    socketserver.TCPServer.server_bind(self)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1520.0_x64__qbz5n2kfra8p0\lib\socketserver.py", line 466, in server_bind
    self.socket.bind(self.server_address)
OSError: [WinError 10049] The requested address is not valid in its context
#

i get this^^^

#

hmmm

ionic crater
sullen nymph
#

Leaked IP again

ionic crater
#

its fine

sullen nymph
#

Use .run on 0.0.0.0 instead

ionic crater
#

i have showed it to half of discord at this point

sullen nymph
#

Doesn't mean it should stay there still

ionic crater
#

why?

#

what happens when i leak my ip?

sullen nymph
#

Someone can spam it with requests

ionic crater
sullen nymph
#

Why the fuck does it show your local IP

ionic crater
#

i have absolutely no idea 🤣

autumn tinsel
#

I-
I don't get any of this at all

ionic crater
autumn tinsel
#

What is my Bot ID.

the id i get by rightclick -> Copy ID or is it something else. cuz boi am i confused

jaunty plank
#

Yep that's the id

#

Looks something like 136583532972605440
But probably starts with a 7 or 8

ionic crater
autumn tinsel
#

it gives me a 404

#

Oh wait nvm got it

#

Im stupid

#

nope i did not get it

jaunty plank
# ionic crater

It shouldn't matter what the ip shows at tbh.
Unless something changed in the py library that I'm unaware of.

You'll just want to use that url with the public ip(google what is my ip)

#

Then you'll need to port forward, the guide I posted above should do

ionic crater
#

ok. thanks

worldly reef
#

for the first time i received a 502 bad gateway error, what does this mean?

sullen nymph
#

Oh, interesting. Flask does, for whatever reason, output local IP now

devout cairn
#

how to setup webhook guide can someone give me detailed guide

jaunty plank
#

i dont know of a guide. the docs provides everything you need to know in relation to the webhook itself.
https://docs.top.gg/resources/webhooks/
there are also libraries listed on the docs you can use.

if you have a specific question I can try and help too

jaunty niche
#

Where i can find api key of my bot?

raw ermine
#

Hi, I have this issue when using the topgg-autoposter library. Has anyone else had anything similar?

node_modules/@top-gg/sdk/dist/structs/Webhook.d.ts:1:49 - error TS2307: Cannot find module 'express' or its corresponding type declarations.

1 import { Request, Response, NextFunction } from "express";```
restive otter
#

Hello how can I get the tag of vote.user?

autumn tinsel
ionic crater
#

I GOT THE WEBHOOK TEST THING TO WORK!!!!!!!!!

#

im a genius

#

is the website down?

#

acctually nvmd

#
from discord.ext import commands
import discord

from flask import Flask, request, abort

app = Flask(__name__)
if __name__ == '__main__':
    app.run('0.0.0.0', 42069)

ID = 865540361169141790

intents = discord.Intents().all()
intents.members = True

client = commands.Bot(command_prefix = '£',  owner_id = 554032717197606936, intents=intents)

class Voting(commands.Cog):

    def __init__(self,client):
        self.client = client

    @commands.Cog.listener()
    async def on_ready(self):
        print("Dylan's voting bot is alive.")
        print("")

    @commands.Cog.listener()
    @app.route('/dblwebhook',methods = ['POST'])
    async def webhook():
        if request.method == 'POST':
            print(request.json)
            return 'sucess',200
        else:
            return abort(400)


def setup(client):
    client.add_cog(Voting(client))

it does not work though pepe_sad . could someone pls help?

#

btw this works

from flask import Flask, request, abort

app = Flask(__name__)

@app.route('/dblwebhook',methods = ['POST'])
def webhook():
    if request.method == 'POST':
        print(request.json)
        return 'sucess',200
    else:
        return abort(400)
if __name__ == '__main__':
    app.run('0.0.0.0', 6969)

(ik the port numbers are different btw.)

restive otter
#

This isn't related to the issue, but you're not supposed to instantiate the Bot object inside extensions. Besides, it's not used. That's not how listeners work either. Also, flask is sync, unless you deploy it properly, in which case is pretty redundant imho. Why don't you use aiohttp if you were to handle requests yourself? It's a d.py dependency. Another thing, __name__ only be __main__ if it's the current module that's executed. That means that if statement won't evaluate to True since it's not directly executed, rather, imported.

ionic crater
#

so i should use aiohttp ?

restive otter
#

If you know what you're doing. Or just use topggpy for the sake of convenience.

ionic crater
#

so i have

from discord import client
from discord.ext import commands
import discord

from flask import Flask, request, abort

"""
app = Flask(__name__)
if __name__ == '__main__':
    app.run('0.0.0.0', 42069)
"""
ID = 865540361169141790

intents = discord.Intents().all()
intents.members = True

import topgg

client = commands.Bot(command_prefix = '£',  owner_id = 554032717197606936, intents=intents)

class Voting(commands.Cog):

    def __init__(self,client):
        self.client = client
        self.client.topgg_webhook = topgg.WebhookManager(client).dbl_webhook("/dblwebhook", "password")
        self.client.topgg_webhook.run(42069)  # this method can be awaited as well

    @commands.Cog.listener()
    async def on_ready(self):
        print("Dylan's voting bot is alive.")
        print("")

    """
    #@commands.Cog.listener()
    @app.route('/dblwebhook',methods = ['POST'])
    async def webhook():
        if request.method == 'POST':
            print(request.json)
            return 'sucess',200
        else:
            return abort(400)
    """

    @commands.Cog.listener()
    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 client.dispatch('dbl_test', data)

        print(f"Received a vote:\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 vote:\n{data}")

def setup(client):
    client.add_cog(Voting(client))

but then this error comes up

Ignoring exception in on_dbl_vote
Traceback (most recent call last):
  File "C:\Users\dylan\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
TypeError: on_dbl_vote() takes 1 positional argument but 2 were given

#

i do not understand why it does not like having data as an argument

sullen nymph
#

forgot self

#

You can safely remove client = commands.Bot(command_prefix = '£', owner_id = 554032717197606936, intents=intents) from your cog file

restive otter
#

Hope you don't come back to complain client isn't defined mmLol

ionic crater
#

i get this error now:

Ignoring exception in on_dbl_vote
Traceback (most recent call last):
  File "C:\Users\dylan\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "file location", line 32, in on_dbl_vote
    return client.dispatch('dbl_test', data)
AttributeError: module 'discord.client' has no attribute 'dispatch'
restive otter
#

You need a Client instance—you already have it btw. Just prepend client with self.. I'd really suggest you learn about OOP though.

ionic crater
#

what is OOP?

sullen nymph
#

Object-oriented programming

ionic crater
#

also wasn't i meant to remove the client = ... thing at the top?

restive otter
#

Indeed

#

The intents is redundant too

#

As well as the from discord import client import

ionic crater
#

i fixed it!!!!!!!!!!!

restive otter
#

It's working now?

#

hey everyone 👋 how do I get my bot to show how many servers we are in? @ me when responding if you could

twin reef
#

the Auto Poster

#

@restive otter

restive otter
#

YE TY \

#

rip caps

twin reef
#

lmao ur good

#

have fun

light orbit
#
const discord = require('discord.js')
const client = new discord.Client()
const { AutoPoster } = require('topgg-autoposter')
const { tokengg } = require('./config.json')
AutoPoster(tokengg, client).on('posted', () => {
    console.log('posted to top.gg stats')
})
``` why it doesn't make print `posted to top.gg stats` and nothing shows server count in top gg
silent lion
#

hey, i'm currently working with the topgg.py wrapper for the top.gg api, could I get some help on setting up the event for when a user votes?

#

I copied the example

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

but votes right now do not trigger this event

restive otter
silent lion
#

ooh ok

#

thank you very much

silent lion
#

hey so I read those for quite a few times and I am afraid that I am still confused

#

I am not sure what webhook url to enter into the webhooks page on top.gg

stark dove
#

I have a question for the topgg api, if I have heroku then how will heroku handle the webhooks? i think it might need some kind of web module or will it just work with the worker module i already enabled?

frigid gorge
#

TOP.GG token is correct

but then why gave this error?

stone escarp
#

Also having same here, i think they are working on the site atm

stark dove
frigid gorge
#

@stark dove
I already tried, same error

stark dove
#

Oh

stark dove
frigid gorge
#

ok, then I'll wait ._.

modern crest
#

same Error
401 Unauthorized (You need a token for this endpoint)

#

crashed my entire bot >_>

fading mica
#

Why? I didnt change the token

glad merlin
#

known issue

restive otter
#

They are fixing right now

fading mica
#

Oh okay thanks 👍

tardy osprey
# sullen nymph Try just working with on_dbl_vote
    @commands.Cog.listener()
    async def on_dbl_vote(self, 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
            print(f"Test vote:\n{data}")
            return# self.bot.dispatch("dbl_test", data)
        print(f"Received a vote:\n{data}")

i tried to do it like this, not sure if this is what you meant but i still am getting nothing printed in console when sending a test vote

delicate saffron
#

now to hope this works

#

yessssirr

#

yk the vibe

tardy osprey
# sullen nymph Try just working with on_dbl_vote

ok so i did some testing (by listening to the port using netcat and attempting to send something using telnet)
[20:05:05] ERROR Error handling request [aiohttp.server]╭──────────────────────────────────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────────────────────────────────╮│ /home/Fear/.local/lib/python3.8/site-packages/aiohttp/web_protocol.py:314 in data_received ││ ❱ 314 messages, upgraded, tail = self._request_parser.feed_data(data) ││ /home/Fear/aiohttp/_http_parser.pyx:546 in aiohttp._http_parser.HttpParser.feed_data ││ FileNotFoundError: [Errno 2] No such file or directory: '/home/Fear/aiohttp/_http_parser.pyx' │╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯BadStatusLine: 400, message="Bad status line 'invalid HTTP method'"
this seems to be the issue (or maybe only one of many), how would i fix this?

#

.... i hate this formatting, here is a screenshot instead

#

to be clear, im almost certain it is something i am doing wrong on my end and not an issue with any other libraries since i get the same output when attempting to send things to the port with telnet

modern crest
#

How long does it take for the API to register a vote?

glad merlin
#

1-3 secs

meager wigeon
modern crest
#

well not sure about that

glad merlin
#

afaik

modern crest
#

cause I voted 2 minutes ago

glad merlin
#

atm vote checks have failure

modern crest
#

I see

#

Still huh

glad merlin
#

I just opened an issue about that

modern crest
#

They said it was resolved

glad merlin
#

Veld said he will look into it after his sleep

tardy osprey
glad merlin
tardy osprey
#

not webhook then, back to trying random things in my code and hoping for it to work

glad merlin
#

delicate saffron
#

i need to figure out how to do vote only cmds

#

😦

sullen nymph
#

Mind reminding me? KEKW

tardy osprey
#

http://(ip):5000/dbl_webhook

sullen nymph
#

Tried sending requests via reqbin?

coarse rune
#

hi

tardy osprey
coarse rune
#

can some one help me with webhooks

#

?

#

i use js

#

i used the code in the example give in the docs

tardy osprey
#

i know my server is recieving the data from top.gg, i can see them when i listen via netcat

#

but when they go through my bot instead i get nothing

coarse rune
#

so i think that the ip for localhost is 127.0.0.1

#

so can some one help pls

#

and also i use vscode

tardy osprey
#

sorry for so many pings...

bleak jacinth
#

what do i put here??

meager wigeon
#

Any reason why it’s showing 1 server count for my bot? My bot is in more then 1 guild,

I have everything setup as well?

sullen nymph
tardy osprey
# sullen nymph Including responding to the tests on those ports?

responding to confirm receiving the webhook on the port i opened with netcat (like to top.gg)? im not sure how to respond with it if that is what you mean, all i know is i did get the data on my server
this is exactly what i did to see if my server was receiving the data or if it was blocking it with a firewall of some kind

sullen nymph
#

This is weird as fuck

#

Could you DM me your code?

tardy osprey
#

yeah, do you just want the whole file or a specific portion?

sullen nymph
#

Whatever that's related to WebhookManager and running it for now

tardy osprey
#

alright ill dm that to you just a sec

twilit gorge
#

@tardy osprey what is that terminal formatting from?

#
╭── Traceback ──╮
│               │
│     code      │
│               │
╰───────────────╯
tardy osprey
twilit gorge
hallow warren
#

Hi I want to show up on the bot servers site.
The written language is BotJS.
What should I do?

coarse rune
modern crest
#

The api still doesn't register a vote. I voted 9 hours ago and it still returns false.

warm glade
#

same

sour comet
#

How do I get an authentication key for the webhooks so I can make it report to my Discord Server?

storm abyss
#

same question

modern crest
sour comet
#

I mean this

modern crest
#

You create it

#

Doesn't have to be anything complicated

dire cairn
#

Hey top.gg api base url changed?

modern crest
#

Hey @vital anvil, will you have time to look into the API problems today?

sullen nacelle
#

Looks like I didn't vote even though I voted on the api? So do users @vital anvil

arctic musk
#

i have reset token and stil no chnage

#

i woke up and my console is spammed

#

with this error

modern crest
arctic musk
#

yea

#

i have voted on 2 different accounts to test

#

and my "token is invaild"

#

no issue till like 1am est it seems like

#

thats when my console started spamming it

modern crest
#

Alright, I suggest you remove the use of the variable for now to avoid unnecessary errors.

glad merlin
#

No votes for sometime folks

#

Sadge

arctic musk
#

the siteand thjere api has just broke more and more

modern crest
#

Damn I just added voting commands yesterday and it was a big hype xD

arctic musk
#

seems like

arctic musk
#

i cant even update stats either

glad merlin
arctic musk
#

well yea i can tell lol

#

when i first joined like 6 months ago

#

almost no issues

#

now you cant load most pages

glad merlin
#

At least they know the issues and trying to fix it. They are humans too 🤷

#

Our best move will be waiting faster KEKW

arctic musk
#

yea ik

#

i just ignore most issue on site

#

some have been for months

drowsy storm
#

Webhook notwork

#

Why

quartz bloom
#

are votes not working?

modern crest
arctic musk
mellow peak
#

Hi ! I have a small question about DBL Stats API, the endpoint widget api is ratelimitable ?

jaunty plank
#

everything has ratelimits

mellow peak
#

but like i don't have information about it :/ it says nothing on the doc

modern crest
#

Hey @jaunty plank any idea on the progress on the API not registering votes?

jaunty plank
#

its been worked on the past few hours, #support message

Hopefully not too much longer

modern crest
#

Thanks :)

jaunty plank
#

@tawdry wolf wheres the webhook receiver being hosted?

tawdry wolf
#

on the bot's vps (docker container exposed)

#

I can send a POST request to the address which means it works for me. I guess it's part of the breaks from the new vote api. Patience is key then~

jaunty plank
#

what library are you using for it?

tawdry wolf
#

Oh, I'm not using a DBL-specific library. I just added the endpoint to my other HTTP endpoints (using Javalin).

jaunty plank
#

and your post request tests are being done remotely?

#

(i would guess so with it being on a vps, but we have had crazier setups)

tawdry wolf
#

Pretty much, used Postman to send several POST requests and even on Reqbin which all were successfully received by my bot

jaunty plank
#

and you filled in URL and auth on your bots webhook section?

tawdry wolf
#

Yep

jaunty plank
#

heck, not really sure what else i can do for you then.
webhooks should work for bots fine. its kinda not working for some servers.

tawdry wolf
#

I copied the URL I wrote on the webhook section, pasted it to Postman and Reqbin and tried it several times and all requests were received. It was only the test webhook on top.gg that isn't hitting the endpoint for some reason kokoLaugh

#

I guess it will fix itself some time

jaunty plank
#

if you dont mind dming me the postman requests(with the url too) i can do some requests myself and see if we can figure something out.

otherwise im not sure.

tawdry wolf
#

Oh, nevermind... It's now somehow working~

#

Thanks for the assistance though mihouPillowHug

jaunty plank
#

magic topggPog

restive otter
#

hi

#

NameError: name 'topgg' is not defined

#

i installed topggpy

#

and imported topgg

#

but not working

#

Mind sending the code?

#
try:
    import discord
    import datetime
    import keep_alive
    from discord.utils import get
    from discord_slash import SlashCommand
    import json
    from giphy_client.rest import ApiException
    import giphy_client
    from discord.ext import commands, tasks
    import asyncio
    import random
    from prsaw import RandomStuffV2
    import DiscordUtils
    import aiosqlite
    import dbdmusic
    import topgg
except:
    import os
    print('Install discord.py')
    os.system('pip install discord.py')
    os.system('pip install prsaw')
    os.system('pip install discord-py-slash-command')
    os.system("pip install DiscordUtils")
    os.system("pip install aiosqlite")
    os.system("pip install topggpy")

intents = discord.Intents.default()
intents.members = True
intents.presences = True
client = commands.Bot(command_prefix=',', intents=intents, case_insensitve=True)
client.remove_command('help')
slash = SlashCommand(client, sync_commands=True)
rs = RandomStuffV2(async_mode=True)

dbl_token = "secret"
client.topggpy = topgg.DBLClient(client, dbl_token)

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

update_stats.start()
#

Did it print Install discord.py?

#

If so, then one of the dependencies failed to import, hence topgg wasn't imported.

#

so instead import discord i should write import discord.py?

#

Why so?

#

and topggpy

#

Did I say otherwise?

#

so what should i do?

#

You print that on exception, that's why I'm asking if that was printed

#

yes

#

Actually, just don't use try except for this. You usually want to use try except for backward compatibility.

#

Just list the dependencies in requirements.txt or something like that

#

okay

#

now it is not giving me any errors

#

when will it show guild count?

#

Don't leak your token, regen it immediately

#

uh

#

wrongly

#

Failed to post server count
Unauthorized: Unauthorized (status code: 401)

#

If you just regenerated the token, make sure to update it in the code

#

updated

#
import discord
import datetime
import keep_alive
from discord.utils import get
from discord_slash import SlashCommand
import json
from giphy_client.rest import ApiException
import giphy_client
from discord.ext import commands, tasks
import asyncio
import random
from prsaw import RandomStuffV2
import DiscordUtils
import aiosqlite
import topgg
import os
#os.system('pip3 install -r requirements.txt')


intents = discord.Intents.default()
intents.members = True
intents.presences = True
client = commands.Bot(command_prefix=',', intents=intents, case_insensitve=True)
client.remove_command('help')
slash = SlashCommand(client, sync_commands=True)
rs = RandomStuffV2(async_mode=True)

dbl_token = "secret"
client.topggpy = topgg.DBLClient(client, dbl_token)

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

update_stats.start()
#

Same error?

#

same

#

how can i fix it?

#

Not so sure, but it's likely on you. Did you double check the token?

#

it's same

#

uh i write everything correctly

#

i just change

#

bot into client

#

and token is correct

#

Just to make sure, are we talking about the same token here? Was referring to your topgg API key

#

i updated

edgy gale
#

@edgy merlin

restive otter
#

Welp, sorry then, can't help you further. Not sure if it's on topgg. I expect it should work if you put the valid token.

#

ok, nvm

#

thanks for help

jaunty plank
#

your bots page, webhooks, "show token"

shell crown
#

How do I get a Webhook URL

jaunty plank
# shell crown How do I get a Webhook URL

webhook url is generally formatted like this
http://PUBLICIPHERE:PORTHERE/PATHHERE
its up to you to fill in the blanks with the relevant data.
if your hosting on a platform without an ip, youll need to use the project URL.

bitter iris
#

how often does topgg-autoposter post server count?

radiant peak
#

Is the api always returning in json?

golden adder
bitter iris
silent elk
#

Can anyone help me to make a vote notification in python ?

next pendant
#
res.statusCode = 200;
        return res.end(JSON.stringify({ message: "Successful" }));
#

I have this, but occasionally, it's still sending multiple requests

#

It doesn't happen each time, but some times it does

#

responding with 200 and closing the connection

#

and this all started happening after the major update

hidden brook
#

is there a way to get a bots stats without a top gg token. I'm just trying to get the server count that is publicly available on the website

hidden brook
#

or is there like a public top.gg token?

eternal bobcat
#

Is there any tog.gg documentation on discord.js vote system?

hushed reef
#

check pinned messages

jovial willow
modest spruce
#

Hey how do i check who have voted my bot

restive otter
#

rekt

eternal bobcat
restive otter
delicate saffron
#

is there any simple vids out there to lock cmds to voters only

empty pelican
#

Bhai zoom link kha ho ga

delicate saffron
golden adder
glad merlin
#

that is another solution also

#

rate limit of top.gg api 60 requests in a minute iirc

tight osprey
#

How do i know if a user voted for the bot

glad merlin
#

send GET request to endpoint of top.gg bots/${botID}/check?userId=${userID}

#

or just use module

tight osprey
#

okk thanks

glad merlin
#

here @tight osprey

hallow herald
#

Guys, I didn't understand how to do that, when a user votes the bot he sends the message "{id} has voted DKMusic on top.gg"

radiant peak
#

Why is the api sometimes returning in json and sometimes in html?

glad merlin
#

well, does anyone gets this sometimes?

radiant peak
#

That could be the issue for my problem too

glad merlin
#

probably

radiant peak
#

Well, sometimes I get a response in json, sometimes in html, just tried on my pc and got a cloudflare error

#

But for some reason its working from my server rn

#

That is so random

glad merlin
#

some users get this

#

yes it is random

#

I didn't find any problem that yields this

radiant peak
#

@willow sphinx Is this a known bug?

glad merlin
#

it's not I guess

#

xetera is on vacation atm T_T

glad merlin
radiant peak
#

then we gotta ping someone else

glad merlin
#

veld? maybe

radiant peak
#

@vital anvil

glad merlin
#

he is responsible from backend afaik

hallow herald
#

ban

radiant peak
#

xd

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

const app = express()

const webhook = new Topgg.Webhook("my authorization")

app.post('/dblwebhook', webhook.listener(vote => {
    const { logVoti } = require('./channelIDs.json')

    bot.channels.cache.get(logVoti).send(`${vote.user}`)

}))
``` Why it doesn't work?
glad merlin
#

Did you edit correctly your webhook settings on the site?

hallow herald
#

yea

glad merlin
#

your url is not correct

hallow herald
#

oh

#

where can i get it?

glad merlin
#

it should be like http://YOUR_IP:3000/dblwebhook

hallow herald
#

oh

#

How do i see my IP?

glad merlin
#

I made it my vps IP since I'm using it on vps

hallow herald
#

ok

glad merlin
#

google > what is my ip

hallow herald
#

I did it

#

If id do test button it will send the message?

glad merlin
#

it will perform post request to that url

hallow herald
#

how do i acces to that url?

glad merlin
hallow herald
#

to verify

glad merlin
#

test button

hallow herald
#

Ok

#

It doesn't work

#

Why it doesn't work?

#

@glad merlin

#

Is it because it's not the same bot? I'm trying it on a test bo

#

t

#

@glad merlin

glad merlin
#

I'm not sure

hallow herald
#

But why it doesn't work?

#

How do i accept the request they send?

hallow herald
scarlet adder
#

My vote page is just freezing here like this whenever I open it or for any bot ,what to do ;-;

#

no vote button no ad

hallow herald
#

that's not topgg api

#

<@&304313580025544704>

glad merlin
#

Oh boi

rough crater
abstract mothBOT
#

@hallow herald

Please do not mention (ping) more than one or two moderators for help, unless there is an emergency.

Here are some examples of emergencies:

  • Raids / Multiple members mass spamming.
  • Severe disruption of Discord's ToS (NSFW content, etc)
  • Anything that requires more than 2 moderators to handle.
scarlet adder
#

uhh sorry

hallow herald
royal fiber
#
const express = require('express')
const Topgg = require('@top-gg/sdk')
const app = express() // Your express app

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

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

Code is with 0 errors, but it doesn't work.

jaunty plank
foggy widget
#

api.setStats(serverCount);

where should i put this so i get server count on my bot page

warped cosmos
#

how can i make a listener who voted? I'm using kotlin

night osprey
#
client = commands.Bot(command_prefix = "ar ", case_insensitive=True)
client.topggpy = topgg.DBLClient(client, dbl_token)

@client.event
async def on_dbl_vote(data):
    print(f"VOTE RECIEVED\n{data}")```
i got my alt to vote but im not recieving the "VOTE RECIEVED" statement in the console
#

any help is appreciated

royal fiber
jaunty plank
#

did you fill it in with the public ip, not private

jaunty plank
night osprey
#

i think ive found the solution in this channel

#

someone had the same issue as me

royal fiber
jaunty plank
#

if you want to

royal fiber
#

The bot stats thing work nicely, but the voting stuff is not working for me.

night osprey
#

what do i put in "password":

client.topgg_webhook = topgg.WebhookManager(client).dbl_webhook("/dblwebhook", "password")```
jaunty plank
#

thats the auth, you make it. just make sure its the same between the website and code.

shell crown
#

How do I add Creator

royal fiber
royal fiber
royal fiber
#

no issues, Have a great day ahead. 🙂

night osprey
#

is there anything wrong with this:

client.topgg_webhook = topgg.WebhookManager(client).dbl_webhook("/http://myip:5000", dbl_token)
client.topgg_webhook.run(5000)  # this method can be awaited as well

@client.event
async def on_dbl_vote(data):
    if data["type"] == "test":
        return client.dispatch('dbl_test', data)

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

remove the /

night osprey
#

ah alright

restive otter
#

Im having alot of users who are voting but the API is not showing them to have voted

#

Ahh... now im getting bad reviews for it aswell

restive otter
#

Hey

#

i have a question

#

what should i put here

#

help please ._.

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

const app = express()

const webhook = new Topgg.Webhook("password")

app.post('/dblwebhook', webhook.listener(vote => {
    const { logVoti } = require('./channelIDs.json')

    bot.channels.cache.get(logVoti).send(`${vote.user}`)

}))
#

What's wrong?

#

lol

#

someone?

#

@sacred shell can you do something?

#

Can you shut the thuck up?

#

Thanks

sacred shell
quick trellis
#

I am trying to use the @waxen widget-gg/sdk npm module, but it does not work when i try to use it (both vote and test button). When i remove the middleware and just listen to basic posts req res it works. Is the thing broken?

lunar tide
#

is the top.gg api for voting check okay?

nimble grove
#

what are valid port(s) to use?

restive otter
#

Still looking for help on this, even though im getting less then 1000 votes a month, the last 1000 votes endpoint is NOT showing the last 1000 votes

#

when checking with check endpoint its fine.

quick trellis
#

Found the problem, i had to update node to the newest version for it to work.

nimble grove
#

Are there other events AutoPoster has other than 'posted'?

stark dove
#

npm install @top-gg/sdk

#

i should use this right

#

btw this is my code

#

so should the two pair together or do i have to install another thing

#

o nvm i install npm i topgg-autoposter

jaunty plank
hearty vortex
#

in discord.js, how can i see if a user has voted my bot without using express (if possible)?

hearty vortex
#

thanks, but api is set to what? sorry, i'm new to top.gg

frigid stirrup
#

WDYM set to what?

hearty vortex
#

i mean what is assigned to the variable 'api'

frigid stirrup
#

console.log(api.getBot('ID'))
Logging:- Promise { <pending> }?

sullen nymph
#

Resolve the promise

frigid stirrup
#

How ... Kinda newb in this coding stuff....

sullen nymph
#

Easily answered with Google

#

"Resolve promise javascript"

frigid stirrup
#

thump NVM await ....

sullen nymph
#

Ez

frigid stirrup
#

@sullen nymph 404 Not Found

sullen nymph
#

Seems a bot under that ID isn't listed

frigid stirrup
#

My bot is listed

#

BTW

sullen nymph
#

Shrug no clue

frigid stirrup
sullen nymph
#

Make sure the ID is correct ig

#

Oh hold on

frigid stirrup
#

I copied from copy id

sullen nymph
#

Try to update to latest topggjs version

frigid stirrup
#

i just downloaded it

#

/@latest

sullen nymph
#

Eugh

#

No clue then

frigid stirrup
#

NVM got it

#
    console.log(bored)``` Logged:-`{ serverCount: undefined, shardCount: undefined, shards: [] }`
#

why is that undefined wuts_this ?

#

do i have to manually post number of servers?

rain heart
#

Yes

frigid stirrup
#

Ok

nimble grove
tight stream
#

how do i get data of who voted for bot so i can make rewrds for the vote?

#

can someone help me with this for my discordjs bot?

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

const app = express()

const webhook = new Topgg.Webhook('sure i put auth')

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

app.listen(3000)

i try this. But it's not working when someone vote why?

restive otter
#

where can i find my topgg token?

jaunty plank
restive otter
#

yea i found out

stark dove
#

Idk

stark dove
#

by the way, im not trying to achieve a webhook thing, im just trying to make it DM the person that voted (if possible), thanking that user for voting.

cold root
#

uhhh

#

I tested the api webhook now it spams me and never stops sending it and i get this error

#
19.07 04:43:16 [Bot] ReferenceError: member is not defined
19.07 04:43:16 [Bot] at /index.js:327:3
19.07 04:43:16 [Bot] at /node_modules/@top-gg/sdk/dist/structs/Webhook.js:89:23
19.07 04:43:16 [Bot] at runMicrotasks (<anonymous>)
19.07 04:43:16 [Bot] at processTicksAndRejections (internal/process/task_queues.js:97:5)```
#

It is sent every 10 seconds..

rain heart
#
  • Member isn't defined
    You're not acknowledging the request with a 2xx
willow spindle
#

he/she is using node sdk

cold root
#

ya...

willow spindle
cold root
#

member

#

also does it have to be port 80? I am using 8025..

willow spindle
#

it doesn't really matter

willow spindle
stark dove
sullen nymph
cold root
#
app.post("/top-gg-votes", webhook.listener(vote => {
  console.log(`${vote.user} has voted for me!`)

  const voteEmbed = new Discord.MessageEmbed()
  .setTitle('I recived a vote!')
  .setDescription(`<@${vote.user}> has voted for me!`)
  .addField('Thank you!', 'You can vote for me again in 12 hours. \n \n wanna get a shout out here too? Vote for me [here!](https://top.gg/bot/743292394237329440)')
  .setFooter(vote.username, 'Thanks')

  member.guild.channels.cache.get(votesChannel).send(voteEmbed) //27th line

  }))```
willow spindle
#

well

sullen nymph
#

member doesn't exist in this context

willow spindle
#

there is no member

#

use client

stark dove
#

but could i just use another method without using express too? (im not trying to make a webhook lol)

#

i just want it to dm the person that voted is all lol

sullen nymph
#

Well, that's what a webhook would do. It will listen to vote requests in real-time and you can send a message to a user when such request is received

#

It doesn't have to be express, that's just the only web framework I can remember off the top of my head lol

stark dove
#

would this work

#

theoretically

#

meh

#

ill just mess around with it until i find something i like

#

thanks for the help :D

sullen nymph
#

Well, it would work, but you wouldn't get the votes in real-time

#

There would have to be like a command and you'd have to make sure no votes are stacked on top of each other

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

const app = express()

const webhook = new Topgg.Webhook("password")

app.post('/dblwebhook', webhook.listener(vote => {
    const { logVoti } = require('./channelIDs.json')

    bot.channels.cache.get(logVoti).send(`${vote.user}`)

}))```
What's wrong?
coarse rune
#

Hi listen what should i do i cannot get the webhooks

#

I use local host

#

Pls dm me if u can help

hallow herald
topaz kraken
#

any error?

hallow herald
#

Np

#

I click on the test button, but nothing appens

#

This is my url, idk if it's good

restive otter
#

hey can someone help me setup the webhook

#

I'm new to this so I don't really know what to do

#

sorry if its a dumb question

cold root
#

Get the package named "express"

#

with npm i express

restive otter
#

do I need to code for it

cold root
#
//const votesChannel with the id of the votes channel
var express = require('express')

var app = express();

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

const webhook = new Topgg.Webhook('webhook autho')

app.post("/top-gg-votes", webhook.listener(vote => {
  console.log(`${vote.user} has voted for me!`)

  const voteEmbed = new Discord.MessageEmbed()
  .setTitle('I recived a vote!')
  .setDescription(`<@${vote.user}> has voted for me!`)
  .addField('Thank you!', 'You can vote for me again in 12 hours. \n \n wanna get a shout out here too? Vote for me [here!](https://top.gg/bot/bot_id)')

  client.channels.cache.get(votesChannel).send(voteEmbed)

  }))```
#

there

restive otter
#

I still don't get it

cold root
#

Just dont copy paste the code, read it then.

restive otter
#

alright

cold root
#

Well

#

look

cold root
#

express creates something like a domain with your ip

cold root
#

just paste that to the webhook thing

hallow herald
cold root
#

hmm

#

one sec

hallow herald
#

ok

restive otter
hallow herald
#

Lacuna made me do this, idk if it's right

cold root
cold root
#

it is

cold root
cold root
restive otter
#

alright

hallow herald
#

VS Code is installing C# depencies

cold root
#

It should work

hallow herald
cold root
#

maybe define it like this:

const channelIDS = require('Path to the file')
// then this to get the id of that channel
bot.channels.cache.get(channelIDS.logVoti).send('stuff')```
hallow herald
#

ok

cold root
#

then tell if works

hallow herald
#

Don't work

#

No errors

#

Do i need to specify the token of the bot that is on top.gg?

cold root
#

uhh

#

one sec

#

in webhook autho u put the thing you putted under the webhook link

#

like a password or smth

hallow herald
#

?

#

i put a pass

#

that's not password

cold root
#

there

hallow herald
#

Yea

#

I put smth

cold root
#

ya then put it in topgg webhook autho

hallow herald
cold root
#

Idk if u can require in a function so i suggest not doing logVoti = require('stuff')

hallow herald
#

like bot.channels.cache.get("id").send(${vote.user})

cold root
#

sure try that.

#

if it doesnt work then the problem aint in ids..

hallow herald
#

ok

cold root
#

just that I feel like it is in ids but not sure.

hallow herald
#

doesn't work

coarse rune
hallow herald
#

I did this

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

const app = express();

const webhook = new Topgg.Webhook("pass")

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

    bot.channels.cache.get("860843237022498856").send(`${vote.user}`)

}))
coarse rune
#

@hallow herald sorry for the ping but can u help me als

#

Also*

hallow herald
#

What's the problem

coarse rune
#

This*

hallow herald
#

Man i don't know, i'm getting help too

coarse rune
#

Oh ok

#

Np

#

Can i talk to u in dms

hallow herald
#

yea

coarse rune
#

@cold root sorry for the ping bu can u pls dm em

cold root
#

hi

#

oh

#

Kaaeza?

coarse rune
#

No me

cold root
#

alr..

hallow herald
cold root
#

nothing

cold root
hallow herald
#

np

cold root
#

Any errors?

hallow herald
#

np

#

@cold root

ancient gale
#

ich hab ne frage ich möchte das wenn jemand voted ein webhook gesendet wird wie kann ich das machen 🙂

hallow herald
#

?

#

pls speak english

cold root
cold root
hallow herald
cold root
#

o

hallow herald
#

So how i do it?

cold root
#

uhhh

#

idk..

#

I mean it seems correct

#

maybe try to paste the id it self

#

if you didnt already do it

hallow herald
#

?

cold root
#

in cache channels

hallow herald
#

Srry if i dont' undestrand but i'm italian

hallow herald
cold root
#

im russian lol

hallow herald
#

lol

cold root
#

uhh

hallow herald
#

like this you mean? bot.channels.cache.get("860843237022498856").send(${vote.user})

cold root
#

ya

hallow herald
#

I did it

cold root
#

I got no idea why it wont work.. ngl

hallow herald
#

You know who can help?

dim belfry
#

aha

#

hello, i added my server now on top.gg, but when i serch on home page, its not visible

hallow herald
#

This chat is only for topgg api

ancient gale
#

Hello how i can detect votes. i want to give voters a role on my server 🙂

rain heart
half burrow
#

Hello Dear Top.GG Official I Have A Bot Named Kontz There Are 47 Servers And 301K Users 1. I Was Wondering When The Security Verification Will Be Done. Have a nice day. @willow sphinx @vital anvil

willow sphinx
#

god

half burrow
#

@willow sphinx When Will the Security Phase Be Next?

#

bro@willow sphinx

#

Sorry For The Ping

worthy jay
#

I get a error:

no module named 'topgg'

when I try to import topgg

import topgg
restive otter
worthy jay
#

no

restive otter
#

Did you install the module?

worthy jay
#

yeah

restive otter
#

Are you using a IDE?

worthy jay
#

yes

#

i found a package called topggpy idk if it might be this one

restive otter
#

It is almost surely it

worthy jay
#

oh ok thanks

sullen nymph
stark dove
#

hold up

#

what ip am i supposed to use for heroku

#

do i just use the heroku url thing

stark dove
restive otter
#

You need to bind to the port Heroku gives you, though.

stark dove
#

True, but what actual url do i use?

#

The herokuapp url?

restive otter
#

Most likely, have you tried it?

stark dove
#

Nope, just making sure what to do

#

But thanks, i'll test everything with what I have

restive otter
#

Sure, good luck!

stark dove
#

Nope, it failed

restive otter
#

What have you tried?

stark dove
#

I used the code that was found here:

#
const express = require("express")

const app = express()

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

app.post("/dblwebhook", webhook.listener(vote => {
  // vote will be your vote object, e.g
  console.log(vote.user) // 395526710101278721 < user who voted\

  // You can also throw an error to the listener callback in order to resend the webhook after a few seconds
}))

app.listen(80)```
#

I installed express

#

Should i show logs

restive otter
stark dove
#

i'm pretty sure it did

#

but it didnt

#

should i show logs because there wasnt anything wrong with index.js

restive otter
#

But you hardcoded the port.

stark dove
#

?

#

sorry im a bit new to programming n stuff so its kinda confusing

#

do u mean that i wrote out the port

#

wait

#

how do i get the port from heroku to bind to

#

oh wait...

restive otter
stark dove
#

oh okay

#

thanks

#

ima try that

#

wait a sec

#

i think its working

#

ima test the webhook

summer portal
#

how to get username#discriminator

stark dove
#

like

#

discordjs?

summer portal
#

Votes

summer portal
stark dove
summer portal
#

vote.user gives UID
But how to get username#discrimninator

willow spindle
#

fetch from discord api

stark dove
#

sooo uh this happened

summer portal
restive otter
#

You set the path to /dblwebhook not /

stark dove
#

ohh

#

thanks

#

im a dumbo

#

now i got 403

restive otter
#

I guess the lib returns 403 if the auth was missing/didn't match.

stark dove
#

I slipped up again I am so dumb

#

I accidentally made a typo

#

In my authkey

#

IT WORKED

#

Thank you so much norizon

restive otter
#

No problem :)

#

@shell swallow

#

dm me i have to talk something

summer portal
willow spindle
#

no?

#

you have to get yourself

restive otter
shell swallow
restive otter
#

@shell swallow am banned from pokemon bot

stark dove
#

Would it be possible to put the vote webhook thingy in another file? The thing is heroku will now idle for web dynos if there isnt any traffic, and the web dyno would be required to run the webhook as opposed to the standard worker module. If I run both, it will run multiple instances and cause my bot to get ratelimited.

restive otter
#

@shell swallow Bro that's my brother fault not mine

sullen nymph
#

Actually I don't remember

polar dragon
#

Nice

stark dove
#

Are you hosting on your PC or using a VPS (like heroku or repl.it)

stark dove
#

What exactly is your vps

grand lichen
stark dove
#

Mkay

#

Can i see logs? (remember to blur out any sensitive information)

grand lichen
stark dove
#

The console

grand lichen
#

Ok give me second

#

When i test the webhook no thing coming in the console.

stark dove
#

What shows up in console when you actually run it?

grand lichen
stark dove
#

Did you install the topgg sdk?

#

(and express)

grand lichen
stark dove
#

Wait

grand lichen
#

I install the required packages

stark dove
#

So do you have the serverjs that gives you a site?

grand lichen
#

Yes

stark dove
#

What webhook url do you use?

#

like

#

Did you put /dblwebhook at the end of it?

grand lichen
#

Oh wait

stark dove
#

Lemme show u

#

It should look something like that

hallow herald
#
//------------Top.gg------------
const Topgg = require('@top-gg/sdk')
const express = require('express');

const app = express();

const webhook = new Topgg.Webhook("Dsasadhahùi")

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

    bot.channels.cache.get("860843237022498856").send(`${vote.user}`)

}))

What's wrong?

grand lichen
stark dove
hallow herald
#

js

grand lichen
#

Thanks i will try (:

stark dove
#

I mean how do you host

#

Like do you use heroku?

hallow herald
#

no

#

my pc for test, but normally a vps

stark dove
#

Check your vps logs

hallow herald
#

This is not in my vps

#

is in my pc

stark dove
#

Ohh

grand lichen
#

@stark dove thanks for your help(:

stark dove
#

I don't know if its possible to do webhooks with locally hosting

grand lichen
#

It's works

stark dove
stark dove
polar river
#

I have a question? What can be done with a webhook top.gg?

polar dragon
#

Nice

arctic musk
#

@half burrow wdym

half burrow
#

Hello Dear Top.GG Official I Have A Bot Named Kontz There Are 50 Servers And 321K Users 1. I Was Wondering When The Security Verification Will Be Done. Have a nice day.

arctic musk
#

@half burrow wdym by "Security Verification"

half burrow
#

@willow sphinx

#

Hello Dear Top.GG Official I Have A Bot Named Kontz It Has 50 Servers And 321K Users I Was Wondering When The 1st Security Stage Will Be Done. Have a nice day.

vital anvil
#

bro stop

#

-m @half burrow this is like the fifth time i've seen this message

abstract mothBOT
#

🤐 Muted Kaanxbey#2033 (@half burrow)

twilit gorge
earnest roost
#

can anyone help me to setup webhook?

twilit gorge
#

YouTube

earnest roost
#

ok but like

#

give me a link

#

i dont find anything

twilit gorge
arctic musk
#

i have never seen him mute

green mantle
stark dove
stark dove
#

if you use py or smtn else then just click on that in the libs category

hidden brook
#

its express

#

why wouldn't it work?

hidden brook
stark dove
#

i dont know because i dont know anyone thats done it

hidden brook
#

its express...

#

just because you've never seen anyone do it doesn't meant its all of a sudden impossible

grim spoke
#

You must link your discord account by sending a private message to AuroraBot on discord. How can i do this

hidden brook
pliant parrot
#

how do i setup webhooks so that it will send when someone votes in my server

void obsidian
#

wat are we supposed to fill in these?

bold mortar
sullen nymph
#

Oh js

meager wigeon
#

I'm using js for my server count ( bot ) and it's not updating after 30 minutes?

restive otter
#

how can i see how meany hours after dos a guy can vote ??

#

like dank memer

slender quail
#

how did this happen, this is topgg-autoposter

meager wigeon
#

I think that's Rate Limit, not too sure

#

¯_(ツ)_/¯

slender quail
#

they set the time for that

restive otter
#

If only you didn't make other requests yourself.

earnest roost
#

Hey uhm i have a question

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

const app = express()

const webhook = new Topgg.Webhook("my auth password")

app.post("that /dbl thing", webhook.listener(vote => {
    vote.user.send("Thanks for voting me!");
  voteChannel.send(`Thanks ${vote.user} for voting`);
}))

app.listen(80)
#

Why doesn't this work

#

No errors pop up

hallow herald
modest spruce
#

Hi

#

Hi

#

Hi

waxen plank
#

hello

#

daddy’s here

#

someone tell me how to check if a user voted for my bot

#

i want to give the user coins from my bot’s economy if they vote

earnest roost
sullen nymph
#
  1. Ya ain't anyone's daddy, bud;
  2. Webhooks for real-time vote receiving or use the API if relying on bot votes
sullen nymph