#topgg-api
1 messages · Page 125 of 1
Yeah haha
I like how getting a bit of help here is quite a lot less toxic than looking for help in discord.py, with dumb mistakes at least haha
Kathleen Kennedy thought Rogue One was boring, but she produced the worst fucking star wars movies ever
why does dblpy not work for the latest version of python?, and is there an alternative?
what exactly doesn't work
It only works with Python versions strictly below 3.9 atm
I'm working on adding support for it
From a api-wise point, no
You could scrape the site and reverse-engineer the description-update process, but i think that's most likely not allowed
@tender furnace through the test button
oh
oh theres a new announcement feature,cool
The ip of the server your bot is hosted on
if heroku or repl.it, most likely the project url
im using local tho
You'll need to portforward then
oh
Ignore those
is there a way I could show how much time left for someone to revote?
why?
Because there's no fix for them and I never found the cause
Well, a workaround I have planned is to suppress that specific error but raise others
it still doesn't work 
Hi, I want to make a vote log, took help of top.gg api doc, and I am Confused
if (voted) console.log("Tonkku has voted!!!")
});
``` Over Here What is 95579865788456960
I have the Module dbl
That is an example of checking if a specific user has voted
in this case, the user tonkku with the ID 95579865788456960
oh, so how to make like all user
use webhooks instead, read the docs
I did the Webhook part is confusing
https://top.gg/api/docs#webhooks
And Youtube or Google has no Help

does my bot need to be verified for me to get a key?
yes
When do you think that will come out?
Like December-early January soon
This December?
K thx
do they exist? All i saw in the api docs is the documentation of diff libraries
hi
im new
from the stream
can someone help me
stream?
ye there was a streem

in twich
i dont know what do you mean
why did you join in this server
bicos there was a link in the stream
pityscreams
wrong server i guess
hmmmm
so weird how this discord gets randomly linked places
they mean webhooks as in webhooks you make with an http server.
top.gg webhooks are not compatible with discord webhooks.
My code got blocked from accessing the top.gg api, and it was working fine before
nothing wrong was happening, and then at 100, it randomly started saying blocked
ohh
that's because if your bot is at 100 servers you have to verify your bot to be able to have more than 100 servers for your bot
o
hello with the @top-gg/sdk module we can detect the votes of my bot like for example when someone votes ca send a message?
pls
how would i set up the api for votes?
i dont really know how to use the webhook stuff but i looked at the code examples in the python library for it
I have the stats update part done but the webhook is confusing me
is there something wrong with this?
File "/home/container/bot.py", line 169, in <module>
raise e
File "/home/container/bot.py", line 166, in <module>
client.load_extension(cog)
File "/home/container/.local/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 664, in load_extension
self._load_from_module_spec(spec, name)
File "/home/container/.local/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 610, in _load_from_module_spec
raise errors.ExtensionFailed(key, e) from e
discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.topgg' raised an error: ImportError: cannot import name 'logger' from 'logging' (/usr/local/lib/python3.9/logging/__init__.py)
i get that error frequently
when i try to start my bot
is it a real token?
lol
i-

regenerating
what code would I put for the api if I am not using cogs?
I just want to paste it in my main.py file with everything else
@jolly hornet
How can i get it so, everytime the guild count updates, it sends a message to a certain channel in my server?
also with a cog, how do i view it's console?
cause if i just do print it doesnt send it to the console the bot runs on
just @ me with answers pls
@flint olive I just had to make a cog
import requests
url = 'https://top.gg/bots/788330205185703967/check'
#demonstrate how to use the 'params' parameter:
x = requests.get(url, params = {"userid": 727031232243695626})
#print the response (the content of the requested file):
print(x.text)
showing page not found
Something like: dbl.postStats(totalGuilds, bot.shard.count) in a setInterval should work for posting the bots guild count and shard count right?
Hi, I tried using @top-gg/sdk package from npm in JS, did this ```js
app.post('/dbl-webhook', webhook.middleware(), (req, _res) => {
console.log(req.vote);
});
I'm receiving the request when I click the test button in the website, it just doesn't pass the `webhook.middleware()` for some reason
The authorization is right, I'm pretty sure with that, it just gets rejected in the middleware function and I'm not sure why
@formal sparrow you need to submit the url in order to test it
by pressing the save button
I did
My test version was ```js
app.post('/dbl-webhook', () => console.log(1), webhook.middleware(), () => console.log(2), (req, _res) => {
console.log(req.vote);
});
Then you aren't send a response if it doesn't do anything after that i think
oh no clue then
I'll just check the request and do stuff myself then
import requests
url = 'https://top.gg/api/bots/788330205185703967/check'
#demonstrate how to use the 'params' parameter:
x = requests.get(url, params = {"userid": 727031232243695626})
#print the response (the content of the requested file):
print(x.text)
It's showing error unauthorized user
how do i see the api doc for discord.py?
Where
thanks
@restive otter https://top.gg/api/docs too
@rain heart can u just send me how to where to write it
Inside the request headers, can't help you with that
Votes resets at 2 AM EST right?
Basically new day in top.gg in everything is at 2 AM EST?
import requests
url = 'https://top.gg/api/bots/788330205185703967/check'
#demonstrate how to use the 'params' parameter:
obj = {
"userid" : "727031232243695626"
}
x = requests.get(url, headers={"Authentication":"xxxxx"}, params = obj)
#print the response (the content of the requested file):
print(x.text)
Then also same output
@rain heart
Authorization, not Authentication
Now read the apidocs correctly, especially this one https://i.imgur.com/9PnvN9w.png
someone knows how to make dbl command
for example
!dbl 713369365294350397 and i give information about the bot in top gg
anyone can help me to setup my discord bot upvote webhook?
If you use discord.js, take a look at @top-gg/sdk package on npm
it should have support for the GET Bot endpoint
Or you can manually send a request. See https://top.gg/api/docs in that case
What library?
me too pls. i'm using discord.js
@restive otter see the message I'm replying to
What library?
discord.js
Refer to topgg-autoposter or @top-gg/sdk on npm and see which one fits your case
wdym
topgg-autoposter will post your bot's server count automatically every X minutes whereas with the SDK you will have to set up your own interval
sry im kinda confuse
Well, I am a noob coder...I don't know whats a library and what I needd to to!
I wanna add server count to my bot
That's it
py library btw
I gave you two packages that can help you post your bot's server count to top.gg and since that's done via an HTTP request in the end, you can either use an official library to do that or post it yourself with an HTTP request library
import dbl
import discord
from discord.ext import commands, tasks
import asyncio
import logging
class TopGG(commands.Cog):
"""Handles interactions with the top.gg API"""
def __init__(self, bot):
self.bot = bot
self.token = 'dbl_token' # set this to your DBL token
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)
# The decorator below will work only on discord.py 1.1.0+
# In case your discord.py version is below that, you can use self.bot.loop.create_task(self.update_stats())
@tasks.loop(minutes=30.0)
async def update_stats(self):
"""This function runs every 30 minutes to automatically update your server count"""
logger.info('Attempting to post server count')
try:
await self.dblpy.post_guild_count()
logger.info('Posted server count ({})'.format(self.dblpy.guild_count()))
except Exception as e:
logger.exception('Failed to post server count\n{}: {}'.format(type(e).__name__, e))
# if you are not using the tasks extension, put the line below
await asyncio.sleep(1800)
@commands.Cog.listener()
async def on_dbl_vote(self, data):
logger.info('Received an upvote')
print(data)
def setup(bot):
global logger
logger = logging.getLogger('bot')
bot.add_cog(TopGG(bot))```
What the heck is this huge code?
e-eh im super confuse now
im so sry
ok, thank you very much
update_stats in that snippet is a function that will post your bot's server count, as its docstring says
uhh ok
By default the function itself will simply exist and not run, hence why the decorator (@tasks.loop)
Oh, nice, it doesn't get started in that snippet
wdym
grrrr
sry
#topgg-api message this might help you
hmm ok
@wintry island as for you, add self.update_status.start() in the end of the __init__ function
type that in our coding?
to actually start the task that will run every 30.0 minutes
not just add some snippets into your code, but read them and understand what they do
snippets?
small parts of code
a snippet is a piece of code
well, I actually don't code bro! My friend coded the bot for meeh and he uses py! He and me are bot owners on top.gg
I am learning to code currently
oh

