#topgg-api

1 messages · Page 46 of 1

arctic arch
#

all versions older than that are now deprecated because they don't work with the api change

snow sky
#

alright

summer pine
#

For some reason I get a not found error with this code for c# d.net
DiscordBotListApi DblApi = new DiscordBotListApi();

restive otter
#

Hi, i want to know. With JDA when we build the DBL Api Object, it will automatic set online the bot on the website ?

runic grove
#

No, the bots status is fetched from this server

#

Meaning, if your bot is kicked the status on the website will display as "???"

restive otter
#

Ok ok

#

So, when my bot is approved(if he is approved) the status will be set to online/offline or if they didn't add the bot on the server it set to "???"

runic grove
#

Exactly

restive otter
#

Ok thanks u

plain timber
#

@lost compass don't store data in json...

#

Use a database

arctic arch
#

on glitch? lul

plain timber
#

yeah u can iirc

#

or host the db somewhere else

restive otter
#

If you can host the DB somewhere else, why are you using gltich to host the bot LUL

old river
#

^

plain timber
#

cuz there are free db hosts 🤔

#

like google

karmic hound
#

heroku ¯_(ツ)_/¯

#

host on some where else then just use the resources off that acnt

restive otter
#

Heroku destroys servers with your bot

#

He destroyed a dozen servers with my bot

sudden rampart
#

no

#

that means you leaked your token

karmic hound
#

thats called a leaked token

restive otter
#

My token never flees

karmic hound
#

also "he" heroku is a company which afik doesn't have a gender

sudden rampart
restive otter
#

@plain timber no they are not free.

plain timber
#

google's cloud firestore is free

restive otter
#

Maybe free trial but not free.

plain timber
#

it has a free plan

#

for an unlimited time

restive otter
#

Don't you still need to create an account and link your payment details?

plain timber
#

well u sign in with ur google account

#

but u dont need to put in payment details

restive otter
#

If I recall correctly, firebase is linked with Google cloud console, which does require that you add payment details

plain timber
#

well firebase doesnt

#

only gcp needs payment details iirc

restive otter
#

Also looking at their limits, for a production bot, they are really small....

#

Could see me surpassing them in a matter of hours

plain timber
#

well you dont use glitch do you

#

the person asking was using glitch

restive otter
#

Oh I definitely use glitch
I run my bot 24/7 no cap

harsh drum
#

i'm trying to use the python api to post my server count

#

and i get 403 forbidden

#

i'm just using the example on the site

#

the only thing i changed aobut it was the dbl token

#

for my bot

sand hazel
#

use the example code provided in the readme

harsh drum
#

thats what im using

sand hazel
#

You said you used the example on the site

#

which site

safe pewter
#

Hi

#

how can I check if the person voted on my bot within 12 hours?

lost compass
#

you can save data from webhook on vote

#

save surrent time

#

than if now < lastvote + 12 h

#

he has voted in last 12 @safe pewter

safe pewter
#

idk much about webkook, what should I do ?

#

I need help about setting up webhooks inside of my bot

safe pewter
#

i'm using Zapier for webhook

lost compass
#

ill look on it when ill go on pc, i didnt know much too but you just copy and paste some code than add what you want and it should work.

restive otter
#

w

harsh drum
#

@sand hazel that's the one i'm using lol, the one that's on the DBL site's api page

#

that's the one that gives me 403 forbissed

#

for context people:

#

i'm trying to use the python api to post my server count
and i get 403 forbidden
thonkspin
i'm just using the example on the site
the only thing i changed aobut it was the dbl token
for my bot

plain timber
#

@harsh drum 403 means either wrong token or ur IP banned

harsh drum
#

I don’t think I’m ip banned, I’ve never had any issues with DBL

#

I’ll see if my token is wrong

sand hazel
#

@harsh drum yeah you supposed to use the one on the GitHub readme

#

Not the dbl site one

hollow marten
#

a

half delta
#

GET /bots/{bot.id}/stats does not appear to exist.

arctic arch
#

it does

half delta
#

no it doesn't

#

it 404s

#

wait

#

i'm just retarded

#

nevermind

#

i forgot the /api/

safe pewter
#

hi, how can I use webhooks to receive vote updates in python ? there are only in js in the API

plain timber
#

@safe pewter you will need to set up a webserver

safe pewter
#

what do you mean?

plain timber
#

you need to set up a webserver and receive a POST request from DBL

safe pewter
#

Is there something I can use to get started?

plain timber
#

idk, you'll have to google how to set up a webserver in python

safe pewter
#

ok

arctic arch
#

look into flask

heavy summit
#

the hasVoted(...) method checks for 24 hours and not 12 hours? I remember the vote being once daily and not twice daily, so wondering if the api was changed to adapt to that

plain timber
#

its 12 hours

heavy summit
#

I need help setting webhooks inside of my bot quote. unquote.

#

I am trying to use the pinned manual example, wanted to make sure when i initialize dbl, do i need to specify port and auth in the options? actually, generally just need help with webhooks. @ me when someone is willing to help, thank you!

plain timber
#

@heavy summit just use dblapi.js

heavy summit
#

yeah, just needed help with a webserver, but i think i'll just end up using glitch :d

#

thank you though, also how long does it take for the bot to acknowledge the user has upvoted?

tidal burrow
#

As soon as the webhook sends that information to you

heavy summit
#

i was testing rn and i received the upvote message in my webserver but the command hasVoted() returns false for approximately 2 mins

plain timber
#

hasVoted isnt related to the webhooks

heavy summit
#

so i should check with the webhook to see if the person voted?

tidal burrow
#

If the webhook told you that they voted, then why do you need to check if they did?

heavy summit
#

my bot has a 24 hr daily command that they can get some additional currency for voting but im currently using hasVoted to check for it

plain timber
#

you can use webhooks to store votes in a db

heavy summit
#

okay thank you

heavy summit
#

