#topgg-api

1 messages Β· Page 41 of 1

late prawn
#

skiddadle skadoodle your dick is now a noodle

topaz wyvern
#

why is this in api

inland wren
#

I am trying to post the server count to my bot from a test bot and getting a Forbidden (status code: 403) error, is this because I am using a different bot?

topaz wyvern
#

incorrect and/or no token provided iirc

inland wren
#

i checked everything and it seems correct

#

hmmm

#

i even regenerated

restive otter
#

yes its because you are using a different bot

#

you post to a stats endpoint and the url includes the bots id

#

if it doesnt match your token

#

then it wont work

sudden rampart
#

you can just drop the id from the url

restive otter
sudden rampart
#

and use the proper token

#

each bot has it's own dbl token

inland wren
#

oh ok, that's what I thought at the first place

#

thanks!

fringe remnant
#

Oof

neat bolt
#

Are web hooks down?

plain timber
#

lemme check

#

@neat bolt nope

neat bolt
#

hm

shut ibex
#

@plain timber can u do smth for me

#

can u updoot my bot

#

I need to check if my upvote thing if bork

plain timber
#

press test button u meme

shut ibex
#

I block test requests

plain timber
#

oof

shut ibex
#

one min

neat bolt
#

it doesnt work for me tho

plain timber
#

maybe its ur code?

shut ibex
#

fuck

neat bolt
#

it was working last week but it isnt now

#

but ima go look over

shut ibex
#

and I borked my code

plain timber
#

rip

shut ibex
#

there I fix

#

can u test

#

was listening on wrong port

#

@plain timber

plain timber
#

ytho

shut ibex
#

cus

#

test votes go through

#

idk if real ones do

plain timber
#

o

#

link?

shut ibex
plain timber
#

@ thonkku beep tortle is ADVERTISING pls BEAN him kthx

shut ibex
#

wow

plain timber
shut ibex
#

thank it went through

#

u have premium on me bot for 48 hours but it doesnt do anything yet

plain timber
#

lol

shut ibex
#

and i ask you for a favor and you treat me like this

plain timber
#

i just give a role + message in the official server

shut ibex
#

I give 4 commands

#

3 include music

plain timber
#

inb4 ping, help, about, and donate

shut ibex
#

I'll also gib role

terse nebula
#

AttributeError: 'Client' object has no attribute 'post_guild_count' someone explain

copper vapor
#

My bot joined two bot farms yesterday

terse nebula
#

can i has link plz

copper vapor
#

Link for wut

#

Crap wrong channel sowwy

terse nebula
#

Failed to post server count
Unauthorized: Unauthorized (status code: 401): {"error":"Unauthorized"}
Traceback (most recent call last):
  File "C:\Users\no name\Desktop\UltraBot\bot.py", line 76, in update_stats
    await self.dblpy.post_server_count()
  File "C:\Users\no name\AppData\Local\Programs\Python\Python36\lib\site-packages\dbl\client.py", line 100, in post_server_count
    await self.http.post_server_count(self.bot_id, self.guild_count(), shard_count, shard_no)
  File "C:\Users\no name\AppData\Local\Programs\Python\Python36\lib\site-packages\dbl\http.py", line 189, in post_server_count
    await self.request('POST', '{}/bots/{}/stats'.format(self.BASE, bot_id), json=payload)
  File "C:\Users\no name\AppData\Local\Programs\Python\Python36\lib\site-packages\dbl\http.py", line 158, in request
    raise Unauthorized(resp, data)
dbl.errors.Unauthorized: Unauthorized (status code: 401): {"error":"Unauthorized"}
``` help
cyan ruin
#

do you even token

#

i mean

#

are you using token and correct id

terse nebula
#
    def __init__(self, bot):
        self.bot = bot
        self.token = its correct no worries
        self.dblpy = dbl.Client(self.bot, self.token)
        self.bot.loop.create_task(self.update_stats())```
#

am i doing anything wrong?

weary ember
#

not ur bot token ur dbl token

cyan ruin
signal smelt
#

self.bot

cyan ruin
#

selfbot

#

yes

terse nebula
#

yes, my dbl token

shut ibex
#

your dbl token isn't your bot token

terse nebula
#

i am aware of that

#

i got the token from discordbots

shut ibex
#

What link are u posting to

terse nebula
#

idk, i'm using the api

placid mist
#

hey

#

i try to do a webhook

#

how i can get Post request GWsetmyxPeepoWeird

weary ember
#

what coding lang @placid mist ?

placid mist
#

PHP

weary ember
#

isnt php frontend?

placid mist
#

it's php

#

anny information was provided in $_POST variable

weary ember
#

i dont do php sowwy

placid mist
arctic arch
#

@placid mist it sounds like you know already

placid mist
#

No

#

i don't know how to do

#

but nothin in $_POST

arctic arch
placid mist
#

$_POST is an array

#

I do not understand anything GWsetmyxPeepoWeird

#

i try $_POST["user"] first

arctic arch
placid mist
#

oh tank

#

I learned something thank you very much

rigid crater
#

is dere such a function like dbl.totalVotes?

#

??!?!?!?!

loud gulch
#

read the docsβ„’

topaz wyvern
#

I just said

#

Read the docs

rigid crater
#

ok if my net will handle this

#

πŸ˜„

topaz wyvern
#

If you internet can handle discord it can handle docs

#

Discord

#

Fuck

rigid crater
#

actually thats kinda smooth

#

now lemme read docs

dusky rampart
restive otter
#

I don't understand webhooks ( I want to use the npm module dblapi.js )

#

plz :v

#

And of course I don't understand what it say in the api > webhooks

ocean patrol
#

Was wondering why DiscordBotListAPI#getVoters(String) is deprecated?

#

in the Java library

restive otter
#

It's not my faut, explain me instead of saying that

loud gulch
#

@terse nebula what

#

you cant tell him that

terse nebula
#

well thats what everyone tells me

loud gulch
#

dbl webhooks are different from bots

terse nebula
#

o

topaz wyvern
#

i dont even know how to do weebhooks

#

i guess i shouldnt make bots

terse nebula
#

point taken

#

Question: When posting to the API, it is considered good practise to return a 204 instead of a 200.

#

Why is it returning a 200?

ocean patrol
#

return 204 if the request was successfull and you have nothing to reply back with

sacred path
#