Ok

SPAM!?!
which
In the message I linked before
which app
const poster = AutoPoster('topggtoken', client) // your djs client/shardingmanager or eris client```
this?
it's from https://top.gg/api/docs
@sullen nymph
but that's with the old API module it's not the new one
Yes
Docs are planned to be updated soon
With brand new UI presumably
ok
client is supposed to be your discord.js client
So I believe you got it right so far
Just... probably put it somewhere where it actually runs
const poster = AutoPoster("topggtoken", client) u mean this? @sullen nymph
the client
Quite literally, the client variable
confuse sry
i paste ```const AutoPoster = require("topgg-autoposter");
const poster = AutoPoster("topggtoken", client); // your djs client/shardingmanager or eris client
me?
Yes
Bismillah
no, the line where you create your client
Where you create/initialize your discord.js client
bruh sry lol im very confuse
where is your discord.js client
this?
put the top.gg token of my bot in const poster = AutoPoster("topggtoken", client); // your djs client/shardingmanager or eris client right?
i mean the ("topggtoken", client)
@rapid kettle
top.gg token is bot token?
Make sure there are no unnecessary spaces and wait a bit
dbl.postStats(totalGuilds, bot.shard.count) How come this doesn’t work? (Total guilds is defined as the amount of servers the bot is in)
I highly doubt you can post shard count and server count just like that
It was working when I was just doing server count
But broke when I added the bot.shards.count
Then yeah
it’s uhh
that ain't gonna work chief
You either send an array with guild counts per each shard
Hi, so i am really struggling how to do anything and like get a webhook etc... Could anyone please help me
or you only post the server count as an integer
the bot status didn't work after coding ```const AutoPoster = require("topgg-autoposter");
const poster = AutoPoster("topggtoken", client); // your djs client/shardingmanager or eris client``` right?
Matt I tried it multiple times when fucking around when adding official support for posting list of server counts
I think I poked Xetera about it in the past as well
trying to post server count to a specific shard ID didn't work either
I just imagine you visiting xet irl with like one of those pokey finger sticks, going poke and running away
Nae, it's either poke until he gets very pissed at me or nothing at all
(Yelling to check DMs included)
Traceback (most recent call last):
File "/usr/src/discord-bot/app/discord_bot.py", line 203, in on_guild_join
await self.topgg.post_guild_count()
File "/usr/local/lib/python3.9/site-packages/dbl/client.py", line 160, in post_guild_count
await self.http.post_guild_count(guild_count, shard_count, shard_id)
File "/usr/local/lib/python3.9/site-packages/dbl/http.py", line 168, in post_guild_count
await self.request('POST', '/bots/stats', json=payload)
File "/usr/local/lib/python3.9/site-packages/dbl/http.py", line 93, in request
async with rate_limiter: # this works but doesn't 'save' over restart.
File "<string>", line 6, in __aenter__
TypeError: object Lock can't be used in 'await' expression
Getting this error when trying to update the guild count
All I'm doing is
import dbl as topgg
await self.topgg.post_guild_count()
Use Python 3.8 for now with dblpy
A completely new and separate release will support 3.9 and have support for multiple webhooks
Not everyone here does
Oh okay
Thanks
Hi I need some help with the python api, on_dbl_test()
I managed to get it to work
Can someone send me a link to the js api wrapper? Because https://top.gg/api/docs seems very outdated.
See pins
thx
Any idea on why setting the webhook on my bot, I keep getting an error?
Looking in the console, the return is
yes, read the docs
there is check endpoint but you need API key for that
I need an example, like a shown code
just use a http lib made in your language
its literally just a get request

