#topgg-api
1 messages · Page 79 of 1
😩
Are you sure the dependencies are actually up-to-date on the machine itself
I think yes
And look now the error
And i use bot
Not
client
Do you think i can replace client by bot on dblapi.js/index.js
yes
And now new error wtffff
Show me
Show code
Look my webhook.js
Sorry im on my phone
token
Reset your token for additional security
^
Why do you code on phone?
const discord = require("discord.js");
const DBL = require('dblapi.js');
const dbl = new DBL("xNTg2MDI0NTM4fQ.ZHSRGS8MbcPv4LPFrDrex3jN3jvhZoBjdXzPUF9dTnc", { webhookPort: 5000, webhookAuth: '...' });
dbl.webhook.on('vote', vote => {
message.channel.send(${vote.user} a voté pour BryXou | +1);
});
Because i don't have my pc today
Ehh are you sure that will help
Pls say u reset ur token?
Sure. now. Did you try it?
const discord = require("discord.js");
const DBL = require('dblapi.js');
const dbl = new DBL("xNTg2MDI0NTM4fQ.ZHSRGS8MbcPv4LPFrDrex3jN3jvhZoBjdXzPUF9dTnc", { webhookPort: 5000, webhookAuth: '...' });
dbl.webhook.on('vote', vote => {
message.channel.send(`${vote.user} a voté pour BryXou | +1`);
});
And error was couldn’t find on of undefined?
I dont have share any of my token
Look
And i have change this on the index.js of dbl-api.js
I have replace client by bot
Plz help
Me
^
twixty, trying to help someone who doesn't even know the basics of coding is the most tedious thing ever
please learn the basics of al any programming language
then english and then make a bot
😂😂
Snails gettin mad v7
snails, dont always flame people for being bad in programming.
I'm not flaming them for that, they refused to learn the basics
and I told 'em several times
and they still ignored me
How do I limit a feature to voted users only
which language do you use
@jaunty sable asked then dipped XD
Its all good. Im looking at the docs now
hmm there is this
I never tried anything like this but maybe when the command is ran use this then if it returns true proceed if not display an error
so like
dbl.hasVoted("95579865788456960").then(voted => { if (voted) {command}| else client.channels.get("<ID").send("Please vote at top.gg/(bots link)") });
and yes i know that code isnt valid just an example
I understand it now! Thanks for your help!
np
tbh i thought i explained it horribly 😅
Lol its quite good
@restive otter use appropriate code blocks
it does
the one you used looks ugly and it isn't that easy to read when you're on phone
But
Who would need it on a phone?
If I send any code for you zsnails I will use the other kind ig
Trying to use the api
And this is an error I get
dbl.webhook.on('ready', hook => {
^
TypeError: Cannot read property 'on' of undefined
whats your full code for the api
const Discord = require("discord.js");
const client = new Discord.Client();
const config = require("../config.json")
const DBL = require('dblapi.js');
const dbl = new DBL("", { webhookPort: 3000, webhookAuth: '' },
client);
dbl.webhook.on('ready', hook => {
console.log(`Discord Bot List Webhook is running at http://${hook.hostname}:${hook.port}${hook.path}`);
dbl.postStats(client.guilds.cache.size)
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
const channel = client.channels.cache.get('683615385920077871');
const embed = new Discord.MessageEmbed()
.setTitle("New vote!")
.setDescription(`<@${vote.user}> just voted on [top.gg](https://top.gg/bot/660818351638970370)`)
.setColor('#00AAFF')
channel.send(embed);
});
dbl.on('posted', () => {
console.log('[TOP.GG] Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
});
client.login();```
(node:11933) UnhandledPromiseRejectionWarning: Error: 400 Bad Request
thats a diffrent error from your first one
what is your url path?
you need the public ip of your device
I have that
is it for your url to the site tho?
http://[IP]:3000/dblwebook changed to
sure the port is open n sutff?
cuz by default those ports are usually closed
Port 3001 works
On port 3001 it says the cannot read on of undefined error
The GBL webhook works
But not dbl
@olive arrow update your dblapi version
npm install dblapi.js
Still says
bad request usually means something on the lines of the data being in a different shape than how it's expected
I am so confused
I have the same issue as @olive arrow (same vps)
@olive arrow typing the ip afress in a browser results in an infinite loading loop
@olive arrow the error you showed was because of that
Really?
yes
It says can't read webhook of undefined tho
what did you change?
That was the original error
show the error and the code
@olive arrow define dbl as new DBL(token, {webhooks settings}, client)
Vote works?
It doesn't recieve votes tho
Oof
but no more errors right?
I got the same things hours ago
No more errors
No errors, no votes
good
It says running webhook at 0.0.0.0/dblwebhok
Now it'd à problem with the ip I guess
I could set up ngrok
port 3002
nope didn't work
dm me your ip, port and auth
nothing for me too
@olive arrow looks like your ip is behind a firewall or the port is blocked
I am tryna remember the command to allow a port
what is your host?
Linux
It's like a local pc that's on 24/7
It's on my friend's pc
whatever router it is connected to
How
you need to access the router's configuration
aka 192.168.0.1 or smth like this
I can do it on my router but not his
you need to do it on the router that is connected to the computer where the bot is hosted
How do I access the router settings
How do I use the voted for bot thing?
only he can
Where should I put it?
you need to check the computer's gateway address. most likely 192.168.1.1 or 192.168.0.1 or 10.0.0.1
@faint rose webhook
Do I just put the code in a bot start running event?
I am tryna do this
just put the code in ur index.js
But it isn't my router so
Nope
Ik
cant u inspect element the passwd?
I could try
Unless it's a very badly designed website
https://corynth.is-inside.me/leHUDPrD.png Now it's fucked up
https://corynth.is-inside.me/QRq0hmR6.png Now it's really fucked up
hi
Thx
should work @olive arrow
works!
@plucky bough still doesn't work
then its ur code because I portforwarded on ur vm and my router
dbl.webhook.on('ready', hook => {
console.log(`Discord Bot List Webhook is running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
const channel = client.channels.cache.get('683615385920077871');
const embed = new Discord.MessageEmbed()
.setTitle("New vote!")
.setDescription(`<@${vote.user}> just voted on [top.gg](https://top.gg/bot/660818351638970370)`)
.setColor('#00AAFF')
channel.send(embed);
});``` What is wrong with this
not sure lol
mine works
@olive arrow check your authorization in top.gg
and make sure you save it before testing
It worked once a removed the channel.send
lol
For what
channel id
I just reput it in
maybe cause they'res nothing in the cache
Channels get automatically cached, but you must access them after the ready event. Put your code in the ready event or where you are sure your bot is online
Alright thx
@olive arrow what is the version of you dblapi.js on you package.json
It is working now
Because i have a little problem with it
I have a problem with the dblapi.js
What is the problem
yeah
Look
at what?
what the heck
I can't make that because my server get little bug
client.on is not a function, it's unlikely that this is because of dblapi
actually it's coming directly from dblapi
idk
I need to entre the version of the api in my package.json and my server install it automatic
I don't even use dblapi so I can't help sorry
if you put a ^ before it, it does anything after 1.1.0
then reinstall it
I have make that 2 time
They are an other version ?
Help me plz
I have change to the version 1.2.1
newest dblapi is 1.4.0
Okey im going to test it
No can't find it
What is the version in you package.json
Can i use new-dblapi ?
How do you get a password for the webhook?
You can setup a passwort on your Bot edit website.
What you mean exactly?
The problem is when i make a test with webook the webhook don't send message
Is it still the same thing like yesterday?
Yes ans now u don't have error on my console
Could you please show me your code again?
Now i test the webhook and nothing
Yes
const Discord = require("discord.js");
const DBL = require('new-dblapi');
const client = new Discord.Client();
const dbl = new DBL("...", { webhookPort: 5000, webhookAuth: '...' });
dbl.on('vote', vote => {
const channel = client.channels.cache.get('694001560539234364');
const embed = new Discord.MessageEmbed()
.setTitle("Vote !")
.setDescription(`${vote.user} a voté sur | https://top.gg/bot/688390331523530978`)
.setColor('#00AAFF')
channel.send(embed);
});
client.channels.cache.get('your-channel-id-here').send(embed) instead of const channel.
In the end of your code
So i van replace it by const channel = channel get("my channel")
dbl.on("vote") doesnt exist
gimme sec
its dbl.webhook.on("vote")
Okey
didnt saw that lol, thx tim
also, what is new-dblapi?
also, what is new-dblapi?
I was about to ask
Search it on npm
dblapi is also on npm?
new-dblapi is not dblapi, its different
Write npm new-dblapi on google
@restive otter i suggest you to use the official dblapi module..
The problem
I can't use it
Why?
Why?
I have a problem with the index.js
bruv
did you update to 1.4.0?
Yes
then you did something wrong
I can't update
Hmm...
Because i don't find it
@restive otter using discord.js?
Yes
Which version?
You messed up alot of things here ngl.
11
V11
Hmm... Now that's messed up with that update of dblapi...
Hmm... Why aren't you using 12v tho? @restive otter
its v11.6 2
Because its complex for me
Hmm i see
Yup
That's what I was trying to say
Ohh
So i cant use dbl with discordjs v11.6.2
Wait
And the version update is ?
V11 => V12
No
I can't my code isn't for the v12
It's not hard to migrate, is it
Is your Bot large?
Yes
you CAN use dblapi with v11
1.4.0
idk how your host works. does it have a terminal? can you type things like npm install dblapi.js?
No
Hmm... Then how's this all gonna work...
I need to write the version of my module on the package.json and ut install it automaticlly
then write dblapi ^1.4.0
Im confused.
Wait 2minutes
please tell me how can i get live corona virus cases
Welp @restive otter ok but let's see where we going with this...
i use discord.js
i literally wrote "coronavirus api" on google
The first
and got like 5 websites
@restive otter did you write it exactly like this?

