#topgg-api

1 messages Ā· Page 48 of 1

versed dust
#

appreciated

snow sky
#

yeah

glass solar
#

So i am using the github example for connecting to the api. But my servercount hasnt updated since i first set it up..

#

And yes it is definitely being loaded with the bot

snow sky
#

have you updated it and made sure the client is defined correctly in dbl?

plain timber
#

@versed dust you're trying to use webhooks?

#

dblapi.js supports them

versed dust
#

i'm using that module

#

but nothing is coming in

plain timber
#

No you were using http

versed dust
#

at first i was using dblapi

#

the with alek we tried the http

#
const dbl = new DBL("token", { webhookPort: 5000, webhookAuth: "auth" });

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!`);
});```
#

this is what i have now

#

but i get nothing

plain timber
#

What URL did you set in dbl

versed dust
#

i press 'test' on the website

plain timber
#

If you use postman does it work

#

Your vps might not be receiving the request for some reason

versed dust
#

Could not get any response

#

can i do anything from ssh?

#

@plain timber any ideas as to how to change that? 😃

#

All ports are BLOCKED except 22 (SSH), 80 (HTTP), and 443 (HTTPS).

#

ok so i had to use port 80

#

dun dun dunnnnnnnnnnnn

#

4 hours for this

#

😦

#

thanks for the help guys

restive otter
#

who have i use bot command and saying message code ?

plain timber
#

@restive otter what

#

Real English pls

lime rock
#

When I use the .postStats method, I get this errorprolog UnhandledPromiseRejectionWarning: Error: 401 Unauthorized

versed dust
#

@lime rock check your token and auth code

#

That means the authorization failed

lime rock
#

Fixed

#

ty

frail lance
#

When I use bot.server_count it will sometimes return 1 even though the bot is in more than 1 server, is there any way to fix that?

shrewd burrow
#

anyone elses webhooks not POSTing anymore?

#

pretty sure the webhooks are doing GET instead of POST

#

for the votes

wet hornet
#

Guys what is a shard

sand hazel
signal hawk
#

i have a message sent to users when they vote and that is not going through, is something broken rn? is happening for a couple of bots i use

humble bison
#

its the dbl api, deal with it

signal hawk
#

was just wanting to know if it was not a user/developer issue šŸ‘€

hollow wraith
#

is the test button working?

indigo shoal
#

šŸ…±roken

shrewd burrow
#

@signal hawk I'm having the same issue, I think it's broken

shrewd burrow
#

looks like theyve fixed it now

vestal trail
#

I was wondering, is it possible to retrieve your guild count as a number from the API instead of a widget?

spiral steeple
#

Why not just client.guilds.size?

shrewd burrow
#

maybe theyre getting it in another app

#

like on a website or something

spiral steeple
#

Well, I believe the docs have a GET for bot info

ionic swan
#

I’ve been searching all morning and can not find an answer: Can you begin using API features with a server after it’s established and it has users?

humble bison
#

not related to the dbl api

ionic swan
#

@humble bison ty!

humble bison
#

šŸ‘Œ

restive otter
#

API bug ?

#

My discord bot randomly shut down

sudden rampart
#
  1. wrong channel
  2. discord is having issues
crisp lake
#

api error ^^

restive otter
#

API error

scarlet copper
#

Server count: 2521 but hasn't updated for the website?

spiral steeple
#

Did you update it?

scarlet copper
#

i use the cog

spiral steeple
#

also some issues with discord rn

scarlet copper
#

this has been for a while, it still says 2,145

spiral steeple
#

Yea and the api has been down for a while

#

We just have to wait

scarlet copper
#

i mean like a few weeks, ik about that

spiral steeple
#

Oh

scarlet copper
#

i just now had time to say something about it

spiral steeple
#

Idk about that then

plain timber
#

@scarlet copper wdym the cog?

scarlet copper
#

the api cogs

plain timber
#

What do you mean

#

Or something else

scarlet copper
#

this one

haughty tundra
#

@scarlet copper rewrite or async?

scarlet copper
#

@haughty tundra rewrite

haughty tundra
#

Then if you're not using webhooks the exact code from the api should work.

wild blade
#

is there any way to get the status of a bot like the widget shows but in json or plaintext?

spiral steeple
wild blade
#

I didn't see anything there so I guess not

plain timber
#

You don't need DBL for that, if it's your bot you can just make an API endpoint for it, if it's someone else's bot use your bot to get it

gray copper
mighty shuttle
#

We are aware of the issue

toxic hazel
#
Traceback (most recent call last):
  File "/storage/emulated/0/Termux/cgbot/cogs/dbl.py", line 23, in update_stats
    await self.dblpy.post_server_count()
  File "/data/data/com.termux/files/usr/lib/python3.7/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 "/data/data/com.termux/files/usr/lib/python3.7/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 "/data/data/com.termux/files/usr/lib/python3.7/site-packages/dbl/http.py", line 160, in request
    raise Forbidden(resp, data)
dbl.errors.Forbidden: Forbidden (status code: 403): {"error":"Forbidden"}```
#

I gave it the token tho

daring gazelle
#

how are you doing that

hollow wraith
#

all my bot stuff is working including webhooks

toxic hazel
#

The dbl module

daring gazelle
#

ik it's d.py but code?

soft geode
#

For my bot

#

??

plain timber
#

@soft geode the link is literally in the channel topic...

soft geode
#

Lol

#

I know

#

Just found it

daring gazelle
#

and this channel is for the api

restive otter
#

how do I create dbl vote rewards?

hollow wraith
hidden marten
#

The api is kind of confusing... Where it says URL on the edit page... Where am I getting the url to put there?

plain timber
hidden marten
#

ye I already looked at that

#

I dont understand the url

plain timber
#

@restive otter you can either use webhooks and store a list of voters in the db, or you can use the check endpoint

hidden marten
#

I console logged the hook

plain timber
#

Are you using js?

hidden marten
#

And got the host and port back, the host was 0.0.0

#

Yes

#

be back in a sec

plain timber
#

Change 0.0.0.0 to the server's IP address or domain

tender garnet
#

Hi, is it planned to have any timestamp of the last vote of the user ? because its not very handy to only have the voted result

sand hazel
#

I don't think it's planned, you current bet is to use the webhook

spiral steeple
#

Just log a new Date() (js anyways) when they vote into a database

#

you can make a lot of this stuff on your own

tender garnet
#

I did, but when the user vote it makes a certain time before voted goes to 1

#

so if the user have something else to do, and come back in one hour or so

#

the timestamp will be different than his next allowed vote timestamp

#

you now I mean

light crag
#

Use webhooks. When you get the request store the vote and current timestamp so you can refer to it later.

tender garnet
#

is it better with php or with express

sand hazel
#

Personal preference really

tender garnet
#

uh

hasty vault
#

where do you put the token again? i'm using the dbl java thing but it's not posting

#

so i need to manually post the updated stats

sudden rampart
#

Authorization header

hasty vault
#

ah thanks

restive otter
#

Can someone help me? I made a bot, but I do not know how to get to the coding part, I know how to code, but I dont have the link or how to get there.

spiral steeple
hollow wraith
#

pick a language, look up the library for that language. Also this is a conversation for #development

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

for webhooks

#

should the hostname say 0.0.0.0 or my server IP?

arctic arch
#

your server ip

fading kraken
#

its logging 0.0.0.0, any idea why that is?

arctic arch
#

it is used as a placeholder

fading kraken
#

but you said it should be logging my server IP there, but its not, - do you have any idea why that is?

sudden rampart
#

just replace 0.0.0.0 with your ip

#

it's probably logging 0.0.0.0 because that's the address the server is binding to

#

which is a special address that means "bind to all network interfaces"

arctic arch
#

In the context of servers, 0.0.0.0 can mean "all IPv4 addresses on the local machine". If a host has two IP addresses, 192.168.1.1 and 10.1.2.1, and a server running on the host is configured to listen on 0.0.0.0, it will be reachable at both of those IP addresses.
https://en.wikipedia.org/wiki/0.0.0.0

sudden rampart
#

so if your server has 5 ips, all 5 of those would work to access that http server

arctic arch
#

the module just says 0.0.0.0 at this time, you should replace that with your own IP

fading kraken
#

alright i was confused because you said it should be showing my server IP, its properly set on the website though to my actual IP

#

ahhh

#

the issue was the port 800 was closed on my server

sand hazel
#

Anything lower than port 1025 requires elevated permission on unix

arctic arch
#

well, I meant you should replace it with your ip

#

when entering it on the site

soft geode
#
const dbl = new DBL('TOKEN', { 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('This dude Voted' + vote);
  // Do what you need to do
});```
#

