#topgg-api
1 messages Β· Page 133 of 1
I wanted to put the top in my bot, gg autoposter, where do I get the top.gg token of my bot?
ok! tysm
Yo um
Im getting the unauthorized error
it says that i need a token for that endpoint
here's the code im using
const webhook = new Topgg.Webhook("password");
const api = new Topgg.Api('Api token')
app.post('/dblwebhook', webhook.middleware(), (req, res) => {
console.log(req.vote.user);
let table = store.get(req.vote.user)
if (store.get(req.vote.user).votecrate) {
table.votecrate += 1;
store.set(vote.user, table);
}
else {
table.votecrate = 1;
store.set(vote.user, table);
}
});
const dbl = new DBL(confige.dbd_token, { webhook Port: 5000, webhook Auth: config.AUTH_PASS });
dbl.webhook.on('vote', (vote) => {
console.log(`<@${vote.user}> has voted me ${vote.size}` );
const webhook = new Discord.webhookClient("804368399634399280", "p7bmUUrOB5DZJpjMZg6GnoKyLlLHiENOVcU4ehfeHme83gHFdVMedhehO6c6BtGlCX2P")
webhook.send(`<@${vote.user}> has voted me ${vote.size}`);
});;
client.on('message' (message) => {
if(message.content.startsWith(prefix "myvote")) {
dbl.hasVoted(message.authot.id).then(c => {
if(c) {
message.channel.send(`Yes , You voted me on top.gg `)
} else {
message.channel.send(` You haven't voted me on top.gg `)
}
})
}
})```
what's the problem
ok

Is there another code? @rain heart
reading the docs should help you find examples for it
upppp
Nono
I did already
I just put placeholders for the password and the token
to send you the code
How do I obtain my bot api to post my bot stats in the website?
on your bot page settings under webhooks
Ahh I see it now thanks!
referring to what? posting stats?
I suggest posting stats every 15 minutes or so
or potentially 30
also, top.gg instead of discordbots.org even if both work
oh
done π
can I use webhooks to make a post to my website
or is it discord webhook bound or smth
The vote webhooks?
yeah sure, you just can't use discord webhooks
oh I don't need
If you want to only track it through your website and not your bot, that's fine
anyway of fake sending a request to test?
the test button on the webhook settings
oh didn't see my bad
it sends a request with the type value test
thanks π
I have clicked test twice now, been waiting 1-2 minutes but nothing came up
you need to save the webhook first before being able to use the test button
oh ye now it was instant
Hi, how can i post the lib of my bot
Library field is deprecated, it does show up in widgets, but will be removed when widgets are being updated
ok, thanks
Yes
Weird I am getting GET request on that endpoint now 
It should only be a post request
is it behind a cloudflare proxy?
also, accessing the webhook url through the browser makes a get request to it
I didn't do that that's why I am confused
coz I just created it xD
must be nothing, it's 405 anyways
As long as they're not authorized/dont have a valid authorization header, it's fine
Just make sure to use a secure authorization key and not share the url to you wouldn't get any malicious requests to it
ye that's what got me, coz this URL endpoint was just created...only place I pasted onto was top.gg
I was wondering if top.gg did GET too that's why I asked
aight I filtered right way to only accept POST
what data can I update besides guild count and shard count?
nothing else i guess.
oh I see
was making sure thanks
where is your webhook hosted
uh still confused :P
where's your web server that handles your webhook hosted?
idk much about webhooks
you have a webserver running listening for post requests, yes?
no :P
well there is no url then
so what do i do then
can do it without this webhook url thing?
can do what
post the server count
yes
alrighty then!
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 = '' # 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))
thats the cog i am usin
so i'll remove the ", webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000" ig
@rapid kettle lemme know if i am sayin something wrong lol
idk much python
ah alr
if you donβt want top.gg to post to your webhook, yes.
and what library do i have to pip install, it gives error : iscord.ext.commands.errors.ExtensionFailed: Extension 'cogs.topgg' raised an error: ModuleNotFoundError: No module named 'dbl' for import dbl
look....the thing is i don't understand docs very well
lmfao
pip install dblpy
install that module
alr done and works! thanks!
np
having some issue saving the webhook, is that normal? (new bot)
Screenshot what the url looks like
you can also dm it to me if you feel more comfortable with that
I mean the webhook url you've entered
free advertising lol
on the webhook url
Can you try reloading your page and re-enter
same result
the test button does nothing
the save button gives that message
google chrome
open inspect-element console and show me what errors pop up when trying to save it
yeah test button doesn't work until you saved it
Is your bot approved yet?
Is it @hollow inlet (barracuda) by any chance?
Or which bot is yours?
I own barracuda
but this is a new one
just registered it
should I just wait for some kind of approval?
You don't seem to be added as a bot owner to that bot
is that bot in a team by any chance?
let me add me lol
Though i see that it isn't in a team, just confused for a second
it did have me
it doesn't show you as a owner though https://i.imgur.com/Awe3wQL.png
Like are you 100% sure you have access to your bot? or are you doing it through a different account?
mustknow is this user
It works to display how many server is in?
ok wait let me log in with lilypad
autopost is enabled
so it should
make sure to replace dbl_token with your top.gg token found under your bot page settings -> webhooks
hi
aight
though how do you have access to that bot with your other account?
with the "your mom" account
mustknow was the name of the other account htee first time I joined top.gg's server, its my old email addresses discord, I keep my access to important things in there cause discord is on 24/7
aight anyways
try saving the webhook with this account
Because that one is mentioned as a owner
I am logged in to this account
its the discord account thats logged into chrome
the app on the desktop is logged into the other account
links auto open in the app
How can i get a token
so the app took over the join into this discord
bot page settings -> webhooks
so I just wait for verify?
I mean your bot is approved, no?
lets see
ah yeah i see it's still in queue
all good, you'll need to wait as you cant make any webhook changes until it is approved
that's cool
last time they told me they couldn't get a hold of me or something and I waited real long π€£ I'll check in in a few days
In self bot = bot, what is the variable bot??
My bot token or something else?
Hi how can i check the authorization value for webhooks? Im using sanic and python3.8.
when you get the data, top.gg's server sends you a json with the authorization value in it, just check if json['authorization'] = your_auth_key_here
does it not show up for test requests?
it might lemme check
cause this is what im getting in the json
does it need to be a real vote?
no
i tried a real vote
it returns the authorization key in the headers
Instantly generate a free, unique URL and email address to test, inspect, and automate (with a visual workflow editor and scripts) incoming HTTP requests and emails
AttributeError: 'Client' object has no attribute 'add_cog'
is that discord.py
class TopGG(commands.Cog):
"""Handles interactions with the top.gg API"""
def __init__(self, bot):
self.bot = client #discord.Client()
self.token = 'token' # set this to your DBL token
self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True) # Autopost will post your guild count every 30 minutes
async def on_guild_post():
print("Server count posted successfully")
def setup(bot):
bot.add_cog(TopGG(bot))
setup(client)
show me you defining the bot instance
have you used a cog before?
What I have to do for count the servers
No
A Cogs Example for the rewrite version of - discord.py - bot_example.py
@random harbor show me the first part of your launcher file
The what?
bot = commands.Bot(command_prefix=get_prefix, description='A Rewrite Cog Example')
that part
it might be client = commands.Bot
just show me that part
Don't have
I have only client = discord.Client()
ommitting token
i-
?
try replacing in def setup(bot): with def setup(client):
and client.add_cog(TopGG(client))
I am italian sorry for my bad english
ok
Don't print ('server. count...')
maybe I should change def _init (self, client) ??
@pliant oak
hi π
I dont find the old docs anymore so I wanted to ask how the vote-event looks like because I dont want to change my live bot to see it π
ah thanks π
Hi I have a question regarding dblpy. When I set up dbl.DBLClinet what does it expect I put into webhook_path? does it assume i put in the webhook url I put into top.gg?
does the url need to accept get requests? Im asking this since i dont know how to get on_dbl_vote to work
cc @sullen nymph I don't really know the lib well enough to answer this, can you help ^^
The library listens to POST requests on a specific route
That route is passed in webhook_path
Route being the that comes after the domain/ip:port, must start with /
No
hold on
lemme explain
So you hostname is for example localhost:4200/webhook_path
/webhook_path is what you should set it to
yes
ok thank you
No problem
No it would need you to set the url
top.gg sends the post request
to your webhook
i set it in top.gg tho right?
since I only see webhook_auth webhook_path and webhook_port as parameters
afaik it uses 0.0.0.0 so it'd be on whatevery_ip_your_host_gave_you:webhook_port/webhook_path
@sullen nymph this correct?
Aye. Enter URL and Authorization key in your bot's Webhooks section on the Edit page
@sullen nymph I would also do people a favour as a testing thing, listen on get webhook_path and make it return Hello world or something as verification its working
i'll make it an issue on the repo if you want
405 is returned
so nothing needs to be done on my server to get this to work right? I just accept post requests and I can see that I get it when I press the test button
I mean, I can technically allow GET but I don't exactly see a point in that, considering you'll just get slapped with 405 if you try to access it in browser, which still kinda shows that the webserver is running
Yea
yup, that should be the case
if it still doesnt work try accessing it on the browser
if it returns err_connection_refused make sure your firewall on the host isnt blocking the port
what do you mean try it on the browser? Is it supposed to return something? I just get a 405 Method GET not allowed since I dont have a GET method set up. Also on_dbl_vote still doesnt print anything
@app.route("/", methods =['POST'])
async def on_post(request):
return response.json({"content": request.json})
try setting the webhook path to something other than /
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path="/webhook", webhook_auth=PASSWORD, webhook_port = 8000)
@commands.Cog.listener()
async def on_dbl_vote(self, data):
print("test")
logger.info('Received an upvote')
print(data)
@app.route("/webhook", methods =['POST'])
async def on_post(request):
return response.json({"content": request.json})
I can see the POST request on my server. I can read in the json file and confirm that it is from top.gg and connecting on a web browser gives a 405. But the on_dbl_vote function still doesnt print anything. They're both hosted on a vps from the same provider. (Although on a separate vps if that matters)
If you're passing values to webhook kwargs, why would you setup the webserver yourself?
was i not supposed to do that?
is there some basic websever template I can just download and run?
I forgot if this was shiv's answer, https://stackoverflow.com/questions/48693069/running-flask-a-discord-bot-in-the-same-application
but anyway, you don't need it, the lib should handle it. What version are you on?
of dblpy or python
dbl
I'm not sure if v1 is out yet, but webhook kwargs are ignored ig, as there's another interface for that
0.4.0
@sullen nymph is this v1 or v0.4.0 
why is __version__ value different with version_info
so, that means it's not out yet
0.4 doesn't ignore the webhook kwargs right? So that means, their webserver should be running.
it is? 
oh yeah it's not documented on 0.4.0 ig
is it the same as on_dbl_vote but its called on_dbl_test
or would there be other differences
for the data returned, check here https://docs.top.gg/resources/webhooks/ as the other docs are dead
It'll be the same except the type field ig
@commands.Cog.listener()
async def on_dbl_test(self, data):
print("test1")
logger.info('Received a test upvote')
print(data)
so this should work right? cause im still not getting anything
I suppose, I'm still on 0.3, but I think there's no diff for that. Did the vote event get dispatched?
If you mean if I've ever seen the on_dbl_test event go off than no
Yeah, you said the test event didn't fire, but did the vote?
You sure the cog is loaded and the listener is one of the cog's methods?
class TopGG(commands.Cog):
"""Handles interactions with the top.gg API"""
def __init__(self, bot):
self.bot = bot
self.token = #token would go here but i took it out so i dont show it here
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path="/dbl", webhook_auth=PASSWORD)
self.claimable = []
self.weekend = False
self.update_stats.start()
@tasks.loop(minutes=30.0)
async def update_stats(self):
"""This function runs every 30 minutes to automatically update your server count"""
self.weekend = await self.dblpy.get_weekend_status()
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))
@commands.Cog.listener()
async def on_dbl_vote(self, data):
print("test")
logger.info('Received an upvote')
print(data)
@commands.Cog.listener()
async def on_dbl_test(self, data):
print("test1")
logger.info('Received a test upvote')
print(data)
yes
I got the webserver you sent in chat that works as cog working so I'll just handle votes outside of the TopGG class I have
If you don't pass the port, TCPSite (which what dbl uses) defaults the port to 8080, but your log says 8000
actually, it won't even run
You seemed to pass /webhook on the site while you set the webhook_path to /dbl.
i changed the webhook
i use a different ip and path now
its fine I've given up trying to use on_dbl_vote
Oh welp, at least you got it working
still not working but trying a different approach
I got the webserver you sent in chat that works as cog working
Didn't you say this
yeah but after i reloaded the cog it stoped working
i cant get the web server to go back up now
it worked at first
i tried restarting the vps and still nothing
@thorn sky did you try and open the webhook path in your browser, and check if it gives you unauthorised, to check if the webhook is running.
nah i just gave up since it would sometimes work and just wouldn't other times. So I went back to my original idea of just running the webhook as a separate python file and writing to a text file and read that in my bot
if only post route was set, it'll give you 405 doe
Can someone send me the api docs link i seem to always hit 404 when i try going on it i think i have the wrong link?
i tried that link but it gives 404 wich means page not found
Ok, hope it gets fixed soon
Should be done fairly quick π€
π€
Yup docs are no more again
if i replace webhook url of my bot will on vote on that link will be posted?
yeah you could
Authorization is required?
yes
Or its just a verification from where the request is coming?
maybe multiple bot can use my webhook path and Authorization key is just to verify from where that request is coming or something else?
just a verification, so malicious requests wouldn't come through
when I press the test button it makes a post request?
yes
Seems when I do make a post request manually its working but pressing the test button doing nothing
if you saved your webhook
got it.
tΓΌrk olan birisi server sayΔ±sΔ±nΔ± postlamama yardΔ±m edebilir mi
nasΔ±l yaparΔ±m
docs Γ§alΔ±ΕmΔ±yo
@restive otter if your asking about how to post guild count, may i know what programming language you are using for your bot, this will determine the way, each programming launguage have its way.
im using discord.js
how can i post server count ?
i have no knowledge with js but i guess this would be helpfull
Owoh
hi where i can get my token acount ?
ok but when i go on https://discordbots.org/api/docs#mybots
{"error":"Failed to lookup view \"docs\" in views directory \"/var/botlist/views\""}
Not that link
go to bot page settings -> webhooks
the docs are kinda broken right now
I want my bot to have the servers on how many it is on this overview I did it on my one bot but forgot because I did it a year ago. Where can I find this in the API
https://docs.top.gg/api/bot/#post-stats If I didn't misinterpret what you said
I need the server_count
You wanna get the server count? Why don't you rely on the cache?
How can I show in how many server my bot is in python, I have already tried the docs but it don't show anything
top.gg api only, maybe shift to #development
If you were asking how to show it on the site, you can use the python-sdk.
This is the snippet from the site:
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!')
})
its for the 'topgg-autoposter' module
deprecated module
move to topgg-autoposter or @waxen widget-gg/sdk depending on usage
hey,how can i get a bot desc to a json?
json?
string to json? just parse it
you can get bot's description in bot info endpoint
What is the node package for getting upvote userids?
@top-gg/sdk
UTC
import dbl
import discord
from discord.ext import commands
import asyncio
import logging
class TopGG(commands.Cog):
"""Handles interactions with the top.gg API"""
def __init__(self, client):
self.client = client
self.token = '' # set this to your DBL token
self.dblpy = dbl.DBLClient(self.client, self.token, autopost=True) # Autopost will post your guild count every 30 minutes
async def on_guild_post():
print("Server count posted successfully")
@commands.Cog.listener()
async def on_dbl_vote(self, data):
logger.info('Received an upvote')
print("Recieved a vote!")
print(f"It was {user}")
print(data)
def setup(client):
client.add_cog(TopGG(client))
the vote check isn't working for me
can anyone here help? :P
you need to specify the port and stuff
port of?
port for the webserver to run on, that should match with what you pass on the site
uh oh
You can just pass the port alone, the path will default to /dblwebhook and the auth will default to an empty string.
You need to ask for help
Yo can anyone help me set up auto rewards with my bot if people vote for my server? I don't want it to be roles I want my bot to give users a !claim command once they have voted.
ty
Yo can anyone help me set up auto rewards with my bot if people vote for my server? I don't want it to be roles I want my bot to give users a !claim command once they have voted. I'll pay some 10$ to help me quick I know it can't be that hard.
How do
What to do
Would anyone like to help me with giving my users voting rewards that arenβt roles in my server?
I am using python lib and trying to know what is the dict keys of on_dbl_vote event
Note: https://top.gg/api/docs#webhooks this line ain't working
it's possible to know when a user vote for your bot without the webhook ?
but i have to connect with webhook ?
like that : self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000
?
not at all
it's the doc
You use the same extension like me for the emotes xD
i repost my question because it was hiden
π€
the discord.py server ?
That's python 
The python server is too active, i'm ignored xD
We can suppose that is possible if this message exists
i asked in the discord.py channel
I've made a self-bot that I can chat and read messages through. Super fun stuff
All by myself too
Yeah but nothing "bad" like Discord would say
They allow clients like such anyway
If Discord really cared about me, they'd know. They're api says it all
how ? The available channel do not allow to write π€
It's in the discord.py
i'm just stupid xD
@manic dune where's the TOS specifically for bots? I want to see it. It's been a while since I've looked at it
Finally, we ask that you respect Discord itself:
- You may not sell your account or your server. - __**You may not use self-bots or user-bots to access Discord.**__ - You may not share content that violates anyone's intellectual property or other rights. - You may not spam Discord, especially our Customer Support and Trust & Safety teams. Making false and malicious reports, sending multiple reports about the same issue, or asking a group of users to all report the same content may lead to action being taken on your account.If you see any activity that violates these guidelines, you can report it to us by filling out this form.
Off-topic
tru
Oh fuck
Read the Webhooks section on docs.top.gg
yeah i did thanks
nice
apparently i've been exceeding my rate limits too frequently (429), what's going on?
okay that on_dbl_vote in python lib doesn't get invoked for some reason
any idea what could be the reason ?
@commands.Cog.listener()
async def on_dbl_vote(self, data):
user_id = data['user']```
this is a part of my event
Ok ok
am i getting it wrong or what ? isn't it called when the bot gets an upvote ?
So I'm confused: why would Discord even allow the connection of self-bots if they don't like their existence at all?
I have the exact same question as well
I was just gonna ask
@bot.event
async def on_dbl_vote(data):
print(data)
Why my bot is not responding when I vote for it?????
My also same question
Anyone here???????
@bot.event
async def on_dbl_vote(data):
print(data)β
Why my bot is not responding when I vote for it?????
did you fill the url on the website?
Means
the website needs a url and auth to know where to send the votes to
your bot/servers edit page, webhooks, URL and auth sections
Ooo
@cedar arch why did you ping me here earlier?
I don't pinged
you need to make a webhook receiver with code(or using one of our libraries) https://docs.top.gg/
the url will be something like
http://ip:port/path
ip, port and path need to be filled in
if using repl or heroku or something non standard you will need to use their URLs and ports.
if using a home server you will need to port forward
It's possible to use a Flask webhook for receiving, right?
how do i use the Api?
@left egret this guy ghostpinging this guy in every channel (this is second time)
deleted lol
let me check
how do u get your dbl token
from your bot page settings -> webhooks
thanks
also what should the webhook url be
i want to make a reward mechanism for voting
so i need to use dblpy
and im just very confused
Hey can some one guide me how to use api
Heyo our documentation is a great place to start, https://docs.top.gg
What issues are you having?
Probably best if you ask here as I am not the most experienced with the api
Ok
what language do you use?
are you looking to post server count?
@pallid forge I am trying the webhook method and when I try the test button it shows nothing
oh webhook
Iβve never personally used the webhooks so I canβt sorry
i can help you.
Thx
What should I do
so you have a bot and hosted?
Yep
may i know what is it, a vps, heroku, repl.it
so first you should know your ip and port,
Ip??
I got it
yes it can work
Same
just get the repl url like this https://PROJECT_NAME.YOUR_REPL_NAME.repl.co @restive otter
and
put
so you both want to post guild only right?
or voting function as well?
Where
i want to get voting function
but its like a redeem sort of thing
so you have dblpy installed?
yes
No
dbl
its the same
Ohh ok
so there is an example in the docs for voting function and guild count
Yes
Yeah
but i dont know how to get any of it to work
But can't understand
like i have the function, but how do you call it
get that code and put it in cogs folder or what ever you named it if you have cogs
I don't
when i try asyncio.run it decides that self isnt declared
there is no asyncio.run in any example i guess
Yeah
just a second
on message prefix+"redeem":
check vote
or alternativley just on user vote is just as workable but i dont know how to test that
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=5000)
@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))
after putting this in your botβs cog folder
restart your bot so it can load and host the webhook
after that go to your botβs edit page and go to webhooks tap, put your webhook as https://PROJECT_NAME.YOUR_REPL_NAME.repl.co/dblwebhook < FOR REPL
after that put the authorization the field under webhook url as your secret the password in the code and the password in the top.gg page should match!.
test the webhook and see if it works.
@carmine drum
@restive otter
Ok
what is the "cog folder"
thx
I am using AWS for hosting
what ip and port should i use ?
your aws ip
what about the port ?
it is your choice
Is it the same for heroku?
yes code probably works on heroku too but..
But the url
after that go to your botβs edit page and go to webhooks tap, put your webhook as https://project_name.your_repl_name.repl.co/dblwebhook < FOR REPL
this part is only for repl
Yea..
you just need to find your heroku app url
Maybe I can use a heroku webhook
Tried there is no
on repl you run your webhook in port 8080, I think same applies to Heroku
you might want to check here https://devcenter.heroku.com/articles/app-webhooks
https://<application name>.herokuapp.com/ isn't this domain working for webhooks?
the path is triggering it
sh-4.2$ ip
Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }
ip [ -force ] -batch filename
where OBJECT := { link | address | addrlabel | route | rule | neigh | ntable |
tunnel | tuntap | maddress | mroute | mrule | monitor | xfrm |
netns | l2tp | fou | macsec | tcp_metrics | token | netconf | ila |
vrf | sr }
OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |
-h[uman-readable] | -iec |
-f[amily] { inet | inet6 | ipx | dnet | mpls | bridge | link } |
-4 | -6 | -I | -D | -B | -0 |
-l[oops] { maximum-addr-flush-attempts } | -br[ief] |
-o[neline] | -t[imestamp] | -ts[hort] | -b[atch] [filename] |
-rc[vbuf] [size] | -n[etns] name | -a[ll] | -c[olor]}```
So ... ?
so your domain should be like https://<application name>.herokuapp.com/dblwebhook
yea it is like that
which ip should i use ? address ?
what
there is what showed when i typed ip command
thanks
http://webhooks.votetracker.xyz/bot-topgg
but I can use this too?
its the votetracker bot webhook
it also gave me the auth
yes
are you serious
about ?
127.0.0.1 is localhost
curl ifconfig.co
same iirc
bot.on('message', async (message)=>{
app.post("/dblwebhook", webhook.middleware(), (req, res) => {
// req.vote wil lbe your vote object, e.g
wc.send(req.vote.user); // 395526710101278721 < user who voted
wc.send(test)
});
app.listen(0);
bot.add_cog(TopGG(bot))```
do I have too call this function?
on what i need to put the app.listen?
port number
google it
nvm,
lol
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='https://python-bot-69.herokuapp/dblwebhook', webhook_auth=auth, webhook_port=5000)
did I put the webhook_path right?
i mean
should it just be /dblwebhook
?
ok
@willow spindle i got my port number, so i just put it there?
it have dots in it, its giving me problems because of it
dots?
it have . and :
what do i place in, for the webhook url i have the one from the selected channel to post votes
ah ty7
-7
i did netstat -a, in CMD and it showed me 100 numbers
and to put it there? in the app.listen?
def __init__(self, bot):
self.bot = bot
self.token = "my_token"
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='https://my_hosting_ip:8080/dblwebhook', webhook_auth='nice', webhook_port=8080)```
Still now working... the path is the exact same as the link in the site
lol how ?
shit the meme in not working
bruh
i am using hosting
i can't go through web
same
if not.. how can i get my port forwarded ?
heroku webhook dont work with this
for this part i do the end of the webhook for the channel ?
const webhook = new Topgg.Webhook("your webhook auth");
I am not working on my router.. it's AWS
wait im stupid the webhook auth is the bot token for top?
set webhook_path to /dblwebhook
You know what
I'll just start raising errors if webhook_path doesn't start with /
you can't anymore
the library field is going to be removed eventually
Well it is, just can't use it anymore
ty
@shut flume is there away that i can do that the bot will send a message when someone voted with out doing that port thing?
i cannot see that :^)
https://github.com/LetsChill/Top.gg-python-webhook-tutorial-
would this be fine?
A Unofficial tutorial on how to make a working webhook on top.gg or any other bot listing services. - LetsChill/Top.gg-python-webhook-tutorial-
const webhook = new Topgg.Webhook("your webhook auth");
translated to python?
nevermind I give up
I should probably start using repl
I cant do that
nah
because they are free
yea but I lose money then
priorities
what's the point of paying money when it doesn't get you some benefits
with a discord bot.. hmm it's not worth it
maybe with some other stuff
Yea
Traceback (most recent call last):
File "/home/ssm-user/.local/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 275, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
File "aiohttp/_http_parser.pyx", line 523, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: invalid HTTP method```
This is my `on_dbl_test` output.. any idea what it does mean ?
at least you'll get less ping 
@commands.Cog.listener()
async def on_dbl_test(self, data):
print(data)```
just this
My mind has blown.. really
Yeah I did
is there somehing wrong with the code ?
yeah i suppose
yup
does the webhook_port need to be given?
because I would use this webhook http://webhooks.votetracker.xyz/bot-topgg
yea
ill just put 5000
idk
its not my webhook
its from the bot
vote tracker
and I will also put the webhook_path to ''
because its already in the url
the bot said it should be like this
and it worked for it
well nothing happened
what should i do about this ?
is it a problem from my port or what
it's not printing what i coded
either when on_dbl_vote or on_dbl_test are called
How are you sending them
like this
But I asked how you send the requests to your webhook
what's your aiohttp version
3.6.3
dbl
wtf
what ,_,
should i update it ? it seems like there is a newer version
hey i am trying to make on_dbl_vote so someone can help me
Can you give me your bot's ID
yeah it's 747965125599821914
Okay, didn't get what I needed. Can you DM me the URL and Authorization key you entered on top.gg?
sure gimme a second

sorry this is a while ago but what do i set my webhook url to if im using heroku
Hey is there any method with using cogs to get the new votes
wym by "get the new votes"
there is get_user_vote
which tells you if a user has voted or not
He probably meant the webhook, but outside of a cog.
for heroku i donβt really know
but
you can try and put your application url + /dblwebhook
yes
cool thx
also with all the "self" stuf it all goes wrong
it messes up my parameters in my discord.py commands
should i not have it in those
just the cog stuff
?
can you show me the code you used?
because thats an on_message error not a webhook
how do you make it so that when a user votes, it posts a message
whoopsie
regenerate it
yup
i have one, but idk what it doses a;one
i have the webhook, but it doesnt post a mesage
when someone votes
is there any errors?
me
yes
no
um python?
no
then sorry i canβt help, i can help with python or discord.py
go to your botβs edit page >webhook tap, you will find it there
2021-02-09T15:31:02.766231+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/dblwebhook" host=hamoodcount.herokuapp.com request_id=0704f27b-ae4a-49d6-94de-776c7f124547 fwd="165.22.130.154" dyno= connect= service= status=503 bytes= protocol=https
This is what happens when i test webhook
but when i set the procfile to web
it says
Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
what do i do
hm i never tested dbl webhook on heroku..
i see, are you sure you are loading the cog extension?
but then it does the Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
thing
are you using the PORT enviroment variable?
heroku gives you an env variable called PORT
that's the port you should be using in your app
um no
process.env.PORT for js
python?
ok so do i put 'PORT' or just any old port
'PORT'
Hello nub
Nub
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)
# 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)
def setup(bot):
global logger
logger = logging.getLogger('bot')
bot.add_cog(TopGG(bot))
oh wait
WHY DID I COPY
Lol
I WAS MEANT TO GET FROM MY BOT
Is malware here
import dbl
from discord.ext import commands ,tasks
import discord
import asyncio
import logging
class TopGG(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.token = '{confidential so removed}' # set this to your DBL token
self.dblpy = dbl.DBLClient(self.bot, self.token)
@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))
def setup(bot):
global logger
logger = logging.getLogger('bot')
bot.add_cog(TopGG(bot))
i have the cog loaded
it still doesnt
show server numbers
i never could solve this either
i ended up using the webhook example for it to work
mhm?
You never started the loop
yes the loop should be called
so in main file i do update_stats()
call that loop from on_ready event
???
ok 
self.update_stats.start() could be in your __init__
no, calling it directly will only invoke the coroutine once
in main file i wont need selfright?
in your main file, the update_stats is not even defined 
yea
cog is loaded 
I mean you can get the cog and start the update_stats method, but just call it directly in the cog init
try:
client.load_extension("cogs.e")
client.load_extension('cogs.modxd')
client.load_extension('cogs.tickets')
client.load_extension("cogs.purge")
client.load_extension("cogs.tags")
client.load_extension('jishaku')
client.load_extension("cogs.utils")
except Exception:
print("extensions cant be loaded the error")
print(Exception)
# Rest of the code
@client.event
async def on_ready():
activity = discord.Game(name=f">help in {len(client.guilds)} guilds")
print("Bot has logged in")
await client.change_presence(status=discord.Status.do_not_disturb, activity=activity)
update_stats.start()
That's not how python works
i am doing this
cogs.e is the file the api code is in
it doesnβt work because nothing is calling the task loop
:eeeeee:
not gonna repeat what I've said kek
alr e
also, you might want to cancel the loop on cog unload, otherwise the loop is gonna stack
also you don't print your exceptions properly
Hello i need help
-ask2ask
Don't ask to ask.
Just ask your question, it wastes time if you say "i need help" or "can someone help me?" instead of just saying what the problem is. Save your time and other people's time and just ask the question.
Please read https://dontasktoask.com/ for an explanation on why this is an issue.
How do i add my bot to Webnook i am on a Amazon fire tablet making my bot
-ask2ask
Luca hates you 
how does that answer the question
I think the apiden is causing this problem. Can someone help me?
You need to make a post request
but how
Try taking a look at the docs first https://docs.top.gg/api/bot/#post-stats
I have all the env stuff but its still returning Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
where can i regen my token i don't see it
bot page settings -> webhooks
id just like to clarify, .hasVoted is if the user has voted in the past 12hrs right?
yes
awesome thats what i thought thank you
omg use a for loop
try:
cogs = ['e', 'modxd', 'tickets', 'purge', 'tags', 'jishaku', 'utils']
for cog in cogs:
client.load_extension('cogs.' + cog)
except Exception:
print("extensions cant be loaded the error")
print(Exception)
# Rest of the code
something like that
/bots/:bot_id/check also has stricter rate limits right?
yes, 60 per minute
okay, thanks
THAT EXCEPTION PRINTING WILL NOT WORK PROPERLYYYYYY
except SomeException as e: AND THEN USE e
print(traceback.format_exc()) exdee
You can't get the channel before the bot is ready because the cache is empty
Thats true too
isn't this supposed to be in #development ?
Idk
oh ok thanks
You are Welcome π If you Need any more Help, Tell me
