#topgg-api
1 messages · Page 99 of 1
Ok
why am i getting this when everything should be working
my procfile is exactly named: Procfile
no...
UFF
i wish we could link directly to the webhook section of jslib
you should still read the docs before coming here
the docs should be your main source of info
-api
THIS CHANNEL IS ONLY FOR SUGGESTIONS/HELP/BUGS TO DO WITH OFFICIAL TOP.GG API LIBRARIES AND API DOCS FOUND AT
https://top.gg/api/docs
hello, what are the dblapi.js constructor options
wdym?
for webhooks or autoPosting
lang?
hello, what are the dblapi.js constructor options
@opal carbon
literally said it .js
cheers
aye thats fine
Yea.
all i have to do is do the constructor and then bam?
If you provide ("token", client) yes
if you want voting webhook setup you'd have to use webhook stuff
Oh right, thanks
what timezone defines a weekend vote
UTC
is that like +0 or something in GMT
^
so i can say this right
votes are considered a weekend vote if the day is Saturday or sunday, based off UTC (GMT+00:00)
yes
Friday is considered weekend
Friday, my favorite weekend day
hiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
1 i is enough smh
const DBL = require('dblapi.js');
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
``` what things do i need to fill in here?
whats the password?
The auth is whatever you define
It doesnt matter what it is, as long as its secure
Its the password your webhook will check against before allowing it through.
Hi
@vapid cape I have fixed the typo issue, The port is all okay. Everything is perfect right now, But upon testing / voting, Still, nothing is happening however the server count is working.
Any update on it?
i get errors
@hasty mortar it says something’s already using that P O R T
Your bots on glitch?
@jaunty plank looks like heroku
yep, its defo heroku
eloel
Does my bot have to be in this server if I want to use the API?
it'll need to be approved
Oh ok
@restive otter
Hey, I've recently updated my Schema for mongoose.
How can I update all existing files in the database.
is the api having problems right now?
0|projectbump | 'x-content-type-options': 'nosniff', 0|projectbump | server: 'cloudflare', 0|projectbump | 'cf-ray': '5bf307b3dd3e0621-FRA' 0|projectbump | }, 0|projectbump | ok: false, 0|projectbump | statusText: 'Origin Connection Time-out'
there are currently issues with the website, so it is very likely to be a result of that
web admins have been notified, just have to wait for now
I'm kind of confused because bots like dank memer are on top.gg but it isn't in this server and I thought it had to br
Be*
-api
THIS CHANNEL IS ONLY FOR SUGGESTIONS/HELP/BUGS TO DO WITH OFFICIAL TOP.GG API LIBRARIES AND API DOCS FOUND AT
https://top.gg/api/docs
Oh sorry
Also for the 'Detailed description of your bot' part, do I just write about what my bot will be doing?
In the application form for the API key
this is more of a #support question
you can write about your commands, and what your bot does.
mentioning nsfw commands isnt allowed
Oh wow
Was told to move here 👀
https://discordapp.com/channels/264445053596991498/714045415707770900/741401089286602804
Do you not receive the votes at all or do you receive after a long delay
I do receive the votes, it just never sends the webhook request with the upvote data
When upvoted (https://i.callumdev.pw/0ae0t.png ), the vote count goes up, but the webhook data is not sent.
When webhook test (https://i.callumdev.pw/xjknq.png ) is pressed, it sends the webhook data just fine, as shown here (https://i.callumdev.pw/7ocwq.png )
const DBL = require('dblapi.js');
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});```
what is webhookport and webhookauth
ok
It's all explained here -> https://top.gg/api/docs#jslib
@frail meteor has it always been like this or just recently
I have only just set this up
The site might be having some issues, could you try it again in +/- 30 minutes?
Sure, if I can find someone who will upvote xd
DM me the bot link in 30 minutes
Aight
dm me the link and ill upvote
@frail meteor
@soft linden just ask your question here
Ok so I'm really confused on how to set the webhooks up. I'm just trying to get it to send a message to a discord channel when someone votes
nah, that is the ip and port of your bot's server
wdym by bot's server
the machine/computer that hosts your bot
oh ok
you cannot set the webhook url to a discord webhook for a channel btw
and then you just need to handle requests on that server
yep
indeed
Spice up your Discord experience with our diverse range of Discord bots
you may wanna check the docs too, if you haven't already
it has some guides on how to do it and what you should expect in the webhook message you receive
alright thx
wait so @trail sigil how do you do it with justs discords webhooks
you don't
Are you using JavaScript/NodeJS
yep
I use this to handle my votes for @last siren https://github.com/Deivu/Haruna
A girly and lovable shipgirl that handles your vote webhook in Top.gg (Discord Bot List) - Deivu/Haruna
oh ok
Standalone webserver to handle votes
someone have good meme API?
-api
TOP.GG API ONLY!!!
ANY OFF-TOPIC CONVERSATION WILL BE DELETED AND MUTED
This channel is only for SUGGESTIONS/HELP/BUGS to do with OFFICIAL API LIBRARIES and API DOCS found at: https://top.gg/api/docs
@dense basalt what is the port meant to be
You want to hide that as well
Just yeet it behind cloudflare
ok
i do
but still;
whats the problem
Uncaught Promise Rejection FetchError: request to https://ip:5607/voteInfo?user_id=510810429828890624 failed, reason: connect ECONNREFUSED ip:5607
@dense basalt
nothing
Also let's move this to #development
ok
hey hey! i'm trying to implement api stuffs to my bot but, as it turns out, I can't get dblpy through pip for whatever reason.
do I have to get it from source or something?
Are you spelling it completely right
@lament blaze you sure that's pip for python 3.5.3+?