where would i find my webhookAuth password

spiral steeple
#

Might wanna regen that

soft geode
#

oh crap

spiral steeple
#

And delete that

#

But regen it lol

soft geode
#

i changed it xD

spiral steeple
#

The webhook auth is what you set it as

#

On the website

soft geode
#

how do i set it?

#

send link?

spiral steeple
#

On your edit page of the bot

#

Scroll down

#

Should say url and authorization or something

soft geode
#

ty

soft geode
#

@spiral steeple I did that and it didn’t work

spiral steeple
#

Do you have your webhook setup correctly?

soft geode
#

What do u mean

#

@spiral steeple scroll up

#

.

dawn fjord
#

chill

soft geode
#

@dawn fjord my phone messed up I didn’t mean to spam it

#

@spiral steeple

dawn fjord
#

chill. You don't need to mention him so many times mightyFacepalm

spiral steeple
#

does it log Webhook running at...

soft geode
#

Yes

#

@dawn fjord

#

Yes it did log it @spiral steeple

spiral steeple
#

First, dont mention people for no reason, like Moose

soft geode
#

Oh crap sorry didn’t mean to mention moose meant to mention Jonny 6

#

I have filled out Authorizatkon but not URL

spiral steeple
#

Jhonny 6 is moose

#

Well you need to fill that out too

soft geode
#

What do I put in URL

spiral steeple
#

How do you host your bot?

#

idk how to do it if you use glitch/heroku

#

Also I really need to sleep I got school in 4 hours, maybe someone else can help you frostpToot

soft geode
#

I use mine locally

#

@spiral steeple

#

Btw I only pinged u cos it said u were online

#

Hey could someone help me; I don’t know what I put in the URL spot in the webhook setup

#

Any help?

limpid shard
#

use your localhost URL or something

soft geode
#

What do you mean @limpid shard

soft geode
#
const dbl = new DBL('Token.Token', { webhookPort: 5000, webhookAuth: 'MyPassword' });
dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
  console.log('This dude Voted' + vote);
  // Do what you need to do
});```
#

whats wrong with this code?

#

am i meant to change webhookPort

limpid shard
#

Learn more about webhooks

#

@soft geode

soft geode
#

i have made my webhook though

hollow wraith
#

is hook defined somewhere? and is your link on DBL pointing to your bots public IP and port?

soft geode
#

@hollow wraith its defined in the library i think and how do i make my link on DBL pointing to your bots public IP and port

hollow wraith
#

in your bot edit screen there is a link for your webhook on DBL.

#

which would need to be http://botpublicip:5000

#

@soft geode

soft geode
#

what?

hollow wraith
#

you navigate to your bots page, and click Edit

#

there will be a place to insert a link in the Webhook portion

soft geode
#

ok..

hollow wraith
#

if your bot is hosted somewhere it will have a public IP address, and that is where DBL will send the webhook when someone upvotes

#

places like glitch and heroku have links for your bot and specifically allowed ports, which you would need to figure out. and use that instead of ip address and port 5000

soft geode
#

k

#

check DM's

#

@hollow wraith

soft geode
#

Can someone please send me a chunk of code that makes it so if someone upvotes my bot, It sends a message to a certain channel saying their username r

hollow wraith
#

you would have to tag their name.. I think bot.users is a list of every user in every guild. you may be able to search that list and get the correct user

soft geode
#

Wait no

#

When they upvote they get sent a discord link to a VOTERS server

hollow wraith
#

? you want a user to get a discord invite link to their own server, when they upvote?

#

or a special server for everyone who upvotes your bot

soft geode
#

Yes

#

No a special server

#

So simply when someone upvotes they get a DM with a server invite 1 use 1 day

hollow wraith
#

do a collection search on bot.users with the userID of the upvoter and send them a message

#

bot = the name variable used to define your discordjs stuff

soft geode
#

What do you mean

#

Talk in Dm

#

Could someone show me a way to find the user ID of whoever voted, then send them a DM

azure pollen
#

]]snipe

alpine pineBOT
#
LachieDaGamer#5038

<@&265158261945270273> - a few seconds ago

azure pollen
#

@soft geode why would you do that

soft geode
#

I didn’t mean to ping you

azure pollen
#

we still get the ping regardless

soft geode
#

Could someone show me a way to find the user ID of whoever voted, then send them a DM

runic grove
#

Fam

#

Read the fucking docs

soft geode
#

It doesn’t work

#

I’ve tried reading the docs, they’re useless

runic grove
#

what lib are you using

#

@soft geode

spiral steeple
#

Useless and docs shouldnt be used in the same sentence unless they are actually useless, it tells you how to get a user id from a vote

#

And your libs docs mostlikely say how to send to a user

soft geode
#

@spiral steeple , I’m trying to make my bot login, and it sends the right thing, but idk what to put into webhookAuth

polar mirage
#

webhookAuth is what you choose on the website

soft geode
#

??

polar mirage
soft geode
#

Ohhh like the Authentication

polar mirage
#

yes

soft geode
#

@polar mirage

#

Ty

#

@polar mirage what’s meant to be in webhookPort

polar mirage
#

The port on which your webserver is listening

soft geode
#

So how do I find what port that is?

runic grove
#

you.. decide on one

soft geode
#

But wouldn’t it have to refer to something

runic grove
#

do you even know what a webhook is

soft geode
#

Good point

#

šŸ‘

runic grove
soft geode
#

***I thought it was ā€œyou don’t even know what a Webhook isā€

#

@runic grove could I just leave it on 5000

runic grove
#

can you stop randomly tagging people kthx

#

and depends

soft geode
#

That wasn’t random tho?

#

What does it depend on?

runic grove
#

it depends

#

do you even know what a webhook is

sudden rampart
#

depends on which port you want it to run, if there's already something running in port 5000, if that port is exposed to inbound connections

runic grove
#

^

soft geode
#

If it’s my first Webhook would that matter what port it’s in?

sudden rampart
#

you need to configure it to use a free port

soft geode
#

I’m sorry, how would I do that?

runic grove
sand hazel
#

tbh just generate a random number

#

1025-65535 inclusive

sudden rampart
#

if you're going that far just use port 0

#

the OS assigns you a free port

soft geode
#

Ok

#

So is it just my bot that needs to refer to port 0 ?

tall comet
#

would discord channel webhooks work for checking for webhooks?

#

like would everything work fine

polar mirage
#

You mean like enter a discord channel webhook into the webhook thing on the bot page?

tall comet
#

ye

polar mirage
#

No

tall comet
#

ah

#

explains a lot

polar mirage
#

šŸ˜‚

tall comet
#

(using discord.js) So Keep getting a error for some reason.

Code: const dbl = new DBL('token', {webhookServer: `link`}, bot);

Error:``` if (server && !(server instanceof Server)) throw Error('The server is not an instance of http.Server');

                                           ^