the following code doesnt seem to work for me :

  //code
});```
#

my webhook receives the vote:
Incoming webhook: {"bot":"CLIENT_ID","user":"USER_ID","type":"upvote","query":"","isWeekend":false}

harsh socket
#

wdym it does not work?

heavy summit
#

like that event does not trigger

#

upon receiving the upvote

#

i tried logging it on console but nothing

harsh socket
#

I recommend checking if the webhook turns ready

heavy summit
#

i literally just learnt about webhooks, im not exactly sure what you mean by 'turns ready'

#

i am using glitch

harsh socket
#

The webhook will fire a ready event when it’s ready

heavy summit
#

oh it does turn ready bc i have this other piece of code:

  console.log(`Webhook is ready`);
});```
which does print on console
harsh socket
#

hmm

heavy summit
#

i think i may have initialized by dbl incorrectly then

harsh socket
#

ok

heavy summit
#

am i doing this right though:

const dbl = new DBL(dbltoken, { webhookPort: 3000, webhookAuth: webauthtoken});```
harsh socket
#

I’m pretty sure you need to pass webhookHost, but I think it defaults to 0.0.0.0

heavy summit
#

ah

#

okay thanks

harsh socket
#

oh wait that’s not a thing

#

hmm

heavy summit
#

o-o

harsh socket
#

idk then

#

sry

heavy summit
#

i just assumed the api would refer to the url i provided in the discordbots website

#

and no problem, thanks for trying

#

maybe webhookPath then?

heavy summit
#

if anyone is using glitch for their webhook, i'd appreciate if you could help. @ me, thanks

plain timber
#

@heavy summit what's the URL you put into DBL?

#

Also are you also running an Express/http server? If so you'll need to do additional setup to connect them

heavy summit
#

@plain timber the url is : https://project-name.glitch.me/webhook
and in glitch.me server.js i have it set as app.post('/webhook', ...) where app = express()
(sorry was asleep then, @ me when you reply)

west mason
#

anyone know what the voting endpoint is

#

this just returns not found

#

nvm got it

sudden rampart
west mason
#

ye

west mason
#

So basically, I have a PHP script going, and it loops the votes endpoint until it finds the user's ID, how do I make it so they can't run the script multiple times to get more rewards, because it sends a message to them in DMs, where they get the rewards. I just don't want people spamming the script, because they've voted twice in the month, and it just checks if their name is in the list.

#

wait

#

when they vote and run the script

#

i'll make a request to my api and check if they've already voted this month

dawn fjord
#

you could just use the webhook

glass solar
#

So, i am just trying to connect to the api, but it just comes up with Forbidden (status code: 403)
I am using the example displayed on the website, adjusted for the version of discord i am using
I am using the python package, with dblpy installed via pip

topaz wyvern
#

Make sure the token is correct

glass solar
#

Yep, it is definitely correct

sand hazel
#

Which example are you using

#

Use the one on the Github readme, not the one on dbl site

glass solar
#

ok, i was using the one on the dbl site. Since y'know it would make sense for the working example to be the first one you see

#

Yep... That worked

#

Could you tell me why?

#

Whats the difference between the two examples

sand hazel
#

the github one has ready check

#

otherwise the user id will be undefined

plain timber
#

@heavy summit you can use either app.post('/webhook') or dblapi.js for webhooks, you can't use both

heavy summit
#

oh hm okay, thanks

heavy summit
#

wait so is there no way i could integrate webhooks received on glitch to my bot?

sand hazel
#

there's

heavy summit
#

how do i go about that?

#

like in the doc i couldn't find any option to specify a host

sand hazel
#

just listen for the payload

#

set a new express route of post('/path')

#

then just set that endpoint in your dbl bot

heavy summit
#

ohh i see okay, thanks, sorry im absolutely new to webhooks

plain timber
#

well as i said you can do it either way

#

if you are using app.post in express you do not need to use dblapi.js for webhooks

#

its either or

heavy summit
#

so the endpoint in my dbl bot is: my_ip:port/path?

sand hazel
#

yeah

plain timber
heavy summit
#

yeah but i just cant get my head around on how to make my bot receive the webhooks sent to glitch, they appear in the glitch console, but idk how to inherit them. so i'll just try using the ip method

plain timber
#

no, your project ip can change

#

wdym inherit them?

#

the votes are getting successfully logged?

heavy summit
#

yeah they are

#

its just, like, i still have no idea how to 'get' the body of the webhook or the webhook itself that is being sent to glitch, like where exactly am i supposed to define it

plain timber
#

express or dblapi.js?

heavy summit
#

this is what i had before:

URL in DBL bot website : my-project.glitch.me/webhook

in glitch's server.js i had:

app.post("/webhook", function (request, response) {
  if (request.headers.authorization === token) {
        res.status(200).send();
        console.log('Incoming webhook: ' + JSON.stringify(request.body));
    } else {
        res.status(403).send();
    }
});
//Listener 
var listener = app.listen(process.env.PORT, function () {
  console.log('Your app is listening on port ' + listener.address().port); //3000
});```
and its receiving the webhooks correctly
light crag
heavy summit
#

well my real question is how do i implement that on my bot

#

like how do i make my bot receive the webhook being sent to glitch

plain timber
#

so what do you get when you do JSON.stringify(request.body)

light crag
#

You could try the dblapi module which will build it right in your bot so you could access stuff like the client.
Or you could try to get this process and your bots process to communicate. Could have a lightweight server on your bot which is private so it could transfer the data. That is how I would go at it.

harsh socket
#

u don’t need to send a response back

heavy summit
#

@plain timber the webhook received, for example this is the log:
Incoming webhook: {"bot":"ClientID","user":"UserID","type":"test","query":"?test=data&notRandomNumber=8","isWeekend":false}

harsh socket
#

ok

plain timber
#

so what exactly is the issue ThinkEyes

harsh socket
#

I know right

plain timber
#

obviously do you get the response

heavy summit
#

i dont have a problem interpreting the thing

harsh socket
#

So, what r u asking about?

#

like what part do you need help with?

plain timber
#

you can take that data and do whatever you want with it

heavy summit
#

i am asking that its being sent to glitch, and i want my d.js bot to use it

plain timber
#

what do you want to do with it

harsh socket
#

yup

#

no limit

plain timber
#

you can just save it to a database

#

or make it do something on vote

heavy summit
#

yeah, well my problem is how to receive it on my bot o-o am i missing something here?

plain timber
#

wait, is your bot not running in that glitch project?

heavy summit
#

no

#

thats why i initially wanted to set up with my ip o-o but i thought there was a way for me to just receive it on glitch and have my bot connect to that host

