#topgg-api

1 messages · Page 65 of 1

left egret
#

..?

grave talon
#

(Ping me on reply)

muted oar
#

Aren’t those archived/not good anymore?

rugged sierra
#

Nah they are okay (most of them)

muted oar
#

Ah mk

narrow zenith
grave talon
#

I did. @narrow zenith where specifically?

narrow zenith
#

You can do either given answers, I suggest the api docs from the website itself

winter spade
#

How can I send shard information using snekfetch with this code:

            snekfetch.post(`https://discordbots.org/api/bots/stats`)
            .set('Authorization', `${config.tokens.dblAPI}`)
            .send({ server_count: server_counts })
            .then(() => console.log('Updated discordbots.org stats.'))
            .catch(err => console.error(`Whoops something went wrong: ${err.body}`));

Would a shard count be added automatically, or is that manually added?

hybrid geyser
#

Ta gueule

#

Mdr

narrow geyser
restive otter
#

@hybrid geyser don't be toxic, also no insult

#

@winter spade that's automatic i think

spiral steeple
#

use the docs

#

your url isnt correct either

#

it should be an array of numbers as it says

#

so fetch the guilds per shard and push them into an array

winter spade
#

ok

sterile dawn
#

-bots @sterile dawn

abstract mothBOT
sullen nymph
restive otter
#
    if (votes.find(vote => vote.id == "95579865788456960")) console.log("Tonkku has voted!!!")

What is vote id ?

#

The id of the bot ?

sullen nymph
#

ID of person who voted

restive otter
#

ok

cloud ferry
#

When my bot is offline and won't receive webhooks, will the webhooks which couldn't be delivered be sent again if the bot is back online?

sullen nymph
#

Negative

vague sequoia
#

how can i get the api ?

rugged sierra
#

@cloud ferry you should probably have a separate server receiving requests for exactly that reason
If your bot crashes, your server (that will have like zero errors) will still receive them

sullen nymph
#

@vague sequoia "Get the API"?

rugged sierra
#

||client.getTheAPI()
hyperkappa ||

sudden rampart
#

api->get()

worn quail
#

api()

cloud ferry
#

Nah then I'm going to implement that the first 12hours the bot runs vote locks will be disabled

restive otter
#

What is API?

fast cairn
#
const express = require('express');
const app = express();
const https = require('http')
app.get("/", (request, response) => {
  process.stdout.write(Date.now() + " Ping Received\n");
  response.sendStatus(200);
});
app.listen(process.env.PORT);
setInterval(() => {
  https.get(`http://too-scared-to-show-my-project-name-lmao.glitch.me/`);
}, 60000);

const server = https.createServer(app)

const dblw = new DBL(process.env.DBL_TOKEN, { webhookAuth: 'AlsoThisIsMyPassword!', webhookServer: server });

dblw.webhook.on('ready', hook => {
  console.log(`Webhook running with path ${hook.path}`);
});
dblw.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});

server.listen(5000, () => {
  console.log('Listening');
});

I have a question, for some reason, while "Webhook running with path /dblwebhook" does log, whenever i vote, it does not trigger User with ID ${vote.user} just voted!...

#

i am using the example from the docs

#

and i set the Webhook URL on my bot page as http://too-scared-to-show-my-project-name-lmao.glitch.me/

fast cairn
#

ah man i guess this chat is mostly dead

brave bison
#

¯_(ツ)_/¯

fast cairn
#

dont wanna be a beggar, but could you help me?

sullen nymph
#

Doesn't Glitch only allow port 3000

fast cairn
#

oh

#

i guess i'll try port 3000 as well

#
const express = require('express');
const app = express();
const https = require('http')
const server = https.createServer(app)
app.get("/", (request, response) => {
  process.stdout.write(Date.now() + " Ping Received\n");
  response.sendStatus(200);
});
server.listen(process.env.PORT);
setInterval(() => {
  https.get(`http://my-project.glitch.me/`);
}, 60000);


const dblw = new DBL(process.env.DBL_TOKEN, { webhookAuth: 'my password >:(', webhookServer: server });

dblw.webhook.on('ready', hook => {
  console.log(`Webhook running with path ${hook.path}`);
});
dblw.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});

this is my updated code... whenever i hit the "test" button it doesnt seem to do anything...

#

should i change it?

sullen nymph
#

Seems fine Shrug

#

Oh

#

What about path tho

fast cairn
#

wdym by path

sullen nymph
#

webhookPath

fast cairn
#

ah

#

well it logs as /dblwebhook

#

if thats what you are trying to ask

sullen nymph
#

And are you using it

fast cairn
#

whytho im not good with servers so idk how you would "use it"

sullen nymph
#

The URL

fast cairn
#

oh

#

umm

#

http://my-project.glitch.me/dblwebhook? it shows as Cannot GET /dblwebhook

sullen nymph
#

I'm just poking fingers at random things at this point

fast cairn
#

0.0.0.0:0

sullen nymph
#

That means your IPv4

fast cairn
#

how would i change the ip to the project's page?

#

ik how to change the port...

sudden rampart
#

0.0.0.0 means it's available on all ip addresses of the machine

fast cairn
#

ah

#

im still super confused tho

#

still not doing anything when i press the test button...

restive otter
#

How to make API look cooler?

winter spade
#

Uhhh

#

👌

runic grove
#

this channel is starting to turn into a starfarm

winter spade
#

(╯°□°)╯︵ ┻━┻

worn quail
#

HoW tO MakE ApI WoRK

cerulean crane
#

I get this error when I start my bot since I post servercount to dbl
{ Error: 429 Too Many Requests

#

Please ping if you can help me

worn quail
#

that's just a ratelimit

#

Its fine.

#

Though unless you are getting 20+ servers at once, then you are fine.

#

You need a rate handler

rugged sierra
#

just post your stats every 10 minutes instead of posting it on every guildCreate and remove

fast cairn
#

wouldnt that also be api spam

#

ish?

#

if it doesnt change

sullen nymph
#

One POST request every 10 minutes is better than POST request per guild leave, join etc

sudden rampart
#

one post every 10m if guild count changed

sullen nymph
#

Even better

fast cairn
#

how about not even posting guild count at all

restive otter
#

How do I even setup the API for how many server's the bot is in.

restive otter
#
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/discord/ext/commands/bot.py", line 580, in _load_from_module_spec
    setup(self)
AttributeError: module 'dbl' has no attribute 'Client'``` I'm getting this error
#

Even though everything worked perfectly before

rocky rain
#

🤔

restive otter
#

oh I see, dbl.Client is renamed to dbl.DBLClient

rocky rain
#

Oops

somber spire
#

i don't understand what i did wrong client.user.setPresence({ game: { name: "I'm makeing a better MIDI than randoms", type: "STREAMING", url: "https://www.twitch.tv/hotbeatstv"}});
console.log('Your Bot is Online')
});
const prefix="!"
client.on("message", (message) => {
if (message.author.bot)return;
if(!message.content.startsWith(prefix))return;
const args = message.content.slice(prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase(); // Replaces the Current Prefix with this

if (command=="ping") {
message.channel.send("pong!");
} else
if (command=="jeffy eat your green beans") {
message.channel.send("no!");
}
else if (message.content === {prefix}user-info) { message.channel.send(Your username: ${message.author.username}\nYour ID: ${message.author.id}); } else if (message.content === ${prefix}server) { message.channel.send(OOSM aka our own midi squad: ${message.guild.name}`);
}

});

#

i did not show the token

muted oar
#

Use code blocks or a paste site