I`ve generated a Token and used the Code from the API Docs but i always get 403 Error "unauthorized"

lilac summit
#

Send your code @sacred path

sacred path
#

i only inserted the token where i should do

lilac summit
#

You're using Python ?

sacred path
#

yes

lilac summit
#

I'm using JS so I don't know how to help u. Sorry bro

sacred path
#

nvm... regenerated token again now it works

lilac summit
#

🀷

sacred path
#

first 3 tokens wont work xD now this one works

lilac summit
#

Lol

lilac summit
#

I don't understand how to set up a webhook with DBL πŸ€” Can someone explain me please ? (JavaScript)

tepid garden
#

do i need to install anything for webhooks

#

i want to make a daily command that requires them to upvote the bot

topaz wyvern
#

Just do a check to see if they voted?

#

Why make a we hook?

#

Webhook*

terse nebula
#

What's to stop someone from forging fake POST information to boost stats

topaz wyvern
#

Nothing afaik, person does get on trouble if caught though

terse nebula
#

mk

elfin solstice
#

well you can't really be 100% sure they post accurate data but you know when they extremly ovverrate the bot like when a bot with 2 commands has 50k servers they probaly wanna see proof and if they caught you get in big trouble

plain timber
tepid garden
#

but i wanted the daily to be auto without me having to check every minute

plain timber
#

@topaz wyvern webhooks are recommended, using the api to check for votes can lead to api spam and also you cant automatically give rewards

tepid garden
#

how do i use webhooks

topaz wyvern
#

Oh

tepid garden
#

how do i use webhooks?

copper vapor
#

^

tepid garden
#

^

#

php

#

?

plain timber
#

@tepid garden what language do you use for your bot

tepid garden
#

javascript

plain timber
tepid garden
#

do i need to install anything?

plain timber
#

on your computer or on your server

tepid garden
#

the computer and server

plain timber
#

if you haven't already installed dblapi.js through npm on your server, you'll have to

#

npm install dblapi.js

tepid garden
#

ok

#

so with this const DBL = require('dblapi.js'); const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' }); dbl.webhook.on('ready', hook => { console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`); }); dbl.webhook.on('vote', vote => { console.log(`User with ID ${vote.user} just voted!`); }); i would put it in the bot.on('message', message => {//stuff in there})

plain timber
#

no

#

not on message

tepid garden
#

?

#

so just at the top?

plain timber
#

what do you want it to do

#

cuz the example code will just log that someone voted

tepid garden
#

i want to make a daily command with it

plain timber
#

so when they use the command it will check if they voted?

tepid garden
#

yea

plain timber
#

then you would need to add an entry to your database when someone votes

#

and check it when someone uses the command

tepid garden
#

i dont have a data base 😭

plain timber
#

they you cant make a command use the webhooks

#

you could just use the check endpoint but thats not really recommended

tepid garden
#

well then how would i do it :b

#

how to i get my bots token

#

thats all i need to know

copper vapor
#

Your dbl token?

tepid garden
#

yea

copper vapor
#

Under api on the website click you bots and click create api token

tepid garden
#

how do i get the pass

#

i have 2 more questions how do i get the pass and do i put the dbl token in " "

plain timber
#

@tepid garden the pass is only for webhooks, its whatever you set as the webhook auth in your edit page

tepid garden
#

oh...

grim stirrup
#

how can i run my bot 24/7?

austere swallow
#

you run your bot on a server, and also these type of questions should do to #development and not here

late prawn
last cedar
#

how to i attach my dbl bot webhook to glitch?

topaz wyvern
#

@late prawn Stop sending memes here

tidal burrow
#

what's the point in saying that after they stopped over 6 hours ago facepalm

#

you are only attracting more unwanted attention

topaz wyvern
#

My bad, didn't notice

#

Thought they just sent it

polar mirage
#

Hello good sirs

#
const Eris = require('eris');
const bot = new Eris(CLIENT_TOKEN);
const DBL = require("dblapi.js");
const dbl = new DBL(DBLKEY, bot);
#

Will that work?

#

Can I use eris with dblapi?

#

If no one answers I'll asume yes

#

If it doesn't work I'll spank yall

arctic arch
#

that should work yes

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

Is this posting automatically when bot is added to server? Or I need to setup an interval to do this even X hours?

arctic arch
#

if you have your bot client passed to the DBL constructor, the library will post automatically
That event will notify you of successful posts and is optional

pliant shell
#
const Discord = require("discord.js");
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL('123123123', client);

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

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


client.login('123123123');

I did like this, should be correct, right?

arctic arch
#

yes

civic harbor
#

what exactly is a webhook?

#

i just want to use the vote listener

#

can i just use any url, eg. my bot's website as the webhook url so i can get info within my bot to see whenever someone voted?

arctic arch
#

if you set up a listener in your website

civic harbor
#

o

#

so is there anyway to do this without setting up a listener on any site

plain timber
#

@civic harbor all you need to do is receive a POST request on the endpoint, if you are using JS you can use the official dblapi.js library and it will receive the requests for you

civic harbor
#

I am using js

#

and the npm package

#

i tried

#
const DBL = require('dblapi.js');
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});
#

and i replaced yourDBLTokenHere with my api key

#

however, i did not get anything when someone voted

plain timber
#

did you set the URL and auth in your bot's edit page?

civic harbor
#

um no

#

what URL do i set tho

plain timber
#

what did it console.log

civic harbor
#

it logged some url

#

do i use that?

plain timber
#

yes

civic harbor
#

oh okay

plain timber
#

but

#

did it have 0.0.0.0?

civic harbor
#

yes

plain timber
#

change that to the ip/domain of your server

civic harbor
#

so like my ip address?

#

do i just leave the port the same?

#

well thanks for your help

restive otter
#

webhooks not working for anyone?

polar mirage
#

Yes

restive otter
#

oof

polar mirage
#

spam tonkku

arctic arch
#

you only need the id, not the url

#

with getVotes you can only get the latest 1000

#

use .length

#

it's an array, not a collection

simple owl
#

wouldn't it be like total votes though

shut ibex
#

I literally says webhook url

arctic arch
#

why do you need that

#

it's not a part of the api

high marten
#

Serkan is my girl

pliant shell
#

Why this DBL library uses a lot of CPU for basic script? There are only 5 lines of code

#
const Discord = require("discord.js");
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL('123123123', client);

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

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


client.login('123123123');
shut ibex
#

I don't even think that the reason

arctic arch
#

are you sure its the dbl library

#

maybe its d.js

#

processing all your events

tough stream
#

Any idea on how to post images in on your bot page in HTML or Markdown while resizing them?

The current way i've been using on all my pages in HTML (as show below) doesn't resize the image like it does on github for some reason

#

btw that's not a line, it's my cursor

terse nebula
#

Could you use a style thingy? style="height:200px" or something

robust olive
#

how come my bot is saying it has 1 upvote this month and 5 total, but /bots/328904846541586432/votes returns an empty array thonk3D

restive otter
#

because dbl

restive otter
#

What with

#

This is for dbl api

#

For code

#

πŸ˜‚