Error: The server is not an instance of http.Server

at new DBLWebhook (/rbd/pnpm-volume/69de6562-01dc-4cbe-badf-09c16eda1645/node_modules/.registry.npmjs.org/dblapi.js/2.3.0/node_modules/dblapi.js/src/webhook.js:23:54)

at new DBLAPI (/rbd/pnpm-volume/69de6562-01dc-4cbe-badf-09c16eda1645/node_modules/.registry.npmjs.org/dblapi.js/2.3.0/node_modules/dblapi.js/src/index.js:69:22)

at Object.<anonymous> (/app/events/ready.js:8:13)

at Module._compile (module.js:653:30)

at Object.Module._extensions..js (module.js:664:10)

at Module.load (module.js:566:32)

at tryModuleLoad (module.js:506:12)

at Function.Module._load (module.js:498:3)

at Module.require (module.js:597:17)

at require (internal/module.js:11:18)```
sudden rampart
#

webhookServer is not supposed to be a string

tall comet
#

could I use http.get('link') @sudden rampart ?

sudden rampart
#

have you read the docs?

spiral steeple
#

Thonk webhookServers type is http.Server

tall comet
#

nvm

sand hazel
#

high iq

restive otter
shut ibex
#

I need to know the error to help

restive otter
#

I can’t really get that but I’ll try

plain timber
#

Yeah we can't help much without the error

restive otter
#

I’ll get it on a bit, it’s quite hard as I’m running it on a Linux vps so the logs are annoying to get lul

remote bramble
#

not really lol

spiral steeple
#

Its just in the console the same way it would be if you hosted it any other way

#

Most other ways*

snow fiber
#

On the webhook is the snowflake send as a string?

#

Quite forgot

sand hazel
#

Yeah prob

snow fiber
#

Aight

restive otter
#

no I use pm2 so it resets each time I load the vps

shut ibex
#

Are you setting the token

restive otter
#

oh wait

#

yeah I found the issue now

#

I didn't set it up properly in my config.js

soft geode
#

What’s the issue?

#

Oh lol

#

What is config.js?

restive otter
#

it's where I store the config stuff

soft geode
#

Like token?

#

@restive otter like tokens?

restive otter
#

yeah like that

harsh pulsar
#

Oof

#

Use config.json lmao

restive otter
#

Failed to post server count
Forbidden: Forbidden (status code: 403): {"error":"Forbidden"}
Traceback (most recent call last):
File "/home/pi/Desktop/Bot/cogs/DBL.py", line 25, in update_stats
await self.dblpy.post_server_count()
File "/home/pi/.local/lib/python3.5/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/pi/.local/lib/python3.5/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/pi/.local/lib/python3.5/site-packages/dbl/http.py", line 160, in request
raise Forbidden(resp, data)
dbl.errors.Forbidden: Forbidden (status code: 403): {"error":"Forbidden"}

#

Getting this error when using the example

spiral steeple
#

I forgot if thats token incorrect or auth incorrect

restive otter
#

wait what

spiral steeple
#

I think that means either the token or auth is wrong, I may be wrong

restive otter
#

hmm

spiral steeple
#

wait, does posting servercount have auth?

#

I think its the token

#

idk Im too tired lmao

restive otter
#

what the hell

#

I regenned it

#

Still doesnt like it

#

403

#

Status code error 403

#

What the hell

#

I put the token innn

#

just take itttt

spiral steeple
#

The token is in the header under "Authorization" right?

restive otter
#

uhm

spiral steeple
#

wait

#

wait.

#

You doing like postStats()?

restive otter
#

yeah

spiral steeple
#

Oh, on mobile it doesnt like to get the full token

#

Turn your phone sideways

restive otter
#

Yeah I just realized ugh

spiral steeple
#

when copying

restive otter
#

Okay

spiral steeple
#

Also why code on phone lmao

sand hazel
#

yeah can you just paste the code

#

i can't read that

restive otter
#

cause it's so late oof

sand hazel
#

then ask again in the morning

restive otter
#

it's literally the example m8 @sand hazel

spiral steeple
#

yea, its just because it doesnt fully copy on mobile

sand hazel
#
import dbl
import discord
from discord.ext import commands

import aiohttp
import asyncio
import logging


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

    def __init__(self, bot):
        self.bot = bot
        self.token = 'dbl_token'  #  set this to your DBL token
        self.dblpy = dbl.Client(self.bot, self.token, loop=bot.loop)
        self.updating = bot.loop.create_task(self.update_stats())

    async def update_stats(self):
        """This function runs every 30 minutes to automatically update your server count"""
        await self.bot.is_ready()
        while not bot.is_closed():
            logger.info('Attempting to post server count')
            try:
                await self.dblpy.post_server_count()
                logger.info('Posted server count ({})'.format(self.dblpy.guild_count())
            except Exception as e:
                logger.exception('Failed to post server count\n{}: {}'.format(type(e).__name__, e))
            await asyncio.sleep(1800)

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

use that

#

use that

restive otter
#

what the actual fuck

#

it wont let me copy it

sand hazel
#

wow, i wonder why

restive otter
#

Even sideways doesn't work

#

fishy can you dm me mine or something

sand hazel
#

what

spiral steeple
#

Request desktop site then. If it dont work then try in the morning

restive otter
#

my api key

sand hazel
#

just use the example I gave, and replace the fields

restive otter
#

I did request desktop site tho :-:

#

I didn't see a example what

spiral steeple
#

Then I'd suggest waiting until you can get on your pc

sand hazel
#

i pasted the patched example

spiral steeple
#

Wait did you?

restive otter
#

yeah I didn't see it

sand hazel
#
import dbl
import discord
from discord.ext import commands

import aiohttp
import asyncio
import logging


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

    def __init__(self, bot):
        self.bot = bot
        self.token = 'dbl_token'  #  set this to your DBL token
        self.dblpy = dbl.Client(self.bot, self.token, loop=bot.loop)
        self.updating = bot.loop.create_task(self.update_stats())

    async def update_stats(self):
        """This function runs every 30 minutes to automatically update your server count"""
        await self.bot.is_ready()
        while not bot.is_closed():
            logger.info('Attempting to post server count')
            try:
                await self.dblpy.post_server_count()
                logger.info('Posted server count ({})'.format(self.dblpy.guild_count())
            except Exception as e:
                logger.exception('Failed to post server count\n{}: {}'.format(type(e).__name__, e))
            await asyncio.sleep(1800)

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

discord is fucking with me

spiral steeple
#

except Exception as e that srs what python does?

sand hazel
#

yeah

spiral steeple
#

why

#

whatever, not the channel for that

restive otter
#

What's different from the example fishy

sand hazel
#

close check

#

and bot ready check

restive otter
#

mk I'll try it

#

Make better API system for mobile fishy

spiral steeple
#

But he was getting an authorization error?

#

wait

#

Forbidden

#

that is auth, no?

sand hazel
#

Yeah

restive otter
#

???

sand hazel
#

But if you supply a wrong path, it will cause auth to invalid id error

restive otter
#

Don't I only need token?

spiral steeple
#

if you use the api, I believe

restive otter
#

yeah API key

sand hazel
spiral steeple
#

but I dont use it to post, so idk

#

ah, well Imma go to bed anyways

restive otter
#

so just wait until ready and check if bot is closed

sand hazel
#

yeah

restive otter
#

%Run Bot.py
Task exception was never retrieved
future: <Task finished coro=<DiscordBotsOrgAPI.update_stats() done, defined at /home/pi/Desktop/Bot/cogs/DBL.py:19> exception=TypeError("object bool can't be used in 'await' expression",)>
Traceback (most recent call last):
File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
result = coro.send(None)
File "/home/pi/Desktop/Bot/cogs/DBL.py", line 23, in update_stats
await self.bot.is_ready()
TypeError: object bool can't be used in 'await' expression
Bot Online

#
import dbl
import discord
from discord.ext import commands

import aiohttp
import asyncio
import logging


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

    def __init__(self, bot):
        self.bot = bot
        self.token = 'dont steal'  #  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"""

        while True:
            await self.bot.is_ready()
            while not self.bot.is_closed():
                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))```