balmy hamlet
#

"makeing"

#

there

#

you fucked it up

#

"

#

after the D

#

and use codeblocks

#

I've found 3 paces where you fucked it up

dawn fjord
#

@somber spire please use codeboxes

somber spire
#

uhh

#

k

turbid estuary
#

hello

narrow geyser
mellow reef
#

Is there a way to send a custom # of servers using dblpy? I run my bot across two servers, so the server count is inaccurate using post_guild_count.

worn quail
#

you can use a rpi, connect the two computers (servers) and use a shared folder, or use a storage system, eg github

spiral steeple
#

@mellow reef just send the request yourself

#

Using some http library that python has

mellow reef
#

yea good idea

#

I used to do that but I thought we were supposed to use the apis now

#

Thanks for the help guys

spiral steeple
#

Well the library is just an api wrapper

mellow reef
#

thanks

nocturne quartz
#

Hey how many times in an min i can make my bot to change role color
As it should not abuse discord api

rugged sierra
#

This channel is for the dbl api.
But it's generally a bad idea to change role colours every X minutes

spiral steeple
#

@nocturne quartz a rainbow role in any respect is usually considered api abuse

amber dune
#

@nocturne quartz once every 24 hours

worn quail
#

@restive otter dotpost

restive otter
#

My stats won't post

#

like the bots server count

#
dbl.on('posted', () => {
  console.log('Server count posted!');
})

dbl.on('error', e => {
 console.log(`Oops! ${e}`);
})
#

I put that but I nothing happened.

#

Is there something I'm supposed to do or?

fast cairn
#

what is "dbl" defined as

#

(remove the token when you post it)

dense basalt
#

Would posting the servercount in a command work, like this:

async run(msg) {
        const DBL = require("dblapi.js");
        const dbl = new DBL('No u.', this.client);
        const embed = new MessageEmbed()
            .setColor(this.client.embedColor)
            .setDescription(`Posting...`)
        const sent = await msg.channel.send(embed);

        // Optional events
        dbl.on('posted', () => {
            const embed2 = new MessageEmbed()
                .setColor(this.client.embedColor)
                .setDescription(`Posted a servercount of ${this.client.guilds.size} to DBL**`)
            sent.edit(embed2);
        })

        dbl.on('error', e => {
            console.log(`Oops! ${e}`);
        })
    }
rugged sierra
#

this would send a message everytime your bot posts

dense basalt
#

It's been like that for 5 minutes now

rugged sierra
#

the interval is very high

#

would rather not enable autoposting.
meaning you do

const dbl = new DBL('token');
dbl.postStats(params...).then(
()=> channel.send('lol, done'),
()=>channel.send('lol dbl api is unstable and failed again')
);
spiral steeple
#

You know you can idk

#

Edit the interval

#

🍴 that repo

rugged sierra
#

sound like a lot of useless work

dense basalt
#

So it posts around every 15 minutes

rugged sierra
#

yes

spiral steeple
#

It's changing one number

#

Literally just backspace

rugged sierra
#

and losing all upcoming updates

spiral steeple
#

Lmao

#

Upcoming updates

#

Nice joke

#

I havent updated my personal lib in months

#

And even then just update and change it MegaThonk

rugged sierra
#

@dense basalt just make your own request, not that hard

spiral steeple
#

Or that

rugged sierra
#

or force it to post stats once

dense basalt
#

I moved it to my ready event now

rugged sierra
#

good idea

#

thats how everyone is doing it

#

I think

dense basalt
#

So, 15 minutes after the launch of my bot it should post

rugged sierra
#

yeah

#

I forced it to post instantly

dense basalt
#

And how would you do that then

rugged sierra
#

call postStats once

dense basalt
#

But you could eval that right

rugged sierra
#

I guess

dense basalt
worn quail
#

You cant vote using the api

#

you can get the total votes, or if a user has voted, but not sending a vote

nimble jungle
#

Hello

dense basalt
#

what's your problem/question thing

rancid knot
#

Does a bot really need to have a website or a github to be certified ?

spiral steeple
#

Yep

#

You need a widget somewhere

rancid knot
#

Okay thx

worn quail
#

my website technically has a widget

#

it's on the navigation menu

#

and cropped

scarlet cobalt
#

One message removed from a suspended account.

restive otter
#

GWovoRaphiXD

dusk pebble
#

GWovoRaphiXD

restive otter
#

GWcorbinMonkaGIGA

sullen nymph
worn quail
#

...

#

what

#

the hell

hearty lintel
#

What

fierce grotto
#

@spiral steeple

spiral steeple
#

Why

worn quail
#

@fierce grotto please dont randomly ping users

restive otter
#

@restive otter

worn quail
#

You too @ꌀ Literary#7824

#

O

#

They aren't here

runic grove
#

they are

#

ping failed

ornate abyss
#

hmmm i got this error...

  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\dbl\client.py", line 432, in close
    await self._webserver.stop()
AttributeError: 'DBLClient' object has no attribute '_webserver'
sullen nymph
#

What's your code

ornate abyss
sullen nymph
#

Looks like I did a bad with dblpy's source code

ornate abyss
#

sure!

sullen nymph
#

👍

restive otter
spiral steeple
#

Not make too many requests

restive otter
#

200iq
there are only commands to vote

spiral steeple
#

So use a webhook

#

Kthx

sullen nymph
#
  1. Don't ghostping people
  2. As Steven said, it's better to use a webhook and store the vote data locally as well as grab it locally
#

one request per command is discouraged

spiral steeple
#

And will comonly het you rate limited

restive otter
#

how can i make it dusunceli

sullen nymph
#

Yes, you send an HTTP request on each command usage as it seems

#

dbalpi.js has built-in webhook

restive otter
#

Is there an example for this

spiral steeple
#

Yes

sullen nymph
#

if only someone did read the docs...

spiral steeple
#

The dbl docs

restive otter
#

oke

restive otter
#

-owner @restive otter

abstract mothBOT
#

tickNo That's a user, not a bot...

sullen nymph
restive otter
#