sacred path
#

okay now its anoying... i always get an Unauthorized Error from the Api and couldnt figgure out whats wrong

#
Forbidden: Forbidden (status code: 403): {"error":"Forbidden"}
Traceback (most recent call last):
  File "/home/noir/moderation/modules/dblapi.py", line 25, in update_stats
    await self.dblpy.post_server_count()
  File "/home/noir/.local/lib/python3.6/site-packages/dbl/client.py", line 100, in post_server_count
    await self.http.post_server_count(self.bot_id, self.guild_count(), shard_count, shard_no)
  File "/home/noir/.local/lib/python3.6/site-packages/dbl/http.py", line 189, in post_server_count
    await self.request('POST', '{}/bots/{}/stats'.format(self.BASE, bot_id), json=payload)
  File "/home/noir/.local/lib/python3.6/site-packages/dbl/http.py", line 160, in request
    raise Forbidden(resp, data)
dbl.errors.Forbidden: Forbidden (status code: 403): {"error":"Forbidden"}
tiny nebula
#

what the fuck do you expect from us

#

magically fix your credentials

sacred path
#

Hum πŸ˜„ first i only want to moan a bit =D

actally im not understanding why this happens
i generated a new token, and i only use the example from
https://discordbots.org/api/docs#pylib

#

nothing else just the server count

terse nebula
#

Would help if you post your code

sacred path
#
import logging

import dbl

from misc.config import cfg


class DiscordBotsOrgAPI:
    """Handles interactions with the discordbots.org API"""

    def __init__(self, bot):
        self.bot = bot
        self.token = 'TOKEN HERE'
        self.dblpy = dbl.Client(self.bot, self.token)
        self.bot.loop.create_task(self.update_stats())
        print('Addon "{}" loaded'.format(self.__class__.__name__))

    async def update_stats(self):
        """This function runs every 30 minutes to automatically update your server count"""

        while True:
            logger.info('attempting to post server count')
            try:
                await self.dblpy.post_server_count()
                logger.info('posted server count ({})'.format(len(self.bot.guilds)))
            except Exception as e:
                logger.exception('Failed to post server count\n{}: {}'.format(type(e).__name__, e))
            await asyncio.sleep(1800)


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

its the absolut basic example from the Page

terse nebula
#

You're using rewrite?

thorny parrot
#

So, supernoob question incoming: how do I add the auth token? lmao

    let options = {
        url: 'https://discordbots.org/api/bots/432533456807919639',
        Authorization: 'token'
    }

    https.get(options, (resp) => {
#

What's wrong?

restive otter
#

just guessing, but probably

{
     url: 'https://discordbots.org/api/bots/432533456807919639',
    headers: {
             Authorization: 'token'
    }
}
restive otter
#

wut

#

yes

#

whats may be your code sir

restive otter
#

Any way I can check if a user has voted, via API?

mystic wing
#

Webhooks preferably or hasvoted

#

@restive otter

rose zealot
#

my bot gives a error about api and websockets how i need to fix?

restive otter
#

you fix it

rose zealot
#

how

#

you want the error?

restive otter
#

yes

shut ibex
#

I can sue

topaz wyvern
restive otter
#

whoops

turbid jasper
#

Where i can get dbl token?

topaz wyvern
rose zealot
#

How to fix websockets error?

restive otter
#

@rose zealot

restive otter
loud gulch
#

reposting isnt going to get you help faster

#

its just stupid

restive otter
#

huh

#

well just an fyi no offtopic conversation so

#

no one likes a smartass either GWbowsuBlobGuns

loud gulch
#

ok

plain timber
#

@restive otter whats your code

restive otter
#

ok i am using python and aiohttp

header = {"Authorization" : config["dbltoken"]}
            payload = {"server_count"  : len(self.guilds)}
            baseurl = "https://discordbots.org/api/bots/501191721456107531/stats"
            await self.change_presence(activity=discord.Activity(name=f".help in {len(self.guilds)} Servers!", url="https://www.twitch.tv/EnterNewName",type=1))
            async with aiohttp.ClientSession() as session:
                await session.post(baseurl, data=payload, headers=header)```
#

its not giving any errors when i did try except

plain timber
#

try using the official lib

restive otter
#

alright

plain timber
restive otter
#

i would rather use aiohttp but ok

#

Guys, what affects the value of mfa_level for a guild?

#

btw how long does it take to post stats

lunar tide
#

i tried doing


dbl.hasVoted(`${message.author.id}`).then(voted => {
    if (!voted) return message.channel.send(`Hey! Please Vote For Us To Use This Command! [**Click Here**](https://discordbots.org/bot/469385784042979328/vote)`);
});

but it keeps saying dbl.hasVoted is not a faction

0|index  | TypeError: DBL.hasVoted is not a function
0|index  |     at Query.con.query (/root/dbot/commands/hentai.js:152:5)
0|index  |     at Query.<anonymous> (/root/dbot/node_modules/mysql/lib/Connection.js:502:10)
0|index  |     at Query._callback (/root/dbot/node_modules/mysql/lib/Connection.js:468:16)
0|index  |     at Query.Sequence.end (/root/dbot/node_modules/mysql/lib/protocol/sequences/Sequence.js:83:24)
0|index  |     at Query._handleFinalResultPacket (/root/dbot/node_modules/mysql/lib/protocol/sequences/Query.js:139:8)
0|index  |     at Query.EofPacket (/root/dbot/node_modules/mysql/lib/protocol/sequences/Query.js:123:8)
0|index  |     at Protocol._parsePacket (/root/dbot/node_modules/mysql/lib/protocol/Protocol.js:278:23)
0|index  |     at Parser.write (/root/dbot/node_modules/mysql/lib/protocol/Parser.js:76:12)
0|index  |     at Protocol.write (/root/dbot/node_modules/mysql/lib/protocol/Protocol.js:38:16)
0|index  |     at Socket.<anonymous> (/root/dbot/node_modules/mysql/lib/Connection.js:91:28)
0|index  |     at Socket.<anonymous> (/root/dbot/node_modules/mysql/lib/Connection.js:502:10)
0|index  |     at Socket.emit (events.js:182:13)
0|index  |     at Socket.EventEmitter.emit (domain.js:442:20)
0|index  |     at addChunk (_stream_readable.js:283:12)
0|index  |     at readableAddChunk (_stream_readable.js:264:11)
0|index  |     at Socket.Readable.push (_stream_readable.js:219:10)
``` any ideas?
solid owl
#

define dbl

lunar tide
#

Oh i did it was the wrong error

0|index  | TypeError: dbl.hasVoted is not a function
0|index  |     at Query.con.query (/root/dbot/commands/hentai.js:152:5)
0|index  |     at Query.<anonymous> (/root/dbot/node_modules/mysql/lib/Connection.js:502:10)
0|index  |     at Query._callback (/root/dbot/node_modules/mysql/lib/Connection.js:468:16)
0|index  |     at Query.Sequence.end (/root/dbot/node_modules/mysql/lib/protocol/sequences/Sequence.js:83:24)
0|index  |     at Query._handleFinalResultPacket (/root/dbot/node_modules/mysql/lib/protocol/sequences/Query.js:139:8)
0|index  |     at Query.EofPacket (/root/dbot/node_modules/mysql/lib/protocol/sequences/Query.js:123:8)
0|index  |     at Protocol._parsePacket (/root/dbot/node_modules/mysql/lib/protocol/Protocol.js:278:23)
0|index  |     at Parser.write (/root/dbot/node_modules/mysql/lib/protocol/Parser.js:76:12)
0|index  |     at Protocol.write (/root/dbot/node_modules/mysql/lib/protocol/Protocol.js:38:16)
0|index  |     at Socket.<anonymous> (/root/dbot/node_modules/mysql/lib/Connection.js:91:28)
0|index  |     at Socket.<anonymous> (/root/dbot/node_modules/mysql/lib/Connection.js:502:10)
0|index  |     at Socket.emit (events.js:182:13)
0|index  |     at Socket.EventEmitter.emit (domain.js:442:20)
0|index  |     at addChunk (_stream_readable.js:283:12)
0|index  |     at readableAddChunk (_stream_readable.js:264:11)
0|index  |     at Socket.Readable.push (_stream_readable.js:219:10)
#

please tag me if you can help

solid owl
#

I canΒ΄t help sry

lunar tide
#

:C

plain timber
#

@lunar tide can you show the code where you defined dbl

lunar tide
#

ye

#
const DBL = require("dblapi.js");
const dbl = new DBL("CODE", { webhookPort: 56571, webhookAuth: '**********' }, client);

i have that in my main file

then

commandfile.run(client, message, args, con, cmd, DBL, dbl, errors);

in the main file to

module.exports.run = async(bot, message, args, con, dbl, DBL) => {

in a command file

#

then this

dbl.hasVoted(`${message.author.id}`).then(voted => {
    if (!voted) return message.channel.send(`Hey! Please Vote For Us To Use This Command! [**Click Here**](https://discordbots.org/bot/469385784042979328/vote)`);
});

