#topgg-api

1 messages · Page 79 of 1

balmy hamlet
#

or somebody else

restive otter
#

😩

sullen nymph
#

You didn't install dblapi.js

#

Simple

restive otter
#

Look

sullen nymph
#

I don't see dblapi.js there

#

nvm

restive otter
#

You don't see it yes 😂

#

@sullen nymph

sullen nymph
#

Are you sure the dependencies are actually up-to-date on the machine itself

restive otter
#

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

oblique trout
#

yes

restive otter
#

And now new error wtffff

oblique trout
#

Show me

restive otter
oblique trout
#

Show code

restive otter
#

Look my webhook.js

oblique trout
#

No no

#

Remove that

#

It has your tonen

restive otter
#

Sorry im on my phone

oblique trout
#

token

sullen nymph
#

Reset your token for additional security

oblique trout
#

^

restive otter
#

Yes yes

#

I know

#

I have the intention of delete my screen

oblique trout
#

Why do you code on phone?

restive otter
#

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

sullen nymph
#

Ehh are you sure that will help

oblique trout
#

Pls say u reset ur token?

restive otter
#

Yes

#

Its not my token i have delete

#

1/2 of the token

oblique trout
#

What?

#

You shouldn’t share any of your token.

restive otter
#

Yes

#

Sorry im french

#

🥖

#

So van you help me plz

oblique trout
#

Sure. now. Did you try it?