dbl.webhook.on(message.author.id).then(voted => {
if(voted) {
So I'm gonna use it like that?

restive otter
#
const DBL = require('dblapi.js');
const ayarlar = require('../ayarlar.json');
const dbl = new DBL(ayarlar.dbltoken, { webhookPort: 5000, webhookAuth: 'mypassword' });

dbl.webhook.on(message.author.id).then(voted => {
if(voted) return message.channel.send('test')
});

what is the problem

ornate abyss
#

uhmm.. not trying to to rude(?) but.. is the close error gonna be fixed soonish?

restive otter
#

how can i solve

sullen nymph
#

@ornate abyss Somewhere around tomorrow. For now you can dig into dblpy source code and fix DBLClient.close method (I attempt to access self._webserver when it doesn't exist. You should be fine with a try-except for that)

ornate abyss
#

ah kk

#

thx

spiral steeple
#

@restive otter .on('vote')

#

you're checking if the webhook is emitting an id

outer kiln
#

How would you download the code for a discord bot?

civic plinth
#

g i t h u b

outer kiln
#

Why do I bother

#

Can I not ask a retarded question for once

amber dune
#

@outer kiln if its not open source then you cant download it

civic plinth
#

Ye

#

But if it is it a mostly on github

restive otter
#

dbl.webhook.on('vote', message.author.id).then(voted => {
if(voted) return
@spiral steeple

flint kindle
restive otter
#

hello how am i able to use the api to post my server count onto my bots page?

signal river
#

what do u mean

restive otter
#

because in the certification it says post your server count to our api, how would i do that in the bot

daring panther
#

It pretty much states everything in the api @restive otter

frail meteor
#

Why am I getting this?

(node:1382) UnhandledPromiseRejectionWarning: Error: [DDBL-MODULE][POST-STATS] An error has occured: Request failed with status code 429
restive otter
#

@daring panther ik but where would i place the posted event in my code?

daring panther
#

It is a loop so you should create it once anywhere you want as long as the loop is being created

restive otter
#

so would i place it in my main app.js file where the bot is being created n everything

sullen nymph
#

@Callum#6052 You're getting ratelimited

frail meteor
#

mmk

daring panther
#

YOu could for example create it in on_ready.

restive otter
#

so eg:

#
bot.on(`ready`, () => {
dbl.on(`posted`, () => {
console.log(`Posted!`);
})
})```
#

like that

sullen nymph
#

Separate event

daring panther
#

That was an example and no, you want to create the loop. As you can see by the command above it's just optional. You don't need that

restive otter
#

ahh so i just put it in my app.js @sullen nymph and it would run anytime it posts?

sullen nymph
#

Provide your client to dblapi.js client and it will automatically post

restive otter
#

ah okay ty

#

ty aswell Keyinator

daring panther
#

you're welcome ^^

shrewd ginkgo
#

const dbl = new DBL(token, { webhookPort: 5001, webhookAuth: the_auth, statsInterval: 2400000}, client);
shouldn't using something like this update the stats every 2400000 ms

sullen nymph
#

Anything that you want as a password

restive otter
#

webhookauth??

sullen nymph
#

Yes, that's what you use

restive otter
#

hmm not working

#

can you throw code to vote with webhook (discord.js)

#

I tried to do it but it didn't

restive otter
#

console.log(Webhook running at http://${hook.hostname}:${hook.port}${hook.path});

#

@sullen nymph

#

what should we write

restive otter
#
const DBL = require('dblapi.js')
const ayarlar = require('../ayarlar.json');
const dbl = new DBL(settings.dbltoken, { webhookPort: 5000, webhookAuth: 'mypassword'});

dbl.webhook.on('voted').then(voted => {
      if(voted) {
message.channel.send('oke')}
})
#

what is the truth, can you correct and send?

restive otter
#

Not working 😦

#

+1

#

help me D:

amber dune
#

dbl useful_js_debugging @restive otter

alpine pineBOT
restive otter
#

hm

#

Hey

#

which bot counts msgs without premium

fast cairn
#
const express = require('express');
const app = express();
const https = require('http')
const server = https.createServer(app)

app.get("/", (request, response) => {
  process.stdout.write(Date.now() + " Ping Received\n");
  response.sendStatus(200);
});
server.listen(process.env.PORT);
setInterval(() => {
  https.get(`glitch url lol`);
}, 60000);


const dblw = new DBL(process.env.DBL_TOKEN, { webhookAuth: process.env.DBL_PASS, webhookServer: server, webhookPort: process.env.PORT });

dblw.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);;
});

dblw.webhook.on('vote', vote => {
  console.log(`User just voted!`);
});

hey guys, so i have this code here... and even after some experimentation , when i test it, nothing happens... i host on glitch so i can only use port 3000... any ideas on what to do?

clever rock
#

use a pinger instead

#

dont use that internal ping thing

fast cairn
#

im using both

clever rock
#

you cant

fast cairn
#

would internal pinging not be very effective?

#

wait

clever rock
#

imagine hosting to webservers at the same port

fast cairn
clever rock
#

that never work

fast cairn
#

im using uptime robot as well

#

well

#

umm

clever rock
#

you need to remove the

app.get("/", (request, response) => {
  process.stdout.write(Date.now() + " Ping Received\n");
  response.sendStatus(200);
});
server.listen(process.env.PORT);
setInterval(() => {
  https.get(`glitch url lol`);
}, 60000);
#

in order for dbl webhook to work

#

or just rent a 5 dollar vps which will provide you superior results

fast cairn
#

alright

#

im poor afraid

clever rock
#

if you can at least have nitro I doubt you cant have 5 dollars vps

fast cairn
#

cant even afford a 5 dollar vps

#

or 1

#

@clever rock i got it from a giveaway

clever rock
#

then im afaik thats a problem

fast cairn
#

the test will fire via vote correct?

ornate abyss
#

what is a vanity url of a bot?
vanity? String The vanity url of the bot

muted oar
#

So like https://discordbots.org/bot/dankmemer iirc is a vanity url

sullen nymph
#

Correct

muted oar
#

But not all bots have them I don’t think

#

Pretty sure it’s just certified bots right?

sullen nymph
#

only certified ones

muted oar
#

Yea

#

And the question mark in vanity? String The vanity url of the bot means it’s an optional thing that you can use btw

ornate abyss
#

ooh thx

random relic
#

how can I make a bot that makes an animated channel

#

?

spiral steeple
#

uh

#

animated channel?

civic plinth
#

Hewooo.... I was wondering.... Is it possible to setup your api and stuff before ur bot gets accepted ?

sullen nymph
#

You have no access to the API unless you have at least ome bot approved

civic plinth
#

Ok!

#

I hope no one reviews me.... cos my server just rebooted randomly now my bots down

restive otter
#

To show bot upvotes on an embedded I have to do .addField(`Total Upvotes`, `${points}`, true)?

#

Can someone please help me with that?

restive otter
#

Can someone please reply?

#

can I do to avoid receiving too many request alerts?

muted oar
#

Not even the right channel

#

This channel is for api help

restive otter
#

It's related to api

#

@muted oar

muted oar
#

How

restive otter
#

If you want to display upvotes, it uses api

muted oar
#

Mk didn’t see that part

#

Show more code then just that along with errors

#

We can’t make guesses as to what is wrong

restive otter
#

It says points is not defined

#

I even tried changing it to ${dbl.points} but then it shows undefined

muted oar
#

Show error and code

restive otter
#

I just told u, it says points is not defined

sullen nymph
#

Showing code will help

muted oar
#

I can’t do much with that

restive otter
#

I did show the code

muted oar
#

Show how you defined dbl

muted oar
#

Show what it console logs

#

Stuff like that

sullen nymph
#

That's not the whole code

muted oar
#

I can’t do anything with an addField

restive otter
#
const infoEmbed = new Discord.RichEmbed()
        .setColor('#FF69B4')
        .setTitle('MegaPhone - BroadCast Messages')
        .setDescription(`MegaPhone is an interactive bot who can send alerts/broadcast and more. The bot has an active developer, and a support server (mb!support). The bot is currently in progress and soon to be finished.`)
        .setThumbnail('https://i.ibb.co/MBWytBw/Logo.png')
        .addField(`Total Guilds`, `${client.guilds.size}`, true)
        .addField(`Total Members`, `${client.users.size}`, true)
        .addField(`Total Channels`, `${client.channels.size}`, true)
        .addField(`Total Upvotes`, `${dbl.points}`, true)
        .setTimestamp()
        .setFooter('Developed By Plemso', 'https://media.tenor.com/images/7389b890146ecc93090ee967e954b7a8/tenor.gif');
#

That's what I currently have

sullen nymph
#

What is dbl

muted oar
#

Don’t think that gif will work in a footer btw

restive otter
#

It works

#

dw about that

sullen nymph
#

Gifs do work in footers

muted oar
#

Wait what

#

I’ve never gotten them to work

#

Smh

#

anyway what is dbl defined as

restive otter
#
    const infoEmbed = new Discord.RichEmbed()
        .setColor('#FF69B4')
        .setTitle('MegaPhone - BroadCast Messages')
        .setDescription(`MegaPhone is an interactive bot who can send alerts/broadcast and more. The bot has an active developer, and a support server (mb!support). The bot is currently in progress and soon to be finished.`)
        .setThumbnail('https://i.ibb.co/MBWytBw/Logo.png')
        .addField(`Total Guilds`, `${client.guilds.size}`, true)
        .addField(`Total Members`, `${client.users.size}`, true)
        .addField(`Total Channels`, `${client.channels.size}`, true)
        .addField(`Total Upvotes`, `${points}`, true)
        .setTimestamp()
        .setFooter('Developed By Plemso', 'https://media.tenor.com/images/7389b890146ecc93090ee967e954b7a8/tenor.gif');
#

That should work tho

#

1 sec

sullen nymph
#

What is dbl
What is points

restive otter
sullen nymph
#

Not send a request on each command invocation

restive otter
#

what should I do

sullen nymph
#

Have you ever read the docs, Eren

restive otter
#

points is supposed to display upvotes, https://gyazo.com/afea8da2d5a6650e56d53321f40352e5

That's the code:

    const infoEmbed = new Discord.RichEmbed()
        .setColor('#FF69B4')
        .setTitle('MegaPhone - BroadCast Messages')
        .setDescription(`MegaPhone is an interactive bot who can send alerts/broadcast and more. The bot has an active developer, and a support server (mb!support). The bot is currently in progress and soon to be finished.`)
        .setThumbnail('https://i.ibb.co/MBWytBw/Logo.png')
        .addField(`Total Guilds`, `${client.guilds.size}`, true)
        .addField(`Total Members`, `${client.users.size}`, true)
        .addField(`Total Channels`, `${client.channels.size}`, true)
        .addField(`Total Upvotes`, `${points}`, true)
        .setTimestamp()
        .setFooter('Developed By Plemso', 'https://media.tenor.com/images/7389b890146ecc93090ee967e954b7a8/tenor.gif');

That's how I defined dbl:

const DBL = require("dblapi.js");
const dbl = new DBL('my token', client);
#

I read but I couldn't :/

sullen nymph
#

@restive otter That's not a property of DBL

restive otter
#

Could webhook be the solution to use?

sullen nymph
#

Yes

restive otter
#

@sullen nymph What's not a property of DBL

#

Points?

sullen nymph
#

points

muted oar
#

Don’t webhooks still have ratelimits or a, I just being dumb

restive otter
#

Ok, how can I display total upvotes then?

muted oar
#

Am*

sullen nymph
#

Use getBot(id) that dblapi.js provides

#

Then the JSON returned will have the points key

restive otter
#

ok, will try

sullen nymph
#

@muted oar How are webhooks supposed to have ratelimits

muted oar
#

I’m being dumb mmLol

#

Also can someone reset my name to my username

sullen nymph
#

You don't send any API requests. Your webhook will get a POST request from DBL when someone votes for your bot

muted oar
#

It’s not hard to mention anymore

#

Thanks <3

restive otter
#

@sullen nymph
So, basically if I use js dbl.getBot("264811613708746752").then(bot => { console.log(bot.username) // "Luca" });
for example, then "points" will be defined?

sullen nymph
#

bot in that case will have points property

#

or, at least, should

restive otter
#

Ok, thanks, I will try it

#

@sullen nymph I am still getting error js ReferenceError: points is not defined

sullen nymph
#

Code

restive otter
#
    const infoEmbed = new Discord.RichEmbed()
        .setColor('#FF69B4')
        .setTitle('MegaPhone - BroadCast Messages')
        .setDescription(`MegaPhone is an interactive bot who can send alerts/broadcast and more. The bot has an active developer, and a support server (mb!support). The bot is currently in progress and soon to be finished.`)
        .setThumbnail('https://i.ibb.co/MBWytBw/Logo.png')
        .addField(`Total Guilds`, `${client.guilds.size}`, true)
        .addField(`Total Members`, `${client.users.size}`, true)
        .addField(`Total Channels`, `${client.channels.size}`, true)
        .addField(`Total Upvotes`, `${points}`, true)
        .setTimestamp()
        .setFooter('Developed By Plemso', 'https://media.tenor.com/images/7389b890146ecc93090ee967e954b7a8/tenor.gif');
#

That's the embed

sullen nymph
#

What's points

muted oar
#

^

restive otter
#

uhh, 1 moment

muted oar
#

Wouldn’t they have to move the embed inside getBot?

sullen nymph
#

Technically

restive otter
#

How do I vote with webhook

#

i read docs but i don't understand

#

Can give an example

#

discord.js

sullen nymph
#

You just vote

#

There's examples on dblapi.js GitHub repo

#

Even on the DBL docs

brisk basin
#

where i can give my bot @sullen nymph

sullen nymph
restive otter
#

I read but I couldn't D:

sullen nymph
#

What

#

couldn't what

restive otter
#

I couldn't make a vote with webhook

#

I mean I normally use hasVoted but how can I do it with webhook
I tried to do but did not

restive otter
#

I can't tell because I use translation :/

left egret
#

What's the issue with it

worn quail
#

dotpost

#

is saw dotpost

restive otter
#

(Correct TR: (doğru türkçe yazılış:) oy verildiği zaman webhook ile bir kanala atmasını nasıl sağlayabilirim?

#

it is not ^

#

(Turkish spelling: ( Demek İstediğim:) hasVoted kullanmak yerine webhook kullanmak istiyorum ama yapamadım, dbl.hasVoted(msg.author.id).then(voted => { if(voted) {
kodunu webhook ile çekilenden nasıl yapabilirim

left egret
scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

left egret
#

it's your bot client

arctic arch
#

are you supplying a client when your client variable is something else like bot for example

scarlet cobalt
#

One message removed from a suspended account.

left egret
#

add it on the constructor when you verified how you called it

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

left egret
#

it depends how you called it

scarlet cobalt
#

One message removed from a suspended account.

mellow reef
#

How long after a post to the api does it take for the site to update?

sullen nymph
#

Almost immediately most of the time

dawn fjord
#

However caching can take up to 30 minutes to update

old grail
#
const DBL = require("dblapi.js");
const express = require('express');
const app = express();
const http = require('http');
const server = http.createServer(app);
const dbl = new DBL("token", {
    webhookServer: server,
    webhookAuth: "passwordok"
}, bot);
dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
let votea = new Discord.RichEmbed()
 .setColor("GREEN")
    .setDescription(`📣 ${bot.users.get(vote.user).tag} just voted the bot! 📢`)
bot.channels.get('1234567890').send(votea)
});
dbl.on('posted', () => {
  console.log('Server count posted!');
})
dbl.on('error', e => {
 console.log(`Oops! ${e}`);
})```
anything wrong with my code? it's not working
dawn fjord
#

]]moreinfo

alpine pineBOT
#

If you want people to be able to assist you, please provide more information, such as what library and language you're using, the code in question and what you are trying to do and/or what is causing the error.

muted oar
#

@old grail what isn’t working?

#

Provide errors

#

Also 1234567890 isn’t not a valid channel ID

old grail
#

nothing responded.

#

@muted oar, no i just changed my channelID

muted oar
#

Why though not like it’s a private thing or anything someone can do something with

#

Anyway

#

Provide errors

old grail
#

no errors there, it didn't repond anything but it responded
{ server_count: 485, shards: [] } Server count posted!

#

when i clicked the "test" button

old grail
#

anyone help?

dawn fjord
#

just wait and be patient

ionic cairn
#

Hey can we DM pls I have some questions @dawn fjord

dawn fjord
#

If they're about the API, you should ask them here

ionic cairn
#

They arent

dawn fjord
#

ok

coarse marten
#

Could someone help me setting up a webhook server for votes?

azure pollen
#

..snipe

alpine pineBOT
#
agentcru#2922 (334025053538877442)

@Moderators - a few seconds ago

worn quail
#

Aaaa

azure pollen
#

@coarse marten why?

worn quail
#

ghost mod ping

azure pollen
#

why would you ghost ping the moderators?

worn quail
azure pollen
#

@coarse marten ??????

worn quail
#

eek

azure pollen
#

@worn quail if you're not here to help, stop filling the chat pointlessly

craggy sentinel
#

]]faq 10 -c

alpine pineBOT
worn quail
#

ok kyo-senpaiGWmiyanoPeek

rigid lichen
#

My bot doesn't want to send stats to dbl...

#

I use the postsStats method but the posted event is not triggered

#
// Post DBL stats
        const DBL = require("dblapi.js");
        const dbl = new DBL(this.client.config.dbl, this.client);
        dbl.postStats(this.client.guilds.size, this.client.shard.id, this.client.shard.count);
        dbl.on("posted", () => {
            client.logger.log("Server count posted to DBL!");
        });```
arctic arch
#

the event is for the autoposter

#

if you use the postStats method, await the promise

restive otter
#

s

winter spade
#

I've seen people use <iframe> for their description. How?

loud gulch
#

use it like you normally would

winter spade
#

But it says there isnt enough content

spiral steeple
#

when submitting a new bot you need 300 characters

#

I believe after that you can change it to an iframe without issue

cold ledge
#

Html and CSS

#

Not rly a question for here tho

wet seal
#

@wet seal

restive otter
#

vote.user returns an ID string right?

restive otter
#

anyone? is this a good place to ask a question about coding or how to get to the coding screen

spiral steeple
#

What?

fast cairn
#

me when im a coding screen

sullen nymph
#

@restive otter I might be late but yes, anything that would say user should be a string ID. If we're talking webhook vote data, that would be correct

restive otter
#

oh someone answered earlier, said that user returns an integer

#

so it’s a string for sure?

sullen nymph
#

Last time I checked, DBL only returns string IDs :p

spiral steeple
#

It's a string

sullen nymph
#

same about Discord

restive otter
#

ok

sudden rampart
#

discord returns ids as numbers if they're smaller than ~2^53

dark monolith
#

Hello i want ask QAQ

coarse marten
#

@dense compass could you help me setting up a Voting Webhook server?

dense compass
#

I've never set one up so probably not

coarse marten
#

ok... Who could help me with that?

dense compass
#

¯_(ツ)_/¯

coarse marten
#

...

#

@sullen nymph Could you help me?

sullen nymph
#

State the problem

coarse marten
#

The webhook server starts and runs but the vote event doesnt fire

sullen nymph
#

Are you sure your specified port is open and that your firewall is not blocking anything

coarse marten
#

It shouldnt

#

I am able to access the page without being in the same internet as the bot

sullen nymph
#

What about webhookAuth

coarse marten
#

They are the some

#

I copied them 5 times to each other

hollow wraith
#

does the api post to discord webhooks yet?

clever rock
hollow wraith
#

i think the biggest issue, is that sometimes people arent able to set up portfowarding and/or firewall rules to allow webhook servers.

civic plinth
#

AA portforwardnig!! Yes, that is a problem, many people (like me) suffer because of that (after years i worked it out lol)

hollow wraith
#

just curious why dbl doesnt support it

#

i have my own system that works with dbl directly, ill probably write an api for it. but its only used by a few people

clever rock
#

the more users you handle, the more load

#

the more load, the more expensive to maintain

#

it would be more cost effective to have them host their own webservers

spiral steeple
#

My dblapi module can mmulu

#

Wait no yes it does

spiral steeple
#

Also putting it directly into a webhook would negate a lot of stuff people do with votes (vote locking, vote rewards, etc.), so I doubt you'll ever be able to put a discord webhook directly into the webhook url space

#

And have it work*

restive otter
#

If i want to get when people vote do i just use a discord webhook or if not where do i get webhooks?

flint lava
#

How would you check if someone has voted for my bot in the last 12 hours?

#

Is it something like: user.voted: true?

worn quail
#

thats... very descriptive

#

what lang?

flint lava
#

Discord.js

worn quail
#

most likely as long as you have the right stuff done.

flint lava
#

Well The bot can receive votes, give people roles in support server and send a message if they vote

balmy hamlet
#

What lang?
Discord.js

That's such a nice lang!

spiral steeple
#

.js

#

If you cant tell the lang

#

Idk

#

He just gave more info

#

2 birds with 1 stone.

worn quail
#

kinda

#

but what dbl lib?

#

Hand made?

vernal quartz
#

Hi neko

sullen nymph
#

Wrong channel for chatting

vernal quartz
#

-_-

dawn fjord
#

@vernal quartz if you're told a channel is not for talking, don't keep talking

frosty kraken
#

Are vote webhooks working currently? I’m having no success

sullen nymph
#

works for me

ruby yarrow
sullen nymph
#

dbl.DBLClient

ruby yarrow
#

?

sullen nymph
#

Use dbl.DBLClient

ruby yarrow
#

I don't know what you mean
AttributeError: module 'dbl' has no attribute 'DBLclient'

#

oh ok I found this
classdbl.DBLClient(bot, token, **kwargs)

sullen nymph
#

So

ruby yarrow
#

I'm not sure

sullen nymph
#

Is any of your folders/files named "dbl"? No? Make sure your version is 0.3.2

#

Though, you were too vague by literally just saying "How to get the example to work?"

ruby yarrow
#

I just don't know how to use it

#

the example is too vague

sullen nymph
#

Well for an average user I'm fairly sure I don't need to explain what cogs are

ruby yarrow
#

fresh environment, fresh install, I copy pasted the example, added my token

sullen nymph
#

That's code for a separate cog file

#

That you later load as an extension in your bot's main file

ruby yarrow
#

hmm ok

sullen nymph
#

And it's not hard to rewrite it for single-file bot

ruby yarrow
#

my discord bot doesn't use extensions

#

I guess I'll be forced to

sullen nymph
#

Pretty much

ruby yarrow
#

so then how do I load it from discord bot?

ruby yarrow
#

the example cog is failing tho

#
ror: AttributeError: module 'dbl' has no attribute 'Client'```
ruby yarrow
#

fixed, i was using dbl.bot instead of dbl.client

ruby yarrow
#

@sullen nymph the dbl.py example is broken

#

Should be dbl.DBLClient not dbl.Client

balmy hamlet
worn quail
#

It's the api example

#

from the docs @balmy hamlet

#

I think

balmy hamlet
#

alright then those are outdated too

worn quail
#

Tru

dusk valve
#

It wont let me make a application for bots

#

How do i fix that?

worn quail
#

hhh

#

a mod ping for that?

restive otter
glass shell
restive otter
#

I want to say this password

spiral steeple
#

@restive otter webhookauth is set by you

#

It's a value you provide

#

In the edit page of your bot

dreamy bay
#

Hello I want to online my bot please?

runic grove
#

no

topaz wyvern
thorny parrot
#
const discordbotsorg = new DISCORDBOTSORG(config.discordbotsorg, bot);

This ain't sending my stats over?

spiral steeple
#

What lib MegaThonk

#

@thorny parrot

thorny parrot
#

dblapi.js

spiral steeple
#

Can you add

discordbotsorg.on('posted', () => console.log("posted"))
thorny parrot
#

See ya in 15 minutes ....

spiral steeple
#

It posts on start as well...

#

Or should

#

You should add a .on('error') too then

thorny parrot
#

oki still nothing in the log

hearty lintel
#

You added the on::error?

thorny parrot
#

Yup

#

Nothing

hearty lintel
#

Try and use the built in postStats method

#

And see if that gives any errors

wide sleet
#

. play senorita

hearty lintel
thorny parrot
#

That works I guess.

spiral steeple
#

Uh

#

The client must've been incorrect in some way

worn kiln
#

hi, please, i need help to enter a valide webhook in the informations of my bot, when i put a discord channel webhook it's said This webhook does NOT post messages to Discord channels. It is designed for use with your bot only.
and i don't know how to create other webhook

hearty lintel
#

Create a webhook server

#

Then when it posts send it to the discord webhook

worn quail
#

@worn kiln you need to self host a webhook

#

A webhook in web development is a method of augmenting or altering the behavior of a web page, or web application, with custom callbacks. These callbacks may be maintained, modified, and managed by third-party users and developers who may not necessarily be affiliated with t...

#

@worn kiln ^

worn kiln
#

ok that right, i have now a webhook, and place it in my bot's information

worn quail
#

No

worn kiln
#

now how do i grab request of the webhook in the bot code ?

worn quail
#

You need to self host one using a static IP

worn kiln
#

i have

worn quail
#

I'd google free webhook and constantly make requests to the ip of it

#

K

#

Now test it

worn kiln
#

i already

#

and he receive

worn quail
#

Alright stop giving your webhook pronouns

#

GWmroTooScary dont make it alivee

worn kiln
#

ok sry

#

alivee? xd

#

alive ?

#

no ?

#

xD

worn quail
#

yis

worn kiln
#

oke

#

so i have my webhook

worn quail
#

k

worn kiln
#

now how connect it* to my bot code ?

worn quail
#

Google "webhook recieved <lang>"

#

And search around and find one that works

worn kiln
#

🤔 i think that not what i'm searching

#

i actually test that

#

but that's not work

#

oh shit that work now xD

thorn iron
#

@abstract moth

#

-bots

abstract mothBOT
sudden notch
#

Hello

dense basalt
#

Ask the question

sudden notch
#

no problem

knotty fable
#

~~It's possible to execute function when user vote on discordbot ?

Because i want give a reward 🙂
(Mention me to respond plz)~~

Edit: okay i've read api's docs ^^"
Sorry i hadnt' seen the link

sly delta
#

new to discord

#

how do i join a specific server is there a link somewhere?

worn quail
#

what

karmic hound
#

probably the same way you joined this server Thonk

ruby yarrow
#

does that go under the class
class DiscordBotsOrgAPI(commands.Cog):?

worn quail
#

oooh do I see a s y n c

ruby yarrow
#

so the example is different from the docs says use

    async def on_dbl_vote(self, data):
        logger.info('Received an upvote')
        print(data)```
which is what ive been using
sullen nymph
#

@ruby yarrow yep, that goes under the class preferably for easier management of your stuff

ruby yarrow
#

ok that's how i have it like the example

sullen nymph
#

on_dbl_vote and on_dbl_test are different events

ruby yarrow
#

yes

sullen nymph
ruby yarrow
#

but i assume they're used the same way, since the example only shows one used

#

im just not getting anything from the test webhook on the edit bot page

sullen nymph
#

Yeah, they're events

#

The decorator should be the same

ruby yarrow
#
import discord
from discord.ext import commands
import asyncio
import logging


class DiscordBotsOrgAPI(commands.Cog):
    """Handles interactions with the discordbots.org API"""

    def __init__(self, bot):
        self.bot = bot
        self.token = '' # set this to your DBL token
        self.dblpy = dbl.DBLClient(self.bot, self.token)

    @commands.Cog.listener()
    async def on_dbl_test(self, data):
        logger.info('Received an upvote')
        print("dbl vote test")
        print(data)
        

def setup(bot):
    global logger
    logger = logging.getLogger('bot')
    bot.add_cog(DiscordBotsOrgAPI(bot))```
#

and im reveiving the webhooks (even tho they say 404 in ngrok, not sure what's up)

#

I'm able to pull get_bot_upvotes() fine

sullen nymph
#

Yep, that should be right

#

About the 404s, I've got no clue :p

ruby yarrow
#

well darn idk what's up then

#

ngrok is forwarding to localhost:80

ruby yarrow
#

is dbl on port 80?

sullen nymph
#

It sends you a request to the URL you put in

ruby yarrow
#

oh shoot...

#

nope

#

i mean dbl.py should be listening to a port?

sullen nymph
#

Are you using the built-in webhook

ruby yarrow
#

ohhhhhhhhhhh finally see it

#

self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)

#

hmm well now it's error 401

#

woowwww finally got it

#

authorization str was required on both sides

coarse marten
#

@dense grail Could you help me setting up the DBL vote webhook for javascript?

dense grail
#

@coarse marten use the api wrapper

coarse marten
#

It doesnt work for me 😢

#

I propably did something wrong

dense grail
#

@coarse marten leave your questions here and we'll try to help you blobthumbsup please avoid tagging random mods for help as not all mods know your language, and not only mods help out in this channel.

coarse marten
#

Yes I saw you have the Certified Developer role and thought you could be experienced with that

dense grail
#

@coarse marten not all cert devs use js tho

#

anyway, just leave your code here

coarse marten
#

Well thats weird managed it to work

restive otter
#

Are there some issues with the API right now?

sullen nymph
#

Such as?

restive otter
#

I tested the voting webhook and it took a few minutes for each vote to arrive at my bot.

#

I "voted" three or four times in a row and I just got dm'd about the third vote even though the first one is at least 5 minutes ago.

#

@sullen nymph any idea?

sullen nymph
#

Looks like API is a bit drunk rn

restive otter
#

aight

sullen nymph
#

I'd say wait a few minutes

restive otter
#

well

#

I already noticed it earlier today

#

like 8 hours ago I already voted

#

and it didn't arrive at all

sullen nymph
#

Hm

restive otter
#

just saying

sullen nymph
#

@restive otter 🤷 vote just came in

#

after 5 minutes, same about test

restive otter
#

alright

restive otter
#

ow do i put this URL? Is it mandatory for the bot to send who voted for it?

timid nexus
#

do dicsord.botumPut(url);

#

in the nuclear launch section of your code

idle sable
#

hey, is there any way to get the timestamp of a user's last vote without webhooks? or can you only get the true/false boolean from the API?

sullen nymph
#

Only the latter

idle sable
#

alright thanks

#

why does the endpoint show if someone voted in the last 24 hours if people can vote once every 12 hours

#

heck

loud gulch
#

docs hasnt been updated

spiral steeple
#

(Which is weird because it's been known for about a year)

#

Or feels that long now

idle sable
#

ohhh ok that makes a lot more sense

#

thanks y'all

#

wait so to be clear, the endpoint does return true if they've voted in the last 12 hours, not 24 hours

shell vale
#

Can i get mee6 bot? Please

restive otter
#

wrong channel and server buddy

restive otter
#

x

#

Bot Developer Role ?

#

And you need to wait

sullen nymph
#

@idle sable yep, it's 12 hours

idle sable
#

thanks

radiant willow
#

Please

#

Please, I want the bank bot.

dense basalt
#

What do you mean?

radiant willow
#

Does anyone speak Arabic?

#

I want the bank bot to go into my server and distribute salaries to customers.

sullen nymph
#

What says this channel is for asking help with any bot?

scarlet cobalt
#

One message removed from a suspended account.

boreal bridge
#

@river verge for example take a look at the vote event for the js library

#

Or the hasVoted method

river verge
#

yeah i did..... thx

boreal bridge
#

Np

restive otter
#

Bonjour, j'ai un problème avec l'api. Une personne peut-elle m'aider svp ? (Je pense que c'est moi qui n'ai pas compris)

#

Mon code :

#
const Discord = require('discord.js');
const client = new Discord.Client();
client.commands = new Discord.Collection();
const fs = require('fs');
const DBL = require('dblapi.js');
const express = require('express');
const http = require('http');

fs.readdir('./Commandes/', (error, f) => {
    if (error) { return console.error(error); }
        let commandes = f.filter(f => f.split('.').pop() === 'js');
        if (commandes.length <= 0) { return console.log('Aucune commande trouvée !'); }

        commandes.forEach((f) => {
            let commande = require(`./Commandes/${f}`);
            console.log(`${f} commande chargée !`);
            client.commands.set(commande.help.name, commande);
        });
});

fs.readdir('./Events/', (error, f) => {
    if (error) { return console.error(error); }
        console.log(`${f.length} events chargés`);

        f.forEach((f) => {
            let events = require(`./Events/${f}`);
            let event = f.split('.')[0];
            client.on(event, events.bind(null, client));
        });
});

const app = express();
const server = http.createServer(app);
const dbl = new DBL('tokenapidiscordbot', { webhookAuth: 'https://discordapp.com/api/webhooks/623042976259506176/P44Ffo53PK8aLmMOFWYqvmEiVU5V52nwtof17L8VKbyVJ9GD3ZWvlAlbuTDYVSmSloIS', webhookServer: server });

dbl.webhook.on('ready', hook => {
  console.log(`Webhook running with path ${hook.path}`);
});
dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});

app.get('/', (req, res) => {
  // ...
});

server.listen(5000, () => {
  console.log('Listening');
});

client.login(process.env.TOKEN);
#

In English: Hello, I have a problem with the API. Can someone help me, please? (I think I'm the one who didn't understand)
My code:

polar mirage
#

webhookAuth is the password you set on the edit page of your bot

#

You'll see it at the bottom of the page

restive otter
#

Ok @polar mirage

#

What should I put in URL ?

polar mirage
#

The url of your server

#

your hook.path basically

idle sable
#

does the bots/<bot.id>/check endpoint (to check if a user has voted in the last 12h) usually take up to 10 mins to update?

hearty lintel
#

Caching

idle sable
#

oh ok

hearty lintel
#

Best solution is to webhook rather than check

idle sable
#

yes I see that now

#

thanks will do

zealous steeple
#

Hi I need help

#

??

cosmic estuary
#

read the error

zealous steeple
#

Ik

cosmic estuary
#

its self explanatory

zealous steeple
#

I cant

#

I dont know how to

cosmic estuary
#

did u make the bot

zealous steeple
#

No

cosmic estuary
#

ok

#

go into ur settings in discord

sullen nymph
cosmic estuary
#

k

zealous steeple
#

where shall I ask about this then?

dense basalt
#

or actually, this can go into general

#

Not here, ask in general

cosmic estuary
#

ok

tepid temple
#

Necesito ayuda, alguien habla español?

worn quail
#

いいえ

glass shell
#

I expect I will need to use this channel soon, because I'm implementing the API :)

glass shell
#

Hm, I have it all set up, but it isn't changing the number of servers or its status.

#

Of course, all I am doing is creating a new instance of the class and giving it my client

alpine plaza
worn quail
#

Likely a new status by posting to the api endpoinys

glass shell
#

This... This truly is big brain time.

alpine plaza
#

Ikr

#

@worn quail I never knew this could be possible

slate saddle
#

Working on setting up webhooks for a djs bot. Trying to run some tests on a local machine but the requests arent coming through. Does the webhook system require a secure https connection or does standard http work?

#

If I create the query in postman and send it off to the same url it works but I'm not seeing any traffic using the test button in the api options on the website

boreal bridge
#

@slate saddle are you using the lib or doing it in another fashion

slate saddle
#

using the library

unreal lion
#

Can you show the code?

slate saddle
#

well I was using the library. Now im just running an express server to catch all traffic on the port i'm using and still not seeing anything

#

My port forward was successful because I can successfully query my public IP at the right port and see the results in express but I'm not receiving anything from discordbots.org

unreal lion
#

Stuff from the library doesn't get caught normally

slate saddle
#
const express = require('express');

const app = express();
const port = 5000;

app.get('*', (req, res) => {
  console.log('get');
  res.send('hello world!');
});

app.post('*', (req, res) => {
  console.log('post');
  res.send('htmm');
});

app.listen(port, () => console.log('Listening'));
#

this should be catching everything on the port

#
POST /dblwebhook HTTP/1.1
Host: **.***.*.**:5000
authorization: *********
Content-Type: application/json
Cache-Control: no-cache

{
    "foo": "bar"
}
#

I'm shooting off this http request and i catch it and this is basically the same request that the website should be sending

boreal bridge
#

And the endpoint you have on the site is correct?

slate saddle
#

wait I've figured it out

#

not including the / at the end breaks it

boreal bridge
#

👍

slate saddle
#

thats super weird tbh

#

but thanks for your help lol

ember turtle
#

@half sphinx dms!

rotund dune
#

need help with this

dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});