in the command file

#

@plain timber

plain timber
#

are you on the latest version of dblapi.js?

lunar tide
#

yup

#

let me make sure

plain timber
#

what if you console.log(dbl)

lunar tide
#

it gives me the prefix and command name :/

0|index | !testfile
#

nvm i fixed it @plain timber sorry to bother

restive otter
#

where did the webhook documentation go?

#

i found it, but why is it not easily accessible on the docs page?

topaz wyvern
#

what lang

restive otter
#

English

inner venture
restive otter
#

yeah i found that eventually through the bot edit page

#

but it doesn't show on the left menu bar

inner venture
#

It's right on the API docs page

restive otter
#

what

#

where

inner venture
restive otter
#

i don't see that

#

Firefox v63.0 (64-bit), 13 inch screen size

#

too far down

inner venture
#

can you screenshot the page

#

@restive otter

restive otter
#

from intro

#

unable to scroll down

inner venture
#

@arctic arch

#

Do you have the site on like 150% scale @restive otter

restive otter
#

no

#

i can only see it after switching to 80% scale

inner venture
#

kk

arctic arch
#

@azure pollen

inner venture
#

down the chain it goes

restive otter
#

thanks

arctic arch
#

you should know I dont frontend lol

inner venture
#

shrug

#

what I did know is that you would get it to the right person :^)

loud bolt
#

Hey

#

Collection#find: pass a function instead

#

What Is This?

solid owl
#

Is there any way to send an image when a user enters the server of discord? my bot is created in discord.js

loud bolt
#

Yes @solid owl

#

Δ°I know this code

solid owl
#

the code is ?

loud bolt
#

Look Dm

#

And Wait Me

#

Oh

#

Sorry

#

Im forgot get the code

#

And server closed

solid owl
#

:/

loud bolt
#

Sorry Man

#

:/

#

You know Collection#find: pass a function instead

#

Error

#

Bot working

sullen nymph
#

Your error doesn't belong to this channel

loud bolt
#

Ok

sterile tendon
#

The api of dbl have bug?

sullen nymph
#

What kind of bug?

jade pebble
#

a flying bug

wary ether
#

A ladybug 🐞

subtle linden
#

πŸ€”

novel carbon
#

Why does the API keep rejecting my request to post my bot's server count?

#

I send a POST request to https://discordbots.org/api/bots/botid/stats

#

with the headers

#

Authorization: token

restive otter
#

Check the response?

novel carbon
#

Response is 401

#

I really need to post my server count

#

@civic vapor

restive otter
#

401 = Unauthorized

novel carbon
#

ik

restive otter
#

Your token isn't right

novel carbon
#

Is it that Im not using the correct token?

#

kk

#

It worked.

#

Ty for ur help

#

I made my own API wrapper

#
grand wind
#

!play Caught my a rythem

novel carbon
#

h!play Nobody Can Save Me

#

h!stop

#

My code:

