#topgg-api
1 messages · Page 140 of 1
@short leaf
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.
Where can I find the startup code in the docs?
in the getstarted section of the docs
read pins
.. and regarding the authorization header, where am I supposed to save that, please?
read the docs
What do you mean by "save"?
That's something you send with the Request
that's the header
As the title of the codeblock says
Test
seems to work
What am I supposed to put here?
The webhook URL one, cause the authorization is the top.gg bot list token
I found you send this. http://ip:port/dblwebhook
ip is the 127... one and the port is the 8080 I think, and the dblwebhook?
IP is not 127.0.0.1
so i am trying to do a auto post of the server count and am getting the error Cannot read property 'size' of undefined
Ohh, I got it, now.
But what about the dblwebhook?
What do your webhook settings look like in your code?
Me?
/* Top.gg API*/
const AutoPoster = require("topgg-autoposter");
const ap = AutoPoster(process.env.TOP_GG, bot);
ap.on('posted', () => {
console.log('Sucessfully posted the server count for Top.gg API.');
});
But I yet didn't understand what you mean by showing the webhook settings
Like this?
One second.
Yeah, that
/* Top.gg API*/
const Topgg = require("@top-gg/sdk");
const express = require("express");
const app = express();
const AutoPoster = require("topgg-autoposter");
const ap = AutoPoster(process.env.TOP_GG, bot);
ap.on('posted', () => {
console.log('Sucessfully posted the server count for Top.gg API.');
});
app.post("/dblwebhook", webhook.middleware(), (req, res) => {
console.log(res.vote.user);
})
I am not sure what to put on the http://ip:port/dblwebhook /dblwebhook part.
I know the server IP and port but the dblwebhook? 🤷♂️
See the .post("/dblwebhook" part?
Yes?
But wait.
const ap = AutoPoster(process.env.TOP_GG, bot); This one is by using the token for the top.gg bot
right?
and what about this?
const webhook = new Topgg.Webhook("your webhook auth");
Mhm
http://ip:port/dblwebhook
I leave the dblwebhook part as it is, right?
I'm having trouble though
https://HostIPAdress:25569/dblwebhook
Didn't work.
http
The authorization code is the my own custom password, correct?
This also applies on my const webhook = new Topgg.Webhook("P"); part
Yes
Indeed.
http://connectionIP:25569/dblwebhook
I didn't edit the dblwebhook in 25569/dblweebhook
I give up on this.
What about the firewall?
Or open port?
Are you sure the webhook is actually running?
Could someone share the code for the server update code as the one im using from the docs is getting errors...
Cannot read property 'size' of undefined
im using auto poster
are you using an old version of djs? ie v11
pretty sure discordjs v11 isnt compatible with it, as v11 is deprecated, so youll have to use the sdk. or, make sure your "client" variable is actually a discordjs or eris client.
it will be in your package.json
probably, i just dont know it
if you want you can manually post the stats and not use the autoposter library
manually as in use the sdk, not as in do it by hand
every 30 minutes
cool
const client = Discord.Client() // Your discord.js client
const Topgg = require('@top-gg/sdk')
const api = new Topgg.Api('Your top.gg token')
setInterval(() => {
api.postStats({
serverCount: client.guilds.cache.size,
shardId: client.shard.ids[0], // if you're sharding
shardCount: client.options.shardCount
})
}, 1800000) // post every 30 minutes
can the time be changed?
ideally, no less than 30 minutes, as you dont need to post it so fast
the sites cached anyway, so it only typically updates once every 30 minutes on the site.
i mean like every hour ?
thats fine
ok thx
also, you will need to change some of the values around for djs v11
shard parameters is different in v11 and v12
is there a way to log when the server count has been uploaded?
inside the interval, just add a console.log
if you want to log changes, youll have to keep track of it in a variable.
omg thx
whats the difference between auto and the sdk one?
is the auto just when someone adds it changes?
so just the same then?
no
are you putting your bot id there?
The website is not loading at all
Press the link
I'm trying to follow https://docs.top.gg/resources/webhooks/
what
'k'?
What's the <<<< for? Don't recognize that as part of the package?
if i use "@" cause this error
dblapi.js install normally
however dblapi.js has been discontinued, right?
Yeah just npm i @top-gg/sdk
-api @void crown
@void crown
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.
oops sorry
@rain heart
Dont ping @rain heart for no reason funni joke
yes
i need a support to use api
but my problem its fixed, i viewed the docs.top.gg
WHo's berry?
the cool frog dude ( @hearty lintel )
@hearty lintel i need u
what
On my vps i get this error, and you are the person who maintians the djs library
Do you know a possible fix
but its already installed on my pc
well obv not
it is
since i can run it on my pc without getting any errors
however on my vps i encounter that error
that's because the package isn't installed on the VPS
npm install @top-gg/sdk
Run that
So i'm making a HTTP request because no python 3.9 support for the library, and this is my code to update my count every 30 minutes.
@tasks.loop(minutes = 30.0)
async def updateBotListCounts(self):
if os.getenv("TEST_MODE") == True:
pass
#return
async with aiohttp.ClientSession() as session:
async with session.post("https://top.gg/api//bots/541373621873016866/stats", data = {
"Authorization": "token removed for this message",
"server_count":len(self.bot.guilds)
}) as response:
if await response.text() == "200":
print("top.gg server count updated successfully.")
else:
print(await response.text())
I get this response from the server:
{"error":"Unauthorized"}
Is there something I've missed?
figured it out, i was sending the token as part of the body
yup should be a header
Does anyone know how to solve the node shards and shard problem that gives the error "shards 0 took too long to get ready" is giving EventEmitter and this error, does anyone know how to solve this?
-api
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.
ask in #development
First you read what this channel is about
In the channel topic and the big smart message above yours
oh okay
:vv
Has anyone made voter rewards for discord.py?
First you read what this channel is about
-api
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.
#development can help maybe
hello
my bot is in 46 servers but it doesnt say so in top.gg
just has a - there
and theres no server count category on my bot
language
?
what language
js
thx
const Topgg = require("@top-gg/sdk");
const express = require("express");
const app = express();
const webhook = new Topgg.Webhook("your webhook auth");
app.post("/dblwebhook", webhook.middleware(), (req, res) => {
// req.vote will be your vote object, e.g
console.log(req.vote.user); // 395526710101278721 < user who voted
});
app.listen(80);
this thing in red is the webhook auth?
use a different port than 80
what should I use?
also, seems like you're using a bot for that
if you're using a bot, you don't need to create that in your bot code
follow the instructions on the bot
yes
authorization would be the orange part you censored out
replace it with whatever you want
how I create a topgg webhook then?
soo hi
dbl.on('vote', (vote) => {
var user = message.mentions.members.first()
db.fetch(`bal_${user.id}`)
db.add(`bal_${user.id}`,2000)
});```
what's wrong with it
i wan't when someone vote my bot the bot adds him a 1000 money
stop using dblapi.js
use @top-gg/sdk
I got ratelimited with that
do you know how can I don't get ratelimited?
I know I need to use webhooks
but how?
what did you do to get ratelimited
I just turn my bot on XD
and it spams me on the console saiyng that I am ratelimited
too many requests bla bla
i think you did something bad so it ratelimited you
i mean you made the speed for api things really fast
I just have a comand that needs vote, and I only use the api on that command
*one command
const Topgg = require('@top-gg/sdk')
const api = new Topgg.Api('topgg token')
module.exports = {
name: "test",
async run (client, message, args) {
api.hasVoted(message.author.id).then(c => {
if(c) {
message.channel.send('Nice')
} else {
message.reply(`you haven\'t voted me on top.gg, please vote to use this command!`)
}
})
}
}
this should work right?
but it says that think 'too many requests'
yes you should store your own vote data
I know that but I'm asking, HOW?
can you give me an example in how should I use an webhook?
it’s a http server
sends a post request with the Authorization header being what you set in the top.gg Authorization bit
this?
the host is called discloud
hm dunno if you can do that there
is there any way to do that without a port?
no
-api
you cannot do that command
all it does is says this https://i.imgur.com/yhPYj3k.png
const AutoPoster = require('topgg-autoposter')
const ap = AutoPoster(process.env.dblTOKEN, bot) // your discord.js or eris client
// optional
ap.on('posted', () => { // ran when succesfully posted
console.log('Posted stats to top.gg')
})```
@hearty lintel explain why this happens on my most recent approved bot but never happens on my oldest bot yet
I shall wait
ah i see
is this part of the 1.1.8
should I just revert back to 1.1.3 like my old bot is or whats the solution
pushing rn
mkay lemme know when
fixed in 1.1.9

!help
A
const client = new Discord.Client() // Your discord.js or eris client (or djs ShardingManager)
const AutoPoster = require('topgg-autoposter')
const ap = AutoPoster('Your Top.gg Token', client)
ap.on('posted', () => {
console.log('Posted stats to Top.gg!')
})
Is this top.gg server count code?
o k
but first my bot have to be verified 😂
also what is the version of topgg-autoposter
read pins
K
thanks^^
k
:(
its not
-botinfo @blissful belfry
That's a user, not a bot...
check the response
where ?
updateWebhook @ webhooks:284
onclick @ webhooks:237
```
ah sorty
error: "Forbidden"```
Yes
is it in a team?
Yeah possibly associated with the errors we're encountering on teams
Not right now
What is url for see alasticsof the bot ?

.nw TiredGold
Python
When someone votes, anyone got a code that sends me in a logging channel who voted when etc?
u can simply create a webserver with flask and recive post requests from top.gg
oh ok
it has already been 3 days and topgg still give me this error Top.GG API Error: 429 Too Many Requests
the ratelimit expires after 1h right?
can someone help me?
yes
I can't use topgg-autoposter anymore
just post it manually using the package in the pinned messages
and it ratelimit me too when I use a vote needed command
like only I use the command and it ratellimit me
even if I use the command only one time
without spamming
any good way to use this?
I mean as you got any good tutorial or how I can learn it?
I saw this, is this right?
no u must learn for a week to know how to fix it,
from flask import Flask, request, Response
from discord_webhook import DiscordWebhook, DiscordEmbed
def on_vote(data):
response = requests.get(url=f'https://discord.com/api/v6/users/{data["user"]}', headers = {
'Authorization': f"Bot {config.TOKEN}"
})
response = response.json()
embed = DiscordEmbed(colour=discord.Colour(
0x5d4b98), url="https://discordapp.com", description="Thanks for your vote!")
embed.set_footer(text="Pastep.Com | _invite",
icon_url="https://media.discordapp.net/attachments/777197110319644703/806202270609047602/logo_2_-_Copy.png")
embed.set_author(name=f"{response['username']}#{response['discriminator']} Voted!", url="https://discordapp.com",
icon_url=f"https://cdn.discordapp.com/avatars/{response['id']}/{response['avatar']}")
webhook = DiscordWebhook(url='YOUR WEBHOOK')
webhook.add_embed(embed)
response = webhook.execute()
app = Flask(__name__)
@app.route('/webhook', methods=['POST'])
def respond():
on_vote(request.json)
return Response(status=200)```
https://github.com/shivaco/DBL-python-webhook feel free to use this for reference
Flask script mainly to handle POST requests from top.gg - shivaco/DBL-python-webhook
Don't leak your webhook URLs
sucks for py :|
In what sense?
Oh tnx i forgot
examples
I mean, it's not hard to do.
With Flask it's literally just a few lines and auth confirmation
it force u to use cogs, for someone who is not expert in cogs, is confusing
The examples will be rewritten
i did it with flask
are the rate limits cumulative? like if i got ratemited 2 times in 1 min will it be 1h 59min? or it still 1h?
mk
this is my code...., feel free to edit it and if you found a better way to use it, send it for me :)
okay I will tinker with it.
and @rain heart My learning method is poking with code :p
how do i log if someone had voted for my bot, the docs are confusing
use webhooks, read the pinned messages
If method isn't post you should probably abort with 405
Okay I was really late wtf is up with my net
Quel quin et fr
are the rate limits cumulative? like if i got ratemited 2 times in 1 min will it be 1h 59min? or it still 1h? because no one used the command that needs vote and it still ratelimited
no they're not
at some point you just get completely blocked on cloudflare's point
but i doubt you would exceed this limit
Does the api work with python?
what webhook do I need to use for voting?
A webserver hosted on a machine
how do I get that
whats a webserver
do i need a webhook?
@sullen nymph
The term web server can refer to hardware or software, or both of them working together.
You need a webserver. Discord webhooks are not implied here
can you give me an example
So, I need to define a class to define the dbl client, if I'm doing that in a Cog, it'll be a nested class?
Define a class? You just need to instantiate the DBLClient object
if even the official maintainer of dblpy is confused, i doubt that it is official 
idk, I just found it
It doesn't claim to be official or even try to look like an official package
lmao
Modern TopGG API wrapper 🤣
but it shows a class in the docs
Because it is
Seems to be like an OOP approach
Where do I instantiate it and how?
outside of my cog I assume, but do I need to write class?
By calling it 
Lmao, it's the same thing as dblpy isn't it
Nah, it's actually different
visible confusion