Seriously though, how would I get the Token for my bot?
Not the discord token obviously
the one for Top.gg
404
Insert your bot id instead of :botid
anyone know what is this?
[20:50:18]: [ApoBot]: TopGGAPIError [Top.GG API Error]: 404 Not Found
at Api._request (/root/apo-bot/node_modules/@top-gg/sdk/dist/structs/Api.js:74:19)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Util.xp (/root/apo-bot/src/Structures/Utils.js:39:15)
at async module.exports.run (/root/apo-bot/src/Events/discord/message/message.js:16:3) {
response: '<!DOCTYPE html>\n' +
'<html lang="en">\n' +
'<head>\n' +
'<meta charset="utf-8">\n' +
'<title>Error</title>\n' +
'</head>\n' +
'<body>\n' +
'<pre>Cannot GET /api//bots/check</pre>\n' +
'</body>\n' +
'</html>\n'
}
Hey guys, need some help with vote rewards implementing 😣
I guess before anything else I'll ask what does the "your.server.ip" stand for?
I put there my Aamazon Web Service instance's public IPv4, but it doesn't seem to forward the vote object to my app
do you have the port open?
Is it something I have to set in my AWS console or in app? This is the code snippet where I'm trying to post server count (doesn't work either but I suppose it needs that 30min interval to pass?) and recieve voters
i suppose that you have filled all the tokens and authorization with real data right?
yesyes
what service of amazon you use?
the code snippet is also put before client.on("ready" and "message" if that could have smth to do with it?
it's free EC2 plan
@toxic thorn
How do i check if a user has voted on my top.gg page using discord.py?
I wanna use the fetch method
I'm blind thanks
Np
How do I want to show the number of servers that the bot has in the site?
What is the code ؟
@marsh ginkgo first of all what language is the bot in?
..
javascript
Programming language

😂

Check the pins there's a package that will help u post it
how do they make apis?
http
I am an Arab and I do not know much in English @cold ledge
Check pins
is it possible to make apis on a cell phone?

where?
its no different than regular programming so yes you can
But why would you?

$$
Can't help you with that
I would make apis for my bot commands
@cold ledge ok
I just need how I want to appear on a site top.gg The number of server in the bot
to add do API and do special commands?
Well then thats using an API yea you can do thst
@marsh ginkgo check the pinned messages in this channel, there is a npm package you can install that will help you
How am I supposed to make an API? XD
@worn lion I don't think they really know what an API actually is
APIS use Javascript?
An API can use any language
What language does bdb and bdfd use?
ts
Same difference
ts?
Typescript
that language use?
check pins

"The docs is"? 😡
😳
Where do I find the pins and what are they?
tf does this mean
so uhh
with the dbl api
i already made a simple system so that the bot's server count updates
it already tells you how to do that
but how do you see if some specific user's id voted
like if someone votes
it does something
webhook
@near hill i resolve that problem using the db to not request everytime the relevant info to the dbl api
Rate limit
that's how fast my bot updates it's status
it has like 26 different ones and most of them are inside jokes
what interval should I set it to (a multiple of 10 seconds preferably)
What you exactly do with your status that is affecting the api?
set it at least to 30 seconds
my bot cycles through every 2 mins
also this is a simple question dont ask here
can anyone help #development
I have the post stats function in the status update loop
Ooh
You need to post stats every 1800000 ms
no cant it still havent change
wait wrong ping
the server count in top.gg of the bot
lemme find that helper yesterday
@sullen nymph yeah u are here
Show your code
@sullen nymph the covered are bot token from the api link u gave me yesterday
and the custom bot status didn't showed after i add this code...it works before
Is there any event for DBL like ```js
dbl.on("vote", (user) = > {
//Do the rest
});
Anyone ?
vote event is for webhook
dblapi.js is deprecated. Use https://npmjs.com/@top-gg/sdk instead
i already paste ```const AutoPoster = require('topgg-autoposter')
const poster = AutoPoster('topggtoken', client) // your djs client/shardingmanager or eris client``` this in the bot coding but why the bot server count still dindt show in top.gg website
any errors?
bruh
o
@sacred shell ads btw
You have all been waiting for spotlight
no, we are not
Hi, I sent the following data
{ server_count: 3578, shard_count: 4, shard_id: 3 }
in a POST request to this URL https://top.gg/api/bots/530082442967646230/stats but somehow it doesn't work correctly, server count is being 2x as the original count, what would be the reason 
Been experiencing this with the API since I started using it:
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.gson.internal.reflect.UnsafeReflectionAccessor
The data I sent here is correct right
It's showing as 7.2k instead 
Remove the shard data, and see if it changes
iirc that posts the guild count for each shard, not sure tho
Lemme try rq
how u add bot server count
i cant did that
Well, it's just sent through the API so you can send whatever server count you want but that's probably not allowed @sterile cedar
@rain heart Tried sending just server count
worked
But I want to send shard count too 
Try it without posting shard_id maybe
Tried that, that too worked
Then why not with shard id
Well, added shard_id too and still works
It's like wtf
Doesn't work before and now works
Sent ```js
{ server_count: 3570, shard_count: 4, shard_id: 3 }
Somehow the same data works this time
Hello anyone knows how to do with the new @top-gg/sdk module to make a system or when someone votes for my bot it sends a message please I can't find it.
(ping me in case of answers)
wdym
What's hard in it?
Just fetch the user inside app.post (given in the example) and send them the message
What I meant is that you can fake the server count of your bot using the API but I don't think you're allowed to do it
oh
ok but how to do that's what I mean
Doesn’t matter what lib you use.
You simply send a POST request to top.gg including your JSON string as data which contains the server count etc.
As described in the docs.
Hello, I have a problem with the api, I get her when I do the test button on my bot page: POST /votes 422 4883.061 ms - 29 code :
const { Router } = require('express');
const config = require('../config.json');
const Topgg = require('@top-gg/sdk');
const webhook = new Topgg.Webhook(config.bot.dbl.authorize);
module.exports.Router = class Home extends Router {
constructor() {
super();
this.get('/', function(req, res) {
res.status(200).render('votes.ejs', {
config: req.config,
bot: req.bot,
user: req.user,
is_logged: (req.isAuthenticated())
});
});
this.post('/', webhook.middleware(), (req, res) => {
console.log(req.vote.user) // 221221226561929217
});
};
};
module.exports.name = '/votes';
the configuration page dbl is check to good
Hi guys! I noticed the server count sometimes changes to "2 servers" instead of the real number on top.gg, any ideas why? Lately I didn't see any other number than 2 at all,~~ could it be because my bot reached over 100 servers and wasn't verified yet? (I can't verify it yet because it was put as an exception for unnatural grow and allowed to continue unverified until 250 guilds)~~
EDIT: It swapped to real number again, so only why is it sometimes real number and sometimes "fixed" 2?
@toxic thorn Do you have test bot running?
Uh, which library do you use to make your bot online?
I do, but my test bot is a different application, so it shouldn't matter I guess?
You use the same API token
node.js
That sends your test bot's server count which is why it's 2 sometimes cuz your test bot is in 2 servers @toxic thorn
I'm asking about library like discord.js or eris like that
oh sorry discord.js v12
So what you're telling me is you don't know how to fetch a user and DM them or you just don't know where to put that code?
Well it's more like going towards #development but still kinda related to API since you wanna do that when a user votes so not sure whether what we're talking about is still not offtopic to this channel
in fact I know how to send a message but I can not put it and I do not know how the API works to watch the votes of my bot @formal sparrow
ohhh, I seee, thanks a lot 😄
@dim wren just look at this
The part where you handle stuff when user votes is here
ok
So there req.vote.user is the ID of the user who voted, use it to fetch the user and then send them a message
You gotta fetch the user first
This is now definitely #development, I guess we can move there
does anyone know how to put the voting API, using heroku? It's my dream
I'm using the dblpy stuff, but whenever I reload the cog my dblpy thingy is in, it won't post the bot's shards/servers. Any reason why?
Scratch that, I think I need to use the autopost
That works now
Yeah
Not really
If you use the tasks example, you need to add self.update_stats.start() at the end of init
its really simple
just remove the 2 lines with the shard stuff
in case you dont have it
like this
the console.log is optional
also this is really obvious but if you aren't using d.js then what i said wont work
dbl.on('posted', post => {
console.log('This api as posted ! -> ' + post);
});
//API TOP ERROR
dbl.on('error', e => {
console.log("Error : " + e);
});
//API TOP RUNNING
dbl.webhook.on('ready', async hook => {
console.log(`Le webhook run sur : http://${hook.hostname}:${hook.port}${hook.path}`);
});
//VOTE API FUNCTION
dbl.webhook.on('vote', async vote => {
console.log(`User with ID ${vote.user} just voted!`);
client.channels.cache.get('736165989204361236').send({embed: {
color: "RANDOM",
title: 'Thank for your vote ! \n Love you ' + vote.user + ' 🥰'
}});
});```
I can do everything, it doesn't work
Hey, using node-sdk, I'm getting req.vote.user is undefined, ie, req.vote is, any fixes?
What is your code
Or any relevant info for this
okay
Like your webhook route
okay okay
app.post('/webhooks/dbl', wh.middleware(), (req, res) => {
console.log(req.vote.user); // of-undefined
})
Does it throw an error?
More or less what i expected
0|Spencer | /root/Spencer/dist/src/routes/Hook Routes/DBLRoute.js:9
0|Spencer | await EconomySchema.increment({ User: req.vote.user }, 'Coins', req.vote.isWeekend ? 2000 : 1000);
0|Spencer | ^
0|Spencer | TypeError: Cannot read property 'user' of undefined
0|Spencer | at Object.run (/root/Spencer/dist/src/routes/Hook Routes/DBLRoute.js:9:52)
Hm

Maybe you need to add express.json?
what is express.json
body-parser exists
I'll try body-parser
if you want the full code here
public serve(): http.Server {
const preDefinedMidllewares: Array<{ name: string; value: Middleware }> = [
{ name: 'dbl', value: this.client.dblWebhook.middleware },
];
this.client.routes.map((value: Route) => {
const middlewares: Array<Middleware> = [];
if (value.middlewares?.length)
value.middlewares.map((value: string) => {
if (preDefinedMidllewares.find((value_) => value_.name == value)) {
preDefinedMidllewares.find((value_) => value_.name == value).value;
}
});
this.server[value.method](
value.path,
...middlewares.map((value: Middleware) => {
return (req: Request, res: Response, next: NextFunction) =>
value(req, res, next);
}),
(req, res, next) => value.run(this.client, req, res, next)
);
});
return this.server.listen(this.client.config.webPort, () =>
this.client.logger.success(
`Webhook server listening on port ${this.client.config.webPort}`
)
);
}````
panik
body-parser isnt required btw as the middleware does it itself
if i had to guess with your code, you're not using the middleware correctly, but i'm unsure
oh i see
@covert lark .middleware() returns a function that is the actual middleware
try
{ name: 'dbl', value: this.client.dblWebhook.middleware },
to
{ name: 'dbl', value: this.client.dblWebhook.middleware() },
Hi, so i am trying to log when someone votes for my bot but it does not work at all could someone please help
const Topgg = require('@top-gg/sdk')
const api = new Topgg.Api(process.env.DBL_KEY)
const webhook = new Topgg.Webhook('')
client.on("ready", () => {
setInterval(() => {
api.postStats({
serverCount: client.guilds.cache.size
});
}, 1800000);
});
app.post('/dblwebhook', webhook.middleware(), (req, res) => {
console.log(`User with ID ${req.vote.user} just voted!`)
//const check = client.guilds.cache.get('734018985812688987')
// if(check.members.cache.has(req.vote.user)) {
//const userID = req.vote.user;
//const member = check.members.cache.get(userID)
// member.roles.add('782380266848518155')
//}
});
app.listen(5000)
make sure your port is open to the internet
Wym
are you using a vps?
Yes
open the port in your firewall
ufw enable && ufw allow 5000
This is a joint project my friend does the website you see can it be same port as that?
if the app you use is shared it can yeah
@hearty lintel But it says adress is already in use?
then it doesnt share the same app
because the app isnt shared.
Damn ok, is there a way i can make it shared?
ideally in those cases, you should host the web hook separate from the bot process within the website.
i don't really know how to help since you're using a custom codebase, and i cant really comprehend it. if you want to stick with it I recommend doing the parsing yourself, or understanding our codebase and integrating the library properly
it works with all other wrappers
well i got an issue which was internal
to node-sdk
cannot read _parse sometihng
but like
i debugged and couldn't find what happpened
can you show where you define .dblWebhook?
sec
if(this.config.webPort) this.dblWebhook = new Webhook(...);
before you ask, webPort was valid
also i console.logged it and it was an instance of it
yeah if you're getting requests from testing the webhook it being open shouldnt be the issue
you're using the test button on top.gg right?
yesa
._parse isnt used anymore
since you're running the middleware out of context this._parseRequest doesnt exist
can we just like how about move that code into the middle ware function
its private so it wouldnt changte anything
that's not something im gonna do as i plan on leaving it there and using it elsewhere in the future, you can however .bind() the function with the webhook object
bind the function .middleware() returns?
yes
{ name: 'dbl', value: this.client.dblWebhook.middleware().bind(this.client.dblWebhook) },
np, u too!
@hearty lintel Ok, i have put them on same port and the website listens to the port anyways so that is fixed so should it work now?
Wait how do i know what my webhook is?
i'd ask your friend on how to attach to their existing webserver
Ok but is the webhook url the host:port/dblwebhook right?
yea
@hearty lintel I got it to work now anyways i did not have webhook setup properly
post server and shard count
get user or bot data
@winter basin
Hello, how do i check if user voted today, Java Library
https://github.com/top-gg/node-sdk
https://topggjs.readthedocs.io/en/latest/Api.html#api-hasvoted-id-code-boolean-code
@odd carbon
oh wait you mean Java not Javascript right?
Yes
An API wrapper for https://discordbots.org/api/docs that works in Java - top-gg/java-sdk
then this
Ok thanks anyway
Umm...
It only checks if user has voted
Maybe last month
I mean that day
i don't think the api return that data but you can track that info by yourself using a db
But, i dont see any vote event
Vote event has to be done by yourself through a webhook for example
This library for webhooks i made for example could work https://github.com/Hopefuls/topggwebhooks4j
Java Webhook Library for Top.gg. Contribute to Hopefuls/topggwebhooks4j development by creating an account on GitHub.
@odd carbon see above
Vote weebhook?
Well, no need to ping
You can use webhooks to get a request to the url you entered to get the webhook event
For example if a user votes, top.gg makes a request to your webhook and you can use the Data inside that request to reward the user for example
Discord Webhook?
It does not work with Discord webhooks, you'll need to host a webhook for yourself
For example through the library i sent
I need an open port?
Yup
Can anyone explain a way to use the API to check if a user has voted for the bot and if yes then add a role for 12 hours?
There is check endpoint
Just add the role when voted, and remove after 24 hours
I got it already and vote cooldown last 12 hours 
No
How can I do that?
Sorry, wrong channel. Thought I was on support.
@lone comet the endpoint is botid/check with sending the userid as a parameter
library field is deprecated
????
The library field that bot owners used was removed but removing it from the widgets is a task of low priority
It's planned to be removed eventually after some other major changes
?
lib
so why is it there?
Library
o
Will be removed eventually
can i remove it?
like from the code
The lib part in the widget
You can't remove the lib field from the widget as it's not generated by you
So you'll have to wait
lol it would be easy to it would just be deleting some studd
oof
thay pay there workers?
someone told me they didn't
And it's a low priority task currently as there are bigger and better changes developers are focused on
For developers they definitely do
o
As for moderators and bot reviewers, there's no definite "no" or "yes"
so the lib thing is there for everyone?
It will be displayed for everyone, yes. You can't set it, however
Can someone Please help me make a event for when someone votes for my bot? its in python
I have no clue on how to do one
What do you have so far?
just this
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 = 'Im hiding this'
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='111.11.111.1:8175/dblwebhook', webhook_auth='password', webhook_port=8175)
@commands.Cog.listener()
async def on_dbl_vote(self, data):
"""An event that is called whenever someone votes for the bot on top.gg."""
print("Received an upvote:", "\n", data, sep="")
@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."""
print("Received a test upvote:", "\n", data, sep="")
def setup(bot):
bot.add_cog(TopGG(bot))```
Right
is their anything wrong?
webhook_path is still poorly documented
it's just the route that comes after the URL
oh
aka ip:port/webhook_path
webhook_path='111.11.111.1:8175/dblwebhook'
/dblwebhook
Remove anything that's not /dblwebhook
?
To further clarify on this statement, the proper URL is http://ip:port/path where path is the value that you set for webhook_path
so I have to have http://?
Are you okay
If you plan on using ip:port/dblwebhook as your URL, set webhook_path to /dblwebhook
as the link to your webserver
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='111.11.111.1:8175/dblwebhook', webhook_auth='password', webhook_port=8175)
so this..
I have to put http://?
❓
Would work, yeah
uh
give me a second
okay...
referring to this
"pain."
ahhhh
im really confsued
so...
this is right?
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=8175
ah
Grafic desing
this is correct
Fuck all of that
IM CONFUSED
so this will work?
yes
so
this goes their?
If you have it open on your hosting, yes
you already did that it seems
what does it mean by that
oh ok let me try it lol
Nothing you need to know right now
ok
im gonna try hope it works
IT WORKS!!!!!!!!
@sullen nymph
wait
your the AUTHOR
of the libary?
Yes
cool
wait
would this still work
if I had my thing running on my pc?
instead of the host
no right
You would have to forward ports and open ports in your router's settings
That aside, sure
The webhook is just a listener for HTTP requests
im not gonna mess with my router