#
require('snekfetch').get(`https://discordbots.org/api/users/242734840829575169`)
    .then(r => {
      const body = JSON.parse(r.body)
      console.log(body.username)
    })```
#

@amber dune

#

It gives me this:

#
(node:379) UnhandledPromiseRejectionWarning: Error: 404 Not Found
    at _response.transport.request.then (/home/runner/node_modules/snekfetch/src/index.js:193:21)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:182:7)
(node:379) 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: 2)
(node:379) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
amber dune
#

seems to be working for me πŸ‘€

novel carbon
#

brb

amber dune
#

also i dont know node

shut ibex
#

@amber dune what lang do u use weeb

amber dune
#

java

#

@shut ibex

shut ibex
#

weak

amber dune
#

says the person using a fad language mmLol

shut ibex
#

go is not a fad lang

quaint bramble
#

@novel carbon

#

imo just use request / html

#

and promisify it yourself

#

or require('util').promisfy(function);

shut ibex
#

snekfetch is deprecated

novel carbon
#

it still works

loud gulch
#

but its recommended you dont

#

sooner or later it will break

arctic arch
fallow stirrup
#

oh sorry will change it

restive otter
#

So, I got my bot approved earlier today, but when I try to post my server count I get a 403 forbidden error, and I'm not sure why. Anyone got any idea? (I'm using Python), and I basically copied the layout that is on the website (as a cog) and just pasted my API key (token) into the code

azure pollen
#

try regen

restive otter
#

still 403

#

Token is wrong.

#

Hm

azure pollen
#

u don did a gooferino somewhere down the line

restive otter
#

but it looks fine 😩

#

Well 403 is forbidden

#

Which means the server acknowledges your request but it rejects it

wary ether
#

Has your bot been approved?

#

Maybe you've been ratelimited

restive otter
#

It has been approved

#

could I get the API token otherwise?

#

I can't see what I could do wrong

wary ether
#

Weird.

#

I don't code in py so I can't help you with the code

restive otter
#

wouldn't rate limit be another type of exception anyways

#

not 403 forbidden

#

@azure pollen This doesn't look too goofed up does it?

azure pollen
#

i dont python

#

sorry frendo

restive otter
#

fek

azure pollen
#

@arctic arch doesnt' python

#

but he might know the issue

restive otter
#

I'll dig some in the API wrapper then

#

see if I can find anything

#

lol ok

#

@azure pollen Ok, so I found the issue, and the "Python Library" example might want to be updated

azure pollen
#

pong tonkku

#

i am not lib dev

restive otter
#

Alright

#

The reason for the 403 Forbidden error:

So, what happened was, when you initialize the dbl client, it will wait until the bot is done with setting up (in the dbl lib for python, there is a method waiting for this, before assigning the id), before it assigns the bots id to one of it's attributes (in the Python lib it's bot_id).

And while the client is waiting for this id, the code will continue, and the bot's loop will create the self.update_stats() task in the example, and try to post the server count, when the bot's id, and server count for that matter have not been registered yet.

So the reason for the error is because the bot_id value is None, when you try to make the POST request. So by just waiting for 30min it will actually work, but on startup you will get an error, unless you add a line of code in the update_stats() method

@arctic arch

#
class DiscordBotsOrgAPI:
    """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.Client(self.bot, self.token)
        self.bot.loop.create_task(self.update_stats())

    async def update_stats(self):
        """This function runs every 30 minutes to automatically update your server count"""

        """Add this line here so it won't attempt to post before the dbl client is properly set up"""
        await self.bot.wait_until_ready()

        while True:
            logger.info('attempting to post server count')
            try:
                await self.dblpy.post_server_count()
                logger.info('posted server count ({})'.format(len(self.bot.guilds)))
            except Exception as e:
                logger.exception('Failed to post server count\n{}: {}'.format(type(e).__name__, e))
            await asyncio.sleep(1800)


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

@azure pollen Is there any API related feature that makes the bot show as "online" on the website, or how is that done?

#

As my bot is online, but with a grey mark with 3 questionmarks

#

on the website that is

azure pollen
#

ping tonkku

#

i said already

restive otter
#

This was another question though

arctic arch
#

@restive otter did you just ping me with a solution

restive otter
#

Yes.

arctic arch
#

and the status comes from this server

restive otter
#

oh it does?

#

Yeah I gave you a brief explanation of the problem, and the solution

#

Dug around in the Python lib and found the flaw so, not sure if others have experienced it

sullen nymph
#

I am pretty sure dblpy already does that

arctic arch
#

ah the python lib is made by francis but idk if they're in this server anymore

restive otter
#

I tested it myself. When the first request was made, the bot_id didn't exist in the dbl client

#

because the bot wasn't done setting up

#

so if you try to post the server count before it is done setting up, there will be issues

#

aka the __ainit__ method

#
class Client:
    def __init__(self, bot, token, **kwargs):
        self.bot = bot
        self.bot_id = None
        self.loop = kwargs.get('loop') or bot.loop
        self.http = HTTPClient(token, loop=self.loop, session=kwargs.get('session'))
        self._is_closed = False
        self.loop.create_task(self.__ainit__())

    async def __ainit__(self):
        await self.bot.wait_until_ready()
        self.bot_id = self.bot.user.id```
#

So here when you initialize the client, it will create a task (ainit) which won't finish until the bot is done registering all the guilds, members etc

sullen nymph
#

idk why you are doing bot_id

restive otter
#

This is not me

#

I didn't write the Python lib lol

sullen nymph
#

Ah right

restive otter
#

Just explaining what makes it not work as well as it could

#

as I assume, you see it too

sullen nymph
#

Sorta

#

Feel free to PR on their repo tho bongocatto

restive otter
#

well, it can be solved either way by just entering the same line of code in the example that is on the API page

#

the await self.bot.wait_until_ready()

#

before the while loop

slim plaza
#

Did somebody got a python example for a vote webhook listener?

winged star
#

@arctic arch how i can create a command with permission only for those who voted?

plain timber
#

@winged star don't mention admins, and always say what language you're using

winged star
#

node.js (discord.js)

plain timber
winged star
#

okay and where i can find the ip and port

#

...

#

http://${hook.hostname}:${hook.port}${hook.path}

shut ibex
#

ip is your public IP afaik

restive otter
#

{mc}help

#

@jaunty depot

#

If I want to check if a specific member id have voted in the recent 24h, how do I use the /bots/{bot.id?}/check endpoint appropriately?

#

Is my bot? muted

#

because I realized the python lib doesn't support this feature, so I'm going to make my own

#

ok I might have figured it out

#

nvm me

plain timber
#

@winged star are you gonna use a we hook and store votes in a database or will you just check the API to see if they have voted

winged star
#

just check the api if they have voted

#

in last 12 hr

#

@plain timber

plain timber
#

Then you don't need ip or port

#

Those are just for webhooks

winged star
#

and how i can check if they voted

#

@plain timber

plain timber
#

Did you look at the link I sent

winged star
#

hmm

#
dbl.hasVoted("95579865788456960").then(voted => {
    if (voted) console.log("Tonkku has voted!!!")
});

Here is the Tonkku's id

plain timber
#

Ok?

winged star
solid owl
#

no

plain timber
#

Yes

ripe linden
#

how frequently does the api post the server count?

restive otter
#

The python library didn't even have any method for checking if a single user has voted lmao

plain timber
restive otter
#

Yeah I already made my own custom class and inherited the original and created my own methods

#

it's fine linkthumb

plain timber
#

@ripe linden the api doesnt post anything, your bot makes requests to the api. If you are using a library for the api then you can probably set the interval but it may have a default, you should check the docs for that library

restive otter
#

that way I don't have to fuck around with the rate limiting etc

#

and just use the pre-existing request method

#

which should already handle those things

terse nebula
#

d.py api doesn't work so i make POST's manually every 3 min

hardy acorn
#

?

terse nebula
#

ye

wary ether
#

just post when a new server joins

#

every 3 mins could get your ratelimited

terse nebula
#

idk how to

wary ether
humble bison
#

@wary ether what if your bot gets a guild every minute or more