#

but i might as well host my bot on glitch then

plain timber
#

you could just store it in a db

heavy summit
#

can i use a local db on glitch?

plain timber
#

it doesnt really seem to be an api question tho

heavy summit
#

well my initial question i guess was on how to use webhooks since its my first time

plain timber
#

well now u know that, you just wanna connect your bot to the glitch project

heavy summit
#

alright, thanks

west mason
#

I aGREE

restive otter
#

Oof

trail shadow
plain timber
#

@trail shadow

  1. send it in 1 channel not 3 smh
  2. you want to act on a vote immediately or check if a user has voted?
trail shadow
#

act on a vote and give them a role for example

#

or give them something

restive otter
#

webhook

plain timber
#

you will need to set up a webserver and DBL's webhooks

#

DBL will send a POST request to your webserver

#

ive heard flask is good for python

trail shadow
#

hm thanks

old grail
#
const DBL = require('dblapi.js');
const dbl = new DBL(token, { webhookPort: 3000, 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(vote)});```
^^ my codes are like that, will webhook works? (I'm using glitch)
plain timber
#

Yes probably

old grail
#

So if I replace that console.log(vote) to ```let ok = client.channels.get("527308073296199700")
ok.send(📣 ${vote.user} just voted the bot! 📢)

Will that still working?
plain timber
#

yes

old grail
#

Hmm seems weird

#

It's not working for me

plain timber
#

any error?

#

and, it works with the console log but not sending to a channel?

old grail
#

No actually I didn't try that console log

#

Wait, should I write the bot url or something to the bot settings on DBL?

old grail
#

I'm not using express, what's my url?

plain timber
old grail
#

Okay let me try

#

What is authorization using for?

plain timber
#

It's whatever you set webhookAuth as in your code

#

It's to ensure that it's not a fake request

#

dblapi.js will make sure that the request auth will match the one in the code

old grail
#

Like it will send a log to the console?

old grail
#

I forgot to say, it sends the servers count

#

And why hasVoted is glitchy? It's delaying like a lot of time

sand hazel
#

cached

#

if you want mere realtime, use webhook

fast spruce
#

Same problem as above but in Java :/ some commands dont work

plain timber
#

uh wot

#

@fast spruce are you asking for help with the dbl api?

fast spruce
#

kinda

#

@plain timber

plain timber
#

well explain the issue

fast spruce
#

some commands dont run because the check if a user has voted doesnt work properly

#

and i cant refresh the server count

polar mirage
#

Just want to make sure, if I'm sharding, I should post the servercount of each shard to dbl?
Like this?

server_count: client.guilds.size,
shard_count: totalShards,
shard_id: shardID```
#

Well

#

I did it and it works

#

So I'll take that as a yes

tall comet
#

hey, I have a question
Would I be able to use

  console.log(`User with ID ${vote.user} just voted!`);
});```
 on another bot other then the one I own (with the defines and stuff at top).
I have a currency thingy and I'd like to give 10 coins every time someone votes.

Would this interfere with anything or cause problems?
plain timber
#

@tall comet you would still need to set the webhook settings in the edit page

flat gull
#

Hey guys, does anyone know the JDA api?

loud gulch
#

jda api?

#

or the java wrapper for the dbl api

sand hazel
#

JDA is the Java Discord API

loud gulch
#

thats confusing

#

how because im tired

plain timber
#

@flat gull are you asking for help with the DBL API? If so ask your question here, if not go to #development and ask your question there

flat gull
#

I think it is java discord api...

humble bison
restive otter
#

Anyone having issues with the DBLPy library? I keep getting a 403 Forbidden error

little harbor
#

did you authenticate?

#

you need to authenticate whenever you send a request

restive otter
#

yes of course

#

i put in my API key

little harbor
#

are you sure the token is valid?

restive otter
little harbor
#

im assuming this is a py lib for dbl

restive otter
#

yes

#

i can try regenning but

little harbor
#

i'd try that

#

i can't imagine what else would cause that error

loud gulch
#

might want to regen that token thonkeyes

restive otter
#

regenned

#

same error

little harbor
#

and make sure you're sending it to the right bot, maybe you're using the wrong id?

#

in the url

restive otter
#

i just copied the cog from here

little harbor
#

very odd

#

@sand hazel maybe you know?

sand hazel
#

know what

#

oh

little harbor
#

apparently they're using the right token

#

still getting a 403

sand hazel
#

@restive otter use this

#
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))
restive otter
#
    except Exception as e:
         ^
SyntaxError: invalid syntax
#

@sand hazel

sand hazel
#

huh

restive otter
#

this is a py3 bot

#

not py2

sand hazel
#

That should still work?

#

It's the same except Exception as your previous

#

I just added additional checks

restive otter
#

it keeps returning invalid syntax

sand hazel
restive otter
#

any ideas?

sand hazel
#

nope

#

python in a nut shell

restive otter
#

shit

#

@sand hazel anyway to make this shit work without this exception

#

i dont get whats wrong lmfao

sand hazel
#

me either

#

you should prob check things prior to that

#

maybe missing something

restive otter
#

nope

#

i did a complete copy-paste

#

i've been googling around and apparently its like

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

try ag a in

restive otter
#

nope

#

still the same error

#

@sand hazel

sand hazel
#

uhhhhhhhhhhh

#

use your old example

#

except replace

#

while True:

#

with

#
await self.bot.is_ready()
while not bot.is_closed():
restive otter
#

TypeError: object bool can't be used in 'await' expression

sand hazel
#

man what is this py 3 bs

restive otter
#

this is py3

sand hazel
#

it should work with 3.5

#

anywho, but just figure out a way to add ready check

#

from dpy

#

that's the problem with 403 forbidden

restive otter
#

@sand hazel patched some shit together and i'm still getting a 403 with the new code

#

i'll just drop a comment on the git and manually do it then

#

thanks again!

sand hazel
#

herp herp herp

#

alrighty

restive otter
#

So wait

#

whats the endpoint to post bot shit

#

nvm im dumb

#

@sand hazel sorry for the ping but you're the only one active

#

i'm trying to send the payload with server_count and

sand hazel
#

only one active

restive otter
#

its saying its missing ??

#

well

#

in this channel