For whatever reason my Ubuntu install tends to default to Python 2.7 :/
linux package managers rely on their own repositories, which are updated only for major releases
That's PyCharm from what I can tell
apply the listener decorator to on_guild_post and rename commands(bot) to comandos(bot)
-api
TOP.GG API ONLY!!!
ANY OFF-TOPIC CONVERSATION WILL BE DELETED AND MUTED
This channel is only for SUGGESTIONS/HELP/BUGS to do with OFFICIAL API LIBRARIES and API DOCS found at: https://top.gg/api/docs
yes
_play Ese tu novio now huh? BB Nobre
-botcommands @candid ferry
@candid ferry
Hey! Bots aren't given permissions to send responses in this channel. Please use #commands or #265156322012561408 to run commands. In addition, bots with commonly used prefixes cannot read or send messages in any channel. This is done to prevent spam and bot abuse.
I tried to add the server count but now my bot is broken
what is happening?
I already made backup but still not working
Post full traceback
Update your discord.py
even the code that is hosted stop working
stopped*
worked ty
thank you @sullen nymph worked the server count
Ey nice
I started program this year helped a lot

You'd have to be more specific
How do I get any API
@final rune by making a get request
ok kid we get it
@signal hawk We have a child here
Who needs to be punished
<@&304313580025544704>



-atmods @restive otter
@restive otter
Please do not mention (ping) more than one or two moderators for help, unless there is an emergency.
Here are some examples of emergencies:
- Raids / Multiple members mass spamming.
- Severe disruption of Discord's ToS (NSFW content, etc)
- Anything that requires more than 2 moderators to handle.