#

every 3 minutes wont ratelimit you

wary ether
#

Then do it every hour or so. When I started I did it on guild join

humble bison
#

i post every 30 seconds

#

the lowest i'd be going is 15 or 30 seconds

#

1 hour is stupid

wary ether
#

why? You don't need to post your count every 30 seconds, what's the point?

arctic arch
#

recommended minimum interval is 15 minutes

#

and with minimum I mean the fastest

wary ether
#

yeah 15-30 seconds is idiotic

humble bison
#

Β―_(ツ)_/Β―

hollow tulip
#

how do i use webhooks to get votes?

sudden depot
#

I mean u can simply post on guild add

jade pebble
#

I don't bother with this votes.

#

my bot is not for prizes.

#

but I know its helpful for a community like this.

restive otter
#

Guys I need help on getting a webhook, I've searched through google and found nothing, what website can I register/make a webhook?
And I have a VPS running so will it be possible to host a webhook with my VPS?, Thanks

polar mirage
#

use express

#

express app sir

#

app.post("/hook", function (req, res) {

#

And you can get them there

#

Epic

restive otter
#

um, Python

#

not JS

shut ibex
#

Why does express use app.post to anyways, it should be app.route

sudden rampart
#

to only handle post requests

restive otter
#

I code in Python... not JS

calm torrent
#

create a web server

polar mirage
#

just use js fqsgqgfqz

#
var express = require('express');
var app = express();

var bodyParser = require('body-parser');
app.use(bodyParser.json()); 
app.use(bodyParser.urlencoded({ extended: true }));

app.use(express.static('public'));

app.get("/", function (req, res) {
    res.send("tf u doing here")
});

app.post("/hook", function (req, res) {
    if (req.headers.authorization !== process.env.WEBHOOKAUTH) return res.send({code: "invalid auth"})
    var user_id = req.body.user;
    var bot = req.body.bot;
    //DO SOME EPIC STUFF HERE
    res.send({code: "success"});
});

var listener = app.listen(process.env.PORT, function () {
  console.log('Your app is listening on port ' + listener.address().port);
});
#

😩 😩

restive otter
#

stop

arctic arch
#

dblapi.js has been updated to support the upcoming API change

terse nebula
#

Which is?

shut ibex
#

idk app.route makes more sense to me @sudden rampart

#

and you specify the type of the route

polar mirage
#

The change where you will need the token to be able to do stuff

#

I guess

terse nebula
#

My thoughts: A darn good idea. You can trace back misbehaving API requests back to the people who generated them, and punish them accordingly.

shut ibex
#

You get it banned for spamming

restive otter
#

so im new to the api, and how do i setup webhooks? for things like Votes (btw i read the docs, but im confused)

plain timber
#

@restive otter you need to set up a webserver to handle requests, if you are using js then the dblapi.js does this for you

restive otter
#

does it really?

#

oof omg thats convenient

#

so what do i add to the Webhook URL in my bot settings?

plain timber
#

iirc the example logs the url to your console

#

but if it says 0.0.0.0 you need to change it to the ip or domain

restive otter
#

ty very much

ripe estuary
#

Possible to Upvote in Discord using API
instead of opening website & upvote

#

Like
-upvote Voted try again in 12 h

plain timber
#

@ripe estuary no

ripe estuary
#

ok

grizzled agate
#

hello i have a question how long does it take for the api to show on dbl ?

plain timber
#

@grizzled agate wdym by showing the api

#

API = application programming interface

lunar tide
dawn fjord
#

The first one is the official I believe

plain timber
#

Yes

#

It says official lol

lunar tide
#

ok good then

const DBL = require('dblapi.js');
const dbl = new DBL(yourDBLTokenHere, { webhookPort: PORT, webhookAuth: 'password' });

if you already put an webhook auth password do you need to change the code in any way for the new update?

plain timber
#

No

#

You don't need to change any code

lunar tide
#

ok few. then whats the update for?

#

yes no??

plain timber
#

The API now needs your token to get data for a bot or user

lunar tide
#

you mean the webHookAuth?

plain timber
#

No

#

The API token

lunar tide
#

OHH XD yourDBLTokenHere

plain timber
#

It doesn't affect webhooks or posting stats

lunar tide
#

ahh oki

plain timber
lunar tide
plain timber
#

Well dblapi.js handles it for you

lunar tide
#

oki ty

grizzled agate
#

what i meen was my api has been on the bot for 24 hours but still my api doesnt show on dbl webpage 😦 @plain timber

plain timber
#

@grizzled agate are you talking about the server count or what

grizzled agate
#

yes

plain timber
#

Because "the API" is not something that shows on a webpage

#

Hm

#

What's your code

grizzled agate
#

is there something wrong with the api ??? because my bot doesnt seem to show the servers on the webpage 😦

#

@cobalt ruin @arctic arch

arctic arch
#

are you posting

grizzled agate
#

sorry for the ping

#

im just asking because my code seems fine to advaith but my bot still doesnt show my servers 😦

arctic arch
#

what's the code

grizzled agate
#

give me a min need to log in the server to get it

#

i allready have change the dbl token so its fine

#

i also did install all dependecy and all the npm both dblapi.js and dblapi

#

@arctic arch

arctic arch
#

are you seeing those logs

grizzled agate
#

what logs are you looking for sorry for asking as im using the vps to access everything for you

arctic arch
grizzled agate
#

are you talking about this ?

arctic arch
#

check that your token is valid

restive otter
#

hi tonkku

grizzled agate
#

@arctic arch must i only use 1 part before the . in the api code ?

arctic arch
#

?

grizzled agate
#

already have change it @arctic arch

#

i give up hay 😒 i have change the token 5 times and it still give me that error 😒

ripe linden
#

ok

novel carbon
#

Why does the endpoint keep rejecting my POST request?

#

it's https://discordbots.org/api/bots/mybotid/stats

#

My token is correct

#

and yes, I replaced mybotid with my bot's id

#

I'm getting 403 Forbidden

#

brb

#

back

dawn fjord
#

Not in here please

restive otter
#

Oh sorry.

novel carbon
#

Could someone please answer my question?

grizzled agate
#

well @novel carbon im gettint the error 401 and my token it correct but still keeps getting it after i have change the token 6 times

arctic arch
#

@novel carbon check that the id is the same as the bot the token is for

grizzled agate
#

@arctic arch i still get that error after i have change the token 6 times already 😒 not sure why

#

401

arctic arch
#

@grizzled agate DM me your token and I'll investigate when I can

plain timber
#

@novel carbon 403 is def wrong token, did u try regening it?

ocean patrol
restive otter
#

because of cache

#

take time to update

#

use a webhook

#

dont be a brainlet and use the api to check if a user voted

#

I don't know how to make my own webhook

#

there is a library

#

I've asked multiple times

#

top of your screen

#

huh

#

the channel topic

#

for this channel

#

in all caps

#

"API LIBRARIES AND DOCS FOUDN AT <link>"

#

the library has webhook

#

I know, but I code in Python and it doesnt say anything about webhooks in the Python docs

#

alright well best to get googling how to make a web server then

#

its a better option

#

omg...

#

python would work

#

i already explained why your way isnt working as you expect

#

yeah, takes time to update

shut ibex
#

@restive otter that endpoint if for the last 24 hours I think

restive otter
#

the voted like 23 minutes before.... @shut ibex

placid mist
#

It is possible that the webhook does not send to every vote? Because some votes are not compatibiliser. By my script that retrieves the votes ...

severe iron
#

compatibiliser? do you mean compatible? all the votes sent through webhooks are in json form so as long as you're able to use json, you should be fine

novel carbon
#

Does DBL use cookies?

shut ibex
#

yes

novel carbon
#

Hmm

#

Welp https://discordbots.org/api/bots/yourbotid/stats doesn't work

#

and

#

https://discordbots.org/api/bots/stats

#

does work

shut ibex
#

/stats without id isn't a thing afaik

novel carbon
#

yes it is

#

it just worked for me

shut ibex
#

if you can't use /stats you can post without /stats

novel carbon
#

If you send a POST request to it, trying to post ur server count, it'll work

shut ibex
#

ok

#

well it does decide the token so yeah

novel carbon
#

Yay I fixed my wrapper for DBL

#

@civic vapor

humble bison
#

tokens are linked to bot

#

aka bot ID

restive otter
#

So, It seems that it takes a couple of minutes to actually detect if a user has voted, is this going to be fixed or is this staying the way it is?

#

As when users vote, they have to wait like 3 minutes before getting access to vote restricted commands

humble bison
#

it's just the speed its detected

#

nothing you can do really

restive otter
#

hmm

humble bison
#

webhooks right?

restive otter
#

Would be cool if it was instant and yeah, webhooks

humble bison
#

alright

novel carbon
#

Why does the api keep on rejecting my POST request to the stats endpoint? My token is correct, and my bot's ID is correct.

#

It will not work!

#

If I try https://discordbots.org/api/bots/stats it gives a 400. If I try https://discordbots.org/api/bots/mybotid/stats it gives me a 403.

#

and yes I replaced mybotid with my bot's id.

#

I also made sure to include headers!

#

("Authorization","mytoken")

#

and yes, I read the docs.

plain timber
#

@novel carbon 403 means wrong token

novel carbon
#

Hrm

#

It's the right one!

plain timber
#

No it's not

novel carbon
#

I JUST copy/pasted it from the site.

plain timber
#

It's your DBL token not your discord token right

novel carbon
#

Yes

#

It's my DBL token.

plain timber
#

You're sure it's the correct bot?

novel carbon
#

It worked. I figured it out.

ripe estuary
#

help me using webhooks

https://discordbots.org/bot/:ID/edit my app
in webhook i added webhook url & set auth
but it not posted anything

shut ibex
#

dbl webhooks arent compatible with discord webhooks

#

you will have to create your own webhook server

ripe estuary
#

i have webserver

#

now

#

how to get webhook

#

http://127.X.x.x:5xx0/

plain timber
#

It just sends a post request

#

No it's not 127.0.0.1

#

That means localhost

ripe estuary
#

Hmm ok

#

any webservers i can use 😐

restive otter
#

whatever programming language you're using to make your bot probably has a webserver package/dependency/module you can use

ripe estuary
#

nodejs

restive otter
#

then you can use the basic http server (require("http")) or express (npm i express and require("express"))

#

or any other webserver of your choosing

ripe estuary
#

i have express

restive otter
#

great

#

then just set up a handler for the url your webhook is gonna be for

ripe estuary
#

example from dbl

restive otter
#

yes that probably works

ripe estuary
#

works in ready event?

novel carbon
#

Is there any way to search for users by their username thru the api?

topaz wyvern
#

Afaik, no

sharp warren
#

Who wanna join my great discord sever

plain timber
#

Nobody

sharp warren
#

yes true

old river
topaz wyvern
#

Why are you sending ads in api?

#

If you don't mind me asking

sharp warren
#

i dnno

sharp warren
#

any good api's

humble bison
#

wrong channel

ripe estuary
#
const DBL = require('dblapi.js');
const express = require('express');
const http = require('http');
const config = require(`${process.cwd()}/config.js`);
const app = express();
const server = http.createServer(app);

const dbl = new DBL(config.dbltoken, { webhookAuth: 'Password', webhookServer: server });
const hook = new Discord.WebhookClient('ID', 'Token');

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

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

this not sending even user voted help

arctic arch
#

is it listening

mystic wing
#

@ripe estuary can you post the webhook link on your bot page?

restive otter
#

I don't see you even listening on a port, though

slate merlin
ripe estuary
ripe linden
#

🀦

tawdry spindle
#

who pinged

ripe estuary
#

I Pinged Saddy Sorry

#

Yes Tonkku its says Listening on Console

arctic arch
#

you need to set your webhook url to your server

#

not the discord webhook

ripe estuary
#

i don't have webhook url

#

how do i get?

ripe linden
#

by making one

ripe estuary
#

Like this?

arctic arch
#

no

#

you make a url that points to your server

ripe linden
#

no

ripe estuary
#

https://discordapp.com/channels/470207676052144128/

ripe linden
#

no

#

you need to create a webhook outside of discord

ripe estuary
#

ok i'll try now

#

creating on github 😐

restive otter
#

Lol. They just said. You need a URL that points to your server, @ripe estuary

ripe estuary
#

discord webhook url points to my server

humble bison
#

it won't

#

dbl sends a post request on vote

ripe estuary
#

??

humble bison
#

you need a web server setup to handle the post

#

discord webhooks can't

ripe estuary
#

for web server i used example from website

#

express

humble bison
#

okay

#

so

#

point dbl to that

ripe estuary
#
const DBL = require('dblapi.js');
const express = require('express');
const http = require('http');
const config = require(`${process.cwd()}/config.js`);
const app = express();
const server = http.createServer(app);

const dbl = new DBL(config.dbltoken, { webhookAuth: 'Password', webhookServer: server });
const hook = new Discord.WebhookClient('ID', 'Token');

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

app.get('/', (req, res) => {
  res.sendStatus(200)
});
restive otter
#

are you listening on a port?

ripe estuary
#
app.get('/dblwebhook', function (req, res) {
  res.send(req.params)
})

will this work?

#

yes its says listening

humble bison
#

i honestly hate people that just can't understand stuff

ripe estuary
#

i pointed to dbl \😐

humble bison
#

set your webhooks URL on your page as the IP and port your listening to

ripe estuary
#

i don't know ip but port 5500

#
server.listen(5500, () => {
  console.log('Listening');
});
humble bison
#

you need to work out your hosts IP then

ripe estuary
#

127.0.0.1 = ip?

humble bison
#

no

#

that's localhost

#

you need the public IP of wherever your hosting at

ripe estuary
#

i'm hosting bot on my pc

#

https://ip/port

restive otter
#

tony u have alot of patience

ripe estuary
#

Sorry l'll stop this l'll try \😦 Thank you for Help \β™₯

humble bison
#

shrug

ripe estuary
#

have ip & port don't know where to add

sudden rampart
restive otter
#

Are there any Python developers here using a Custom webhook?

restive otter
#
@app.route('/hook', methods=['POST'])
def votes():
    request.data = request.data.decode("utf-8")
    user_id = request.json['user']
    cur.execute("UPDATE users SET voted=(%s) WHERE u_id = (%s)", (False, user_id));
    conn.commit()
    cur.close()
    print(f"Received this: {request.data}")
    return "", 200```

I have this as the webhook in my Linode VPS, but when I test it with ``http://ip:port/hook`` nothing happens
#

specifically http://linode_public_ip:5000/hook

restive otter
#

It works when I use this url http://127.0.0.1:5000/hook

boreal ravine
#

.

unique ruin
#

So for the webhook url
what do i use?
am kinda confused on that
as a discord webhook dont seem to work

restive otter
#

a url to your own webserver

unique ruin
#

ah

#

ok ty

#

or?

restive otter
#

yup

#

something like that

unique ruin
#

port is frm what?

restive otter
#

the port your webserver is listening on

unique ruin
#

so that?

restive otter
unique ruin
#

ok

restive otter
#

if your server is listening on port 5000

unique ruin
#

ok

#

do you recommend i change the 5000 to something else or?

restive otter
#

well

#

where are you hosting

unique ruin
#

ovh

#

france

restive otter
#

ok

#

then you should be able to use 80 (for unencrypted http) or 443 (for encrypted http/https)

#

which is the standard

unique ruin
#

what you recommend?

restive otter
#

probably get a certificate and use 443

unique ruin
#

mhm

restive otter
#

then if you make a website later people can access it without typing in a port

unique ruin
#

could i use a couldflare certificate?

restive otter
#

probably

#

i've had my share of issues with cloudflare

#

but yes it should work

unique ruin
#

what u using?

restive otter
#

cloudflare

#

it still works

unique ruin
#

oh lol

restive otter
#

just not all the time

unique ruin
#

mhm thats confusing since i tried doing my ip in cloudflare and said enter a domain am prob just dumb tbh

restive otter
#

if the cloudflare certificate doesn't work, try using let's encrypt

#

oh for cloudflare you need a domain for which you can edit the nameservers

unique ruin
#

AH

#

ok

#

ok nvm then should i just use port 80 or could i use lets encrypt

restive otter
#

if you plan on making a website at some point and want that sweet green padlock, use lets encrypt

#

otherwise port 80 should work fine

#

(note that you will have to start your bot with sudo or root permission if you want to use 80 or 443)

unique ruin
#

ok gotcha

#

so like sudo pm2 start index.js -n "bot"

#

?

restive otter
#

yes

#

that would work

#

are you using express?

unique ruin
#

what node express no i dont think so

restive otter
#

ok

unique ruin
#

ok started my bot with that

restive otter
#

hello again

unique ruin
#

seems to work

restive otter
#

with what

#

sudo?

unique ruin
#

yeh and port 80

restive otter
#

alright

#

so you created a server and listened on port 80?

unique ruin
#

what?

restive otter
#

what did you use to start it on port 80

unique ruin
#

the bot?

#

wait

restive otter
#

yeah

unique ruin
#

is that right

#

lol

#

or am i dumb

restive otter
#

is what right

#

if you mean the command yes, thats correct

#

but you need to edit the code to create a webserver that listens on port 80

unique ruin
#

ah gotcha

#

ty

restive otter
unique ruin
#

ok gotcha ty ma man

restive otter
#

yw

amber yacht
#

Please add discord webhook support for bot votes, it would be very good !
thank you

shut ibex
#

you can always make your own webserver and trigger the discord webhook

misty geode
#

quick question i was in the wrong section, can we vote using commands in discord?

plain timber
#

@misty geode no

#

since that could let bots make fake votes

misty geode
#

tru

restive otter
#

Turkish

arctic arch
#

Snekfetch is deprecated tho

indigo trout
#

If I want to use webhooks for voting, do I have to create my own webserver to do so or is there an easier way?

slate merlin
#

create your own

indigo trout
#

K thx

restive otter
#

v

#

hi dick

knotty frigate
#

this would be correct right?

#

https://discordbots.org/api/bots/${bot.user.id}/check?userid=${user.id}

shut ibex
#

?userId

plain timber
#

@indigo trout if you are using js then dblapi.js can handle it for you

boreal knot
#

How would I authenticate myself when using the /bots/{bot.id?}/check endpoint

#

because it "Requires authentication."

#

Does that mean i need to be logged in

shut ibex
#

set token

boreal knot
#

How would I go about doing that

#

add it as a param?

#

or auth header

old river
#

Auth header

#

Judging by auth being short for authentication

boreal knot
#

yes

marble urchin
#

Guys. I'm having an error 403 when trying to post the bots server count

#

Forbidden

plain timber
#

@marble urchin wrong token

marble urchin
#

okay

#

mmm

#

I regenerated the token

#

but I still have the forbidden error

#

I copy pasted the code on the python doc

humble bison
plain timber
#

no

humble bison
#

okay

#

dunno what's up there

#
    async postCounts() {
        const { botlists } = require('../../config.json');
        try {
            // discordbots.org
            await this.util.p({
                url: `https://discordbots.org/api/bots/${this.user.id}/stats`,
                method: 'POST',
                headers: {
                    'Authorization': botlists['discordbots.org']
                },
                body: {
                    server_count: this.guilds.size
                }
            });
        } catch(err) { console.log(err); }
    }

honestly, can someone try explain what's up here

#

it won't post

#

but no errors come out in logs

restive otter
#

details correct?

elfin solstice
#

You use node-fetch right?

#

You know that this lib dont reject on 3xx-5xx status codes?

#

@humble bison

restive otter
#

axios does

humble bison
#

oh it doesn't

#

oof

elfin solstice
#

Nope

humble bison
#

also i was trying both it and phin

#

they both failed

restive otter
#

Axios does reject on 500 codes