sand hazel
#

what's missing

#

what's the message

#

can you give me the result payload

restive otter
#
url = 'https://discordbots.org/api/bots/421879566265614337/stats'
        payload = {'server_count': str(len(bot.guilds))}
        headers = {'Authorization': 'uwu', 'server_count': str(len(bot.guilds))}
        r = requests.post(url, data=json.dumps(payload), headers=headers)
        print(r.content)
b'{"error":"Required parameter server_count or shards missing"}'
sand hazel
#

can you print payload

restive otter
#
{'server_count': '1002'}
#

@sand hazel

sand hazel
#

replace that url

#

with that

#

so I can see the payload

restive otter
#

posted

sand hazel
#

Yeah for some reason I don't see the body

#

try using like

#

r = requests.post(url, json=payload, headers=headers)

restive otter
#

TypeError: request() got an unexpected keyword argument 'payload'

sand hazel
#

curses

#

uh

#

thought that lib has that

#

but nvm

#

hue

#

back to your original

#

but can you pass an application/json in Content-Type as a header

restive otter
#

wait

#

i got it

#

i think

sand hazel
#

yeah

#

then switch the url back

restive otter
#

got it

#

tysm @sand hazel ❤

fast spruce
#

I can't post the Servercount to DBL🤔

humble bison
#

error?

fast spruce
#

no error

mystic wing
#

code?

humble bison
#

inb4 "no code"

heavy summit
#

so i have this code:

dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});
dbl.webhook.on('test', test => {
  console.log(`User with ID ${test.user} just tested!`);
});```
and every time i try testing from the edit bot page in discordbots, it gives me:
`User with ID 'my_id' just voted!`
#

does on('test') not exist?

loud gulch
#

um no

#

also its supposed to do that

heavy summit
#

o okay, thanks

loud gulch
#

afaik

toxic solar
#

hey guys, does anyone know why I keep getting the 403 forbidden error when I try to update the server count?

#

Im storing the token as an environ variable

runic grove
#

most likely wrong token

toxic solar
#

should I get a new one?

runic grove
#

are you sure youre using your dbl token

toxic solar
#

yeah

#

its the one in bot edit settings

loud gulch
#

regen

#

and try again

toxic solar
#

ok, ill try

#

but its weird, it still shows up on my bot'sedit page

restive otter
#

@toxic solar yo

#

what lib are you using

toxic solar
restive otter
#

i had the exact same issue last night

#

lemme get you my code

toxic solar
#

oohh

#

sure thing

loud gulch
#

uh

#

no

#

rule 7

toxic solar
#

also regen keeps giving me the same token

#

common this is not "spoon feeding"

#

this is advanced problem solving

loud gulch
#

totally

restive otter
#

@loud gulch shut it

#

i got help last night

#

so

#

idc

#

@arctic arch could you pin that to this channel so people with the same problem know the solution?

toxic solar
#

thx ill look into it

loud gulch
#

oh ok

sudden rampart
#

isn't requests blocking?

restive otter
#

what?

sudden rampart
#

the python requests module

restive otter
#

wdym "blocking"

sudden rampart
#

exactly what i said

restive otter
#

isnt requests block the python requests module

#

i'm not sure what you're asking here

loud gulch
#

it is

#

its recommended to use aiohttp

restive otter
#

¯_(ツ)_/¯

#

requests is easier

loud gulch
#

@sudden rampart

#

and jacc

sudden rampart
#

i know what blocking is

loud gulch
#

no thats for

#

@restive otter

#

smh

#

i mentioned you for my last message

restive otter
#

@sudden rampart if they just fixed the lib we wouldnt have to use such a janky solution

#

¯_(ツ)_/¯

sand hazel
#

It's prob better off if you pr the python module

#

or make one to replace it

#

the original author seems to be gone

restive otter
#

eh ig i can see what i can do

sand hazel
#

@restive otter if you do a pr, I can merge it

tepid garden
#

never mind

#

how do i get the webhook url

mystic wing
#

It is where you are running the code for the webhooks

#

(server address + subdirectory)

#

1.1.1.1/webhook ex

tepid garden
#

i dont quite understand

#

so a website url with /webhook after it

sudden rampart
#

no

#

you put the url where YOUR webserver is listening for webhook requests

tepid garden
#

i dont have one i think...

sudden rampart
#

then you need to get one

tepid garden
#

how

sudden rampart
#

what language are you using?

tepid garden
#

javascript

sudden rampart
#

use dblapi.js

#

it can run a webserver for you

#

to fire webhook events

tepid garden
#

so in the url i just put that

mystic wing
#

@tepid garden the URL is the servers ip address

#

And then /whatyouset

#

As mentioned use dblapi.js

tepid garden
#

dblapi.js/whatiput ?

plain timber
#

..

#

no

#

dblapi.js is a module

tepid garden
#

im complete new to this

plain timber
#

you need to code the webhook

tepid garden
#

so if i use glitch.com can i use the website for that?

plain timber
#

oh you use glitch?

#

do you use express?

tepid garden
#

yea

plain timber
#

do you have a const listener = app.listen line?

tepid garden
#

i deleted it but i can add it back then yes

plain timber
#

well you need to put the webhook code below that

#

but change webhookPort: 5000 to webhookServer: listener

tepid garden
#

k

#

but do i need to put the link the the url for the bot settings

plain timber
#

in the bot's edit page the url is https://PROJECTNAME.glitch.me/dblwebhook

tepid garden
#

thanks

nimble crescent
#

I may have an issue with the Java api..

#

Every 5 minutes, I send stats to DBL but I can't see guilds count on my bot's page Thonk

#

ooooh

#

I'm a stupid guy

#

nvm

sand hazel
#

wew

nimble crescent
#

I literally put my bot token in the api......

#

so retarded

restive otter
haughty tundra
#

Are we allowed to edit the DBL API (the one we have installed)?
Just to make things easier.

#

@arctic arch (I would assume you would have a say about this since you're an web adminn)

arctic arch
#

yes?

haughty tundra
#

So its allowed.

weary ember
#

why wouldn't it

plain timber
#

@haughty tundra you can't install an api, are you referring to a library for the API? If so why wouldn't u be able to edit it, it's just code you can write yourself but packaged

runic grove
#

Advaith is right, you can even make your own lib for the api

haughty tundra
#

@plain timber indeed xP, IDK just wanted to be safe

humble bison
#

just don't break the license @haughty tundra

tepid garden
#

how can i send a private message to the user that voted

dawn fjord
#

@tepid garden what language and library are you using?

tepid garden
#

discord.js, node.js, javascript

fleet tide
#

node.js isnt language ok

loud gulch
#

^ actually

low ginkgo
#

hey any of yall here use the random puppy generator API

spiral steeple
#

Idk about puppy i got a dog one tho

#

Lol

#

Im pretty sure one exists.

restive otter
#

^^

low ginkgo
#

Do you know how to limit the generator, (since you can change which subreddit it pulls from) to not pull images from NSFW channels?

restive otter
#

@abstract moth

spiral steeple
#

Your talking about reddit api?

low ginkgo
#

yea

spiral steeple
#

Never used it, will look into it for you tho

low ginkgo
#

This one:

plain timber
#

@low ginkgo this channel is only for the DBL API as the channel topic says, for help with other apis go to #development

low ginkgo
#

oh kk

hearty perch
#

Is there anything built into the API for checking the account ages of connections

#

Or do I have to connect to each respective API

harsh socket
#

wdym account ages

humble bison
#

wrong channel

harsh socket
#

yes

hearty perch
#

The discord api

#

Account connections

harsh socket
hearty perch
#

Is there any way to get account age metadata from a DiscordAPI connection object, or do I have to connect to, say, the FB api

#

oh

#

Ooooh my b

thin gulch
#

Is there a delay in the results of /bots/{bot.id?}/check being updated?

plain timber
#

Yes it's cached iirc, it's recommended you use the webhooks instead

thin gulch
#

I can't really test that locally though :<

#

And does it do backoff in case my bot goes down for a bit?

manic igloo
#
(node:4605) UnhandledPromiseRejectionWarning: TypeError: dbl.hasVoted is not a function```
#