restive otter
#
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`);
});
oblique trout
#

And error was couldn’t find on of undefined?

restive otter
#

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

fiery shadow
#

on vote = message.channel.send?

#

Message = undefined

balmy hamlet
#

^

#

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

restive otter
#

😂😂

fiery shadow
#

Snails gettin mad v7

#

snails, dont always flame people for being bad in programming.

balmy hamlet
#

I'm not flaming them for that, they refused to learn the basics

#

and I told 'em several times

fiery shadow
#

Just be a bit more kind aPES_HappyBlanket

balmy hamlet
#

and they still ignored me

jaunty sable
#

How do I limit a feature to voted users only

willow spindle
#

which language do you use

restive otter
#

@jaunty sable asked then dipped XD

jaunty sable
#

discordjs

#

Lol sorry i didnt read the messages

restive otter
#

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

jaunty sable
#

I understand it now! Thanks for your help!

restive otter
#

np
tbh i thought i explained it horribly 😅

jaunty sable
#

Lol its quite good

balmy hamlet
#

@restive otter use appropriate code blocks

restive otter
#

eh

#

doesnt matter

balmy hamlet
#

it does

#

the one you used looks ugly and it isn't that easy to read when you're on phone

restive otter
#

But

#

Who would need it on a phone?

#

If I send any code for you zsnails I will use the other kind ig

olive arrow
#

Trying to use the api

#

And this is an error I get

#

dbl.webhook.on('ready', hook => {
^

TypeError: Cannot read property 'on' of undefined

green mantle
#

whats your full code for the api

olive arrow
#
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

green mantle
#

thats a diffrent error from your first one

olive arrow
#

yes

#

Now it works

#

But

#

with a differemy error

green mantle
#

what is your url path?

olive arrow
green mantle
#

errm

#

im not sure

olive arrow
#

I am running on a vm

#

on my friend's pc

shy vortex
#

you need the public ip of your device

olive arrow
#

I have that

green mantle
#

is it for your url to the site tho?

olive arrow
#

http://[IP]:3000/dblwebook changed to

dense grail
#

Pretty sure your ip or something is wrong

#

make sure to unblock portums too

green mantle
#

sure the port is open n sutff?

dense grail
#

cuz by default those ports are usually closed

olive arrow
#

Port 3001 works

#

On port 3001 it says the cannot read on of undefined error

#

The GBL webhook works

#

But not dbl

vapid cape
#

@olive arrow update your dblapi version

olive arrow
#

Good poijny

#

What is the latest version?

dense grail
#

npm install dblapi.js

olive arrow
#

Still says

dense grail
#

bad request usually means something on the lines of the data being in a different shape than how it's expected

olive arrow
#

I just sent the guilds size

#

I sent a test vote

#

It didn't work

olive arrow
#

I am so confused

vapid cape
#

whats your dblapi version?

#

and your discord.js version?

olive arrow
#

dblapi v is 2.4.0

#

discord.js is 12.1.1

vapid cape
#

why do you have this?

#

remove it

olive arrow
#

ok

#

But that isn't the issue

#

Posting stats works

#

Just not votes

true talon
#

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

vapid cape
#

@olive arrow the error you showed was because of that

olive arrow
#

Really?

vapid cape
#

yes

olive arrow
#

It says can't read webhook of undefined tho

vapid cape
#

what did you change?

olive arrow
#

That was the original error

vapid cape
#

show the error and the code

true talon
#

@olive arrow define dbl as new DBL(token, {webhooks settings}, client)

olive arrow
#

Now it's wor,king

#

I think

true talon
#

Vote works?

olive arrow
#

It doesn't recieve votes tho

true talon
#

Oof

vapid cape
#

but no more errors right?

true talon
#

I got the same things hours ago

olive arrow
#

No more errors

true talon
#

No errors, no votes

vapid cape
#

good

olive arrow
#

It says running webhook at 0.0.0.0/dblwebhok

true talon
#

Now it'd à problem with the ip I guess

vapid cape
#

now what did you put in the webhook settings in top.gg?

true talon
#

lemme try another port

olive arrow
#

I could set up ngrok

true talon
#

port 3002

olive arrow
#

nope didn't work

vapid cape
#

dm me your ip, port and auth

true talon
#

nothing for me too

olive arrow
#

dm me your ip, port and auth
@vapid cape Done

#

In that order

vapid cape
#

@olive arrow looks like your ip is behind a firewall or the port is blocked

true talon
#

problem is from firewall/ports

#

(am too slow)

olive arrow
#

I am tryna remember the command to allow a port

vapid cape
#

what is your host?

olive arrow
#

Linux

vapid cape
#

i mean, your vps hosting

#

or is it your local pc?

olive arrow
#

It's like a local pc that's on 24/7

vapid cape
#

then you need to check your router

#

and do port forwarding

olive arrow
#

It's on my friend's pc

vapid cape
#

whatever router it is connected to

olive arrow
#

How

true talon
#

ask ur friend to come here

#

@olive arrow

vapid cape
#

you need to access the router's configuration

olive arrow
#

@plucky bough

#

Well then

true talon
#

aka 192.168.0.1 or smth like this

olive arrow
#

I can do it on my router but not his

vapid cape
#

you need to do it on the router that is connected to the computer where the bot is hosted

olive arrow
#

How do I access the router settings

faint rose
#

How do I use the voted for bot thing?

true talon
#

only he can

faint rose
#

Where should I put it?

vapid cape
#

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

olive arrow
true talon
#

@faint rose webhook

faint rose
#

Do I just put the code in a bot start running event?

olive arrow
#

I am tryna do this

true talon
#

just put the code in ur index.js

olive arrow
#

But it isn't my router so

vapid cape
#

you need the router's username and password

#

try admin admin

olive arrow
#

Nope

true talon
#

username
password

#

?

#

literally

olive arrow
#

Nope

true talon
#

oof

#

invalid username/password

olive arrow
#

Ik

true talon
#

cant u inspect element the passwd?

olive arrow
#

I could try

vapid cape
#

try admin and password

#

you cant inspect element the password lol

olive arrow
#

Unless it's a very badly designed website

true talon
#

I tried looking at my box files

#

I found the password

olive arrow
true talon
#

thx french security

#

user access refused

olive arrow
#

Oh well

#

We can live without it

plucky bough
#

hi

olive arrow
#

Can you do port forwarding on your router?

#

@plucky bough

plucky bough
#

yeah sure what port

#

@olive arrow

olive arrow
#

3000/3001/3002

#

Those three

#

Me and Lumap need it

plucky bough
#

TCP or UDP

#

Ill just use tcp for now

#

see if that works

olive arrow
#

Thx

plucky bough
#

should work @olive arrow

olive arrow
#

Thanks

#

Will try it out

true talon
#

works!

olive arrow
#

@plucky bough still doesn't work

plucky bough
#

then its ur code because I portforwarded on ur vm and my router

olive arrow
#
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
plucky bough
#

not sure lol

true talon
#

mine works

vapid cape
#

@olive arrow check your authorization in top.gg

#

and make sure you save it before testing

olive arrow
#

It worked once a removed the channel.send

true talon
#

interesting

#

my channel stuff works

plucky bough
#

@olive arrow

#

the id is wrong

#

WRONG

#

lol

true talon
#

lol

olive arrow
#

For what

true talon
#

channel id

olive arrow
#

I just reput it in

plucky bough
#

or put it in the ready event

#

because iirc client.channels doesnt go with boot

olive arrow
#

Why is the id wrong?

#

It's on a vote

plucky bough
#

maybe cause they'res nothing in the cache

olive arrow
#

It worked

#

No it didn't

#

How do I put it in the cache

teal lava
#

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

olive arrow
#

Alright thx

restive otter
#

@olive arrow what is the version of you dblapi.js on you package.json

olive arrow
#

It is working now

restive otter
#

Because i have a little problem with it

olive arrow
#

What

#

is your issue

#

and why did you have to ping me

restive otter
#

I have a problem with the dblapi.js

pale fulcrum
#

What is the problem

olive arrow
#

yeah

restive otter
#

Look

olive arrow
#

at what?

restive otter
#

It's the index.js of the api

olive arrow
#

npm rebuild

#

or

restive otter
#

what the heck

olive arrow
#

npm i dblapi.js

#

That's fuckin' weird

restive otter
#

I can't make that because my server get little bug

teal lava
#

client.on is not a function, it's unlikely that this is because of dblapi

#

actually it's coming directly from dblapi

#

idk

restive otter
#

I need to entre the version of the api in my package.json and my server install it automatic

teal lava
#

I don't even use dblapi so I can't help sorry

restive otter
#

I have the version 1.1.0

#

On my package.json

pale fulcrum
#

if you put a ^ before it, it does anything after 1.1.0

restive otter
#

I have make that

#

It's the last

#

"Dblapi.js": "^1.1.0"

pale fulcrum
#

then reinstall it

restive otter
#

I have make that 2 time

#

They are an other version ?

#

Help me plz

#

I have change to the version 1.2.1

vapid cape
#

newest dblapi is 1.4.0

restive otter
#

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?

fiery shadow
#

You can setup a passwort on your Bot edit website.

restive otter
#

👍

#

Yee

#

I have use new-dblapi and it work

fiery shadow
#

What you mean exactly?

restive otter
#

The problem is when i make a test with webook the webhook don't send message

fiery shadow
#

Is it still the same thing like yesterday?

restive otter
#

Yes ans now u don't have error on my console

fiery shadow
#

Could you please show me your code again?

restive otter
#

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);
});
fiery shadow
#

client.channels.cache.get('your-channel-id-here').send(embed) instead of const channel.

#

In the end of your code

restive otter
#

So i van replace it by const channel = channel get("my channel")

vapid cape
#

dbl.on("vote") doesnt exist

fiery shadow
#

gimme sec

vapid cape
#

its dbl.webhook.on("vote")

restive otter
#

Okey

fiery shadow
#

didnt saw that lol, thx tim

vapid cape
#

also, what is new-dblapi?

restive otter
#

Its like dblapi

#

Its on npm

fiery shadow
#

also, what is new-dblapi?
I was about to ask aPES_HappyBlanket

restive otter
#

Search it on npm

fiery shadow
#

dblapi is also on npm?

vapid cape
#

new-dblapi is not dblapi, its different

restive otter
#

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?

fiery shadow
#

Why?

restive otter
#

I have a problem with the index.js

fiery shadow
#

bruv

restive otter
#

??? What's it

#

Look

vapid cape
#

did you update to 1.4.0?

restive otter
#

Yes

vapid cape
#

then you did something wrong

restive otter
#

I can't update

#

Hmm...

#

Because i don't find it

#

@restive otter using discord.js?

#

Yes

#

Which version?

fiery shadow
#

You messed up alot of things here ngl.

restive otter
#

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

fiery shadow
#

You need to update discord.js...otherwise you cant use dblapi

restive otter
#

Yup

#

That's what I was trying to say

#

Ohh

#

So i cant use dbl with discordjs v11.6.2

fiery shadow
#

you can use npm update discord.js i guess

#

Stop

restive otter
#

Updater to v12

#

?

fiery shadow
#

Wait

restive otter
#

Ok

#

@restive otter yea
npm update discord.js

#

Hmm

fiery shadow
#

Open your Bot Folder and open a Powershell Window.

#

Then npm update discord.js

restive otter
#

And the version update is ?

fiery shadow
#

V11 => V12

restive otter
#

No

fiery shadow
#

Why not?

restive otter
#

I can't my code isn't for the v12

sullen nymph
#

It's not hard to migrate, is it

restive otter
#

No

#

I don't want use the v12

fiery shadow
#

Is your Bot large?

restive otter
#

Yes

fiery shadow
#

Ok, then you cant use dblapi.

#

Im sorry for you

restive otter
#

@restive otter what's your bot name?

#

BryXou its fr

#

Hmm lemme check real quick

vapid cape
#

you CAN use dblapi with v11

restive otter
#

Hmm

#

What is the version for use with the v11

vapid cape
#

1.4.0

#

idk how your host works. does it have a terminal? can you type things like npm install dblapi.js?

restive otter
#

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

vapid cape
#

then write dblapi ^1.4.0

fiery shadow
#

Im confused.

restive otter
#

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

vapid cape
#

use an API

#

there are many coronavirus APIs

restive otter
#

which api ?

#

@vapid cape where can i find apis ?

#

Look

vapid cape
#

i literally wrote "coronavirus api" on google

restive otter
#

The first

vapid cape
#

and got like 5 websites

restive otter
#

ok

#

@restive otter wtf how's that possible...

#

Yes how its possible

vapid cape
restive otter
#

@restive otter wait why did you put a ^

#

Oh i see

#

Yes @vapid cape

fiery shadow
restive otter
fiery shadow
#

I wonder how often Tim is losing his mind here monkaS

vapid cape
#

you didnt...

#

you wrote dblapi

#

not dblapi.js

restive otter
#

@restive otter dblapi.js

#

Hmm

#

No

#

Doesn't work

vapid cape
#

what did you write now?

restive otter
#

"dblapi.js": "^1.4.0"

vapid cape
#

actually

#

its 2.4.0 not 1.4.0 lol

#

my bad lmao

restive otter
#

You have write 1.4.0

#

Okey thats goof

#

Good

#

So lets go test

#

I have test and

#

Doesn't send message

vapid cape
#

show code

restive otter
#

@vapid cape wait... Isn't 2.4.0 for the v12 discord.js?

vapid cape
#

its for both

restive otter
#

Hmm... Let's see that code then

vapid cape
#

there isnt a specific version for one or other

restive otter
#

Bots?

#

Both?

vapid cape
#

was that your bot token? if yes, then its wrong. you use your top.gg token, not your bot token

restive otter
#

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);
});
vapid cape
#

its dbl.webhook.on("vote")

#

not dbl.on("vote)

restive otter
#

No i don't have share any token

vapid cape
restive otter
#

No don't work when i test

#

Ues the token of my webhook

vapid cape
#

also, what did you put in your bot's top.gg webhook options

restive otter
#

My password

#

And my webhook url

vapid cape
#

what is the url?

restive otter
#

Authorization = password

#

And url

#

And url of my webhook

vapid cape
#

if its a discord webhook then its wrong

#

top.gg does not use discord webhooks

restive otter
vapid cape
#

yes its wrong

restive otter
#

Just bot

vapid cape
#

webhook URL = your bot's ip address and port

restive otter
vapid cape
#

or your project url, or whatever your webhosting uses

restive otter
#

Look

vapid cape
#

its wrong

restive otter
#

What my bot ip

#

Wtf

#

I don't understand

vapid cape
#

top.gg does not send votes to discord

#

directly to your bot

#

it needs to know your bot's address on the internet

#

where its hosted

restive otter
#

Okey

vapid cape
#

check with your hosting what is your bot's IP address and port

restive otter
#

The ip adress and port of my server

#

Im idiot sorry

#

So i need to check with the ip and port of my server ?

vapid cape
#

yes

restive otter
#

Hmm

#

For example

#

My adress for connexion

#

And the port

#

How place it

#

?

vapid cape
#

does it have a port?

restive otter
#

Yes

#

2022

vapid cape
#

then try this game07.ouiheberg.com:2022/dblwebhook

restive otter
#

Authorization = my password

#

So now lets go test

#

No don't send

#

I click on test

#

And nothing

vapid cape
#

did you change webhookPort to 2022?

restive otter
#

Ohh no sorry

#

No nothing

vapid cape
#

do you have "webhook running on 0.0.0.0:2022" in your console?

restive otter
#

No

#

My console dont write all logs sometime

vapid cape
#

which file did you put your dbl code?

restive otter
#

?

#

Sorry im french i dont understand very good

vapid cape
#

your bot has many files right?

#

like index.js

#

etc

restive otter
#

Yzs

#

Yes

#

Handler

vapid cape
#

where did you put new DBL(etc)

restive otter
#

On my handler

vapid cape
#

show code

restive otter
#

On handlers

vapid cape
#

then its wrong

#

you should put it in index.js

restive otter
#

Hmm

#

Ok

vapid cape
#

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

restive otter
#

Yes

#

I have fix that

tulip heart
#

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.

restive otter
#

French ?

#

@vapid cape nothing

#

Wtfff

blazing kraken
#

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

tulip heart
#

Twixty, can you help me?

vapid cape
#

@restive otter as i said, show code

#

full index.js

tulip heart
#

@dense compass can you help me?

vapid cape
#

dont ping mods

blazing kraken
#

sorry

tulip heart
#

Ok, sorry. I dont know

vapid cape
#

why are both of you saying the same things

tulip heart
#

we have the same question.

#

We are coding this bot.

#

:d

restive otter
#

Look

#

And password is not real

#

Not don't send message

vapid cape
#

does the console show "webhook running on 0.0.0.0..."?

restive otter
#

No

#

When i make the bot send a message in the channel ? Or the console show webhook running...

vapid cape
#

the console should show that when you start your bot

restive otter
#

Just this

#

And when i make test ?

vapid cape
#

test is later

#

first the webhook has to be running

restive otter
#

Just a question when i make a test the bot send a message in the channel ?

vapid cape
#

if everything is working, it should yes

restive otter
#

My friend has vote and nothing so no

vapid cape
#

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

restive otter
#

It doesn't show that

vapid cape
#

what does your console show?

restive otter
#

Nothing

vapid cape
#

your bot doesnt log anything when it starts?

#

doesnt it say "ready" or anything?

restive otter
#

No because the console of my server don't show all logs

vapid cape
#

what logs does it show then?

restive otter
#

Look the logs.txt

vapid cape
#

this is not the bot log, this is only npm log

restive otter
#

Yes

vapid cape
#

you need to find how to see the console logs

#

maybe ask in your host's support server

restive otter
#

Yes im with them

restive otter
#

Nothing

#

I have change of port with them and nothing

#

They are nothing on my console and when a person vote nothing

vapid cape
#

so when you write console.log(something) in your code, you cant see it anywhere?

restive otter
#

Yes

#

I cant see

vapid cape
#

sound like a very bad hosting then lol

restive otter
#

No they going to update this

#

Look my code now

#

And for the end they are channel.send(embed);

vapid cape
#

you changed port to 25578?

restive otter
#

Yes with them

#

Because its custom 2022 is private port and now 25578 is public port

vapid cape
#

ah

#

so then you need to put 2022 in your webhookPort, and 25578 in top.gg

restive otter
#

Yes i have change

vapid cape
#

dm me your password

#

i can test

restive otter
#

I have test

#

2 time

#

Or 5

vapid cape
#

and?

restive otter
#

Nothing in logs or channel

vapid cape
#

its 25578 or 25573?

#

in your code is 25578

restive otter
#

Yes 25578

vapid cape
#

25578 is working

restive otter
#

Yes

#

25578 work

#

I have see with my host support i think he have write 8 or 3 by error so i test

vapid cape
#

8 is correct

#

i can test here

restive otter
#

Hmm ok

#

Wait 2 minutes

vapid cape
#

now you change to 3

#

lol

restive otter
#

Yes y have change it

#

And now 8

vapid cape
#

why are you changing lol

restive otter
#

Testing

#

So i have change by 8 on top.gg ans my index.js

cinder adder
#

-botinfo 690851693113638922

#

-botinfo @690851693113638922

willow spindle
willow oracle
#

help with
how to share Servers count?

oblique trout
#

Use api

vapid cape
willow oracle
#

tnx

left egret
#

@cinder adder Testing channels for Luca’s commands please

cinder adder
#

@left egret okay sorry

fast mirage
#

my api is no longer updating the amount of servers on the bot page, does anyone know how to fix this?

vapid cape
#

any errors?

#

any code changes?

fast mirage
#

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)
vapid cape
#

does it log attempting to post server count?

fast mirage
#

whats?

#

@vapid cape você fala português que eu sei pode falar

#

pra facilitar

fiery shadow
sullen nymph
#

Why the asyncio.sleep there

fast mirage
#

@sullen nymph is code recommendade for dbl

sullen nymph
#

The comment above that line literally says to use it only if you're not using tasks.loop

fast mirage
#

as well

#

?

sullen nymph
#

Also you don't have any approved bots

green mantle
#

Is that code, taken from the module itself??

#

Looks identical

sullen nymph
#

No it's from github examples

green mantle
#

What's with the 1800 second sleep then

#

Oh

sullen nymph
#

You should see the examples for yourself

green mantle
#

Nvm they just haven't read comments and taken it out

fast mirage
#

but what can be causing this?

spiral steeple
#

you dont have a bot on the site

fast mirage
#

why before it worked more after the dbl changed its name stopped

spiral steeple
#

you can't post stats to nothing

green mantle
#

^^

spiral steeple
green mantle
#

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

fast mirage
#

this is my secondary account

#

@spiral steeple

green mantle
#

Why are you asking with your secondary account

sullen nymph
#

I wonder if they have logging on to see the error

green mantle
#

What is / was your main

sullen nymph
#

inb4 their error is logged with logging when they're not using it

green mantle
#

Tbf I would use logging.CRITIAL rather than exception so it shows without logging on if it's a big exception like thay

fast mirage
#

I don't get errors

green mantle
#

Have you got logging enabled...

#

And what is your main account

sullen nymph
#

If you wanna open an issue/PR for that :p

green mantle
#

I might do it tomorrow

#

When my internet and sleep isn't dead

sullen nymph
fast mirage
#
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

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

fast mirage
#

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

sullen nymph
#

Probably because you are not closing the bot properly

fast mirage
#

is there a problem i change the tasks time to 5 seconds?

#

@sullen nymph

green mantle
#

Yes

#

Because that would spam the api

#

Secondly

#

Lower the task timer will not solve your issue

fast mirage
#

I already managed to solve

green mantle
#

Kk

fast mirage
#

Because that would spam the api
@green mantle thx

green mantle
#

But no don't set to 5 secs

fast mirage
#

it was because my test bot was initializing the discordbotslist

#

right

sullen nymph
restive otter
#

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

oblique trout
#

Might be your port is different - read longer up in chat

keen flint
#

Do the bot need a approval to get a DBL Token?

oblique trout
#

Yes

keen flint
#

Okay, thanks but what is a Webhook and how to intergrate them to a bot?

vapid cape
#

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

oblique trout
restive otter
#

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

oblique trout
#

What? @restive otter

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)
oblique trout
#

Btw, why do space it so much?

#

What is it supposed to do? What is the error?

vapid cape
#

wasnt your port different? why are you using port 3000?

restive otter
#

no i have search an help on google and i have see that @vapid cape

#

it's not me

fluid rock
#

I want this

vapid cape
#

URL depends on your hosting

fluid rock
#

its good

#

@vapid cape

vapid cape
#

top.gg webhook is not discord webhook

fluid rock
#

ahh

restive otter
#

Its the ip + port of you heberg

fluid rock
balmy hamlet
#

🤦‍♂️

vapid cape
#

no

balmy hamlet
#

flav28...

#

not that url

vapid cape
#

@fluid rock i told you. URL depends on your hosting

balmy hamlet
#

your host's url

vapid cape
#

where is your bot hosted?

fluid rock
#

on my vps

balmy hamlet
#

then

fluid rock
#

and my site in this my vps

fiery shadow
#

You are the PLS FRITE guy

balmy hamlet
#

if you setup that vps then why can't you set up a webhook

#

in your bot

#

start a webserver listening on port 8080

restive otter
#

@balmy hamlet like me 😂

balmy hamlet
#

bc it's most likely unused

#

wdym

#

and you need an endpoint called webhook

#

iirc

#

so it'd be like

restive otter
#

Why webhook

balmy hamlet
#

bc that's where dbl will post

restive otter
#

It dblwebhook no ?

balmy hamlet
#

idk

#

I'm just giving an example

#

it doesn't matter rn

restive otter
#

Okey

#

I have an little error with my code when a person vote nothing and when i make a rester nothing

balmy hamlet
#

a what

#

a rester

#

what is that

restive otter
#

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

balmy hamlet
#

show your code

restive otter
#
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);
});
balmy hamlet
#

what do you get in the console

#

isn't it bot.channels.cache.get

#

since you're not fetching

restive otter
#

Nothing

balmy hamlet
#

wait

restive otter
#

Yes

balmy hamlet
#

you're not passing your client

vapid cape
#

his console doesnt work

restive otter
#

I use bot

vapid cape
#

he says his console never shows anything

balmy hamlet
#

DBL(auth, ops, client)

restive otter
#

I have see @vapid cape on my logs hosting webhook. ..

balmy hamlet
#

weird

vapid cape
#

client is not required for webhooks, only for posting

balmy hamlet
#

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

restive otter
#

So can you fix my error with an code or example plz

balmy hamlet
#

show us the top of your main file

restive otter
#

Because i don't understand all words il french

balmy hamlet
#

show us the top of your main file

#

lemme try something

restive otter
#

My Index.js

balmy hamlet
#

do you understand spanish? @restive otter I know you're french

restive otter
#
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

balmy hamlet
#

but I can understand french, not very well, but I can understand some of it

restive otter
#

Okey speack little

balmy hamlet
#

btw

restive otter
#

Speak litte

balmy hamlet
#

we can't use other languages here

#

lemme take this into dms

restive otter
#

Yes no

#

Np

vapid cape
restive otter
#

Ok

#

Yes

vapid cape
#

do you see "Lancement du bot" in your logs?

restive otter
#

Yes in logs

#

Not in console

balmy hamlet
#

...

vapid cape
restive otter
#

Yes

#

Now yed

#

Yes

vapid cape
#

when you test in top.gg, do you see "User with ID ... just voted!" in your logs?

balmy hamlet
#

Do you have a webserver twixty?

restive otter
#

Hmm

#

Wait 2 min

balmy hamlet
#

unless dblapi.js already handles that

restive otter
#

?

vapid cape
#

dblapi handles it

restive otter
#

I dont have webserver

balmy hamlet
#

just do what you were going to do

#

ah

#

don't worry then

restive otter
#

Its a server for host bot

balmy hamlet
#

dblapi handles it for you

#

that's not what I mean

#

you can google what a webserver is later

restive otter
#

?

balmy hamlet
#

brb

fluid rock
#

its good

#

merci

restive otter
#

Frrrr

#

Ouii

#

Wait 2 minutes he speak french so i can be help by it

vapid cape
#

did you check if the your logs show if a user voted?

restive otter
#

I dont have see it for the moment

#

I search

#

I ping you after x)

fluid rock
#

plz vote for test

balmy hamlet
#

...

#

there's literally a test webhook button

#

you only want free upvotes don't ya?

restive otter
#

@vapid cape i dont have see it

fluid rock
#

plz

restive otter
#

@balmy hamlet i don't see a message on my logs if i make a test or other

#

@fluid rock

#

Va dans testing

#

1

balmy hamlet
#

hmm

restive otter
#

🤔🤔

balmy hamlet
#

I'll assume that, after every change you restart your bot

restive otter
#

Yes i restart every times

balmy hamlet
#

hmm

#

what's the url you put in dbl

#

like

restive otter
#

Look

#

The ip of my server + port

#

Tim has help me

#

For make that

balmy hamlet
#

hmm

#

are you sure that's the correct ip

restive otter
#

Yes

#

I have see with my support

vapid cape
#

@restive otter dm me your authorization

restive otter
#

Look

#

Ip

vapid cape
#

@restive otter send me your authorization / webhook password

balmy hamlet
#

uuhh

restive otter
#

Wait 2 minutes plz

balmy hamlet
#

hmm

restive otter
#

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

balmy hamlet
#

not in all servers buddy

vapid cape
#

can you show more logs?

#

what comes before that part?

restive otter
#

No i cant

balmy hamlet
#

why not?

restive otter
#

Its just this

#

On my

balmy hamlet
#

hmm

restive otter
#

Console

vapid cape
#

what about in your logs

restive otter
#

Nothing

vapid cape
#

your host sucks lol

#

its extremely hard to do anything if you cant see logs

#

you cant fix errors without logs

restive otter
#

Ok.

fluid rock
vapid cape
#

missing permissions

fluid rock
#

don't work

vapid cape
#

yeah it doesnt work

#

you dont have permissions

fluid rock
#

why

#

@vapid cape

balmy hamlet
#

bc your bot doesn't have the required perms

restive otter
#

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);
});
pale fulcrum
#

did you set it up correctly on the website?

balmy hamlet
#

...

restive otter
#

Yes

pale fulcrum
#

Where do you host?

balmy hamlet
#

I'm pretty sure that's not your hosts ip

#

can you run

#

ipconfig in the console

#

and dm me the output

pale fulcrum
#

ight I assume you got it from here zSnails

restive otter
#

A little host

#

/ heberg

balmy hamlet
#

emm

#

I'm waiting lol

restive otter
#

?

balmy hamlet
#

run ipconfig in your console

#

and then show me what you get

#

but in dms

restive otter
#

I have ever

#

My host have give me the port and the ip its this bro

vapid cape
#

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

restive otter
#

Add me

#

@vapid cape

#

And i send you

vapid cape
#

just send me, my dms are open

restive otter
#

Look

balmy hamlet
#

you have dms disabled @restive otter

vapid cape
#

@restive otter can you show your last logs?

restive otter
#

Ok

#

@vapid cape

#

And ?

vapid cape
#

show your logs lol

restive otter
#

Ohh

#

Ok

#

I have see my Running etc

vapid cape
#

this shows that its working

restive otter
#

Ohh nice

vapid cape
#

but your bot is crashing right after

restive otter
#

Sorry im on my phone

#

Yes is crashing

vapid cape
#

delete this part

#

and test again

restive otter
#

Why delete my message embed ?

#

I think just delete the setInterval

vapid cape
#

delete both

#

to see if it stops crashing

restive otter
#

Ok

#

Can uou wait 2 minutes ? Plz

vapid cape
#

did you remove it?

restive otter
#

Nice now i can see my console !!!

#

Logs on my console

vapid cape
#

haleluiah