amber dune
#

@restive otter my dude you leaked your token

sand hazel
#

kek

restive otter
#

I regenerate it

sand hazel
#

anywho, which py version u on

amber dune
restive otter
#

3.6 I think

#

don't delete bot pls @amber dune

amber dune
#

what

#

i know

#

its the api token

#

not the bot token

restive otter
#

ok

amber dune
#

wait JUST KIDDING

#

i looked at your code again

restive otter
#

wait what

sand hazel
#

are you using the rewrite lib

amber dune
#

reset your fucking token asap

#

like no joke

restive otter
#

I did what

amber dune
#

now

restive otter
#

I did

#

WHAY

amber dune
#

oh ok

plain timber
#

the bot token or api token

restive otter
#

my bot or api

#

API got reset

amber dune
#

bot token @plain timber fuk

plain timber
#

lmaoo

restive otter
#

bot wasn't leaked tho

plain timber
#

kax

amber dune
#

oh rly kk

restive otter
#

Show me

amber dune
#

yea now that i see it it looks like a dbl token

restive otter
#

serious

#

you made me reset it for no reason

#

go spooder

plain timber
#

u reset the bot token too?

restive otter
#

yeah

#

-_-

plain timber
#

well its still a good idea to occasionally reset ur bot token

restive otter
#

@luca eval token

plain timber
#

so if an old one gets leaked it wont be valid anymore

restive otter
#

Ohh okay

#

I'm going to bed

spiral steeple
#

Which is why you use a config file so you dont have to manually change it in all those places

restive otter
#

what

#

Task exception was never retrieved
future: <Task finished coro=<DiscordBotsOrgAPI.update_stats() done, defined at /home/pi/Desktop/Bot/cogs/DBL.py:19> exception=TypeError("object bool can't be used in 'await' expression",)>
Traceback (most recent call last):
File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
result = coro.send(None)
File "/home/pi/Desktop/Bot/cogs/DBL.py", line 23, in update_stats
await self.bot.is_ready()
TypeError: object bool can't be used in 'await' expression

haughty tundra
#

As it says at the bottom.
Your object returns a boolean (True, False).
And it wants to like idk express the boolean using await.

sand hazel
#

wow, literally rephrased the error feelspepoclap

#

are you using the rewrite branch

flint harness
#

hi, I'm having some issues with the dblapi.js library..
I'm trying to connect to a webhook but it's telling me that client.on isn't a function even though I'm not setting a client in the my setup

#

so I removed the { webhookPort: 5000, blah blah blah } and commented out all the dbl.webhook.on requests and the code works perfectly now but not how I intend to use the API

arctic arch
#

what version of the module are you using

#

sounds like v1.x.x to me

hoary timber
#

Did the API somehow change?
For some reason is the server count of my bot stuck on 675 guilds, while my bot actually is in 753 guilds.

#

I use the Java library of DBL to post the count

#

Oh wait....

#

It was a stupid typo -_-

#

The most beloved error you can have and make

novel oyster
#

Do I post stats on the sharding file?

const Discord = require('discord.js');
const Manager = new Discord.ShardingManager('./bot.js');
Manager.spawn(1)

//Here?
#

Sorry for the ping Daddy

#

xD

amber dune
#

lmao

novel oyster
#

xD

humble bison
#

no you don't

novel oyster
#

So I put it in bot.js?

humble bison
#

once all your shards are loaded post in the ready event

novel oyster
#

As where the bot file is

humble bison
#

and use broadcastEval to get your proper count

novel oyster
#

And how do I do that?

#

(I am new to sharding)

humble bison
#
const postCount = async () => {
    try {
        let guildCount = null;
        await client.shard.broadcastEval('this.guilds.size')
        .then(async results => {
            guildCount = results.reduce((prev, val) => prev + val, 0);
        

        await post(`https://discordbots.org/api/bots/:id/stats`)
        .set('Authorization', `stuff`).send({ server_count: guildCount, shards: results, shard_id: client.shard.id, shard_count: client.shard.count });
    
        });
    } catch(err) {
        // stuff
    }
};

postCount();
setInterval(() => postCount(), 60 * 1000 * 10);

thats what i do

#

in my main file anyways

novel oyster
#

Wow!

#

Thank you.

#

What api do you use to post ?

#

@humble bison

humble bison
#

wdym what api

novel oyster
#

For posting

humble bison
#

oh

#

that's using snekfetch because i haven't migrated it yet

#
const { post } = require('snekfetch'); // npm i snekfetch```
novel oyster
#

Alright

#

Thanks for everthing

restive otter
#

what's happening

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