why?

cyan ruin
#

code please

manic igloo
#
dbl.hasVoted(message.author.id).then(voted => {
    if (!voted) return message.channel.send(`Bu komutu kullanmak için botumuza DBL'den oy vermen gerekiyor. Oy vermek için **v/dbloy**`);
    if (message.channel.nsfw === true) {
      const get= require('superagent')
            .get('https://nekobot.xyz/api/image')
            .query({ type: '4k'})
            .end((err, res) => {
              message.channel.send({ file: res.body.message });
            });
      } else {
        message.channel.send({embed: {
            description: "Bu bir NSFWF kanalı değildir! Lütfen bir NSFW kanalında deneyiniz."
        }})
      }
                           });
};```
#

Please look

sterile dawn
#

@manic igloo bu ne komutu ?

manic igloo
#

nsfw ama

#

dbl oyu vermeyenler kullanamıyor

#

uyarı veriyor

sterile dawn
#

çok iyiymiş

#

birşey değiştirmeye gerek varmı

manic igloo
#

Hata veriyor

#

yukarıya bak istersen

#

This is not about api

indigo shoal
#

Is it against some kind of tos to use a oauth app to automatically bot for bots?

thorny parrot
#

It would be cool if the api provided if the bot is offline or not.

sand hazel
restive otter
#

Just find the bot from this guild and check its status

sand hazel
#

the API would return the status for one shard

grizzled agate
#

hello what to press to get the full api key ?

harsh socket
#

you can find your bots api key on the modify page or on the api docs

grizzled agate
#

i am there but for some reason it doesnt give me the full code only half of it 😦

harsh socket
#

you need to copy it then

sour garden
#

Guys what is shards

#

no bully plz ;)

#

minx.confused()==True

#

"shards" not in minx.dictionary["programming"]

sand hazel
#

what

sour garden
#

I don't know what you mean when you talk about a bot having multiple shards

sand hazel
sour garden
#

Good point, I guess I just saw people mentioning shards earlier in this channel and asked here

#

I'll move to... Idk

fringe epoch
#

Hello everyone, I really need some help with the Python API:

#Importing libraries 
import discord
from discord.ext import commands

#Defining the bot
gopbot = commands.Bot(command_prefix ='!')

import dbl

import aiohttp
import asyncio
import logging


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

    def __init__(self, bot):
        self.bot = bot
        self.token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjQ1ODQwNDkyMDk3MDk2OTA5OCIsImJvdCI6dHJ1ZSwiaWF0IjoxNTM4OTQ2ODk3fQ.B90Jn0yasKskZE5rpyyz_n3z-NfTF2YT_mGHeGFsipw'  #  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:
            print('HAHAHAHAHAHAHAHHAHAHAHAHAHAHAHAHAHAHHAHAHA')
            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(20)
            



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

setup(gopbot)
#

Gives:

HAHAHAHAHAHAHAHHAHAHAHAHAHAHAHAHAHAHHAHAHA
Failed to post server count
AttributeError: '<class 'discord.ext.commands.bot.Bot'>' object has no attribute 'guilds'
Traceback (most recent call last):
  File "/Users/Zl109819/Documents/PythonBot/botjes/spy blin.py", line 40, in update_stats
    logger.info('posted server count ({})'.format(len(self.bot.guilds)))
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/discord/client.py", line 296, in __getattr__
    raise AttributeError(msg.format(self.__class__, name))
AttributeError: '<class 'discord.ext.commands.bot.Bot'>' object has no attribute 'guilds'
#

What I did wrong, I don't understand.

#

I took the code from the example.

sour garden
#

You need to run the bot at the end of the code, after setup

fringe epoch
#

I did.

sour garden
#

bot.run("your_bot_token")

fringe epoch
#

Whait

#

Okay, after

@gopbot.event
async def on_ready():
#

This?

sour garden
#

No

#

Right at the end

fringe epoch
#

#Get's the bot online!
gopbot.run(Token)

sour garden
#

Yes

fringe epoch
#

Bruh I am not a debil, that is not API that is Discord bot

#

It's about the DBL api

sour garden
#

But you need the discord bot running to be able to post server count

#

Otherwise how does DBL know how many servers the bot is on

fringe epoch
#

...

#

I HAD IT RUNNING

#

It's not the only code

#

Ofc

#

The whole code is 122 lines

sour garden
#

Oh

fringe epoch
#

So over the 2000 limit

#

It's only the DBL thing that I added and gives error

sour garden
#

Idk then

fringe epoch
#

Oh well found the problem

#

The example

sand hazel
#

Just saying, the python lib doesn't support the ext framework

fringe epoch
#

Is shit

sour garden
#

I don't use discord.ext

sand hazel
sour garden
#

No you aren't

#

Are you?

fringe epoch
#

logger.info('posted server count ({})'.format(len(self.bot.guilds)))
should be:
logger.info('posted server count ({})'.format(len(gopbot.servers)))

#

Then it works fine

#

What is this Cyka example

#

Wtf is discord.ext

sour garden
#

@meager folio is written using dpy, with a separate piece of code running the bot with discord.ext with server count updater

sudden rampart
#

from discord.ext import commands

sour garden
#

discord.ext is what you use @fringe epoch

sand hazel
#

which version are you using

sour garden
#

Me?

sand hazel
#

no

fringe epoch
#

Again

sand hazel
#

there might be some attributes changes

fringe epoch
#

This example is gavno

#

Total trash

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

This is the updated one with the ready check

fringe epoch
#

If the example itself uses "from discord.ext import commands"

sour garden
#

Exactly

sand hazel
#

however there may be some version conflict

fringe epoch
#

Then u can't blame me.

#

I already found the problem

#

The example is incorrect

#

logger.info('posted server count ({})'.format(len(self.bot.guilds)))
should be:
logger.info('posted server count ({})'.format(len(gopbot.servers)))

sand hazel
#

well whatever floats your boat, it works for most people here

fringe epoch
#

But maybe for rewritten it works

#

but 3.6.5 uses .servers

sour garden
#

Insult people in Shakespearean English

sand hazel
#

@sour garden don't advertise your bot please

sour garden
#

Ok

sand hazel
#

yeah maybe it's meant for the rewrite

#

not sure

sour garden
#

It's for rewrite, definitely

sand hazel
#

we need to get the doc updated :/

fringe epoch
#

Uhu

#

I tried this DBL Api several other times

#

But nobody could explain me

sand hazel
#

?

fringe epoch
#

That I tried to use the example serval other times

#

Like a month ago

#

And therefore 2 months ago

sand hazel
#

What you tried it with the rewrite branch

fringe epoch
#

No, I never used rewrite

#

Because there are small amount of examples

#

I use original

sand hazel
#

The maintainer of the DBL py lib is inactive, so I have no idea

sour garden
#

Your bot is currently rewrite

fringe epoch
#

No, it isn't rewrite

#

That is 3.7

sour garden
#

you use discord.ext

sand hazel
#

You can also make the call yourself to the DBL API

#

someone posted a snippet using request few days ago

sour garden
#

@restive otter's bot @restive otter does that

fringe epoch
#

Well then explain my why gopbot.guilds DOESNT WORK (rewritten command, read the api...)
And GOPBOT.server sdoes work

#

So again, I don't use rewritten

sour garden
#

That's weird

sand hazel
#

just change it to bot.servers

#

simple snippet to post the data yourself

fringe epoch
#

Indeed

#

I did

#

But that should be on the example page...

sand hazel
#

well, the dbl api page is outdated

fringe epoch
#

I already said 3 times that I did do that

sand hazel
#

I don't think it's even updated

fringe epoch
#

Oh...

sand hazel
#

Your best bet is to look on the Github repo readme

fringe epoch
#

Ah well it works now

#

And I don't like dbl api that much that I am going to read it while it works

#

As long as it works, I'm not going to read.

warm topaz
#

Whats API means?

humble bison
#

like, application programming interface or some cool crap

plain timber
#

yes

indigo shoal
#

Is it against some kind of tos to use a oauth app to automatically vote for bots?

plain timber
#

its probably not possible

#

but idk if its against the actual tos

#

actually yeah it might be possible

hearty perch
#

Afaik upvoting the bot requires visiting the dbl website, so that would violate ToS if you got a scraper working

plain timber
#

i dont see it in the tos

indigo shoal
#

Guess I'll just ask a website admin or mod

restive otter
sinful hollow
#

x

thorny parrot
#

"the API would return the status for one shard"

That's fine by me. Since the information is already acquired by DBL, why not put it in the API too?

#

Would be nice.

restive otter
#

I do use the vote webhook, but sometimes some votes don't appear through webhooks either because the connection is bad or the bot is restarting currently.
That's why I'd like to fetch the last 1000 votes using dbl.getVotes() every 5 minutes and check if the specific user has voted in the last 12/24 hours and if they have received their reward yet or not (in case the webhook didn't go through).
Unfortunately .getVotes() doesn't tell me the timestamps when someone voted which means I can't compare it and check if the user voted in the last 12/24 hours.
Any other idea how I could do what I'm trying to achieve?

arctic arch
#

you can check if one user has voted in the last 12 hours with .hasVoted(id)

restive otter
#

I'd have to use this method for a lot of users then.

#

Not the best way in my opinion.

arctic arch
#

well I'd make a command to check if the user didn't receive their reward

restive otter
#

oh lol

#

good idea.

#

thx

polar mirage
#

If you're gonna check every 5 minutes anyway, you could save the previous values and compare them with the new values. All the new ones would mean they voted in those last 5 minutes mmLol

arctic arch
#

yeah that is a good idea too

regal rivet
#

Anyone know why my bot says ??? for online status?

runic grove
#

Its not in this server

grizzled saddle
#

Check #mod-logs if your bot got kicked or something

haughty tundra
#

Hi.
I have no clue on how to retrieve my vote info using webhooks.
May anyone be so kind to help me out?

#

@regal rivet It might take some time if ur bot just got added. (atleast it did for me)

regal rivet
#

My bot has been there for 3 months

#

It has 545 servers

#

And just recently it decided to make the status for the bot ???

#

on the website and i dont know why

haughty tundra
#

Oh

#

LOL

regal rivet
#

exactly

#

Like it was working perfectly

#

then i added a new version of the bot

#

and it decided to go all autistic

haughty tundra
#

I don't think its in the server.

#

@regal rivet

regal rivet
#

i got it

#

fixed that on the update as well 😭

haughty tundra
#

Message staff about it. ^^

regal rivet
#

wait tf it means dms on empty prefix

spiral steeple
#

you put just the prefix and no command

#

I thing

#

think*

old grail
#
dbl.webhook.on('vote', vote => {
let ok = client.channels.get("527308073296199700")
let votea = new Discord.RichEmbed()
 .setColor("GREEN")
    .setDescription(`${vote.user} just voted the bot! 📢`)
ok.send(votea)
});```
Error: ok.send(votea)
                  ^