Error


/home/dominik/ModBot/index.js:22
dbl.webhook.on('vote', vote => {
            ^

TypeError: Cannot read property 'on' of undefined
    at Object.<anonymous> (/home/dominik/ModBot/index.js:22:13)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:188:16)
    at bootstrap_node.js:609:3
hearty lintel
#

This means you haven’t provided correct options for webhook server or port etc

rotund dune
#

@hearty lintel so what i do

#

i dont own a site

#

rn

hearty lintel
#

Well you don’t have to own a site but you do need to make the host accessible from the outside

rotund dune
#

@hearty lintel so i just give hostip:port

#

yes?

hearty lintel
#

Read the docs on how to do it then forward the server and add it in

rotund dune
#

i dont rly understand the dosc that why i come here

hearty lintel
#

If you don’t understand the docs chances are you don’t understand how to get everything even working on the outside. Further knowledge is what you need, not walkthrough support

rotund dune
#

@hearty lintel i mean i neved done that

#

that why

hearty lintel
#

Ok then you need to figure out how things work

#

We’re not gonna drag you along and direct you to everything to do.

rotund dune
#

where could i find how to creake a webhook>

hearty lintel
#

Google

rotund dune
#

oh

#

okay

restive otter
#

How do you make a bot? like Dyno

#

but no

worn quail
#

nani

restive otter
#

@worn quail sry xd

worn quail
#

wut

quartz harness
#

Hey guys, had a look through the API and I can't seem to find a field for when the user registered with discord?

#

Unsure if I'm looking at the wrong thing lmao

dense basalt
#

Do you mean the Discord API?

quartz harness
#

Yeah

dense basalt
#

If so, this channel is only for DBL's API

#

hot api

alpine pineBOT
leaden quiver
#

I can't get the api to work for me... It keeps saying "Install Error" when I try to install dblpy...

spiral steeple
#

what command did you run

#

@leaden quiver

leaden quiver
#

Wait, let me check...

#

@spiral steeple pip install dblpy

glass shell
#

Are you using 3.0 or whatever the 2.X version is

leaden quiver
#

3.7.4

glass shell
#

is there a difference between installing with pip for 2.X and 3.X?

#

if so, install the 3.X way

leaden quiver
#

Okay, I'll check...

#

Yep, that was the problem! Thanks so much! 😃

glass shell
#

you're welcome!

restive otter
#

What is the getaddrinfo error? Like why does it happen?

untold canyon
#

HI

dense basalt
#

hot api

alpine pineBOT
dense basalt
#

@untold canyon ^

stiff orchid
#

Hi I get AttributeError: module 'dbl' has no attribute 'Client'

#

when trying to use the post server count in python

worn quail
#

@stiff orchid DblClient

#

Caps may be off

#

But it was changed

stiff orchid
#

self.dblpy = Dbl.Client(self.bot, self.token)
NameError: name 'Dbl' is not defined

#

where are my spelling mistakes

#

in what line

#

oh yeah i changed that

#

and i just get AttributeError: module 'dbl' has no attribute 'Client'

glass shell
#

@stiff orchid I think it wants you to pass in self and self.bot?

#

nope, read the wrong part

#

sorry

sullen nymph
#

@stiff orchid dbl.DBLClient

restive otter
#

I use this code to make it work when a user votes:

'use strict';

const DBL = require("dblapi.js");

module.exports = async (client) => {
    let stats = new DBL(client.config.api_key.discord_bots, client);
    setInterval(function () {
        stats.postStats(client.guilds.size);
    }, 60000 * 10); // every 10 minutes
    let dbl = new DBL(client.config.api_key.discord_bots, { webhookPort: client.config.webhook_discordbots.port, webhookAuth: client.config.webhook_discordbots.password });
    dbl.webhook.on("vote", async (vote) => {
        let dUser = vote.user;
        dUser.send("**📨 | Merci d'avoir voté pour __Novus__ sur __Discord Bots__ !**").catch((err) => { });
        client.guilds.get('613327170298839061').channels.get("624675003266236427").send(`**:incoming_envelope: | Merci à ${dUser} d'avoir voté pour __Novus__ sur __Discord Bots__ ! > https://discordbots.org/bot/613339080658255895/**`)  
    });
}```

And when I test the system, no errors reach me in the system and it doesn't send to the text room concerned.

Port: 5001
near sparrow
#

Why ghost ping

amber dune
#

-m @restive otter ghostpinging mods | 1 week

abstract mothBOT
#

🤐 Muted Emmanuel#1411 (@bold herald)

cold ledge
#

Damn ghost ping ffs

craggy sentinel
near sparrow
#

Unless it was accidental, which I doubt

cold ledge
#

I was excited thinking someone @ me

near sparrow
#

IKR

#

Or he tagged us and realized his mistake idk

brisk scroll
#

Does the website go offline in the mornings

#

Looking back at my logs it says bad gateway assuming it went down

narrow zenith
#

the website's having a 500 error

brisk scroll
#

I mean is it everyday/constant

shrewd ginkgo
#

is there any reason automatic stats posting isn't working?

const dbl = new DBL(botAuth, { webhookPort: 4000, webhookAuth: whAuth, statsInterval: 2400000}, client);
sullen nymph
#

Not sure statsInterval exists

shrewd ginkgo
sullen nymph
#

Does the guild post event get emitted?

shrewd ginkgo
#

how would I check that?

sullen nymph
#

There should be an example where autopost would emit an event

shrewd ginkgo
#

oh this?

dbl.webhook.on('posted', () => {
  console.log('Server count posted!');
});
#

cause that never gets emitted

sharp sierra
#

unfortunately, my bot stops working after an hour. so i want someone to help me with some type of "restart code".

#

like you can restart using the console

#

but how can i do that in code

boreal bridge
sharp sierra
#

ok

brisk mountain
#

How to setup webhook?

boreal bridge
brisk mountain
#

@boreal bridge how to get auth for webhook?

boreal bridge
#

you make it

brisk mountain
#

What do you mean?

boreal bridge
#

you set it to be whatever you want it to be

#

its essentially a password

brisk mountain
boreal bridge
#

look at the url you sent

#

:ID

brisk mountain
#

I replace :ID with the id of bot?

#

Or do I keep the :

boreal bridge
#

replace it

brisk mountain
#

Thanks

restive otter
#
const dbl = new DBL("secretToken", { webhookPort: 5000, webhookAuth: 'secretPassword' }, client);
dbl.webhook.on('ready', hook => {
    console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
    client.db.query("INSERT INTO votes (user_ID, time) VALUES ('" + vote.user + "','" + new Date().valueOf() + "');");
    console.log(`User with ID ${vote.user} just voted!`);
});```

I have added this to my code but it is not working. What am I doing wrong. Or better question what am I not doing for the vote endpoint to work correctly?
boreal bridge
#

define not working

restive otter
#

well its not sending anything to the database and I am not getting a console.log of the user voting

boreal bridge
#

did you open the port

restive otter
#

do you mean port forwarding?

boreal bridge
#

yes

restive otter
#

i think I did it right

#

@boreal bridge yes I know it is now and its still not working

boreal bridge
#

@restive otter does the ready event get fired

restive otter
#

yes

#

this guy

boreal bridge
#

@restive otter not really sure what to say then

#

if you have configured everything correctly both on the site and in your code

#

and opened the desired port

restive otter
#

Im not either. I am very confused

boreal bridge
#

what token did you use for the DBLToken

restive otter
#

the token found in edit

boreal bridge
#

and the url and authorization are formatted correctly

#

?

restive otter
#

I believe so.. I added my own password and in the url I added the console url that pops up when the ready event fires

restive otter
#

So, basically... I used this:

        dbl.getVotes().then(votes => {
    if (votes.find(vote => vote.id === `${message.author.id}`)) message.channel.send(message.channel.send(factEmbed))
        else message.channel.send(votelockEmbed)

But after voting it still sends the votelockEmbed. I have to restart in order for it to start sending the factEmbed... What should I do?
https://gyazo.com/669a27aa04e9af99f6f24a7d4e00b18d

#
message.channel.send(message.channel.send(factEmbed))```
nimble fossil
#

If the command is for 24 hours... why not use hasVoted(id)

inner venture
#

yeah, that method is ridiculously inefficient

restive otter
#

yeah, I'm changing that

#

I will use that from now on js dbl.hasVoted(message.author.id).then(voted => { if (voted) message.channel.send(factEmbed) else message.channel.send(votelockEmbed) });

restive otter
#

Now it's not working at all

civic mirage
#

/weekend

spiral steeple
#

tfw client mods

untold marten
#

?

#

@spiral steeple

grim dew
#

ugh

#

discord.py needs an argument in the message Object to tell apart if the message has been sent on desktob, web or mobile

sullen nymph
#

Uhh no?

runic grove
#

FOR CHATTING ABOUT GENERAL TOPICS

worn quail
#

WHAT CYBER SAID

dense basalt
#

Guys, please

#

hot api

alpine pineBOT
worn quail
#

ok timo

restive otter
#

How can I get an authorization for the webhooks ?

#

I think I just give a random password

boreal bridge
#

@restive otter correct you create the autorization

restive otter
#

😁

mild oyster
#

So uh, using dblpy, when doing await self.dblpy.post_guild_count() I get dbl.errors.Forbidden: Forbidden (status code: 403). Is my token fucky or what am I missing?