// send the stats every hour to DBL
const dbl = new DBL("mytokenishere", { statsInterval : 3600000 }, bot);
dbl.on('error', e => {
 console.log(`DBL Error! ${e}`);

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

@restive otter what lib are you using?

restive otter
#

d.js

#

@plain timber

plain timber
#

Is bot your discord.js client?

restive otter
#

yes

#

if that helps

plain timber
#

Uh

#

Thats the npm version

#

To get the dblapi.js version do npm ls dblapi.js

restive otter
#

@plain timber

plain timber
#

Hmm that's the latest version

restive otter
#

Any idea why this is wrong?

plain timber
#

Where did u define bot

restive otter
#

at the top

plain timber
#

Send the line

restive otter
#
const bot = new Discord.Client({disableEveryone: true})```
plain timber
#

Hmm it looks fine

#

Ask tonkku

restive otter
#

in dms?

#

or @ tonkuu

plain timber
#

Here

restive otter
#

@arctic arch

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

// send the stats every hour to DBL
const dbl = new DBL("mytokenishere", { statsInterval : 3600000 }, bot);
dbl.on('error', e => {
 console.log(`DBL Error! ${e}`);
});
 // Optional events
dbl.on('posted', () => {
    console.log('Server count posted!');
});
arctic arch
#

is that the discord.js module or from something else

restive otter
#

This is a d.js

arctic arch
#

it shouldnt do that if the client object is from a module named discord.js

restive otter
#

Why is it doing it tho

arctic arch
restive otter
#

@arctic arch I mean, I am using d.js

arctic arch
#

can you log the output of require.cache[require.resolve('discord.js')]

restive otter
#

yeah sec

#

@arctic arch

#

It basically is showing everything

arctic arch
#

do you require dbl before d.js

restive otter
#

no

restive otter
#

@arctic arch

trim cargo
#

Hi!

#

I would love to know how I hide the servers my bot is and the shards. I saw this in one more docs I just forgot to save .. Anyway if any admin could help me I would be grateful!

restive otter
#

This might not work, but send a post req with null values

humble bison
#

odd question but can you like, implement vote rewards before your bot is approved

#

so it's ready on approval

sand hazel
#

Yeah

humble bison
#

okay

#

so it won't throw any errors

sand hazel
#

error on what

humble bison
#

like if the bots unapproved

#

it might not send test votes

sand hazel
#

I mean if the bot is not approved, there won't be an endpoint for them to send the payload to regardless

humble bison
#

but you should be able to set it

#

iirc

sand hazel
#

I don't see it from the new bots page

topaz glacier
#

Uh rip I am not able to set webhook anyone can help me?

#

in the bot

balmy hamlet
#

i can't help, but i would like to know what happened

sand hazel
#

Set webhook on the bot page?

topaz glacier
#

yes and if someone votes and I get a message

sand hazel
#

Can you elaborate on "not unable to set a webhook"

topaz glacier
#

I clearly don't understand webhooks

plain timber
#

@topaz glacier dbl will send a post request to the url u enter

#

The post body will have the vote information

topaz glacier
#

And what url should I enter? šŸ¤”

plain timber
#

Well a url that your webserver will receive post requests on

#

What language do u use?

topaz glacier
#

.js

plain timber
#

The dblapi.js package will set up the webserver for you

topaz glacier
#

Oh thanks I understood

restive otter
#

I can't login to the web

#

When I click it, it should show a button on the bottom

#

But now it doesn't

#

Help please I want to get my daily rewards

#

I can't slide to the bottom

sand hazel
#

do it on a computer

#

and try another browser

arctic arch
#

you can scroll to the bottom but it's a bit difficult

restive otter
#
const DBL = require("dblapi.js");

// send the stats every hour to DBL
const dbl = new DBL("mytokenishere", { statsInterval : 3600000 }, bot);
dbl.on('error', e => {
 console.log(`DBL Error! ${e}`);
});
 // Optional events
dbl.on('posted', () => {
    console.log('Server count posted!');
});
#

Anyone help?

ocean pike
#

Why am I getting this error?

spiral steeple
#

Could be a 503 error or something

ocean pike
#

Well

spiral steeple
#

Server side

#

You cant do anything about it except wait I believe

ocean pike
#

I guess

#

But I'll wait for a staff to confirm

spiral steeple
#

Well you literally cant

#

Theybdid multiple times

ocean pike
#

But I didn't see lol

spiral steeple
#

A simple search for 503 will give you multiple cases of them talking to users :+1:

ocean pike
#

Ah

#

Thanks

spiral steeple
#

Sorry i explained it as a dick mmLol

#

I didnt mean to be passive aggressive

thorny parrot
#

503 Backend fetch failed gettings these a lot

spiral steeple
runic grove
#

no

#

duh

#

in your bots page

edgy violet
#

On the site, you click on API or something along those lines and it's the top button on the left side I believe

#

There, you should be able to generate a DBL token @quartz heron

#

Yup

restive otter
arctic arch
#

wrong channel
just resubmit the form

restive otter
#

where ?

#

it's works now but where should I post this

sand hazel
#

General or development perhaps

cold tartan
#

How can I get upvotes for the last 24 hours? I tried with await self.dblpy.get_upvote_info(onlyids = True, days = 1), but it seems to ignore the parameters and gives me the upvotes for all 31 days.

arctic arch
#

the parameters dont exist anymore

cold tartan
#

Oh, then, what's the way to go?

arctic arch
#

you can get if a single user has voted in the past 12 hours, or use webhooks

cold tartan
#

Via DBL-Python-Library? Or is there any minimal viable example for this, in Python?

arctic arch
#

I dont think the python library is up to date

sand hazel
#

A lot of the API is outdated HappyThonk

restive otter
#

Why i prefer making my own dbl handler

restive otter
#
            // send the stats every hour to DBL
            const dbl = new DBL("mytokenhere", { statsInterval : 3600000 }, bot);
            dbl.on('error', e => {
             console.log(`DBL Error! ${e}`);
            })
             // Optional events
            dbl.on('posted', () => {
                console.log('Server count posted!');

            });```
scenic trail
#

Wait what the provided client is not supported ThonkEyes

restive otter
#

Idk what's happening

#

I define client as bot

#

Update what?

snow sky
#

Oh wait

#

Oh nevermind

restive otter
#

already ran it

snow sky
#

I can't read, what lib you using

restive otter
#

.js

#

d.js

snow sky
#

IDK how to help then sorry

restive otter
#

WHOA

#

YOU FIXED IT

#

ALEK

#

@snow sky

#

Thanks mate

snow sky
#

You just updated the dblapi package?

#

Wow

restive otter
#

yup..

spiral steeple
#

Well Im guessing whatever it the "client" was wasn't supported in the version you used mmLol

restive otter
#

yeah

#

thanks guys

#

The dblpy doesn't seem to be updating my server count

#

-botinfo @burnt heart

abstract mothBOT
#
Bot info
ID

522490058599694357

Username

GameBot

Discriminator

2148

Short Description

Simple Discord Bot | Multiple Game commands with a side of moderation.

Library
Prefix

g!

Total Upvotes

60

Monthly Upvotes

41

Server Count

No server count

Owner(s)

@plain smelt

restive otter
#

See

spiral steeple
#

Yea, its like dying

#

or something

restive otter
#

?

#

The API?

spiral steeple
#

Yes, atleast mine didnt update yesterday either

#

I didnt try it today

restive otter
#

Its supposed to update every 30 mins

plain timber
#

the site itself is pretty broken rn

topaz glacier
#

-botinfo @restive otter

abstract mothBOT
#
Bot info
ID

535120982952771594

Username

Euphoria

Discriminator

5451

Short Description

A Moderation bot with some fun commands and many more which is simple to use!

Library

discord.js

Prefix

;

Total Upvotes

48

Monthly Upvotes

47

Server Count

152 Servers

Owner(s)

@topaz glacier

topaz glacier
#

I used this const DBL = require('dblapi.js'); const dbl = new DBL('token', { 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!`); });

#

It doesn't log the votes

#

and it creates a webhook with link like this 0.0.0.00/webhook

#

and yeah I provided the correct token, server count code is working properly

arctic arch
#

@plain timber false

#

@topaz glacier you haven't put in the webhook details on the edit page

#

@spiral steeple @restive otter what error are you getting?

junior lintel
#

Never had any issues with any webhooks what so ever.

#

I followed the example on the website, same as Otaku. I get an error telling me the token is not defined.

arctic arch
#

is that a warning

junior lintel
#

No.

#

Just tells me it's not defined.

#

The index is looking like a mess anyways now, will have to clean it up with a config, perhaps that might help.

topaz glacier
#

@arctic arch should I put he weebhook creted on the log?

arctic arch
#

yes but you need to replace the 0.0.0.0 with your public ip

topaz glacier
#

I see

#

@arctic arch I used glitch to host the bot now what?

arctic arch
topaz glacier
#

aren't glitch default to 3000? @arctic arch

arctic arch
#

ye

topaz glacier
#

then just giving the link should work? right?

#

I tried doing that once but it didn't worj

arctic arch
autumn oxide
#

-botinfo @signal flower

sudden rampart
restive otter
#

Not even get a error

spiral steeple
#

Im not getting an error?

restive otter
#

Yeah I was having API key issues but we sorted that out

#

now it's not printing a error

#

Or a success message

restive otter
#

@bot.event
async def on_ready():
    params = {'shard_count': str(shardscount)}
    headers = {'Authorization': "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjUyMjQ5MDA1ODU5OTY5NDM1NyIsImJvdCI6dHJ1ZSwiaWF0IjoxNTQ3NzcyOTY1fQ.ZyHePD5BpXob1E9wymvnRtasv_IlTNRzHpR5QSkt4oU"}
    async with aiohttp.ClientSession() as cs:
        async with cs.post('https://discordbots.org/bots/522490058599694357/stats', params=params, headers=headers) as postshard:
            return
        return
    
    print("Bot Successfully loaded")
#

this doesnt seem to be posting the shard count

#

yes i regenerated

sand hazel
#

Is that the actual auth token

restive otter
#

it was, just reset it

#

it was the api key for my bot

#

i reset it now

#

hello?

restive otter
#

:/

#

Id really like to get this working

sand hazel
#

Can you show the code

restive otter
#
@bot.event
async def on_ready():
    params = {'shard_count': str(shardscount)}
    headers = {'Authorization': "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjUyMjQ5MDA1ODU5OTY5NDM1NyIsImJvdCI6dHJ1ZSwiaWF0IjoxNTQ3NzcyOTY1fQ.ZyHePD5BpXob1E9wymvnRtasv_IlTNRzHpR5QSkt4oU"}
    async with aiohttp.ClientSession() as cs:
        async with cs.post('https://discordbots.org/bots/522490058599694357/stats', params=params, headers=headers) as postshard:
            return
        return
    
    print("Bot Successfully loaded")```
#

i already posted it

#

thats the code

#

wait

#

-botinfo @burnt heart

abstract mothBOT
#
Bot info
ID

522490058599694357

Username

GameBot

Discriminator

2148

Short Description

Simple Discord Bot | Multiple Game commands with a side of moderation.

Library
Prefix

g!

Total Upvotes

62

Monthly Upvotes

43

Server Count

No server count

Owner(s)

@plain smelt

restive otter
#

hmm

#

-botinfo @burnt heart

abstract mothBOT
#
Bot info
ID

522490058599694357

Username

GameBot

Discriminator

2148

Short Description

Simple Discord Bot | Multiple Game commands with a side of moderation.

Library
Prefix

g!

Total Upvotes

62

Monthly Upvotes

43

Server Count

No server count

Owner(s)

@plain smelt

restive otter
#

what the hell

#

GG

#

i forgot to update a bit

#

-botinfo @burnt heart

abstract mothBOT
#
Bot info
ID

522490058599694357

Username

GameBot

Discriminator

2148

Short Description

Simple Discord Bot | Multiple Game commands with a side of moderation.

Library
Prefix

g!

Total Upvotes

62

Monthly Upvotes

43

Server Count

No server count

Owner(s)

@plain smelt

restive otter
#

WHAT THE HELL

spiral steeple
#

yes

#

find('a', 'b') is deprecated

#

use a function

#

or delete your question

#

that works too

junior lintel
#

Thank you, haha.

#

Found the issue, thank you for answering tho @spiral steeple

arctic arch
#

@restive otter you're only trying to send a shard count, that's invalid

#

you need a server count

restive otter
#

Im sending that now but

#

Ohh

#

Wait a second

#

you should make it so I can sent shard count separately

#

cause I kinda only want to shard when the bot wakes up

arctic arch
#

shard count is optional

restive otter
#

meh, okay

#

-botinfo @burnt heart

abstract mothBOT
#
Bot info
ID

522490058599694357

Username

GameBot

Discriminator

2148

Short Description

Simple Discord Bot | Multiple Game commands with a side of moderation.

Library
Prefix

g!

Total Upvotes

62

Monthly Upvotes

43

Server Count

No server count

Owner(s)

@plain smelt

restive otter
#

it still isn't doing server count

arctic arch
#

show your updated code

restive otter
#
async def backroundupdatestats():
    await bot.wait_until_ready()
    while True:
        data = {'server_count': len(bot.guilds)}
        headers = {'Content-Type': 'application/json', 'Authorization': "don't touch this token m8"}
        async with aiohttp.ClientSession() as cs:
            async with cs.post('https://discordbots.org/bots/522490058599694357/stats', data=data, headers=headers) as postshard:
                return
            return
        asyncio.sleep(1800)```
#

atTonkku#0107

arctic arch
#

hm

#

I'm looking at logs

#

can you run that once again

#

atr0b0t#1533

restive otter
#

It runs every 30 mins, lemme get it to run again

#

LMAO, I think it crashed

#

Hmm, restarting it now

#

-botinfo @burnt heart

abstract mothBOT
#
Bot info
ID

522490058599694357

Username

GameBot

Discriminator

2148

Short Description

Simple Discord Bot | Multiple Game commands with a side of moderation.

Library
Prefix

g!

Total Upvotes

62

Monthly Upvotes

43

Server Count

No server count

Owner(s)

@plain smelt

restive otter
#

@arctic arch

arctic arch
#

alright

#

it looks like your request doesn't have any body

restive otter
#

huh?

#

How would I do that

arctic arch
#

aka data in your code

#

your syntax might be wrong

#

it's worth asking someone who knows python

restive otter
#

Hmm okay

#

@snow fiber

snow fiber
#

Use json.dumps(data)

arctic arch
#

lol I see

#

stringifying

#

why is it called "dumps" tho

snow fiber
#

Dump string

#

Json.dump is for working with files

#

But I'm pretty sure you can also set json instead of data

#

So just json=data

restive otter
#

Okay

#

So do I string the servers

#

Is this correct

snow fiber
#

Dumps

#

Not just dump

arctic arch
#

are you coding on phone

restive otter
#

yes

#

yes I am @arctic arch

#

-botinfo @burnt heart

abstract mothBOT
#
Bot info
ID

522490058599694357

Username

GameBot

Discriminator

2148

Short Description

Simple Discord Bot | Multiple Game commands with a side of moderation.

Library
Prefix

g!

Total Upvotes

62

Monthly Upvotes

43

Server Count

No server count

Owner(s)

@plain smelt

restive otter
#

what the fucking hell

#

@snow fiber I changed dump to dumps and it didn't do it anyways

snow fiber
#

Hmm should work tho

restive otter
#

-botinfo @burnt heart

abstract mothBOT
#
Bot info
ID

522490058599694357

Username

GameBot

Discriminator

2148

Short Description

Simple Discord Bot | Multiple Game commands with a side of moderation.

Library
Prefix

g!

Total Upvotes

62

Monthly Upvotes

43

Server Count

No server count

Owner(s)

@plain smelt

restive otter
#

See

topaz glacier
#

@arctic arch sorry I was off what did u give? a glitch project?

restive otter
#

Okay @snow fiber can you help me with this please

snow fiber
#

What's the code you have now?

#

Fully, just without token

restive otter
#

Lemme get it

#
async def backroundupdatestats():
    await bot.wait_until_ready()
    data = {'server_count': len(bot.guilds)}
    headers = {'Content-Type': 'application/json', 'Authorization': "ok"}
    async with aiohttp.ClientSession() as cs:
        async with cs.post('https://discordbots.org/bots/522490058599694357/stats', data=json.dumps(data), headers=headers) as servercount:                return
            return
    asyncio.sleep(1800)```
#

WAIT

#

that return shouldn't be there

#

I removed it

#

-botinfo @burnt heart

abstract mothBOT
#
Bot info
ID

522490058599694357

Username

GameBot

Discriminator

2148

Short Description

Game Themed Bot | Has Fortnite Commands, Splatoon Commands, Roblox coming soon | Click on me to learn more

Library
Prefix

g!

Total Upvotes

62

Monthly Upvotes

43

Server Count

No server count

Owner(s)

@plain smelt

restive otter
#

Okay

#

I removed the return on same line as servercount:

#

And still doesn't work

#

:/

snow fiber
#

And where are you calling the function?

#

also do ClientSession(loop=bot.loop)

restive otter
#

Where?

snow fiber
#

just replace ClientSession() with it

restive otter
#

bot.loop.create_task(backroundupdatestats())

#

I'm doing tbaf

snow fiber
#

Ah, okay

restive otter
#

Right next to bot.run

snow fiber
#

And if you put a print('test') statement in the code?

restive otter
#

Let me try

snow fiber
#

Also, before or after run?

restive otter
#

Prints it

#

Before

snow fiber
#

Aight

restive otter
#

K

#

-botinfo @burnt heart

abstract mothBOT
#
Bot info
ID

522490058599694357

Username

GameBot

Discriminator

2148

Short Description

Game Themed Bot | Has Fortnite Commands, Splatoon Commands, Roblox coming soon | Click on me to learn more

Library
Prefix

g!

Total Upvotes

62

Monthly Upvotes

43

Server Count

No server count

Owner(s)

@plain smelt

restive otter
#

ugh Thonk

snow fiber
#

Can you do under as cs: print(await cs.text())

#

So print(await cs.text()) instead of return

#

Also keep in mind if that return is there it won't loop

restive otter
#
>>> %Run Bot.py
test
ready
Task exception was never retrieved
future: <Task finished coro=<backroundupdatestats() done, defined at /home/pi/Desktop/Bot/Bot.py:28> exception=AttributeError("'ClientSession' object has no attribute 'text'",)>
Traceback (most recent call last):
  File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
    result = coro.send(None)
  File "/home/pi/Desktop/Bot/Bot.py", line 35, in backroundupdatestats
    print(await cs.text())
AttributeError: 'ClientSession' object has no attribute 'text'```
snow fiber
#

Oh no I mean under the post part

#

smh

restive otter
#

huh?

#

It is

snow fiber
#

sleepy auxim

restive otter
snow fiber
#

No I mean not cs.text()

#

But however you call async with cs.post() as x:

restive otter
#

Server count?

snow fiber
#

so needs to be x.text()

restive otter
#

Okay

#

it's returned HTML code what the heck

snow fiber
#

lemme see

restive otter
#

too much too

#

Too much to copy

snow fiber
#

oh i see lol

#

You forgot /api

#

so the url is

restive otter
#

LMAO, I'm stupid

#

-botinfo @burnt heart

abstract mothBOT
#
Bot info
ID

522490058599694357

Username

GameBot

Discriminator

2148

Short Description

Game Themed Bot | Has Fortnite Commands, Splatoon Commands, Roblox coming soon | Click on me to learn more

Library
Prefix

g!

Total Upvotes

62

Monthly Upvotes

43

Server Count

No server count

Owner(s)

@plain smelt

restive otter
#

Doesn't this mean you can fake it

sand hazel
#

Yeah

restive otter
#

-botinfo @burnt heart

abstract mothBOT
#
Bot info
ID

522490058599694357

Username

GameBot

Discriminator

2148

Short Description

Game Themed Bot | Has Fortnite Commands, Splatoon Commands, Roblox coming soon | Click on me to learn more

Library
Prefix

g!

Total Upvotes

62

Monthly Upvotes

43

Server Count

64 Servers

Owner(s)

@plain smelt

sand hazel
#

there's also a rule that you will get banned if you do

restive otter
#

YES

snow fiber
#

Yes, and your bot will be removed if you do

sand hazel
#

soooo

restive otter
#

64

#

YAS IT WORKS

#

anyways

#

okay cool

snow fiber
#

Also, just a note

sand hazel
#

yes a note

snow fiber
#

But you are constantly creating a new ClientSession

#

Instead, do

restive otter
#

Hey @arctic arch you should make it so you can upload shard count separately

#

okt

snow fiber
#

cs = aiohttp.ClientSession(loop=bot.loop) somewhere before the function

restive otter
#

okay

snow fiber
#

You can just include shard_count in the json

restive otter
#

what's the point of updating every 30 minutes tho lol

arctic arch
#

^^

snow fiber
#

Because it isn't neccesary to be accurate up to the second

sand hazel
#

yes

snow fiber
#

But you can do 5 or 10 minutes and it's fine also

sand hazel
#

just do 1 every second

snow fiber
#

I mean I think you can

sand hazel
#

yes 60/m rate limit

snow fiber
#

The ratelimit is 60 per minute

restive otter
#

Whythodoggowave

snow fiber
#

But you wouldn't have any other queries left

sand hazel
#

that's like the only endpoint I ever request to

snow fiber
#

Same

arctic arch
#

spam and get ban

restive otter
#

what?

arctic arch
#

you dont need to update stats so often

restive otter
#

Can I do every 10 minutes tonkku?

#

i cannot invite the bot to my server how to invite

sand hazel
#

it's not spam if it's under the rate limit thinksmart

arctic arch
#

for dblapi.js, the shotest allowed is 15 minutes

sand hazel
#

oof

restive otter
#

I'm not using dblapi.js

#

python

wet sequoia
#

I update stats everytime my bot gets invited to or kicked from a server

restive otter
#

i think the bot creator blocked the bot invitation . pls help bro

wet sequoia
#

isnt that smart?

sand hazel
#

@restive otter ask in general

restive otter
#

@restive otter we aren't support

#

Hmm

#

So thonkku can I do every 10 @arctic arch

arctic arch
#

yes

restive otter
#

Okay

#

no ban?

sand hazel
#

no

#

60/m is the rate limit

#

anything under will be fine

arctic arch
#

if I see you in logs requesting every second tho I'm gonna manually ban you

restive otter
#

Wait so

sand hazel
restive otter
#

10 minute = allowed?

sand hazel
#

yes

sudden rampart
#

@wet sequoia updating on guild join/leave is dangerous

#

there were cases of discord spamming guild joins/leaves during outages in the past

wet sequoia
#

okay I'll change that, thanks for telling

restive otter
#

How to make votelocking use webhooks?

humble bison
#

on vote store the users ID in your db

#

in x hours remove it

#

and on cmd just check your db

rocky bear
#

hey, is the DBL api an event?

plain timber
#

??

#

wdym

rocky bear
#

I'm trying to get the API thing to work, so I can have the site show how many server I am in and such

spiral steeple
#

Shh

#

I didnt click the link

#

Wait

#

The docs dont exist

#

Nice

plain timber
restive otter
#

@plain timber how would I make something where if a user voted, it would dm them they're vote was registered and that they can use vote-locked commands

plain timber
#

@restive otter use webhooks

restive otter
#

i mean without webhooks

#

cause idk anything without db

#

about*

plain timber
#

well

#

for the dm u need webhooks

#

for the votelocking u can just use the api

#

no db needed

restive otter
#

yeah that's what ive been doing

#

but it's slow

#

and takes like 5 minutes

#

for the user to actually run a votelocked command

plain timber
#

well the only other solution is to use a db

humble bison
#

and then in 12h remove it ig

latent pasture
#

Hello guys !
I'm trying to get a list of users who voted for my bot. But each time i try to get it, it returns this error :

Ignoring exception in command_error
Traceback (most recent call last):
  File "C:\Users\Belhadi LahcĆØne\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\ext\commands\core.py", line 62, in wrapped
    ret = await coro(*args, **kwargs)
  File "c:\Users\Belhadi LahcĆØne\Documents\2_Larcks_Discord\TRU_Guibot\Guibot_0.5.1\main.py", line 47, in test
    await dblClient.get_upvote_info()
  File "C:\Users\Belhadi LahcĆØne\AppData\Local\Programs\Python\Python36\lib\site-packages\dbl\client.py", line 156, in get_upvote_info
    return await self.http.get_upvote_info(bot_id, onlyids, days)
  File "C:\Users\Belhadi LahcĆØne\AppData\Local\Programs\Python\Python36\lib\site-packages\dbl\http.py", line 210, in get_upvote_info
    return await self.request('GET', '{}/bots/{}/votes?'.format(self.BASE, bot_id) + urlencode(params))
  File "C:\Users\Belhadi LahcĆØne\AppData\Local\Programs\Python\Python36\lib\site-packages\dbl\http.py", line 160, in request
    raise Forbidden(resp, data)
dbl.errors.Forbidden: Forbidden (status code: 403): {"error":"Forbidden"}

The above exception was the direct cause of the following exception:```

My code is the following : 
```python
import discord

import asyncio
import logging
import aiohttp
import dbl

from discord.ext import commands

@client.command(pass_context=True)
async def test(ctx):
    dblToken = 'MY_TOKEN'
    dblClient = dbl.Client(client, dblToken)

    await dblClient.get_upvote_info()
    print('{}'.format(dblClient.get_upvote_info()))```

Any idea please ?
calm torrent
#

add ur dbl token in the variable

#

MY_TOKEN isnt a valid token

latent pasture
#

This is what i do, i replaced the token to post my part of code here ^^

restive otter
#

Hey, dbl library doesn't work well. I'd recommend posting it using aiohttp

latent pasture
#

It has a strange behaviour, when i pass my Bot's token, i get the Forbidden (status code: 401)
But when i pass the token that i got from discordbots/api it returns the Forbidden (status code: 403) šŸ¤”

I'm not very sure, but i guess that this issue is returned because of a bad token passed, i got the error 401 when i try to pass a bad token to use functions like get_user_info().

#

@restive otter Hmm, how could i get a voter list using aiohttp ?

restive otter
#

Oh, your getting voter list?

latent pasture
#

Yes i'm trying to get voters to give them some rewards you know

restive otter
#

idk about that, sorry. I just thought it was a server count poster

latent pasture
#

Ah np, ty for help

latent pasture
#

Any other way to get the last voters ? šŸ¤”

restive otter
#

Webhooks

fast tapir
#

Try it and see

plush ore
#

How do i fetch who voted for my bot?

runic grove
#

read the docs

plush ore
#

i've never used webhooks

plain timber
#

@plush ore if you want to run code when someone votes you need to use webhooks, if you want to just check if someone has voted you can use the API route but it's still recommended to use webhooks + db

#

The API route may not change instantly

restive otter
#

For the url you put your webserver
For the authorisation you put a password or some other crap

plush ore
#

@plain timber so using the api route, would I have to set up a 1 min interval or so to check for votes?

plain timber
#

@plush ore wdym

#

It's recommended that u don't use the API route

plush ore
#

Why?

plain timber
#

Because it gets updated late and can be wrong

#

Also you shouldn't spam the api

rocky bear
#

trying to get the server count working, getting this error
Traceback (most recent call last):
File "C:\Users\Aave\OneDrive\Bot\Main\Discord Bot\bot.py", line 17, in <module>
from discord.ext import commands
ModuleNotFoundError: No module named 'discord.ext'

restive otter
#

Anyone remember how to fix this? stupid admin on glitch messed up my bot

sudden rampart
#

you don't have a file in utils/botconfig.json

restive otter
#

Yea i figured that out, turned out that i didnt even need that anymore and was just putting it into all my commands but it never gave me a problem till now, thanks

restive otter
#

What's your bots name on glitch @restive otter

restive otter
#

SabresClawBot

#

its locked

#

@restive otter Why?

old grail
#

I just realized the http npm is dead

#

That's why my webhook is not working

#

What can I replace it with?

sand hazel
#

http is built into nodejs

restive otter
#

Is your token on glitch @restive otter

restive otter
#

Yes it's on my .env