TypeError: Cannot read property 'send' of undefined
#

what's the problem?

restive otter
#

@old grail ; i think

old grail
#

still not working ;/

restive otter
#

ah

#

dont you need to do

#

{ embed : vota}

#

i never really played much with js

old grail
#

huh why? but console.log works well

restive otter
#

what

#

what does console.log have anything to do with what you are have problems with

old grail
#

my problem is
Error: ok.send(votea)
^
TypeError: Cannot read property 'send' of undefined
but if I use console.log('testing 1 2 3')
works.

restive otter
#

this doesnt have nothing to do with your problem

#

did you try {embed : vota}

old grail
#

what's that??

restive otter
#

ok.send({embed: vota})

smoky trench
#

ok is undefined, thats what the problem is lol

old grail
#

the problem is ''.send''

smoky trench
#

meaning the channel doesnt exist

old grail
#

maybe you are right

smoky trench
#

i am right

#

and it's not exactly relevant to the api itself, this is more of a #development issue

tepid garden
#

node.js and discord.js is a library @fleet tide

fleet tide
#

node.js is a runtime

primal plank
#

Hey! My stats won't update 😢

#

%eval dbl.postStats(client.guilds.size)

#

Even when I eval it nothing happens

runic grove
#

is dbl defined properly?

primal plank
#