tfw
A
https://top.gg/api/docs?__cf_chl_jschl_tk__=9800aa264629af2dba751d5c4ec09fa81b0b72b1-1596868671-0-AbiPOhw0-x-FclFnUm9qnA-3GFN4r5woi1NvNRBCPgg2ICET1pS9QQDpHu3sP8kv_oXsWCyGa3yO5bFXVBdL2si9iJlw87aVvdPp20MU8tXUrort7oIcPogMJ2PteRMx6NBE7DxPnH7ymAKTPV6xp2GVrEt0M122Ngh3KcVrm7xBGaZxTfeNHly-TL3vHzGf5jDVT3saiNXxB_-z8iAb943IIzqjRog8Ed0xoEWjyQe4o0-a02IC75QXIoXv2ONwa8AjuWRkU4yNA3t4XI0V-2N0Q3eFuFRKj3S5qNavUNCD#pylib so this example for automatic server counter is inside a cog, does that mean it will only work on a cog or its just an example and can be converted to normal
Spice up your Discord experience with our diverse range of Discord bots
How to make a voting system like this
your bot needs to be approved
Spice up your Discord experience with our diverse range of Discord bots
You have to record the number yourself. Use one of the dbl libraries and when a vote is received, you can save it somewhere so that the user can get a reward
Hello guys
You have to record the number yourself. Use one of the dbl libraries and when a vote is received, you can save it somewhere so that the user can get a reward
@ember terrace
They already get a reward ;-;
?
you'll need to count the votes like that nonetheless
?
@ember terrace
I am saying I already have a reward for them if they vote
so i just updated to discord.js v12 and all of a sudden i'm not receiving votes
no errors or anything
just nothing
the website is down iirc.
its been going up and down the past like 12 to 24 hours
got it, thanks
Which api can be used to make Pokécord
pokecord you will have to make yourself
May I ask you to read the channel topic
Sorry for asking
how make pokeman with api
https://i.callumdev.pw/uddh5.png
https://i.callumdev.pw/bozdh.png
https://i.callumdev.pw/t8rcz.png
dk why this returns false, as I have voted!
corona sy
-api
TOP.GG API ONLY!!!
ANY OFF-TOPIC CONVERSATION WILL BE DELETED AND MUTED
This channel is only for SUGGESTIONS/HELP/BUGS to do with OFFICIAL API LIBRARIES and API DOCS found at: https://top.gg/api/docs
how can i make the webhooks with votes
are you using one of the libraries?
.
Start by setting up your webhook URL in the edit form of your bot on this site, it can be found at https://top.gg/bot/:ID/edit once you have entered the URL you want the webhook to be sent to, you're all set! If you need help setting up webhooks inside of your bot don't be afraid to ask in our discord server in our #topgg-api channel.
How to make it?
you can’t yet
merci!
how should i do a bot with a automated request/buy system?
ok sry
🤐 Muted kyloRen#7491 (@deep pivot)
Thanks
Thanks eri
Hey! I'm using this code and my servercount is not being posted. I am not getting any error either. Any idea on how to fix the code?:
const dblToken = 'botToken';
const DBL = require('dblapi.js');
const dbl2 = new DBL(dblToken, client);
// Optional events
dbl2.on('posted', () => {
console.log('Server count posted!');
})
dbl2.on('error', e => {
console.log(`Oops! ${e}`);
})```
client is the client you log in with correct?
Yes
is the webhookAuth this? http://king-api.xyz/i/jmr1b0aj.png
yes
kk ty
the api is not working
suddenly it stopped
working
i dind't changed anything
wtf
Same it broke for me too
yeh
Gotta wait i guess
I'm quite sure it's already aware
Ya, we know. Telling admins
Me and Zoro have already reported
Don't steal my credit
¯\_(ツ)_/¯
is it just me or dbl’s vote webhooks are not working?
i never changed anything to my code and it just suddenly broke
Bro
It has been reported
And the third message above you literally said we are aware
oh ok thx i was just too lazy to scroll up just now lol
Hello I sent you 25 days to get me on the website but until now I have no answer for me do I have a problem please someone help me why didn't I get it until now I'm waiting for you.
This is the wrong channel for that, but approval takes up to 4 weeks but it can also take longer so please stay patient ^^
Thanks I’m I watting..
Anyone else not getting webhook data? Mine worked yesterday but today it doesn't send anything, not even the test. My IP is the same, and port still open
@short edge ehm, I was just looking myself
my api settings got rolled back to what they were like 2 weeks ago
so go check your settings, as I too am no longer getting data, imma put it back to what it should be now and check if that works 
@dense basalt is top.gg aware of that or any idea as to why?
Oh ok!
@dense basalt I mean my webhook got changed 
What do you mean changed?
i had 2999/topgg as I now handle it myself, but when looking at the settings it shows :2998/dblwebhook like im still using the dbl package, which im not
yeah no im just misremembering I guess, 
it is still correct, I just assumed it wasn't given it looks weird and no webhooks are being sent out
anyway don't mind me, im a retard, time to change this to be /topgg in my code
Yeah we're having issue with votes not going through
thank god i checked here before tearing my bot apart trying to fix it
Lmao
I get this error often.
The code to post server count, one of the examples from top.gg/api !
Ping me if anyone helps.
I'm getting response code 503 when posting to https://top.gg/bots/712738481285103676/stats
thats a server error -- Unavailable server error response code indicates that the server is not ready to handle the request
So it is not my fault? Is API down?
In my response body I can read Checking your browser before accessing from cludflare
So I'm probably getting some kind of captcha, but not sure how to bypass that
your url is wrong
What do I have to put here?
ok thx
was working fine for a month
now i am not getting any post request anymore
was the api updated
the webhooks dont work crrently
so what should i do? is it under maintainance?
the admins know
unplanned maintenance, you could say
@commands.Cog.listener()
async def on_dbl_vote(self, data):
ch = self.bot.get_channel(725860667772502016)
await ch.send(data)
``` I don't get why this is not sending anything
# The decorator below will work only on discord.py 1.1.0+ this?
Fuck
No, I meant the on_dbl_test event with Test button on your bot's Edit page
as for "scroll up", I meant this channel
obh sorry, lemme check
sorry, I don't get what does it mean by "webhook" if it's not the discord one
a webserver
A webhook is reverse API. You listen to requests instead of sending them
so it's just a simple GET request?
Post
mhh
so if I don't have a webserver I can't check upvotes?
I could make a loop for all users anche check if they voted
i noticed that some bot support servers have a channel when it says that the bot was voted. is that relevant to this site? only cos i know top.gg has a vote system
The top.gg api has a ratelimit of 60 requests a minute. Looping through all users in cache will very likly result in a ratelimit
mhh right
I tried doing a simple server using flask:
@app.route('/webhook', methods = ["GET", "POST"])
def webhook():
if request.method == "POST":
data = {"content": "New post request"}
print(request.form)
requests.post(url, data = json.dumps(data), headers={"Content-Type": "application/json"}) # this is a discord webhook
else:
return "nothing to see here"
``` but it still not working
why are you sending a request
it's a discord webhook
url is a discord webhook url
btw if I do a normal post request it works
not that
@jaunty plank when top.gg makes a post request to my server, my server will send a discord webhook
Ah, forwarding webhooks, fun
hmm
Anyone know if the api is back?
I'm running the dblapi.js on a different repository than the bot. Do I need to install anything other than that dependency, or do I need some server handler like express and set up endpoints for the webhook?
nah just a webhook and a bot client afaik
@rapid kettle This is how the webhook looks like right now, it's basically the same as the examples except the database call on line 15. The Discord dependency is not included because it's not used in the api examples. I deployed this to heroku, but the test-button doesn't give me any response in the logs. Is there an obvious mistake I'm doing?
Ok, thank you
Just got voting confirmations for users who voted 6 hours ago 😂
Hey, I'm having some trouble with vote webhooks. It's not logging anything when I vote or use the test button, but works just fine when I send it in postman.
app.post('/vote', async (req, res) => {
res.header('Access-Control-Allow-Origin', '*'); // allow cross-domain requests
res.header('Access-Control-Allow-Headers', 'X-Requested-With'); // allow cross-domain requests
const auth = req.get('Authorization'); // get auth header
console.log(auth); // for debug
if (!auth || auth !== keys.dblWebhook) return res.status(401).send(); // check auth headre matches
const {user} = req.body; // user id
new Vote({
user,
time: new Date()
}).save(); //log in db
res.status(200).send();
});
any help?
again, works just fine when I send it in postman to the same url with the same auth header.
scroll up
@spiral steeple to what?
ah, it's offline?
can someone pin that message to help future people asking?
and is there any eta?
Yeah lmao I didnt even know I had a pin in this channel
<@&412346069675147264> Hey, the DiscordBotList org has been renamed to top-gg. You should update your git configs and any links to the repos 🙂
will do in a bit
@sullen nymph How you gonna label the import 🤣 topggpy
pip install top.gg gang
does that mean everyone needs to update their library installs?
probably not
Functionality doesn't change so
if tonkku is gonna force them to change it then might aswell redo the lib to make it more oop ey shiv 👀
I haven't changed shit because no one has really complained
i mean theres no point really
not until v2 comes out
that would be the time to change it
dont change it
Hi, I closed dm from all servers because I am busy and after my bot is approved, I do not get notification from Luca bot that my bot has been approved
The problem is I don't get the DBL api or the token 🙂
Spice up your Discord experience with our diverse range of Discord bots
thank you
yeah
im not sure if the api is completely working yet.
this is my webhook
the api has been having pretty significant issues all day
Hello
hey
What time My bot verified
3+ weeks from submission
3 week?
mine is 4+
const Discord = require("discord.js");
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL('Your top.gg token', client);
// Optional events
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})
``` how often does this update? this example is on the api page for dbl
npm install top.gg --thebest
activeServers = bot.guilds
print(activeServers)
summ=0
for s in activeServers:
summ += len(s.members)
print(summ)
whats wrong here? the output is
0
i did const guild = server
um do we have to put something in our code to show something in site?
because i m new to this
if you have the top.gg API library (for node.js or python)
then it's auto, just check the docs to set it up
if not you will have to deal with API requests yourself
@whole night your bot is not instantly conneted to the Discord gateway
put that in your on_ready function
uhhh api requests i m not advanced but i'll try once its approved
@whole night your bot is not instantly conneted to the Discord gateway
@remote slate
Yeah it's done
@whole night that works now?
Is default webhookPath in dblapi.js planned to be changed to something like /topgg in the future?
This server name is still Discord Bot List, I guess it will remain /dblwebhook
it would break so many bots to change it btw
Yea, its practically the standard for now.
no plan rn
got it
also im thinking dblapi.js will stay specific to bots with the integrations
with a different module for generic top.gg or new modules for specific integrations
I see where you're getting at
Hey <@&412346069675147264>, another small change while we are reworking the way we work with GitHub internally. To help smoothen out permissions and billing on our side, you'll be converted to an outside collaborator with the same permissions you have right now on your repositories.
when creating a webhook to dbl what's the password for webhookAuth supposed to be
Whatever you set under edit on your bot on topgg
what do you mean
actually nvm
thanks
but what does it mean webhook url?
like do i have to create one?
Yes
ok thanks
My port keeps changing everytime
So
Can i just do ip/dblwebhook
Or do i still need to put the port
There must always be a port
frik
but
when someone visits my bot ip there is no port needed
so
I use expressjs
Do you have a webserver set up to listen on that port and redirect ports 80/443 to it?
Umm
Maybe
This is my site:
over 30 character long URL that looks really weird
I run my bot and my smol bot website in the same file
Do you have a webserver set up to listen on that port and redirect ports 80/443 to it?
@spiral steeple it works for 80 but not for 443
lmfao
i accidentally used http instead of https that's why
well if it's not https, it wouldnt
Isn't 80 http and 443 https
doesnt need to use https
lemme try
https
Works
443 port:
||https://codeco-discord-bot.code913.repl.co:443||
-api
TOP.GG API ONLY!!!
ANY OFF-TOPIC CONVERSATION WILL BE DELETED AND MUTED
This channel is only for SUGGESTIONS/HELP/BUGS to do with OFFICIAL API LIBRARIES and API DOCS found at: https://top.gg/api/docs
How can i get usersize api
@restive otter What do you mean?
i mean
i want to share total user count on my website
and server count
@remote slate
website
i know
If it's for your own website: let's continue in #development
If I have nginx set up, do I need to proxy pass anything for webhooks?
Yes, you have to add the Connection, Upgrade headers
and probably the http proxy pass version
you should search on the internet
Pls use wi
i tried using the bot widget and it worked fine until today
anyone?
Hello ppl
#312614469819826177 maybe
it is outdated
@sullen nymph shiv there is ads
ffs I'm restarting my client
the ads
imagine ads in a channel no one looks at
Keep this channel on topic yo
Does the votes ever reset?
at the beginning of every month
Yes, once at the start of each month
Ok, thanks!
How i setup a vote webhook?
Do you have an approved bot?
No, but i want to know it
The docs on https://top.gg/api/docs explain it well
-help
@hollow crane, #rules-and-info have all the @abstract moth 's commands.
???
Why does top.gg keep breaking, it keeps saying i only have 2 Serves with my bot, even though thats incorrect
but if i stop the stop for 1 min
restart it, the website says the correct count
And once again
it has again gone back to 2
@teal bay make a setInterval function to update the server count every minute
naybe it'll fix it
how would i add that though?
const DBL = require("dblapi.js");
const dbl = new DBL('<removed>', client);
// Optional events
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})
bruh
I litterly copy and pasted
then
maybe the copy paste was wrong
also do you know how to do setInterval functions
Yh, but were would i attach it in this case bec i got no clue
setInterval(function(){
//code
},60000);
The 60000 means it will run every minute
It claims to manage this automatically
Put your code inside it
Ah wait there is a manual post
dbl.postStats
yh i can use setInterval now thanks
Ive done that but now it keeps changing one second its the correct number then its specifically 2 again
Its not my browser cache as ive used multiple browsers and cleared my cache
might just be server caching?
Mine?
could be that
it says 2 then correct 2 then correct :/
yeah, that's what happens when you have multiple cache servers
yeah
will the topgg's api work when my bot hasn't been verified yet?
no, you only get your key once approved
no problem. thanks
@ornate sinew do you need help with anything
do you need help with the api
-api
TOP.GG API ONLY!!!
ANY OFF-TOPIC CONVERSATION WILL BE DELETED AND MUTED
This channel is only for SUGGESTIONS/HELP/BUGS to do with OFFICIAL API LIBRARIES and API DOCS found at: https://top.gg/api/docs
hmmm my bot catch this error Error: 503 Backend fetch failed what is it?
The .NET API documentation doesn't appear to cover webhooks in any way. Does anyone have any experience with this, as i'd like to be notified when someone votes for my bot
Youd have to make your own webhook server which handles the requests.
-add
This article elaborates on how to create a OWIN self-host console application for the WebApi that recives webhooks.
Hi @restive otter
I've been posting to the API every 5 minutes, and it was only this once that the API returned error 522.
Yes
ahoy i asked here ages ago about my server posting- i took the advice about the cog listener but it still doesnt work oop
def __init__(self, bot):
self.bot = bot
self.token = get my token
self.dblpy = dbl.DBLClient(self.bot, self.token,
autopost=True)
@commands.Cog.listener()
async def on_guild_post(self):
print("Server count posted successfully")
def setup(bot):
bot.add_cog(TopGG(bot))```
this is my code 😳
un-nest your on_guild_post event
Try waiting 30 minutes
it’s been 30 minutes and it’s not updating :,(
TOP.GG API ONLY!!!
ANY OFF-TOPIC CONVERSATION WILL BE DELETED AND MUTED
This channel is only for SUGGESTIONS/HELP/BUGS to do with OFFICIAL API LIBRARIES and API DOCS found at: https://top.gg/api/docs
Open music
-api
hey guys can anyone tell me what does relationships.read scope do in oauth2 in discord developers portal
not a question about the top.gg api, move to #development
come on they say to go to api and you say go to development
the people who told you to come here are wrong
tell them that tonkku said they're wrong and should be ashamed
@arctic arch sir how i verify my bot
@arctic arch i add my bot on bot list website but after add there i see a notice verify bot now who verify my bot
@cinder gate firstly, this is the wrong channel to ask, secondly please don't ping tonkku for something like that and thirdly, check #502193464054644737 and pins in #support, it'll tell you all about getting your bot added and approved on top.gg
Im trying to add the yugioh bot i found on top.gg but it wont let me invite it to my server what do i do
is there an error?
It says unavailable on mobile launch from web instead but when i click to launch from my browser it just takes me back to the homepage
Its that bot
thats actually an issue with discord not top.gg.
its been going on for a long time.
the fix i was told was to run your phones browser in desktop mode
how can i set up webhooks for getting votes? im a little confused aha
What lang are you using @wet wing
py!
Ooh, I don't know about py, sorry
thats fine, thank you anyway!
dbl.on is not a function
help?
i have it like: ```client.on("ready", async () => {
console.log("ready");
setInterval(() => {
dbl.postStats(client.guilds.size, client.shards.Id, client.shards.total);
}, 1800000);
// Start auto posting
let initalPost = await statcord.autopost();
// If there is an error, console.error and exit
if (initalPost) {
console.error(initalPost);
process.exit();
}
});
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(Oops! ${e});
})```
What's dbl
should it be: ```client.on("ready", async () => {
console.log("ready");
setInterval(() => {
dbl.postStats(client.guilds.size, client.shards.Id, client.shards.total);
}, 1800000);
// Start auto posting
let initalPost = await statcord.autopost();
// If there is an error, console.error and exit
if (initalPost) {
console.error(initalPost);
process.exit();
}
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(Oops! ${e});
})
});
the
thing
@sullen nymph
What did you defined as dbl ?
const dbl = new DBL('my token', client); ofc with the token
@restive otter
I see
I still don't get it, lol
oh
I fixed it now
Code: setInterval(() => { dbl.postStats(client.guilds.cache.size); }, 1800000); Error: [dblapi.js autopost] Failed to post stats: {"error":"Required parameter server_count or shards missing"}
Help?
nvm
i do it tmr
can somebody help me with showing servers with api (lib is bdfd)
I don't think you can do POST requests with bdfd
my friend have it
Then he probably uses other languages?
no he has bdfd too look here: https://top.gg/bot/651839354418757662
I don't know then, try asking him.
I dont know the answer, so i cannot.
:/
uuh
most people here don't use bdfd though so most of us won't be very helpful
@fringe whale Its easy, but honestly learn js
Tell your friend to learn
hey so im trying the topgg api
and i get the error No module named 'dbl'
even tho i have imported it and have downloaded it with wthat they said
How did you install it?
install from source
So you didn't use pip? (I assume you're using python)
You did it in the right directory?
and then just copy pasted the example with manual server count and webhook
i suppose so
i did what it said
tried it agian and everything was satisfied
Weird, I don't actually use python, but if you tried pip and from source and neither worked you'll have to get someone more experienced in it than I am, sorry.
Which translates to you'll have to wait for someone else.
understood
hey man thanks for the effort anyway!
hey so im trying the topgg api
and i get the error No module named 'dbl'
even tho i have imported it and have downloaded it with wthat they said
python
Nvm read that wrong
.
-dotpost @harsh peak
@harsh peak
Please do not post dots to clear your messages/get attention. It adds absolutely nothing to the conversation and just causes spam.
If you need to get attention, then say hello everyone. If you need to clear your messages, then press the Esc key. If you do not follow these instructions you will be muted.
help, i try to get the votes of my bot with the dblapi.js package and the getVotes() function and if i put votes it says [object Object]
then i tried to put votes()
and it just didn't send
nvm im just dumb it's to find people that voted ur bot
hey i wanted to know what this topgg api does
the docs explain it pretty well @sudden palm https://top.gg/api/docs
thank you
Hi matt
hello
Specify what youre trying to do
yes, please do
I am developing a bot using python but the only problem that I am facing is that when I runs the code for connecting to server it fails
#development, this is for top.gg api only
heck you Matt typing faster than me
Sorry matt
@sharp vigil are you sure you used pip for the same python interpreter that you use to run your bot?
how often does the bots info refresh ?
like once in an hour?
the bots guild info isnt updating on website
oh nvm. it updated