uh noo idea
what that means
but
it works
and I still dont understand
yay
Then yeah, good idea to keep everything as it is
You're welcome
01.01 12:33:53 [Bot] {'bot': '762361400903204925', 'user': '618209006837825547', 'type': 'upvote', 'query': '', 'isWeekend': True}
soo
thats cool
Quick question. What does the API do? Does it allow me to check if someone has voted, they unlock a privelige?
Yeah, you can use it for that
k
Can i have a vote tracking system for my bot that will track a server votes ?
error error go away never come again any other day
01.01 13:16:07 [Bot] OSError: [Errno 98] error while attempting to bind on address ('ip'', 8175): address already in use
Webhook is already running on that port
um what
Only one thingy wingy can be running on one port, meaning that two webhooks can't run on the same port
Are you reloading the TopGG cog?
You'd need to use discord.py's cog_unload event and use .close on the webhook
um
How do I .close it
will it close auto if I resetart the entire bot or no
Actually, hold on
ok
@sullen nymph can I or no lol
im trying to make it send a DM to who ever voted
In the event, do something like self.dblpy.loop.run_until_complete(self.dblpy.close())
If you'll need further help with, move to #development
Does someone know how to setup the API for Discord.Py?
Does the large widget automatically update?
like if i used the html code topgg generates for me on my bots website, will the widget also update on my bots website?
How do I create an API for BDFD?
dont think bdfd allows you to create an api
oh its absolutely what he means, but not at all what he asked 🤷♂️.
awhile back i decided its better to answer the question asked rather than trying to figure out what they mean.
Guys how to Make an API call to the bot
Discord.js ??
api as always get error?
Hi, I'm having problems receiving votes. I'm not sure why cuz i think i have done everything correctly. 🤔 Here is my code: https://sourceb.in/kkT91LiZcX (its just for testing). And dbl's webhook ready event is also fired with this output:
But when i press the test button nothing happens
You need to save the webhook url on your bot page before being able to test it
by submitting it
the save button?
Idk, i saved multiple times and tried re-running the bot nothing worked
hmm ok
That's because you are rate limited
try to not request things so fast
interval 10 minutes?
may i need to increase 1 day interval
I thing is a server error but try to set it to 30mins it solved for me
How do "404" and "Internal Server Error" make you think "ratelimits"
how can i make when some one vote the bot on top gg the bot send a message with the name of voter
that is the problem
from where i can get this
when i use this command
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});```
that's the ip of your server
it just give me 0.0.0.0
You need to get the external ip of your server your bot is hosted on
if my bot hosted on glitch or ripl it?
if my bot on vps how can i get the ip @rain heart
ok thanks
I need some help with the new library webhook
works on the old one but not on the new one
both ports are open, the only difference is which port each library is using
theres no trigger on the new lib
Hi i have an error how i can fix that?
dbl.webhook.on('vote', vote => {
^
TypeError: Cannot read property 'on' of undefined
Can someone help me with webhooks?
In any channel you could've posted this, you decide to post it inside a channel dedicated to the top.gg api
Can someone please help?
discord.py, I want it to send a message when someone votes, English.
use the api
Where is that?
This is all I could find for tracking votes and it doesn't seem to have anything to do with webhooks
@commands.Cog.listener()
async def on_dbl_vote(self, data):
logger.info('Received an upvote')
print(data)
where do you want to send the message?
In a channel in the support server
Yes
In webhook url?
Yes
There must stand http://IP:Port/dblwebhook
In IP the IP Adress your machine is getting hosted on
and Port I've put the port of my hoster
How do I get the IP adress?
alr
What do I do with it?
Ok