Yes it is

#
const Discord = require('discord.js');
const DBL = require("dblapi.js");
const client = new Discord.Client();
const config = require('./config.json');
const dbl = new DBL(config.dblToken);
const embeds = require('./embeds.js');
const cooldown = new Set();```Thats at the top of everything
#

I thought I might have been blocked because I changed it every time the bot joins or leaves a server but a block is just 1hr

#

An I changed it now

#
client.on('ready', function(){
    console.log("MemberCounter is ready!");
    dbl.postStats(client.guilds.size);
    setInterval(function() {
        dbl.postStats(client.guilds.size);
    }, 300000);
    client.user.setActivity('%help', { type: 'PLAYING' });
})```This is my ready event
fleet tide
#

em, error from console? :p

primal plank
#

Wait a sec

#

Hm strange

#

When I host it on my PC it works Thinktastic

#

But it doesnt work on my Raspberry

#

🤦 I forgot the dbl token in my config on my Raspi

#

But thank you ThumbsUp

dapper helm
#

gg

trim zenith
#

just asking: with
dbl.on('posted', () => {
console.log('Server count posted!');
})

#

the server count only gets posted at start

#

i have to do an Interval to refresh it?

humble bison
#

read the docs

restive otter
#

@restive otter here you can get help for posting your server count i don't have time right now someone may have

hallow prairie
#

@primal plank OwO you are hosting on rpi as well? 😅

primal plank
#

Of course! Raspberry is the way to go when starting coding and having small bots. But yesterday we had a power breakdown and everything was down but thats okay xD @hallow prairie

hallow prairie
#

;p

#

still trying to get mine working on boot

#

it's being one pain in the arse

#

it worked then decided

#

nah

#

I don't like you

#

and now my bot is offline

#

reee

#

oof

#

I think I know the possible problem

#

OOF

#

I didn't run cd xd

#

reee

#

it all makes sense now

#

yey

#

xd

craggy sentinel
#

consider using less new lines pls

hallow prairie
#

Ok

misty scroll
#

Can someone help me with webhooks?

#
const DBL = require("dblapi.js");
const dbl = new DBL('no token4u', { webhookServer: server, /*webhookPort: process.env.PORT,*/ webhookAuth: 'probably same thing as above' }, client);
#
dbl.webhook.on('vote', async (vote) => {
  console.log(`someone with id ${vote.user} voted.`)
});
#

doesnt work

plain timber
#

@misty scroll you need to change 0.0.0.0:0 to your IP/domain:port

old grail
#

how to check total votes from a bot?

plain timber
#

@old grail just use the get bot endpoint, points is total votes and monthlyPoints is the monthly votes

old grail
#

.getBot("id").points?

plain timber
#

Are you using dblapi.js?

#

If you are, then no, since .getBot returns a promise

old grail
#

then how?

sand hazel
#

wait for the promise to be fullfilled Thonkang

misty scroll
#

@plain timber 🤔 How tho? using express().listen(port) doesnt work

plain timber
#

are you using dblapi.js or express

#

dblapi.js should start a webserver

misty scroll
#

express

plain timber
#

well your code was dblapi.js

#

where are you hosting?

misty scroll
#

glitch

#

oh ye i use both

#

api and express

plain timber
#

k so then in DBL, the url should be https://PROJECTNAME.glitch.me/dblwebhook

misty scroll
#

hm

#

let me check

#

@plain timber

plain timber
#

yes you cant visit it in your browser

misty scroll
#

but it works?

plain timber
#

yes

misty scroll
#

thanks uwu'

plain timber
#

browsers make get requests but webhooks use post requests

#

yw

misty scroll
#

yey finally works

fast spruce
#

The If(UserVoted) Check doesn't work properly🤔

weary ember
#

it uses cache results and if ur bot has more than 1k votes it doesn't show

solemn knot
#

Does anyone know how to get google's youtube data v3 api to fucking work

#

I keep getting

{
 "error": {
  "errors": [
   {
    "domain": "usageLimits",
    "reason": "accessNotConfigured",
    "message": "Access Not Configured. YouTube Data API has not been used in project [redacted] before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/youtube.googleapis.com/overview?project=[redacted] then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.",
    "extendedHelp": "https://console.developers.google.com/apis/api/youtube.googleapis.com/overview?project=[redacted]"
   }
  ],
  "code": 403,
  "message": "Access Not Configured. YouTube Data API has not been used in project [redacted] before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/youtube.googleapis.com/overview?project=[redacted] then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry."
 }
}
humble bison
solemn knot
humble bison
#