@sullen nymph i think i so Maybe git? Ill try In like an hour when i get back
@mighty shuttle ahem
@worldly siren #memes-and-media
-api @grim torrent
@grim torrent
TOP.GG API ONLY!!!
ANY OFF-TOPIC CONVERSATION WILL BE DELETED AND MUTED
This channel is only for SUGGESTIONS/HELP/BUGS to do with OFFICIAL API LIBRARIES and API DOCS found at: https://top.gg/api/docs
ne yazdın amk
-notr @grim torrent
@grim torrent
İngilizceden başka dillerde sohbet etmek için #memes-and-media kanalını, top.gg hakkında (Türkçe olarak da) destek almak için #support kanalını kullanın.
Bu kanalda Türkçe konuşmayın.
ok
@sullen nymph i did pip install dblpy and in my code it says import dbl ... i changed it to dblpy but still didnt work
I followed the topgg instructions
What's the command you use to run the bot?
i use a bat file to run it
What does the bat file execute?
One message removed from a suspended account.
Paste it here please
pushd %~dp0
"C:\Users\Gebruiker\AppData\Local\Programs\Python\Python38-32\python.exe" webhooklistener.py
pause
oh nvm
my friend changed it i see
now its this
pushd %~dp0
"C:\Users\Gebruiker\AppData\Local\Programs\Python\Python38-32\python.exe" topgg.py
pause
and this is the error
why not just put Python in PATH and simply type python
Anyhow, append -m pip install -u dblpy to the path with Python executable
idk why my friend set this part up am trying to make it work agian ;/
eum this might sound dumb
but how?
cuz i tried the cd path and then do it but -m is not recognized as an internal or external command,
operable program or batch file
then tried to the path with the topgg file
and without anythin
Add Python to path, python -m pip
Shortly for --update
Try running your bot with python webhooklistener.py
Question
it’s a web deployment lib
why do you have Flask as a requirement in your project lol
i have no idea XD my friend made the bot about a year ago and im reviving it / learning with it
If it's not used anywhere in your code, why not remove it?
ill send the code
import asyncio
import random
import os, re, aiohttp
from cogs.rpgutils.db import db
from cogs.rpgutils.defaults import serverdata, userdata
from discord.ext import commands
from random import choice as randchoice
from cogs.utils.dataIO import fileIO
import time
import dbl
import sys
from flask import Flask, request, abort
import flask
import json
app = Flask(__name__)
@app.route('/', methods=['POST','GET'])
def webhook():
if request.method == 'GET':
print("Solyx GET request?!")
return '<h1>This is for top.gg only, what are you doing here?!</h1>'
elif request.method == 'POST':
data = request.json
print("SOLYX VOTE: {}".format(request.json["user"]))
userinfo = db.users.find_one({"_id": data['user']})
# Account check
if userinfo["class"] == "None" and userinfo["race"] == "None":
return
if request.json["isWeekend"] == "True":
userinfo["voted"] = "weekend"
else:
userinfo["voted"] = "True"
db.users.replace_one({"_id": data['user']}, userinfo, upsert=True)
return '', 200
else:
abort(400)
if __name__ == "__main__":
app.run(host='my ip', port=my port, threaded=True, debug=True) # will listen on port
Well, there's no need for dblpy in that file
the plan is that if a user uses the command -vote they get the link and then they vote and try the command again -vote and the get rewards
and in this code ( vote cog) i saw the webhooklistenere thing and i went to try that out maybe that works
becuase rn i only get the link and not not the actual voted stuff
the code itself worked fine btw just the voting not
... yeah, you can scrap that file
Optimally, I would create a DBLClient with dblpy's built-in webhook in my main file and then attach it to my d.py bot object. While you will be at it, set on_dbL_vote and on_dbl_test events.
Voting doesn't work because apparently you don't connect the database used in the Flask script properly to your bot
scrapt the webhooklistener? or the vote file?
The webhooklistener
aight done
Since it's ran separately without any direct connection to your bot
Now, onto slapping dblpy into your bot's main file :p
it has to be main file?
i thought of this idk if it might work tho
in the topgg file
Not really, you could use a cog for it (which is what dblpy examples happen to be)
Also on_dbl_test to easily test the votes with the Test button
whats that?
An event used by dblpy
ooh i finnaly found something about dblpy
I have loaded the dblapi.js module, but the console gives MODULE_NOT_FOUND error.
what is the full error?
that is heroku yes?
yes
yes
has the package been installed?
yes
How do you know
hey do you know why it doesn't work ?
const DBL = require('dblapi.js');
const express = require('express');
const http = require('http');
const app = express();
const server = http.createServer(app);
const stats = new DBL("token de api", bot);
setInterval(() => {
stats.postStats(bot.guilds.size);
}, 1800000);
const dbl = new DBL("token api", { webhookAuth: 'password', webhookServer: server });
dbl.webhook.on("vote", vote => {
console.log(`User with ID ${vote.user} just voted!`);
})
when someone vote nothing appear in the console
I should in theory work
Why not try using the built in DBL webhook?
here is my init line
const dbl = new DBL('token', { webhookPort: 5000, webhookAuth: 'auth' }, client);
You don't understand, the bot run the same port twice, so its working for shard 1 but not shard 2
😅
it's why the error is
Error: listen EADDRINUSE: address already in use :::5000
oh okay, no problems
code?
My time to ask for a bit of help
Snippet from the api docs
gg definetly fowarded to that ip
locally definetly has response on webserver
ports definetly opened
and i can ping it outside too(checking if ports are indeed properly opened). @ me for answer pls
? Bot
30 minutes is normal.
is it normal that it takes about 2 minutes for dbl to recognize that the user has voted?
Yeah, top.gg has slow webhook times sometimes.
It seems instant right now for me tho
Just did a test vote
works fine for me
I need to ask top.gg/bots/my_bot_id/votes ?
Because that doesn't seems to works, maybe this is another url ?
(404, not found)
How can I log in to my bot?
import requests
import json
s = requests.Session()
r=s.get('https://top.gg/api/bots/your_bot_id/votes', headers={'Authorization': "your token"})
data=r.text
(in python)
You can get your api token here @restive otter
how do I trigger the on_dbl_test? want to test how it works ofc
Im actually blind, tysm
Oh okay, sorry @jaunty plank
getting no result from it, is something wrong with my code here?
"""Handles interactions with the top.gg API"""
def __init__(self, bot):
self.bot = bot
self.token = 'tok' # my token is here
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):
print('abc')
logger.info('Received an upvote')
print(data)
@commands.Cog.listener()
async def on_dbl_test(self, data):
print('test', data)
def setup(bot):
global logger
logger = logging.getLogger('bot')
setup(bot)
bot.add_cog(TopGG(bot))```
this is my code except token stripped.
no errors or anything, just nothing printed so guessing the listeners arent being triggered
having a similar deal
waiting for that too
ports opened, webserver definetly listening on that path, yet no incoming traffic
wait do I need to edit stuff in the API options like the url and authorization? It just says come here if you're stuck
right, and do I have to edit any of the values in the Cog for it to trigger the event?
like webhook_path='/dblwebhook', webhook_auth='password',, these two, do they need to be edited?
webhook_auth - yes, if you entered anything in the Authorization field on top.gg
webhook_path is just the stuff after the URL (ip.address.here.aaa:port<webhooK_path>)
ah yeah got the webhook auth, uh how do I find that url?
sorry never used webhooks before
@serene shuttle Where are you hosting?
hosting the bot? Im running it on a vps
Ah, nice
So, to run the webhook it's generally http://your.vps.ip.here:port/dblwebhook
wait what is the new DBL line?
oh ic, so I just use /dblwebhook?
webhook_path='/dblwebhook'
if not thats the default afaik
@rapid kettle correct,/dblwebhookis the default value for webhook_path
Im still just getting no output
I dont need to edit the webhook url in api options do I?
What do you have it set to?
its empty
So, to run the webhook it's generally
http://your.vps.ip.here:port/dblwebhook
the thing in codeblock is the URL "example" you would use
my bad ty, I think my brain is melting I dont know why Im struggling to grasp basic things here lmao
Realizing it is one step closer to improving 🙂
Tried sending manual requests?
with the test function or manually connecting?
Manual
Try to set up a webserver listening to POST requests
Try sending a remote request with reqbin
still cant get it to work
self.bot = bot
self.token = 'tok'
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='mypass', webhook_port=5000)
@commands.Cog.listener()
async def on_dbl_test(self, data):
print('test', data)
and then the url in API options is set to https://my.ip.is.here:5000/dblwebhook




)