totally intentionally fucking it up for the older versions
petition to rename it to toppy
no
cri
topggpy >
add dot
bottomggpy
import top.gg
top/gg/ 

That isn't bad doe
how can i insatiate the client
DBLClient(myargs, poggers=bro)
poggers=bro
How can I set the client to bot when im in a cog insantiating the dbl client
becasue im not using discord.py client, im using bot
It's fine to pass commands.Bot instead of discord.Client
since the former inherits the latter
The thing is, I defined it in the main file, which is why I cant get it in the cog
so should I setup the dbl client in the main file?
Cogs' __init__ methods get one argument passed which is the bot object
Create the instance in the cog's init method
got it
thx
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: module 'dbl' has no attribute 'get_bot_votes'
???
upvotes
New docs moment
That doesnt work either
Still, it's referencing to the dbl module
Did you attach it to your cog?
I could do that too
but it works
import discord
from datetime import datetime
from discord.ext import commands
import dbl
class Listing(commands.Cog):
def __init__(self, bot, dbl):
self.bot = bot
self.dbl = dbl
@commands.command()
@commands.is_owner()
async def votes(self, ctx):
await ctx.send(self.dbl.get_bot_votes())
def setup(bot):
bot.add_cog(Listing(bot, dbl))
What
Why even require it in the init as an argument in the first place
dbl is accessible in the whole scope
You never instantiated the object either
Or you did in the main file?
Well then you can attach it to the bot object
how?
And then you can access it from any cog since it got access to the bot as well
bot.dbl?
Yes
Tmw both objects attach each other exdee