your in the wrong channel

#

and can you not tell me to move to an unrelated channel

solemn knot
#

Shh

#

calm down

humble bison
#

@amber dune can i have some help

#

i don't like being told off

amber dune
#

@solemn knot angeryBOYE

#

tony is right

solemn knot
#

@amber dune anger

amber dune
#

this chanel is for the dbl api

solemn knot
#

Yeah? and I moved my message

#

your problem?

amber dune
#

not just any other api angerysad

#

whoa there

solemn knot
#

Here's an idea

amber dune
#

be nice everyone

solemn knot
#

"dbl-api-support"

amber dune
#

but it says in the channel topic

solemn knot
#

Also can that ned flanders looking ass that ghost pinged me fuck off?

amber dune
#

its only for the dbl api

#

chloe plz

restive otter
#

nsfw url plz 😄 xD

scarlet copper
#

im still getting a forbidden with the server post cogs

sacred stratus
#

ayy 3rd time on starboard

sand hazel
#

cool but why you posting in api Thonkang

sacred stratus
#

idk

idle apex
#

Error: 401 Unauthorized.

plain timber
#

@idle apex that means you didnt provide an api key, however are you sure the error is on this list?

idle apex
#

Yes, im pretty sure.

#

Because i only submit my bot in 4 website.

plain timber
#

well you didnt provide an api key

idle apex
#

But, i've been,

plain timber
#

well thats what the error says blobshrug

idle apex
plain timber
#

are you on the latest version of dblapi.js?

idle apex
#

:(

#

yes.

#

i always update my package

#

@plain timber I put the wrong token API.

tiny swallow
#

is voting broken atm?

dawn fjord
#

Doesn't appear to be, why? @tiny swallow

scarlet copper
#

still no fix for 403 forbidden?

#

this is on my own pc now

#

just @ me

sand hazel
#

show code

scarlet copper
#

i have the correct api token

#

its the example on the dbl website api

#

Sorry about this again tonkku but i haven't been able to update my server count in a while

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

try this

scarlet copper
#

it works thanks

#

and line 27 of the code is missing an )

sand hazel
#

yeah idk which line that is, discord doesn't have line count

scarlet copper
#
logger.info('Posted server count ({})'.format(self.dblpy.guild_count())
#

what did you do?

sand hazel
#

added ready check and ws check

scarlet copper
#

Thanks for the help!

old grail
#

Hello, I want to ask, that .hasVoted is 24hours or 12 hours?

plain timber
#

@old grail 12 iirc

summer pine
#

For the C# / Discord.NET API I get an error saying The type or namespace name 'ISelfBot' could not be found (are you missing a using directive or an assembly reference?)

#

for: ISelfBot me = await DblApi.GetMeAsync();
Is there something else I am supposed to include?

restive otter
#

yhow

#

how

#

ojh

#

oh thx

#

who help me

oak dagger
shut ibex
#

That's not enough information

#

We need to see code

#

And full error

oak dagger
#

?????

humble bison
oak dagger
#

-_-

restive otter
#

eeeeeeeee

#

bad

spiral steeple
#

I just got a "Forbidden" error when posting to dbl. It didn't update my server count (obviously) what does this mean or how do I fix it?

#

Nvm I was using the wrong ID, this is also the wrong channel forthis 👌

tidal rover
#

does dbl.webhook.on have to be in a bot event?

weary ember
#

no

#

it should not be

tidal rover
#

then there must be another reason im not getting ym votes thro on the bot thonk

hollow wraith
#

a few reasons. ports, hosts, url..

tidal rover
#

i think i forgot to set it

#

but when it says URL what URL do i put

hollow wraith
#

where are you hosting your bot

tidal rover
#

VPS server

hollow wraith
#

ofc the actual public IP

#

and port

tidal rover
#

thanks

hollow wraith
#

working?

tidal rover
#

i need to get my public IP i have a confusing system for the VPS bcuz I get it for free 😄

hollow wraith
#

do u have a web browser on your vps?

tidal rover
#

idk i dont get access to it

#

its a personal machine from a company in london that hosts my bot for free

hollow wraith
#

how did u get your bot on it

tidal rover
#

i send them the files

#

they put them up

hollow wraith
#

you will need to ask them probably

#

that sounds like a massive pain 😂 sorry

tidal rover
#

it is but then i realise im getting it for free and i shrug it off

#

they're quite active anyways

hollow wraith
#

that's good. I'm assuming your bot is written in js

#

there are some free hosting places I believe like heroku and something else

noble wing
#

;receive

cunning sluice
#

How would I dm a user if they upvoted my bot, I added the dbl connection
But having troubles with messaging them
I assume I use the


});```
tidal rover
#

is bot dming not against some form of TOS whether its bot or api?

cunning sluice
#

Its not lol

polar mirage
#

Sending a user a DM when they do a certain action is not against tos..

safe girder
#

Sending lots of DM to lots of users simultaneously would be against ToS, but sending a message when somebody votes is fine (lots of bot do that)

polar mirage
#

I assume you're using discord.js

cunning sluice
#

yes lol

polar mirage
#

Get the user from client.users

#

And use .send on it

cunning sluice
#

ye ik how to dm lol I guess im more confused on how the api works

#

});```
Would this be the right way to do that ^^
#

the hasVoted function worked but that only works in the message event right? I want to do it right away when they upvote?

hollow wraith
#

vote should be your return object.. if I recall what I've seen of the JS code. So it should have user defined in the vote object.

restive otter
#

Somebody can help me with posting stats ?

cunning sluice
#

hmm

#

so I can do this vote.user.send(embed); or am I misunderstanding?

hollow wraith
#

user is just the user id

#

so you would have to define the user

#

guild.getUsers(user) or whatever the function may be

cunning sluice
#

hmmm

hollow wraith
#

wesley said client.users.. maybe thats a collection of all users on all guilds.. idk

#

you'll get an error if that user isnt found on any guild your bot is in

cunning sluice
#
let voteUser = bot.users.get(vote.user);
voteUser.send(embed);
#

hmmm 🤔

#

bot.users is basically client.users for me

#

cuz of the way I wrote the code

hollow wraith
#

yeah however u defined discord.js object..