I wonder how often Tim is losing his mind here 
what did you write now?
You have write 1.4.0
Okey thats goof
Good
So lets go test
I have test and
Doesn't send message
show code
@vapid cape wait... Isn't 2.4.0 for the v12 discord.js?
its for both
Hmm... Let's see that code then
there isnt a specific version for one or other
was that your bot token? if yes, then its wrong. you use your top.gg token, not your bot token
Did she just reveal it's bot token?
const Discord = require("discord.js");
const DBL = require('dblapi.js');
const client = new Discord.Client();
const dbl = new DBL ("...", { webhookPort: 5000, webhookAuth: '...' });
dbl.on('vote', vote => {
const channel = client.channels.cache.get('694001560539234364');
const embed = new Discord.MessageEmbed()
.setTitle("Vote !")
.setDescription(`${vote.user} a voté sur | https://top.gg/bot/688390331523530978`)
.setColor('#00AAFF')
channel.send(embed);
});
No i don't have share any token
what is the url?
yes its wrong
Just bot
webhook URL = your bot's ip address and port
or your project url, or whatever your webhosting uses
Look
its wrong
top.gg does not send votes to discord
top.gg sends votes to YOU
directly to your bot
it needs to know your bot's address on the internet
where its hosted
Okey
check with your hosting what is your bot's IP address and port
The ip adress and port of my server
Im idiot sorry
So i need to check with the ip and port of my server ?
yes
does it have a port?
then try this game07.ouiheberg.com:2022/dblwebhook
Authorization = my password
So now lets go test
No don't send
I click on test
And nothing
did you change webhookPort to 2022?
do you have "webhook running on 0.0.0.0:2022" in your console?
which file did you put your dbl code?
where did you put new DBL(etc)
On my handler
show code
and dont create a new DIscord and new DIscord.Client()
use the discord and client that you already have in your index.js
show full index.js when you finish
Hello, sorry for bad english first. I have a question. If i make all commands with vote. What will happens? I have 4 commands in my bot.
Hello, sorry for bad english first. I have a question. If i make all commands with vote. What will happens? I have 4 commands in my bot.
Help Please
Twixty, can you help me?
@dense compass can you help me?
dont ping mods
sorry
Ok, sorry. I dont know
why are both of you saying the same things
does the console show "webhook running on 0.0.0.0..."?
No
When i make the bot send a message in the channel ? Or the console show webhook running...
the console should show that when you start your bot
Just a question when i make a test the bot send a message in the channel ?
if everything is working, it should yes
My friend has vote and nothing so no
as i said
one thing at a time
first get the webhook running
it should show "webhook running on 0.0.0.0.." in your console
if it doesnt show that, then of course its not gonna work
It doesn't show that
what does your console show?
Nothing
No because the console of my server don't show all logs
what logs does it show then?
this is not the bot log, this is only npm log
Yes
Yes im with them
Nothing
I have change of port with them and nothing
They are nothing on my console and when a person vote nothing
so when you write console.log(something) in your code, you cant see it anywhere?
sound like a very bad hosting then lol
No they going to update this
Look my code now
And for the end they are channel.send(embed);
you changed port to 25578?
Yes with them
Because its custom 2022 is private port and now 25578 is public port
Yes i have change
and?
Nothing in logs or channel
Yes 25578
25578 is working
Yes
25578 work
I have see with my host support i think he have write 8 or 3 by error so i test
why are you changing lol
help with
how to share Servers count?
Use api
tnx
@cinder adder Testing channels for Luca’s commands please
@left egret okay sorry
my api is no longer updating the amount of servers on the bot page, does anyone know how to fix this?
I don't get any errors
@vapid cape
code ```py
@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)
does it log attempting to post server count?

Why the asyncio.sleep there
@sullen nymph is code recommendade for dbl
The comment above that line literally says to use it only if you're not using tasks.loop
Also you don't have any approved bots
No it's from github examples
You should see the examples for yourself
Nvm they just haven't read comments and taken it out
but what can be causing this?
you dont have a bot on the site
why before it worked more after the dbl changed its name stopped
you can't post stats to nothing
^^
You don't actually have a bot on this site that is approved rn
Secondly
That code will run once every 1 hour and 30 minutes
after the bot is approved
Why are you asking with your secondary account
I wonder if they have logging on to see the error
What is / was your main
inb4 their error is logged with logging when they're not using it
Tbf I would use logging.CRITIAL rather than exception so it shows without logging on if it's a big exception like thay
I don't get errors
If you wanna open an issue/PR for that :p

Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f08dc18dc18>
Task exception was never retrieved
future: <Task finished coro=<DBLClient.webhook() done, defined at /usr/local/lib/python3.7/dist-packages/dbl/client.py:417> exception=OSError(98, "error while attempting to bind on address ('0.0.0.0', 5000): address already in use")>
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/dbl/client.py", line 436, in webhook
await self._webserver.start()
File "/usr/local/lib/python3.7/dist-packages/aiohttp/web_runner.py", line 104, in start
reuse_port=self._reuse_port)
File "/usr/lib/python3.7/asyncio/base_events.py", line 1378, in create_server
% (sa, err.strerror.lower())) from None
OSError: [Errno 98] error while attempting to bind on address ('0.0.0.0', 5000): address already in use
@sullen nymph
Only one program can be using a certain port and you are trying to connect to a used port
Make sure you don't have any code duplicates running
I think I already know the reason more so I still don't understand, I sometimes use a test bot to do things with it it links all the files, dblapi is one of them it causes a conflict and makes the current one stop?
@sullen nymph
Probably because you are not closing the bot properly
Yes
Because that would spam the api
Secondly
Lower the task timer will not solve your issue
I already managed to solve
Kk
Because that would spam the api
@green mantle thx
But no don't set to 5 secs
@nimble plover Please delete that message. If you want to list your bot on top.gg, you need to submit it at https://top.gg/newbot
I have a problem i have a good code etc and when a people vote for me nothing and they are nothing on my console
Might be your port is different - read longer up in chat
Do the bot need a approval to get a DBL Token?
Yes
Okay, thanks but what is a Webhook and how to intergrate them to a bot?
a webhook is the opposite of a request
instead of you requesting data from a server or api, the server sends you data instead
top.gg's webhooks send you data to inform you when someone voted for your bot
Hey i have a problem i have get the help of Tim for make the vote notification with my bot the problem is they aren't message when a person vote for my bot
What? @restive otter
Hmm
I have get help of time yesterday for my bot send message in a custom channel when a person vote
The problem : il i make a test or i vote nothing
@oblique trout
i need my api key :"(
You need
To use the webhook
And after tou get an token
*you
This code can fonctionnat ?
const Discord = require('discord.js')
const client = new Discord.Client()
const DBL = require('dblapi.js');
const dbl = new DBL(process.env.DBLTOKEN, { webhookPort: 3000, webhookAuth: process.env.AUTH });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`)});
dbl.webhook.on('vote', vote => {
const uservoted = client.users.get(vote.user).username
var voted = new Discord.RichEmbed()
.setTitle(`${uservoted} has just voted for Ticketz!`)
.setColor('GREEN')
client.users.get("510970297814614016").send(voted)
const user = new Discord.WebhookClient(process.env.WEBID, process.env.WEBTOKEN)
user.send(voted);
});
client.login(process.env.TOKEN)
wasnt your port different? why are you using port 3000?
ahh
Its the ip + port of you heberg
🤦♂️
no
@fluid rock i told you. URL depends on your hosting
your host's url
where is your bot hosted?
then
and my site in this my vps
You are the PLS FRITE guy
if you setup that vps then why can't you set up a webhook
in your bot
start a webserver listening on port 8080
@balmy hamlet like me 😂
bc it's most likely unused
wdym
and you need an endpoint called webhook
iirc
so it'd be like
Why webhook
bc that's where dbl will post
It dblwebhook no ?
Okey
I have an little error with my code when a person vote nothing and when i make a rester nothing
If a person vote the bot send a message in a specific channel and he do nothing
I have get the help of Tim yesterday
show your code
const DBL = require("dblapi.js");
const dbl = new DBL("..........Tg2MDQyNjE04mTyQBCXhzP4hv1UnJfZA4UjvnnY", { webhookPort: 25578, webhookAuth: '...' });
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!`);
setInterval(() => {
dbl.postStats(bot.guilds.size);
}, 1800000);
const channel1 = bot.channels.get('694001560539234364');
const embed = new Discord.MessageEmbed()
.setTitle("Vote !")
.setDescription(`${vote.user} a voté sur | https://top.gg/bot/688390331523530978`)
.setColor('#00AAFF')
channel1.send(embed);
});
what do you get in the console
isn't it bot.channels.cache.get
since you're not fetching
Nothing
wait
Yes
you're not passing your client
his console doesnt work
I use bot
he says his console never shows anything
DBL(auth, ops, client)
I have see @vapid cape on my logs hosting webhook. ..
weird
client is not required for webhooks, only for posting
ah yes
how did you define your client
bc a lot of people define it as something else and then use another name
show us the top of your main file
So can you fix my error with an code or example plz
show us the top of your main file
Because i don't understand all words il french
My Index.js
do you understand spanish? @restive otter I know you're french
const Discord = require('discord.js');
const bot = new Discord.Client();
const fs = require("fs");
const enmap = require('enmap');
const config = require('./config.json')
console.log("Lancement du bot");
bot.login(config.token);
bot.on("error", (e) => console.error(e))
bot.on("warn", (e) => console.warn(e))
bot.on("debug", (e) => console.info(e))
And they are my handlers etc
but I can understand french, not very well, but I can understand some of it
Okey speack little
btw
Speak litte
@restive otter
do you see "Lancement du bot" in your logs?
...
do you see "Webhook running at http://0.0.0.0...." in your logs?
Do you have a webserver twixty?
unless dblapi.js already handles that
?
dblapi handles it
I dont have webserver
Its a server for host bot
dblapi handles it for you
that's not what I mean
you can google what a webserver is later
?
brb
did you check if the your logs show if a user voted?
plz vote for test
@vapid cape i dont have see it
@balmy hamlet i don't see a message on my logs if i make a test or other
@fluid rock
Va dans testing
1
hmm
🤔🤔
I'll assume that, after every change you restart your bot
Yes i restart every times
@restive otter dm me your authorization
@restive otter send me your authorization / webhook password
uuhh
Wait 2 minutes plz
hmm
So
I use a specific server not
An websiteheberg
So its
Now i have an new error
(node:11) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions
at item.request.gen.end (/home/container/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:85:15)
at then (/home/container/node_modules/snekfetch/src/index.js:215:21)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:11) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 5)
My bot have admin permissions
not in all servers buddy
No i cant
why not?
hmm
Console
what about in your logs
Nothing
your host sucks lol
its extremely hard to do anything if you cant see logs
you cant fix errors without logs
Ok.
missing permissions
don't work
bc your bot doesn't have the required perms
Why my bot doesn't send message my friend has vote
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!`);
setInterval(() => {
dbl.postStats(bot.guilds.size);
}, 1800000);
const channel1 = bot.channels.get('694001560539234364');
const embed = new Discord.MessageEmbed()
.setTitle("Vote !")
.setDescription(`${vote.user} a voté sur | https://top.gg/bot/688390331523530978`)
.setColor('#00AAFF')
channel1.send(embed);
});
did you set it up correctly on the website?
...
Yes
Where do you host?
I'm pretty sure that's not your hosts ip
can you run
ipconfig in the console
and dm me the output
ight I assume you got it from here zSnails
?
i've already asked you like 5 times, and i'll ask again
send me your webhookAuth password
so i can test if your webhook server is working
since your console doesnt work, there's no other way to test
just send me, my dms are open
you have dms disabled @restive otter
@restive otter can you show your last logs?
show your logs lol
Ohh nice
but your bot is crashing right after
did you remove it?
haleluiah