Command raised an exception: AttributeError: 'DBLClient' object has no attribute 'get_bot_votes'
is it upvotes then
got it
Yeah
it says courotine obj
await
One last thing
@commands.Cog.listener
async def on_dbl_vote(self, data):
print(data)
For some reason the 2nd line is invalid syntax
listener()
That didnt make a difference
i know it should be included but it says invalid syntax still
Show how you're entering it
remove ()
what
I think I need that
but it isnt working either way
no error
just not sending i think
hi
in v0.4 there's on_dbl_test that's emitted for test requests specifically
Merged into one on_dbl_vote in v1.0
but how can I test in the first place
Test button in the bot's Webhooks section, Edit page
ok
Nope
becasue technically it isnt a webhook anyway
its an event
so how does it reciveve the event
I got a 405
hen i put the url
*when
It's an event that's emitted by the webhook running from DBLClient if you pass correct webhook arguments
how can I get the api key
Whats the example python libary with webhook do?
a?
and how I get like whitelisted from that?
but I don't use topgg on my commands since 3 days ago, and I still am ratelimited
but on my test bot I use the same info and tokens from topgg and it worked
const Topgg = require('@top-gg/sdk')
const api = new Topgg.Api('topgg token')
module.exports = {
name: "test",
async run (client, message, args) {
api.hasVoted(message.author.id).then(c => {
if(c) {
message.channel.send('you\'ve voted me')
} else {
message.reply('vote on me')
}
})
}
}
this should work right?
it says too many requests, even with just one test
Actually, i suggest not interacting with the api at all for a few days if it really says you're doing too many requests
Reset your token too
it's been 3 days, but this is what i would do if nothing worked, thanks anyways :)
i forgot where I can find my token?
Read pins
thanks
isn't the ratelimit for posting stats 15 minutes
What does autopost do?
How can I config it to post in a specific channel
Or is that not how it works
autopost is for posting bots stats like shard count and server count to the top.gg page
has the API endpoint moved for updating guild count?
No
it's still /api/bots/<client id>/stats?
OK, it's been a while since I've checked the dashboard, has the location where my token can be found the same place?
Checking my bot's webhooks as the documentation says seems to get me a 404
like going to the webhook section?
yeah
oh wait, I keep getting mixed up which list uses the bot user ID or application ID.
Any one need help dm me!
Can someone help me? This isnt posting my server count
"this"? youll have to be more specific
self.dblpy = dbl.DBLClient(self.client, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=8175, autopost=True)
I had autopost=True
and before it worked
Now it dosent
I dont know py, sorry 
aw
what programming language?
You need to actively post to the api
const express = require('express')
const Topgg = require('@top-gg/sdk')
const app = express() // Your express app
const webhook = new Topgg.Webhook('topggauth123') // add your top.gg webhook authorization (not bot token)
app.post('/dblwebhook', webhook.middleware(), (req, res) => {
// req.vote is your vote object e.g
console.log(req.vote.user) // 221221226561929217
}) // attach the middleware
app.listen(3000) // your port
topggauth123 needs to be the same on the website, and your code
if you host somewhere other than a VPS or proper dedicated server(with a dedicated ip) youll need to do some other stuff.
@long cipher
tag me if you need something else, im actually at my pc now
where are you hosting?
home network?
youll need to port forward your router, and allow the connection through any firewalls
https://portforward.com/ this site has guides for most routers.
np
Do I make up a URL for the API or do I get one from somewhere. If I need to get one from somewhere how do I get it? (Please ping me) Thanks in advance!
for the api? nope. for webhooks, you will need to make a url.
how its formed depends on your hosting.
oh
How do I make a URL for webhooks?
and how do I host? (I host my bot on a Raspi 4)
http://yourpublicip:yourport/path
you will need to port forward on your router
if you have any firewalls, you will need to let the port through those too
web requests have a port, it just says "go here, in this location" in a way.
they are numbers.
as long as they are the same between what you port forward, what you use in your code, and what you use in the URL your fine.
no
server count key?
Dbl Token you mean?
ye
dw though
i found it
for anyone else searching for this later its in the webhook section when u edit ur bot
yeah, its pinned.
does anyone know how to do server count on top.gg using discord.Client() and not discord.commands.ext.Bot()? I'm using discord.py btw
use_agree
-botcommands
Hey! Bots aren't given permissions to send responses in this channel. Please use #commands to run commands.
What you really need from the examples is DBLClient and the update_tasks function
The rest can be pretty much scrapped
Firstly, you read the channel topic and wonder if you're in the right channel
ok
I've put my server on https://top.gg/, and I made it so when you vote you should get a role, but that doesn't work. Why?
How are you doing it?
Well, I just put my role in the settings of the site.
Do you have the DBL bot on your server? Is it above the role you're trying to assign? What does the "Test Webhook" button do for you?
That's just to test the webhook. If you've selected the role, click "Test Webhook" and then check your server to see if you've been assigned the role.
But I don't have that filled in, what should I fill it in with?
Don't worry about those. Just see if that works. I don't know how the server voting works I only know bots. If that doesn't work then maybe someone else can help you.
Should I make a new webhook? If so, what channel should it direct to?
That's not how it works. You need a bot to receive it.
It doesn't work for me. I tried it multiple times with multiple accounts.
Ok welp you'll have to wait for someone else to help you! 😬 Sorry
Oh, wait, do I have to give the role of the bot the permission to change roles?
That wasn't on by default.
Probably 😂
Ok, I'll try next time
Where do you get this information
read pins
Can you send a print?
ah
How can I check if someone has voted and if they have how long yntil they can vote again
how long yntil they can vote again
is something that top.gg does not provide, you need to track it yourself with making your own webhook
and for the first one, https://docs.top.gg/api/bot/#individual-user-vote
How could we do that? I would want to have something small to check when I can vote again, without having to get lucky, kinda.
as said, webhooks are your way to go: https://docs.top.gg is a great way to get started
Ok, thanks
I don't quite get it, I'm not that far into coding and programming
https://top.gg/api//bots/:bot_id/check
What do I have to do with this URL?
But with what? I don't get it.
With a user's ID
That's something you cannot do with the top.gg api, you wil need to do that with webhooks
As top.gg/servers doesn't have api support
But how can I do that? I don't have any experience with that.
DBL is not a place to find developers for jobs. You can try and put a request on Fiverr or Freelancer. Please do not post the request again. Doing so may result in punishment.
Oh
is there any docs for the api?
const AutoPoster = require('topgg-autoposter')
const ap = AutoPoster('topgg token', client)
``` what should I write to make this post stats every 30 mins?
thank you so much
😐
ty
How can i get the Autorization ?
I can't find the on_dbl_vote function in the top.gg python-sdk
is it even there
I mean how to does it work
where ?
uhhh this on_dbl_vote wont work
I have question
how do yall host a webhook for it?
got it working afaik, ty!
Your sdk should have the framework for this.
If your language doesn't have an SDK you'd just have to set up a Webserver to handle the POST request that top.gg sends you whenever someone votes.
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.
is the search query in the https://top.gg/api/bots (GET method) ever gonna be fixed? It's been awhile
what search query?
Nope, it searches for bots with a specfic query
Hey i need some help setting up Webhooks for my discord bot
I need it to get the userID of someone who votes for my discord bot
what lib/language/host?
I was wondering if it would be possible to block my bot's commands and unlock if they vote for it, is that possible?
im using discord.js and hosting on Heroku
vote locking for a few commands is fine, but the majority of your commands cannot do that.
Yes but I don't know how to do it or how to start
store users who voted in a database, check the database when the command gets run.
if you need help with that part #development
what do i put for the Webhook URL
the heroku url to your project with /dblwebhook
at the end
what programming language?
https://docs.top.gg/libraries/python/
bottom section
ok
let me see
I've seen that site and read through it over and over but I still don't get it...
it tells me to enter a webhook path, port, and auth but where do I get those?
you make them.
how...
well
path can be any string within some limits
port can be any number between like 1 and 60,000 thats not already in use(you can use like 6000, should be free).
auth you can litterally just type whatever
I use raspi to run bot so I put the IP address of the raspi?
the ip of your home network
oh
path is just a path.
youtube.com/subscriptions
subscriptions is the path
oh
its just a way for you to specifically point to something
ohhh the path to my bot file?
nope
oh
path of the url
uh
filesystems, and http servers are seperate things.
ohh
they can sometimes be linked, but thats not the case for this
nope
its a url, like visiting a website
ok?
ok then lol
could be your path if you wanted
just make sure you port forward, and the path and port are the same between the code and url
should work fine
ok
Do I need to fill something out for the authorization (in the site)? If I do, what is it?
nvmd
you're supposed to pass your web server url instead of discord webhook url doe
?
what does that mean? I dont have a website.. 😐
When I test a webhook what does it return?
idk
um ok
The same as if someone votes, except the type field will be "test"
It still isn't working for me. :C
How can i do webhook ... Which webhook it needed?
oh ok
Will it pop up in the run window?
I'm currently trying to update my setup for receiving votes from dblapi.js to @top-gg/sdk but I've got a question about this example image:
It shows IP:PORT, but is that required or would a normal url be okay? Cause when I did update my code to the new package the voting wasn't working anymore so I had to revert it. I may be just doing something really dumb, which is probably the case cause I'm not used to express routes and just handling requests in general
It can be a IP and/or a Domain
Or what do you mean
As long as you properly set that domain on the ip that is
the api is wrong? they are displaying two different server counts and idk which one is true or not
discord says its 18.1k but top.gg api says its 18.0k
Also, the server count you get through your code to post to our api is very likely the correct one
how to see if someone voted my bot
nice eyes
nah not really
patience of doing that but thanks for the future idea
How come I got this error?
-api
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.
ask in #development
I don't get how to use top.gg npm to receive vote notifications when a user voted my bot.
API is used for vote-posting, right?
I have trouble in Setting up webhooks...
everyone has...
What have you tried so far?
create a express server then top.gg will send a post request to your server and u must process it
I haven't had issues with webhooks
If you need help with them lmk
@sullen nymph See, my bot is hosted on heroku, so I tried to put my webhook as https://project-name.herokuapp/dblwebhook and a custom Auth password.
Now when I runner the code and tested the webhook on top.gg, I checked the logs of my app in heroku. It was showing an error:
2021-03-16T11:09:41.109507+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/dblwebhook" host=project-name.herokuapp.com request_id=39ada476-023e-4246-a853-37356c67cfc4 fwd="165.22.130.154" dyno= connect= service= status=503 bytes= protocol=https
What's should I do?
@stiff night
Did you turn the web dyno on? Which port do you run the webserver on?
Port value?
i don't use heroku, i can't help u about heroku
I think 8000 @sullen nymph
You don't rely on a static port with Heroku webservers
Refer to the PORT environment variable instead
It's usually preferred if you remain silent in case you don't know something unless you are asked personally
they mentioned me
Right, didn't see that
@fluid matrix hey please don't advertise, thanks
@sullen nymph
?
You told about web dyno
Ahh lemme do
@sullen nymph i did it, but then when I trigger a command, bot is showing two same responses
Tried only running the web dyno?
Well I wish I was more familiar with Heroku
What do you mean?
Ahh npm
Use the @top-gg/sdk one
Ahh ok
@static kayak you can't run a bot on a web dyno
that's because web dynos go idle after a set time without any request
just like glitch
"If you need help setting up webhooks inside of your bot don't be afraid to ask in our discord server in the #topgg-api channel."
How do i make webhook url
if you run a webserver in said VPS, it'll have a path
so http://IP:port/path
i mean what does it means
virtual private server
o
a computer that is 24/7 somewhere in the planet
im Using website Hoisting tho ...
this techhost?
okAy hOw
Which lang?
there is a api option where i gen my api key in TechHost
gotta say, it's sus
This doesn't matter.
what it work for me
Ehh web hosts are poo for bots especially when you want to use webhooks like this.
express for JS, springboot for java, idkwhat for python, etc
Im using js/d.js
yep
o
You probably can't run a webserver on web hosts since the only exposed port is occupied with keeping your discord connection alive.
well, there's that too
anyone who uses repl.it can ask me for help, I use and post the status of my bot and created the server to collect voting information
Still the same
You need to have your webserver attached to your bot under the same port to work
👀
how l continue with required vote commands
do you have the webhook setup?
yep
your using js right?
right
okay #development ill run you through a bit.
I have a question are there servers that help people with servers?
I cant figure out how to give top.gg bot info.. 😐
ya
and? I have it
wait
ILl read the description and examples
hm..
I got this after I putted exactly what u have, and what the example has, and got this, again.
does that mean my token is incorrect or smth?
i copy pasted it from top.gg.............
yes
index?
it gave me this error
here in bots folder?
yes
after const Discord = ..
no
its before message
ok
like so, right?
stil
@long cipher its same thing
😐
😦
anyone?
👀 can you show your package.json?
sure
{
"name": "smug_fugy",
"version": "1.0.0",
"description": "",
"main": "index..js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"Smug",
"Smugy",
"Smugy Fugy",
"Moderation"
],
"author": "SmugTheKiler#7012",
"license": "ISC",
"dependencies": {
"beautify": "^0.0.8",
"discord-giveaway": "^1.1.3",
"discord-giveaways": "^4.4.3",
"https": "^1.0.0",
"ms": "^2.1.2",
"pm2": "^4.5.4"
}
}
so, your not using discordjs directly?
I guess?
can you show the part you require discord.js?
or if you have a discord variable(something like this)
const Discord = require('discord.js');
try doing below that
console.log(Discord.version);
alr
wait.. ik its 12
I updated the packages like a week ago
and your sure of this? afaik, this issue only arises with djs v11, and wont happen on v12.
if you want, you can just post the stats with the sdk
its not completely required if he is using node filename anyway
I need help with my voting webhook. My thing was http:IP:8000/index.js. IP removed for obvious reasons.
your path is index.js? the path is the path of the endpoint, not the actual file.
http://
Oh.
I'm still having issues.
What's the issue
It isn't working. Like nothing happens, even though I have to so it should log it in the console. There are no erros, but it isn't logging.
Are you sure the Authorization key matches the auth key in your code? Are you sure your port is accessible?
Which IP address should be in the link? IPv6 Address, or IPv4 Address?
IPv4
Yeah
I put the link in my browser to see if I can get any issues, and this is what it says. Is it normal?
Mhm
It accepts POST requests and browsers by default send GET
So it seems to be accessible at least
Is it suppose to still run app.post("/dblwebhook", webhook.middleware(), (req, res) => { // req.vote will be your vote object, e.g console.log(req.vote.user); // 395526710101278721 < user who voted }); whenever I click the test button, or just actually voting?
Should work with both
Then still not working.
where are you hosting?
Local. ;-;
have you port forwarded?
https://portforward.com/
if you havent, this site has guides for how to port forward for various router models.
How do I get my device's name for port forwarding?
like the local ip?
Sure?
is it like an rpi your sshing into? or a computer your on?
I am hosting it on my PC?
windows?
Yes.
network, network properties, ipv4 address
I don't see the port forwarding name.

literally can not find it

wrong token