#development

1 messages ยท Page 355 of 1

next bluff
#

you can probably activate DB logging for whatever library you're using and it will show you the exact sql it generates

topaz fjord
#

this is

#
 guild.channels.filter(c => c.permissionsFor(guild.me).has(["SEND_MESSAGES", "EMBED_LINKS", "VIEW_CHANNEL"])).sort((a, b) => a.calculatedPosition-b.calculatedPosition).first().send({embed: embed1})
``` line 21
#

and here is my error

#
0|TurtleBo | RangeError: Invalid permission string or number.
0|TurtleBo |     at Function.resolve (/root/Bot/TurtleBot/node_modules/discord.js/src/util/Permissions.js:168:65)
0|TurtleBo |     at Permissions.has (/root/Bot/TurtleBot/node_modules/discord.js/src/util/Permissions.js:62:35)
0|TurtleBo |     at permission.every.p (/root/Bot/TurtleBot/node_modules/discord.js/src/util/Permissions.js:61:72)
0|TurtleBo |     at Array.every (<anonymous>)
0|TurtleBo |     at Permissions.has (/root/Bot/TurtleBot/node_modules/discord.js/src/util/Permissions.js:61:56)
0|TurtleBo |     at guild.channels.filter.c (/root/Bot/TurtleBot/events/guildCreate.js:21:63)
0|TurtleBo |     at Map.filter (/root/Bot/TurtleBot/node_modules/discord.js/src/util/Collection.js:228:11)
0|TurtleBo |     at module.exports (/root/Bot/TurtleBot/events/guildCreate.js:21:24)
0|TurtleBo |     at <anonymous>
0|TurtleBo |     at process._tickDomainCallback (internal/process/next_tick.js:228:7)
umbral pelican
#

you can't give .has an array

ebon bluff
#

Will anyone make my brother a bot? For free

umbral pelican
#

lol

topaz fjord
#

should i use .includes @umbral pelican

umbral pelican
#

actually, the docs says you can thonk

#

might be because it's a voice channel

topaz fjord
#

wdym?

umbral pelican
#

well, you can't have "Send Messages" for a voice channel

#

but I just checked and it works fine for that as well

#

you sure that's the line it's erroring on?

fervent goblet
#

aids

compact scaffold
#

How do i check if content is nsfw when web scrapping the content?
Let's say google images

earnest phoenix
#

make a self learning AI and make it watch porn till it knows what SFW and NSFW is. Then boom you have a boolean

#

Correct!

#

restrict some keywords @compact scaffold

#

for example

#

Oh

#

Im not giving you all keywords for nsfw

#

lel

compact scaffold
#

Like a list ๐Ÿค”

earnest phoenix
#

sure

#

bobs as purn etc

#

wew

inner jewel
#

safe search is a thing

vital lark
#
Caused by: com.typesafe.config.ConfigException$Missing: No configuration setting found for key 'default'
        at com.typesafe.config.impl.SimpleConfig.findKeyOrNull(SimpleConfig.java:152)
        at com.typesafe.config.impl.SimpleConfig.findKey(SimpleConfig.java:145)
        at com.typesafe.config.impl.SimpleConfig.findOrNull(SimpleConfig.java:172)
        at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:184)
        at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:189)
        at com.typesafe.config.impl.SimpleConfig.getString(SimpleConfig.java:246)
        at xyz.rembot.discord.utils.Settings.<clinit>(Settings.java:13)``` same
#

and ```conf
default {
prefix: ">"
name: "RemBot"
shards: 1
}

small plume
#

Is it possible to filter a presence for when someones streaming for discord.js

umbral pelican
#

yes, the type will be 1 if streaming

opaque bison
#

@topaz fjord that's not how you do MySQL queries ๐Ÿ˜ญ

topaz fjord
#

Wut

thorny hinge
opaque bison
#

INSERT INTO <table> values(<v1>, [v2], [v3]);

#

that's the way to insert values

topaz fjord
#

Where did i put that

#

Im so confu

#

Confused

opaque bison
#

About 20 message above

topaz fjord
#

Oh that

opaque bison
#

ye

topaz fjord
#

It works....

quiet bobcat
#

How do I make the bot DM me? So like it sends "I've joined a guild." to me when it joins a guild

fathom pebble
#

which language?

quiet bobcat
#

Discord.js

mighty barn
#

<Client>.users.find('id', '<your id>').send("I've joined a guild");

#

I think

quiet bobcat
#

oh

#

I forgot to put 'id'

#

๐Ÿคฆ๐Ÿป

mighty barn
#

lol

quiet bobcat
#

Thanks

vestal grail
#

@peak summit

#

;options

#

;options set broadcast false

glossy sand
#

@vestal grail interact with bots in designated channels pls

vestal grail
#

I tried, but it's muted so I figured I might be able to use it over here. Well, that failed...

glossy sand
#

i mean we can unmute your bot if the issue is fixed

vestal grail
#

yeah it will keep sending messages that you have earned a crate, so no worries you can leave him muted

#

because that's kindof the entire purpose of the bot

glossy sand
#

๐Ÿ‘

upper ember
#

there is anyway to remove the code block of the prefix with CSS?

next bluff
#

display: none baby

upper ember
#

ktnx

lethal sun
#

hello

quiet bobcat
#

@next bluff any way to get rid of it without removing the entire bot prefix? So you still keep the prefix thing but remove the background?

next bluff
#

Umm, I'm not looking at the page right now but you could use border: none and change the background color to match the surroundings

quiet bobcat
#

ok

earnest phoenix
#

I'm new at making bots can anybody tell me how to make commands for my bots?

quiet bobcat
#

What library?

crystal void
#

guys, how to get members username and discrim from their id?

#

any1 who could help pls?

glossy sand
#

if you have a bot, you can just make a request to the appropriate api endpoint

inner jewel
#

or check if the lib has the user cached

glossy sand
#

odds are you're using some bot library in that case, so consider looking through the docs

abstract mango
#

couldn't you use <client>.users.find

crystal void
#

hmmm... good idea @abstract mango ๐Ÿ˜‚

glossy sand
crystal void
#

if my bot is in the same guild..

#

and it is 100%

glossy sand
#

Client#users.find isn't guaranteed to work I don't think

#

it'll retrieve the user if and only if it's already been cached

crystal void
#

.fetchUser it is

#

thanks @glossy sand

glossy sand
#

๐Ÿ‘

bitter sundial
#

javascript

clever escarp
#

google it

#

that's what google made for

mighty barn
#

"JavaScript Object Notation"

flat hare
mighty barn
#

To start I would say js

flat hare
#

You kinda just answered your own question there

#

I'm assuming you looking at discord.js right

mighty barn
#

Or Eris?

glossy sand
mighty barn
#

just incase

flat hare
#

either way he's gonna have fun

mighty barn
#

A lot of it

weak parrot
#

Eww JS bloblul

mighty barn
#

shush! It's a starting point

prime cliff
#

Eww .timo

weak parrot
#

Lol

flat hare
#

.js

weak parrot
#

That's not even a file extentions though bloblul

flat hare
#

lord help us

mighty barn
#

node <filename> in a console that is path's located to where the .js file is

#

I suck at explaining

prime cliff
#

It could be

#

:3

flat hare
#

but the real question... is node installed

#

but how smart :p

prime cliff
#

Whoa racist much

glossy sand
#

woah there

#

calm down

flat hare
#

god damn

mighty barn
#

woah

glossy sand
#

you can stop now

flat hare
#

too much smart you may hurt yourself

quiet bobcat
#

stop or dblBanne

undone plover
#

^

prime cliff
#

@glossy sand can we get a mute for this guy

quiet bobcat
#

Yes but this isnt development...

slow elk
#

No

blissful reef
#

are you okay?

flat hare
#

bruh

mighty barn
#

json api bloody wat

inner jewel
flat hare
#

someone already did

slow elk
#

That's easy.

inner jewel
#

or smth

slow elk
mighty barn
#

So sure Vulgar just did a couple of msgs up

blissful reef
mighty barn
#

^

quiet bobcat
#

^

slow elk
#

Thank God for that

blissful reef
#

lol

mighty barn
blissful reef
#

my bots d.js

quiet bobcat
#

lol

blissful reef
#

he gone

slow elk
#

I just read a little bit of the convo and that guy was already getting on my nerves

flat hare
#

lmao

quiet bobcat
#

I told him stop or dblBanne

slow elk
#

He got dblBanne

flat hare
#

look under your seat is a dblBanne

blissful reef
#

Joined !Discord Botz With 876 <-- bot ramdomly put this in my console window

quiet bobcat
slow elk
#

XD

#

@blissful reef Blacklist it XD

blissful reef
#

lol

#

no thx

#

idc

flat hare
#

illuminati

weak parrot
slow elk
#

Ok

earnest phoenix
#

Can someone help me, I am using discord.js and I am trying to find a way to show how many servers my bot is in like in the bots playing message

glossy sand
#

right so let's look at the docs

earnest phoenix
#

alright

glossy sand
#

you'll notice the Client object has a property called guilds, which is a collection of all the servers the bot's in

earnest phoenix
#

what about client.servers?

glossy sand
#

I mean you have the docs right there

#

see for yourself

earnest phoenix
#

Ok

#

Ohhhhhhhhhh I get it now

#

Thanks!

glossy sand
#

๐Ÿ‘

earnest phoenix
#

My music bot (Javascript) joins the voice channel, but then returns Error: spawn EACCES

glossy sand
#

are you trying to run a shell command from your bot?

earnest phoenix
#

No. I do /play [song], it joins, then returns in console Error: spawn EACCES

glossy sand
#

and did you write the bot?

earnest phoenix
#

Yes.

#

Well, sorta. Me and my friend wrote it.

glossy sand
#

see if the child process module is used at all

#

as far as I remember, spawn EACCES is thrown when you try to run a command but don't have the proper permissions

earnest phoenix
#

I checked, all codes. Even modules.

#

No child processes.

next bluff
#

does the user running the application have proper permissions?

earnest phoenix
#

Yes (me)

#

Its in my own Discord.

next bluff
#

well, not discord permissions

earnest phoenix
#

Perms on the bot? Yes.

next bluff
#

like permissions in linux (I assume that's the OS you're using?)

earnest phoenix
#

Oh yes.

next bluff
#

k just thought I'd ask

hearty bramble
#

where does get discordbotlist token

ebon apex
#

You can get that on your bots edit page or in the API documentation if you're logged in

#

@hearty bramble ^

hearty bramble
#

oh its probably because i havent got my bot approved yet ๐Ÿค”

ebon apex
#

Yep

#

That would be why

quiet bobcat
#

I'm trying to make so that if someone levels up on dbl it sends a message in #265156361791209475 but if it's out of dbl it sends it in any channel.

ebon apex
#

You can do a check if the guild id is equal to this servers ID then change the channel it is sent to.

#

That's pretty easy

#

depends on the library and language though.

quiet bobcat
#

I'm using discord.js

ebon apex
#

How good are you with discord.js?

quiet bobcat
#

not that good

ebon apex
#

So how are you sending your messages currently for the leveling up?

quiet bobcat
#

message.channel.send(level up here)

ebon apex
#

So above that you can do this

if (message.guild.id == "264445053596991498") {
  let channel = message.guild.channels.find('name', 'bot-hell');
  channel.send(`stuffhere`);
} else {
  // Normal send here //
  message.channel.send(`stuffhere`);
}
#

Replacing that thing you sent a moment ago

quiet bobcat
#

ok

#

That actually looks pretty simple

#

Thanks

ebon apex
#

No problem and there is many better ways to do that, I encourage you to learn off what I gave you and improve on it.

#

Like catching errors and such

quiet bobcat
#

Yeah

slow elk
#

Hey, I'm trying to make a dev command for my bot, where it'll list all the guilds it is in, with the ID of that guild behind it.

I'm using discord.js
Anyone a solution?

quiet bobcat
#

Just the guilds its in is pretty simple

slow elk
#

True

quiet bobcat
#

You got that or?

slow elk
#

That's a simple map()

quiet bobcat
#

yeah

slow elk
#

I mapped all the names

#

But I want the ID of that same guild behind it's name

#

I know it's possible though, I just don't know how to do that XD

quiet bobcat
#

Yeah

earnest phoenix
#

help me in server count

#

{ Error: getaddrinfo ENOTFOUND https://discordbots.org https://discordbots.org:443
10:22 AM

at errnoException (dns.js:28:10)

10:22 AM

at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26)

10:22 AM

code: 'ENOTFOUND',
10:22 AM

errno: 'ENOTFOUND',
10:22 AM

syscall: 'getaddrinfo',
10:22 AM

hostname: 'https://discordbots.org',
10:22 AM

host: 'https://discordbots.org',
10:22 AM

port: 443 }
10:22 AM

10:22 AM


mighty barn
#

code?

earnest phoenix
#

nvm got it fixed

mighty barn
#

mmmk

quiet bobcat
#

How do I pause and resume a song in discord.js without it skipping a couple of seconds and then playing a second and skipping another couple of seconds? Because right now my pause and resume command does just that. Is there like any way to pause ffmpeg?

thorny hinge
#

@slow elk d.js?

earnest phoenix
#

@thorny hinge doesnt it say discord.js in the message

thorny hinge
#

Im asking him @earnest phoenix

#

I use d.js so I wanna make sure rooty does too so I can be able to help BusThinking

earnest phoenix
#

yeah its in discord.js

thorny hinge
#

Alrighty

#

I just woke up kek

earnest phoenix
#

oh right

thorny hinge
#
client.guilds.map(g => `${g.name} - ${g.id}`);
``` that would work
slow elk
#

@thorny hinge It works. Thanks a lot

thorny hinge
#

No problem

slow elk
#

How does one implement the API token into the bot files?

mighty barn
#

to get server count?

thorny hinge
#

Wdym

slow elk
#

Yea, for the server count.

Or do I need the following codes:

"server_count": client.guilds.size
mighty barn
#

?

slow elk
#

No...

#

Brb

#

XD

mighty barn
#

lol do it

upper tundra
#

Anyone here can help me with C#? ๐Ÿ™

#

I want to code the playing tag for my bot, but I don't know how to.

mighty barn
#

Isn't there a documentation for whatever library u are using?

gilded blaze
#

How would I get the join position of a user? (d.js)

mighty barn
#

Wouldn't it be just the member count when the user joins?

#

unless you mean all the joins that ever happened no the server

gilded blaze
#

o

#

Does guild.members result in the order?

mighty barn
#

guild.members.size as far as I know

gilded blaze
#

well I don't need the size of it

mighty barn
#

I remember there is guild.memberCount or smth like that

#

ye found it in the docs

gilded blaze
#

how do I use membercount to find join position?

mighty barn
#

Not sure it's possible

flat hare
#

The Bot pages long description is only CSS unless your certified right

next bluff
#

No, you can put HTML in the long description so you can include CSS tags as well

flat hare
#

oops sorry meant to include html there as well

thorny hinge
#

You can use HTML and CSS, however only certified people and mods can use javascript

flat hare
#

okay thats what I thought

earnest phoenix
#

lol I look all these intelligent people who know CSS and stuff while I have a thing that needs little to no effort.

flat hare
#

I know fuck all about css and shit except for the basics ๐Ÿ˜ƒ

winged edge
#

Ok sorry

earnest phoenix
#

broke my codemirror

blissful reef
#

Joined PUBGAndFriends With 6 lol why my bot its trash

#

simple but works

slow elk
#

Is that to display the server count? @blissful reef

blissful reef
#

yea

#

go to testing and do ;guildsize

slow elk
#

Nah, mate, I already got it. Thanks anyway @blissful reef

blissful reef
#

kay

#

np

blissful reef
#

my bot is joining some weird ass servers

fervent goblet
#

lol

median isle
#

mine joined one recently named More than one waifu will destroy your laifu

#

kek

quiet bobcat
#

How do I get intelliJ to find my SDK? I've downloaded the JDK from java but it still doesn't see it

topaz fjord
#
2017-12-29T17:10:38.222-0800 I CONTROL  [initandlisten] MongoDB starting : pid=9856 port=27017 dbpath=C:\data\db\ 64-bit host=Sid-PC
2017-12-29T17:10:38.222-0800 I CONTROL  [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R2
2017-12-29T17:10:38.223-0800 I CONTROL  [initandlisten] db version v3.6.1
2017-12-29T17:10:38.223-0800 I CONTROL  [initandlisten] git version: 025d4f4fe61efd1fb6f0005be20cb45a004093d1
2017-12-29T17:10:38.223-0800 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.1u-fips  22 Sep 2016
2017-12-29T17:10:38.223-0800 I CONTROL  [initandlisten] allocator: tcmalloc
2017-12-29T17:10:38.223-0800 I CONTROL  [initandlisten] modules: none
2017-12-29T17:10:38.223-0800 I CONTROL  [initandlisten] build environment:
2017-12-29T17:10:38.223-0800 I CONTROL  [initandlisten]     distmod: 2008plus-ssl
2017-12-29T17:10:38.223-0800 I CONTROL  [initandlisten]     distarch: x86_64
2017-12-29T17:10:38.223-0800 I CONTROL  [initandlisten]     target_arch: x86_64
2017-12-29T17:10:38.223-0800 I CONTROL  [initandlisten] options: {}
2017-12-29T17:10:38.223-0800 I STORAGE  [initandlisten] exception in initAndListen: NonExistentPath: Data directory C:\data\db\ not found., terminating
2017-12-29T17:10:38.224-0800 I CONTROL  [initandlisten] now exiting
2017-12-29T17:10:38.224-0800 I CONTROL  [initandlisten] shutting down with code:100
haughty bough
#

Data directory C:\data\db\ not found., terminating

topaz fjord
#

when doing mongod

earnest phoenix
#

mongoosedb

#

also maybe try creating C:\data\db\ @topaz fjord

haughty bough
#

Reading the error goes a long way.

topaz fjord
#

i thought it auto makes ๐Ÿ˜

glossy sand
#

unfortunately, I don't think it does

#

you'll just have to make the dir \data\db manually then see what happens

topaz fjord
#

am i doin somethin wrong

#

db.stats.insert( {server_count: 229, shards: []} )

#

and stats is my collection

#

it says db.stats.insert isnt a function

thorny hinge
#

So you can't directly insert an array in sqlite.. any workaround? eyes3

shy rose
#

maybe could join it with a unique character then on readout split by that?

#

so then jsut inserting a string

earnest phoenix
topaz fjord
#

ewwww

#

discord bots maker

earnest phoenix
#

what

#

only true OG'S use this whacky tacky program

#

that's why Lil Pik is here

thorny hinge
#

AAa

#

Pls

#

It doesnt even check if the person has a higher role or lower role than the mentioned user

thorny hinge
#

Hey, is it possible to insert an array or JSON object in an sqlite column directly?

icy lynx
#

Yes, both. As string

#

Wait

thorny hinge
icy lynx
#

Column?

#

Do you mean in a single field?

thorny hinge
#
sql.run("INSERT INTO idk (whatever) VALUES (?)", [["array"]]);
``` smth like that
icy lynx
#

Yes, but instert it as string

#

If it's one single field

thorny hinge
#

So after inserting it as a string I can then do

let x = await sql.run(`SELECT * FROM idk WHERE something = somethingelse`);
console.log(x.whatever);

And itll return ["array"]?

icy lynx
#

In theory, you get that value on var

#

But you might need to run a function to make JS engine know it's an array

earnest phoenix
#

Someone already used node-dogstatsd

dire kernel
#

anyone wanna help me find out what's wrong with my blacklist code?

#
     if(!message.member.hasPermission("MANAGE_MESSAGES")) return message.channel.send("You do not have permissions to use this command.");
    let toBlacklist = message.guild.member(message.mentions.users.first()) || message.guild.members.get(args[0]);
    if(!toBlacklist) return message.channel.send("You did not specify a user (or ID) to blacklist! `Usage: blacklist <@user>`");
    if(toBlacklist.id === message.author.id) return message.channel.send("You cannot blacklist yourself, silly.");
    if(toBlacklist.highestRole.position >= message.member.highestRole.position) return message.channel.send("Nice try, but you cannot blacklist a member with a role higher than you!");


    let role = message.guild.roles.find(r => r.name === "2D Blacklisted");
    if(!role){
        try {
            role = await message.guild.createRole({
                name: "2D Blacklisted",
                color: "#000000"
            });
            
        } catch(e) {
            console.log(e.stack);
        }
    }

    if(toBlacklist.roles.has(role.id)) return message.channel.send("This user is already blacklisted!");

    bot.blacklists[toBlacklist.id] = {
        guild: message.guild.id,
        user: toBlacklist.id,
        by: message.author.id
    }

    await toBlacklist.addRole(role);

    fs.writeFile("./blacklistedusers.json", JSON.stringify(bot.blacklists, null, 4), err => {
        if(err) throw err;
        message.channel.send("I have blacklisted the user! Be gone, abuser!");
    });

    return;
#

doesn't return any errors except this

#
(node:50252) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot set property '317619987311230976' of undefined
(node:50252) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
#

the property being the target's id

strange lintel
#
Traceback (most recent call last):
  File "C:\Users\Isaac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\client.py", line 307, in _run_event
    yield from getattr(self, event)(*args, **kwargs)
  File "C:\Users\Isaac\Desktop\programs\bitbot\bot.py", line 25, in on_message
    await command.run(cmd, args, msg, user, server, channel)
  File "C:\Users\Isaac\Desktop\programs\bitbot\command.py", line 8, in run
    await client.send_message(channel, "t")
  File "C:\Users\Isaac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\client.py", line 1152, in send_message
    data = yield from self.http.send_message(channel_id, content, guild_id=guild_id, tts=tts, embed=embed)
  File "C:\Users\Isaac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\http.py", line 200, in request
    raise HTTPException(r, data)
discord.errors.HTTPException: UNAUTHORIZED (status code: 401): 401: Unauthorized```
#

it has permissions on the channel

#

@ebon apex

#
import re, sys, time
import discord
from discord.ext import commands
import asyncio
import command

description = '''A bot for everything BitCoin'''
client = commands.Bot(command_prefix='~', description=description)
prefix = "~"

print("INIT")

@client.event
async def on_message(message):
    msg = message
    user = msg.author
    server = msg.server
    channel = msg.channel
    if msg.content.startswith(prefix):
        args = msg.content.split(" ")
        if args[0].strip(prefix) in command.commands:
            cmd = args[0].strip(prefix)
            del args[0]
            await command.run(cmd, args, msg, user, server, channel)


if __name__ == '__main__':
    client.run(TOKEN)```
#
from modals import *
import bot
commands=["price"]
client = bot.client

async def run(cmd, args, msg, user, server, channel):
    if cmd == "price":
        await client.send_message(channel, "t")
ebon apex
#

Does that send in any channel?

#

Or just one

#

and error

strange lintel
#
 
Traceback (most recent call last):
  File "C:\Users\Isaac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\client.py", line 307, in _run_event
    yield from getattr(self, event)(*args, **kwargs)
  File "C:\Users\Isaac\Desktop\programs\bitbot\bot.py", line 25, in on_message
    await command.run(cmd, args, msg, user, server, channel)
  File "C:\Users\Isaac\Desktop\programs\bitbot\command.py", line 8, in run
    await client.send_message(channel, "t")
  File "C:\Users\Isaac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\client.py", line 1152, in send_message
    data = yield from self.http.send_message(channel_id, content, guild_id=guild_id, tts=tts, embed=embed)
  File "C:\Users\Isaac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\http.py", line 200, in request
    raise HTTPException(r, data)
discord.errors.HTTPException: UNAUTHORIZED (status code: 401): 401: Unauthorized```
ebon apex
#

Happening on every channel?

strange lintel
#

thers only one channel

#

sec

ebon apex
#

Has perms to send and read?

strange lintel
#

strange

#

it works

#

when

#

file

#

will it unauthorize me if i have 2 instances of the bot running?

ebon apex
#

I wouldn't run two instances.

#

That might be why

strange lintel
#

yeah the import in the second file made a second instance

#

trying now

ebon apex
#

Look into sharing the client between files I'm pretty sure you can in python similar to how you do in js

strange lintel
#

yep

#

that must have been thge problem

#

fixed now

#

and yeah i passed client through as an arg this time

dire kernel
#

who's good at discord.js

mighty barn
#

me, sortof

dire kernel
#

can you look at my code? (scroll up a bit)

#

what's wrong

mighty barn
#

target's id which is the toBlacklist's id?

dire kernel
#

yes

mighty barn
#

I would say there is no user with that id so it returns undefined?

dire kernel
#

no because then it would return "you did not specify a user"

mighty barn
#

ah

#

I see nothing wrong in the code

#

Sorry, couldn't help.

dire kernel
#

exactly i'm confused

#

it doesn't create the role, give anyone the role, or update the .json file

mighty barn
#

It has the permission to create it?

dire kernel
#

yes

#

it works with other commands such as mute

#

which creates a muted role

#

so idk wtf is wrong

pulsar kestrel
#

@dire kernel it means toBlackList is not defined ig

#

maybe

earnest phoenix
#

Alright here comes a spastic moment

#

How tf do i get my bot to show its server count when i command Luca to show my bot stats?

#

XDDDDDDDDDDD

#

Nevermind my spastic brain figured it out >.<

mighty barn
earnest phoenix
frail kestrel
#

Ok

earnest phoenix
#

module.exports

#

ty man

#

daddy

frail kestrel
#

yo Kiru

earnest phoenix
#

yo

next wedge
#

private async Task HandleCommandAsync(SocketMessage arg)
{
var message = arg as SocketUserMessage;

        if (message is null || message.Author.IsBot) return.;  // this is all red :(

        int argPos = 0;

        if (message.HasStringPrefix("ta!", ref argPos) || message.HasMentionPrefix(_client.CurrentUser, ref argPos))
        {
            var context = new SocketCommandContext(_client, message);

            var result = await _commands.ExecuteAsync(context, argPos, _services);

            if (!result.IsSuccess)
                Console.WriteLine(result.ErrorReason);
        }
earnest phoenix
#

ok nice dude

next wedge
#

Hi whats the problem?

earnest phoenix
#

cant read sorry

next wedge
#

๐Ÿ˜ฆ

#

if (message is null || message.Author.IsBot) return. //this is all red ๐Ÿ˜ฆ

mighty barn
#

what lang and lib?

next wedge
#

c#

#

discord net 1.0.2

mighty barn
#

mmmm I'm no experienced with c# but shouldn't it be if (message = null || message.Author.IsBot) return?

#

just a gusse from my js knowledge

next wedge
#

ok

#

i try

weak parrot
#

return.; why is there a . there?

next wedge
#

thats a ; ๐Ÿ˜„

weak parrot
#

No in the thing you posted it's .;

next wedge
#

but it's dont work ๐Ÿ˜ฆ

#

i deleted that

weak parrot
#

What do you use to code?

next wedge
#

but dont work ๐Ÿ˜„

#

visual studio

#

2015

weak parrot
#

Cause if you're using VS it should tell you what you're doing wrong

next wedge
#

but its doesn't tell anything D:

mighty barn
#

not even in the terminal?

next wedge
#

operator || cannot be applied to operands of type <null> and bool :/

mighty barn
#

then || can't be applied to null and boolean?

next wedge
#

lol yes

mighty barn
#

mmm idk, as I said, Idk c#

next wedge
#

what do i put in place?

#

๐Ÿ˜ฆ

earnest phoenix
next wedge
#

idk discord.js

#

๐Ÿ˜ฆ

thorny hinge
#

Read the error @earnest phoenix

#

It actually tells you

lethal sun
#

How to see the uptime of a bot? discord.js

dire kernel
#
function secondsToString(seconds) {
        seconds = Math.trunc(seconds)
        let numdays = Math.floor((seconds % 31536000) / 86400)
        let numhours = Math.floor(((seconds % 31536000) % 86400) / 3600)
        let numminutes = Math.floor((((seconds % 31536000) % 86400) % 3600) / 60)
        let numseconds = (((seconds % 31536000) % 86400) % 3600) % 60
        return `${numdays}d:${numhours}h:${numminutes}m:${numseconds}s`
    };
#

@lethal sun

lethal sun
#

hmm.. any SIMPLE ways to do it?

dire kernel
#

uh yeah the one i just sent you

lethal sun
#

mm

#

alright

#

thanks

#

๐Ÿ–ค

dire kernel
#

unless i'm retarded and discord.js added an uptime string

#

but that's how i do it lol so

#

ยฏ_(ใƒ„)_/ยฏ

terse pier
#

Sorry for disturbing, but do you know, where to get many examples of discord bots code?

languid dragon
terse pier
#

I'm using discordpy ๐Ÿ˜„

#

Any ideas?

languid dragon
earnest phoenix
#

Anyone good with streaming audio to shoutcast/icecast on python 3.6?

terse pier
#

I thought that i'm dealing with profesionals ๐Ÿ˜ฆ @languid dragon

earnest phoenix
#

You are

languid dragon
#

You could simply Google and retrieve the answer you're looking for in a matter of seconds

dire kernel
#

just because someone didn't answer you doesn't mean people aren't professionals lmfao

languid dragon
#

Try Googling lines such as Python Discord Bot GitHub

dire kernel
#

and who said we were professionals we're just fellow coders

#

lol

languid dragon
#

There are bound to be some open source bots on GitHub

terse pier
#

I know, but how could you live without page with that content

earnest phoenix
#

What

languid dragon
#

English?

dire kernel
crystal void
#

do you see that the pic is broken maybe?

#

lol

hybrid raptor
#

i need help

#

๐Ÿ˜

#

how do i add roles to bots when they join

#

member.bot??

thorny hinge
#

What lib?

hybrid raptor
#

d.js

thorny hinge
#

member.bot is not a thing pls read docs kthx

#

Search for GuildMember#addRole

#

Docs are amazing

hybrid raptor
#

doesnt show

#

how to add to bots ;-;

mighty barn
#

Spend some time there ^^

#

maybe even join Discord.js's offical server

gusty topaz
#

Discord js read the docs is outdated

#
mighty barn
#

my life has been wasted

earnest phoenix
#

Discord.js Enmap.
It says that guildConf.map is not a function

let configKeys = guildConf.map( (value, key) => `${key}  :  ${value}`).join("\n");
#

key and value are both defined too idk whats meant by it

topaz fjord
#

anyone know how to chnage the _id property in mongodb?

crystal void
#

@earnest phoenix when I do it with my bot, it doesn't work..

#

d.dbl-emojis

#

see?

earnest phoenix
#

huh

#

It doesnt have perms to type here you fool

#

๐Ÿคฆ

crystal void
#

oh. fuck

earnest phoenix
#

Daddy, any AIdea why my code will not work lol

crystal void
earnest phoenix
#

@crystal void You good with Enmaps or whatever they are? I seem to have an error with my code and i cant seem tyo get it to work again!
Error: guildConf.map is not a function

Code:

let configKeys = guildConf.map( (value, key) => `${key}  :  ${value}`).join("\n");
crystal void
#

sry.. I'm not rly :/

#

@earnest phoenix ๐Ÿ˜ฆ

earnest phoenix
#

Oh, its okay. Nevermind

#

๐Ÿ˜ƒ

#

@earnest phoenix Sorry for the tag but do you know why this is happening? Is it being Depricated... I have no idea what to change it to...

#

?

#

Above

#

Code block

#

What is your end goal?

#

Show a config lol hold up

#

wtf

#

just require it

#

is it a .js or .json file?

#

enmap... No file i dont think lol

#
if(command === "showconf") {
    let configKeys = guildConf.map((value, key) => `${key}  :  ${value}`).join("\n");
    message.channel.send(`The following are the server's current configuration: \`\`\`${configKeys}\`\`\``);
  }
#

oh

#

getting a SERVERS config

#

a .js file

#

idk man

#

I only use databases

#

Your best bet maybe is to FS read the file

#

parse it

#

then split

#

or seomthing

#

Damn

#

Alright, thanks lol

bronze bramble
#

Woe

earnest phoenix
#
{ Error: 400 Bad Request
    at _response.transport.finalizeRequest.call.then (/app/node_modules/snekfetch/src/index.js:198:23)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
  request: 
   ClientRequest {
     domain: null,
     _events: 
      { abort: [Object],...............................(a lot of things)
``` What is this?
#

and how i can rezolv?

crystal void
#

idk

#

and idk

dire kernel
#

you seem to have something wrong with your snekfetch module

#

try updating node, updating snekfetch, etc.

earnest phoenix
#
snekfetch.post(`https://discordbots.org/api/bots/393359617310195713/stats`)
    .set('Authorization', "HIDDEN")
    .send({ server_count: client.guilds.size, 
          //shard_count: client.shard.count, 
     //shard_id: client.shard.id })
    })
     .then(() => console.log(`Posted to dbl.`))
    .catch((e) => console.error(e));
``` What is wrong?
next bluff
#

what response are you getting back?

earnest phoenix
#

?

#

i want to have servercount

whole mural
#

Then use something to POST it? nvm ur having trouble.

earnest phoenix
#

how i can rezolv?

next bluff
#

nothing looks blatantly wrong about it, what problem are you running into?

#

if you're actually using "HIDDEN" for the authorization header, that would be one problem

#

oh I didn't see your other message, you were getting a 400 response

topaz fjord
#

can someone here help me out with mongoose

earnest phoenix
#

@next bluff how i can rezolv?

#

๐Ÿ’ฆ

next bluff
#

I'm not really sure what the problem is if you're getting a 400 error. Try sending the raw request from Postman or something and see if that works

#

you need to make sure you have the right auth token

scenic crest
#

is ECMA script pronounced E-C-M-A script or Ehckma script Thonk

topaz fjord
#

2nd one

next bluff
#

it's fun to stay at the E M C A

earnest phoenix
#

client.user.avatarURL?

scenic crest
#

any particular VSC plugins I need for JS development?

topaz fjord
#

@scenic crest. Eslint Thonk

glossy sand
#

eslint and not much else really

#

but consider using typescript if you don't want your brain to explode once your project scales up

scenic crest
#

doing ECMA6 because why not

#

I'm not planning on doing naything major with it

#

but ig I'll see where I'll go

glossy sand
#

have fun with that

topaz fjord
#

Is there a way to get a bots pfp url from I'd in a website

scenic crest
#

@glossy sand so am I understanding it corectly, tc compiles into a js file which I can then run with node?

glossy sand
#

right

earnest phoenix
#

Why when I do this donโ€™t it work?
msg.channel.send(โ€œPinging...โ€);
m.edit(โ€œ[n.] pongโ€);

Ignore the [n.]

#

I trained msg.edit

#

Still not working

median isle
#

wouldn't it be something like msg.channel.send("Pinging").then(m => m.edit("pong"));? i'm not sure though

earnest phoenix
#

Iโ€™ll try

#

Bots donโ€™t work here do they?

median isle
#

doubt it

earnest phoenix
#

Letโ€™s see if it works @median isle

#

It started up

abstract mango
#

@earnest phoenix well couldn't you use variable? lol

#
var m = msg.channel.send('ping')
m.edit('pong')
#

or is that what you're doing

raw plinth
#

oo

ebon apex
#

But you can .then it

#

So it does it right after

#

And promises are better

shell bane
#

ok so I have this really weird issue where somebody in a server isn't showing up on the server's member list

#

like I can see them in the server, but when I bring up the member list with
bot.servers[bot.channels[channelID].guild_id].members (discord.io)
their userID just isn't in the list with everyone else

scenic crest
#

@shell bane is this member offline?

#

since Discord doesn't send the presence for those and this can cause issues especially if the lib is outdated

shell bane
#

no they're online

dire kernel
#

yeah usually if a person is offline or appearing offline some libraries can just die

shell bane
#

this will show a perosn if they're online and just not have a status usually status is 'online'

#

but he is online and just not showing up as existing in the server

#

as far as the library is concerned, in discord we can see him in the server just fine

scenic crest
#

or it may be the outage that's going on rn

shell bane
#

although it may do with that notice that just came up with outages

radiant citrus
#

Can We Use JavaScript Tho?

abstract mango
#

why couldn't you

radiant citrus
#

Try this console.log(user)

#

or

#

var m.log("ping.user")

#

console.log(ping:discordapp.com/)var()

#

will that work?

inner jewel
#

what

#

do you even know js?

radiant citrus
#

idk

#

i tryed code class,

#

im fu**ing tripping out cuz of it xD

#

im going to get banned,

#

i know it

#

at least i censored it

#

maybe...idk

#

console.log("Hello!") console.log("Please select a Channel to Continue!")

#

will that work?

#

this my test

#

console.log("Hello!");
console.log("Select a Server To Continue!")

radiant citrus
#

or even

#

console.log("Welcome!)
var m (ping)
console.log("0010001.length")
var m (connect(83.length))
log(if user exits ask to reconnect)
log(terminal:reconnect)
server.js
end

#

will that even work?

icy lynx
#

end
Maybe you should try Ruby

glossy sand
#

uhhhh

#

I don't think that's compliant javascript

#

...or compliant any-other-language

#

perhaps you should try starting from the basics and building your way up instead of immediately diving into such an advanced project as a discord bot

icy lynx
#

Ruby is the lang that uses end.
I recommend you using codecademy to learn languages

#

There's also crystal that uses ruby syntax, but it isn't properly backed yet

#
require 'discordrb' 
bot = Discordrb::Bot.new token: '<token here>' 

bot.message(with_text: 'Ping!') do |event| 
   event.respond 'Pong!' 
end 
bot.run```
earnest phoenix
#

for a bot mention as a perfix do i just list it in the prefixs or...

icy lynx
#

That works too

#

The id as string

earnest phoenix
#

if i do that isnt it just gonna wait till someone puts @neat pawn

#

with the #

icy lynx
#

?

#

You need to make sure the message starts with an id like @icy lynx

#

^ my id

earnest phoenix
#

Really?

#

@icy lynx

#

i want my bot to say my prefix is >< when someone mentions it

#

How'd you do it without tagging yourself?

#

@earnest phoenix

#

put a \ at the start

#

@earnest phoenix

#

That still tagged me

icy lynx
#

There should be something on your wrapper that tells what users have been mentioned

#

@Demi-lea#7951

earnest phoenix
#

still showed the id

#

nope

#

my bot tells me nothing

#

:(

#

im lucky i could add a server count to the page

icy lynx
#

Did you do that on a channel here?

earnest phoenix
#

do what

icy lynx
#

Testing

earnest phoenix
#

no

icy lynx
#

Is your scripting checking if the message starts with @proper comet?

earnest phoenix
#

@earnest phoenix

#

im a noob man mine is as basic as it could be

#

I put the ! yet it still tags me xD

icy lynx
#

To debug it easier, you can make it log the messages to cmd

unique star
#

the "!" only indicates they have a nickname

#

it's not present if they don't

earnest phoenix
#

i did that but when i listed the name it came with the oposite to what i wanted

#

${msg.author} has used the invite command! Wow very helpful bot

icy lynx
#

It should look like @proper comet help

earnest phoenix
#

0-0

#

ummmmmmmmmmmmmmmmm

icy lynx
#

What have you been doing GWcfcThonk

earnest phoenix
#

the command?

icy lynx
#

Show code

earnest phoenix
#

what bit

#

there lots

#

that dont even work properly

icy lynx
#

Just that one part

#

The part that checks if the bot gets mentioned

earnest phoenix
#

i just cnearly deleted it hold on

icy lynx
#

๐Ÿ‘€

earnest phoenix
#

the bot dont even check

#

for a mention

icy lynx
#

So, you didnt make it check for the bot id?

earnest phoenix
#
  if (msg.channel.type === 'dm') return;
  if (!msg.content.startsWith(keys.prefix)) return;
  if (msg.content.startsWith(keys.prefix + 'play') && !msg.guild.member(client.user).hasPermission('CONNECT') || !msg.guild.member(client.user).hasPermission('SPEAK')) return msg.reply(':no_entry_sign: I don\'t have the **Connect** or **Speak** permission!');
  if (commands.hasOwnProperty(msg.content.toLowerCase().slice(keys.prefix.length).split(' ')[0])) commands[msg.content.toLowerCase().slice(keys.prefix.length).split(' ')[0]](msg);
});```
#

@neat pawn

icy lynx
#

Is the 4th one the one with the mention?

earnest phoenix
#

341702872901353493 if (!msg.content.startsWith("@neat pawn")) return;

#

would that work

#

it didnt have the mention in it it was the ID

icy lynx
#

Should work

earnest phoenix
#

we will see in a sec

#

ready to see

#

it started up

strange lintel
#

R2V0IG91dCBvZiBteSBoZWFk

earnest phoenix
#

Searching a team mate for manage/code @open oar stuff with me

#

(DM me/mention me)

next bluff
#

Is it impossible to make custom embeds with the youtube video player in it?

prime cliff
#

Nope you cant use embed vids

next bluff
#

cool, I'll stop wasting my time on that then lol

prime cliff
#

You can use gifs though

next bluff
#

good to know

earnest phoenix
#

Sorry but does anybody know why the fuck my bot is responding with every prefix? It responds with everything such as !ping, ยฃping, $ping, rping etc
I have already asked staff to unmute GameBot as it workedd on my tewsting server! Im using JavaScript

const prefix = "$";
  const args = message.content.slice(prefix.length).trim().split(/ +/g);
  const command = args.shift().toLowerCase();  

//Further down the code. The botinfo comand. Only tested this on this command!

if(command==="botinfo") {
  console.log(`${message.author.tag}: ${commandused}`)
  client.channels.get(config.logID).send({embed: {
    color: green,
    description: `**${message.author.tag}:** *${commandused}*`
  }}).catch(console.error);
  if(message.guild.member(client.user).hasPermission("MANAGE_MESSAGES")) {
    message.delete().catch(console.error);
  }
  return message.channel.send({embed: {
    color: green,
    author: {
      name: message.author.tag,
      icon_url: message.author.avatarURL
    },
    description: `
**Game Bot Information:**

**Username:** ${client.user.username}
**Discriminator:** #${client.user.discriminator}
**ID:** ${client.user.id}
**Bot Developer:** [SKILL SHOTZZZ#1716]()
**Bot:** True
**Created At:** ${client.user.createdAt}
**Avatar:** [Click to View](${client.user.avatarURL})
**Current Servers:** ${client.guilds.size} Guilds!
**Current Users:** ${client.users.size} Users!
**Rating:** 5 Star Bot!
`
}}).catch(console.error);
}
#

Oops sorry hold on let me get rid of that

#

I have tried restarting the bot multiple times already...

#

Ping me im going AFK

quiet bobcat
#

@earnest phoenix It's respond to every prefix because you have prefix.length. It only sees that the length is one and then responds to every prefix that only has one character. Maybe try js if(!message.content.startsWith(prefix))) return;

#

I don't know

earnest phoenix
#

Oh yeah ๐Ÿ˜‚ Thanks you got it working for me lmfao ๐Ÿ˜‚

quiet bobcat
#

lol np

#

Can someone help me? I'm trying to import ListenerAdapter but I don't get that. Instead it shows two options to fix it, create a class (which I don't want to) and add a maven dependency (which I also don't want). I just started the project and my pom.xml file looks like this: ```xml
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>9</source>
<target>9</target>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
    <dependency>
        <groupId>net.dv8tion</groupId>
        <artifactId>JDA</artifactId>
        <version>3.4.0_319</version>
    </dependency>

    <dependency>
        <groupId>com.sedmelluq</groupId>
        <artifactId>lavaplayer</artifactId>
        <version>1.2.34</version>
    </dependency>
</dependencies>

<repositories>
    <repository>
        <id>jcenter</id>
        <name>jcenter-bintray</name>
        <url>http://jcenter.bintray.com</url>
    </repository>
</repositories>```
earnest phoenix
#

Whuts one of them lol

#

Bruh im trying to get the server count from the dbl API thingy but this error pops up, I put in my token and everything else but this is the error:
Error: Cannot read property ID of null.

Code:

path: `/api/bots/${client.user.id}/stats`,
scenic crest
#

@quiet bobcat open the maven tool window (google, forgot how to off the top of my head) and press the blue refresh button, usually fixes ir for me. Oh and make sure maven auto import is enabled

quiet bobcat
#

Ah thanks

earnest phoenix
#

Hello, I have a question. Does anyone know a tutorial on how to disable and enable modules? Like a code tutorial? I have different files for discord.js bot, all the different files have different commands. Like a stop and start command for modules. I already have reload. If you know, DM or mention me. Thanks

quasi sandal
#

@bitter sundial i don't know why but a part of my custom html is displayed like this

bitter sundial
#

-bots @quasi sandal

gilded plankBOT
#
duncte123#1245
Bots

@glossy steeple

gusty topaz
#

Tonkku question, can uncertified developers embed flash in their bot pages?

bitter sundial
quasi sandal
#

oh ok

mighty barn
#

@earnest phoenix you got it fixed yet?

neon pasture
#

@gusty topaz please don't use flash

gusty topaz
#

why ๐Ÿ˜›

#

0 day exploits still being found

earnest phoenix
#

Can someone fix this so that is replies to a ping:

    if(message.content.startsWith("@JZN Studios BOT")) {
            message.channel.send("My prefix is ${keys.prefix}, Try out ${keys.prefix}help to see my commands!");        
    }
});```
gusty topaz
#

@earnest phoenix see the thing is

#

internally

#

discord doesn't see your mentions as

#

@user#0000

#

but rather as <@userid>

quasi marsh
#

@quasi marsh

earnest phoenix
#

So I put the id

gusty topaz
#

so you need to replace @JZN Studios BOT with <@the id of your bot>

earnest phoenix
#

@azure ether?

quasi marsh
#

You can type it like \@JZN Studios BOT

#

oh you got it nice

earnest phoenix
#

@neat pawn

gusty topaz
#

@neat pawn

#

yep

#

this is what d.js actually sees

earnest phoenix
#

do i need a !

gusty topaz
#

no

#

use what you typed above

#

if that doesn't work, ping me here

earnest phoenix
#

lets see

gusty topaz
#

Also if you want to mention a user from your code, you also need to do <@user id> instead of @User#0000

earnest phoenix
#

thx it worked

gusty topaz
#

you are welcome

earnest phoenix
#

@mighty barn Yeah, fixed a while ago.

mighty barn
#

oh, ok.

earnest phoenix
#

I might sound stupid but I have to idea how to embed

wooden shoal
#

what lib?

#

d.js k

#
channel.send({
          embed: {
            color: 3447003,
            title: "Just a test",
            url: '<URL THAT THE TITLE LINKS TO>',
            thumbnail: {
              url: bot.user.avatarURL
            },
            image: {
                url: '<ADD AN IMAGE TO THE EMBED (URL HERE)>'
            },
            fields: [
                {
                    name: 'Test',
                    value: 'This is a test field',
                    inline: true
                },
                {
                    name: 'Test 2',
                    value: 'This is the second test field',
                    inline: true // Allows the fields to be side by side
                }
            ],
            footer: {
              icon_url: bot.user.avatarURL,
              text: prefix+'Test'
            }
          }
        });
#

something like that

#

you can look on the docs for something more complicated

#

There is an error in that code... but it is something like that

fervent goblet
#

url in the embed

#

fail

#

it would be [Just a test](GET YOUR FUCKING URL IN HERE)

#

as title

earnest phoenix
#

Im using discord.js but im not sure why this code is not working. It says that guildConf.map() is not a function but i dont know what to replace it with!

if(command === "showconf") {
    const configKeys = guildConf.map( (value, key) => `${key}  :  ${value}`).join("\n");
    message.channel.send(`The following are the server's current configuration: \`\`\`${configKeys}\`\`\``);
  }
#

Using enmap module

#

it is for a per server configuration

#

Please Tag me, Going AFK

#

Question, I wanted to use the discord-bots-api node package (https://www.npmjs.com/package/discord-bots-api) since it seemed like a good API wrapper for the site, but I get a 401 invalid auth on all its functions: UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): StatusCodeError: 401 - {"error":"Invalid auth"}

this regardless of being 1000% sure that I have a good API key from the site because I only requested it like 10 minutes ago.

#

@fervent goblet about what you said earlier btw ... Discord.JS definitly has a URL property for RichEmbeds: https://discord.js.org/#/docs/main/stable/class/RichEmbed?scrollTo=setURL

The problem with @wooden shoal 's code was that it is displayAvatarURL and not avatarURL. Also do note that on DJS Master (and later stable) it will be displayAvatarURL() as function with options such as format

Good code:

        msg.channel.send({
            'embed': {
                'color': 3447003,
                'title': 'Just a test',
                'url': '<AN AWESOME URL>',
                'thumbnail': {'url': this.client.user.displayAvatarURL},
                'image': {'url': '<AN AWESOME URL>'},
                'fields': [
                    {
                        'name': 'Test',
                        'value': 'This is a test field',
                        'inline': true
                    },
                    {
                        'name': 'Test 2',
                        'value': 'This is the second test field',
                        'inline': true // Allows the fields to be side by side
                    }
                ],
                'footer': {
                    'icon_url': this.client.user.displayAvatarURL,
                    'text': `${prefix}Test`
                }
            }
        });
topaz fjord
#

@earnest phoenix do you have an auth key?

earnest phoenix
#

I generated one (by now) 20'ish minutes ago and loaded it in the code the same way I load any other API keys

#

Please? can someone help me... I have been stuck tryiong to fix this issue for over an hour

#

Embeds donโ€™t work on my bot

#

Sad

topaz fjord
#

Show me the code @earnest phoenix ur using to send stats

earnest phoenix
#

That's odd Lea thonk

#

Im using discord.js but im not sure why this code is not working. It says that guildConf.map() is not a function but i dont know what to replace it with!

if(command === "showconf") {
    const configKeys = guildConf.map( (value, key) => `${key}  :  ${value}`).join("\n");
    message.channel.send(`The following are the server's current configuration: \`\`\`${configKeys}\`\`\``);
  }

Im making a per system configuration thingy!
Im using the Enmap Module!

#

Erm I'm having dinner rn. I can send it afterwards and mention you then @topaz fjord

topaz fjord
#

Oke

#

And also why use a package?

#

You can do it easily with snekfetch

earnest phoenix
#

Oh? Hmm I'll have to look into that then

#

Someone told me to put thonking on my bot

topaz fjord
#

Nice @earnest phoenix

earnest phoenix
#

nitro for bots when

topaz fjord
#

@earnest phoenix I found your problem your using Evie's modules

earnest phoenix
#

Yeah lol

topaz fjord
#

Db better

fervent goblet
#

oh really favna?

#

I never knew

earnest phoenix
#

๐Ÿ˜ฆ

#

@topaz fjord do I understand correctly that you basically want server specific settings?

fervent goblet
#

I don't use djs

#

I use real languages

earnest phoenix
#

Kek

topaz fjord
#

Why mention me?

earnest phoenix
#

@earnest phoenix Its me that wants Per Guild Settings lol

fervent goblet
#

@earnest phoenix easy

#

redis

#

key:

#

guilds:<insert_guildid>:settings:<settingname>

#

value: whatever the fuck you want

earnest phoenix
#

Sorry ye

#

Try the DiscordJS commando framework

#

It has SQL client provider

#

I'll show details to you after my dinner

earnest phoenix
#

ok

#

right so as I was saying, details.

The commando framework can be found on the same docs page, just change the Main Library to Commando: https://discord.js.org/#/docs/commando/master/general/welcome

Naturally these docs have a lot of info as it is, but for this detail stuff I'll keep it to the settings. Somewhere before you login you want to assign the client provider, which is generally best as an sqlite database. In my bot's code I do it like so:

this.client.setProvider(
            sqlite.open(Path.join(__dirname, 'settings.sqlite3')).then(db => new Commando.SQLiteProvider(db))
        ).catch(console.error); // eslint-disable-line no-console

(On GitHub: https://github.com/Favna/Ribbon/blob/master/src/Ribbon.js#L210)

Once you have that you can write commands to control the settings in settings as seen here: https://discord.js.org/#/docs/commando/master/class/SettingProvider. Using this.client.provider.get('msg.guild.id','AnAwesomeToggle') would get the setting AnAwsomeToggle for the guild that the message is sent to referenced by its ID. For example in my bot I make it possible for server admins to toggle deleting command messages (the !someCommand) on and off with !deletecommandmessages as seen here: https://github.com/Favna/Ribbon/blob/master/src/commands/moderation/deletecommandmessages.js

Because the database file is sqlite it can also be opened manually with the program DB Browser for SQLite (http://sqlitebrowser.org/) and it will have a single table called settings with 2 rows (guild and settings). As you can probably expect now, the guild is listed by ID and the settings are all in the second field. Example picture (blurred 1 part because it is mildly nsfw but suffice it to say, in the commando framework commands can be individually toggled enabled or disabled on a per-guild basis)

https://favna.s-ul.eu/AHD3BwZs.png

#

@earnest phoenix forgot to tag you in there ^

topaz fjord
#

Thonk why not use mysql

earnest phoenix
#

sqlite is more lightweight

#

i mean.. it's in the name

topaz fjord
#

but mysql is a bit easier

earnest phoenix
#

at least I assume that's the reason Gawdly had (the dev of commando)

topaz fjord
#

commando is ded

earnest phoenix
#

Pretty sure it also supports MongoDB but eh

#

@topaz fjord you asked for my code earlier

    async run (msg) {
        const discordbots = new DiscordBotsAPI(auth.discordbotsAPIKey),
            post = await discordbots.postStats(this.client.user.id, this.client.guilds.size);

        if (post) {
            console.log(post);
        } else {
            console.log('error');
        }
    }

this.client.user.id evaluates to 376520643862331396 which is correct: https://discordbots.org/bot/376520643862331396
this.client.guilds.size evaluates to the amount of guilds the bot is in
auth.discordbotsAPIKey evaluates to my API key, obviously not sharing it here. I'm 100% sure this is correct as I do the exact same for other API keys (Steam, Google etc)
Rewriting the .then.catch promise system to async/await system has always worked fine in other packages so there is no reason that should be an issue here.
it logs error because of the StatusCodeError: 401 - {"error":"Invalid auth"}

#

also that if would return true unless post is null or undefined so it's either of those.

#

p.s. I know the package says .postStats returns undefined, but if it worked then I would assume I should be seeing the server count on the site now but...

topaz fjord
#

why not just do

#
snekfetch.post(`https://discordbots.org/api/bots/${bot.user.id}/stats`)
        .set('Authorization', 'secret shit')
        .send({
            server_count: bot.guilds.size
        })
        .then(() => console.log('Updated discordbots.org stats.'))
        .catch(e => e);
#

@earnest phoenix

earnest phoenix
#

ye im gonna do that now then

#

i didn't look into snekfetch further after you recommended it

#

thought i'd first share the code

topaz fjord
#

oke

earnest phoenix
#

thanks @topaz fjord that posted perfectly ๐Ÿ˜ƒ

topaz fjord
#

np

lethal sun
#

Who knows how to add footer to your websites twitter card? html

neon pasture
gusty topaz
#

Question, @trim steppe (You approved my bot and so I assume you will be avaliable to answer a question)
Am I permitted to add things to my bot that depend on if the user upvoted my bot or not? (Like more money in daily or whatever)

earnest phoenix
#

What does it mean by RSV2 and RSV3 must be clear?!

trim steppe
#

allowed

#

but don't be an arse

#

@gusty topaz

gusty topaz
#

you only get 1 credit unless you updoot in which case you get 600 credit /s

earnest phoenix
dire kernel
#
const update = () => {
  const data = stringify({ server_count: bot.guilds.size });
  const req = request({
    host: 'discordbots.org',
    path: `/api/bots/${bot.user.id}/stats`,
    method: 'POST',
    headers: {
      'Authorization': 'API TOKEN',
      'Content-Type': 'application/x-www-form-urlencoded',
      'Content-Length': Buffer.byteLength(data)
    }
  });
  req.write(data);
  req.end();
};

bot.on('ready', update);
bot.on('guildCreate', update);
bot.on('guildRemove', update);
#

still not displaying on site

karmic lake
dire kernel
#

oh lmfao

karmic lake
#

go generate an api token

dire kernel
#

i'm tired

karmic lake
#

and slap that sombitch on there

shy rose
#

Hey @trim steppe Noticed you remove someones bot cause token on github whats that discord mamager thing you had open?

trim steppe
#

It's the online discord manager client

shy rose
#

?

fathom pebble
#

@trim steppe what's the link?

trim steppe
fathom pebble
#

thanks

earnest phoenix
#

who owns @Phonecord

ebon apex
#

It's not here, so obviously nobody knows.

ebon apex
#

@topaz fjord ask your question here

#

Do you have anything showing what you're trying to do?

topaz fjord
#
router.get('https://discordapp.com/api/users/'+data.clientid)
#

idk how to set an auth header

ebon apex
#

I've never used a get request like that, I don't think you even can.

#

Just use request to call it

#

Or you could even use snekfetch

#

But I perfer request.

fervent goblet
#

what the fuck?

#

router.get?

ebon apex
#

But I perfer request.

fervent goblet
#

a router isn't for http requests

#

or am I so idiotic

ebon apex
#

router.get is for getting a request to your express server.

#

Is this for a bot to authorize or for a user that logged in with discord? @topaz fjord

#

For a bot token authorization

const request = require("request");

let options = {
    method: 'GET',
    url: `https://discordapp.com/api/users/${data.clientid}`,
    headers: { Authorization: 'Bot BOT TOKEN' }
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);
  console.log(body);
});

For auth bearer authorization

var request = require("request");

var options = {
    method: 'GET',
    url: `https://discordapp.com/api/users/${user.id}`,
    headers: { Authorization: 'Bearer CLIENT Bearer' }
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);
  console.log(body);
});

fervent goblet
#

barer?

#

u mean

#

Bearer

#

important detail

ebon apex
#

You're right

#

Edited it

#

thanks

topaz fjord
#

@ebon apex is there a way to do it asynchronous

#

Cause I need to fetch a certain thing from the Json data that comes back then I need to update my db with that data

ebon apex
#

Just use google to find out how to do a asynchronous get request in nodejs

fallen rover
#

could someone lend a hand with Reaction collector on assigning roles based on reaction.

earnest phoenix
ebon apex
#

Oh yeah

#

Great use

mighty barn
#

My nub skills can't help me understand how 2 make a mention prefix

#

halp

#
if (!['---', config.prefix, `@Gamebot `].some(prefix=>message.content.startsWith(prefix))) return;
#

that I have rn

lethal sun
#

@mighty barn <@botid>

mighty barn
#

c-correct

#

facepalms realizing how dumb he is

#

ty

#

@lethal sun

lethal sun
#

np

mighty barn
#

And no apparently it just takes the first 3 characters only as the prefix

lethal sun
#

prefix.length?

#

do you spell lenght like that lol

mighty barn
#

mmmm

#

a 2nd facepalm, might aswell make a HowToBeDumb101

lethal sun
#

wow

lethal sun
#

How to collect all the users that have reacted to a certain message? Yes, I have read the docs. No, I don't understand them. And yes, I am dumb.

Laungage: Javascript
Library: discord.js

mighty barn
#

there is the message.reactions functions, then map it and fetchusers

#
message.reactions.map(r => r.fetchUsers())
#

as far as I can think

#

that's a basic idea tho, you have to get the message u need

#

like message ids and stuff

thorny hinge
#

How can I select from every row in a table, then update every row in that table in sqlite?

neon pasture
quasi sandal
#

@neon pasture "socket hang up", your internet probably died

neon pasture
#

It's running on a vps

#

And I have started the bot multiple times up

quasi sandal
#

ยฏ_(ใƒ„)_/ยฏ

#

The only logical other reason that I can think of is that you are timing out

neon pasture
#

But it's starts up

#

and then it crash

#

it's working now...

#

weird

quasi sandal
#

its JavaScript

fervent goblet
#

wots js

tawny lava
#

yes

fervent goblet
#

what asthmatic idiot uses js?

#

all I see is blocked messages

inland salmon
#

.

quiet bobcat
#

Can someone help me? I'm trying to see if the message contains a number. When I try to use js if(isNan(args[0]) return message.channel.send("You need a number for this") it says that isNan is not defined, isn't isNan a default function in javascript?

tawny lava
#

it's isNaN

quiet bobcat
#

Oh yeah

#

I have that in my command though

#

Just wrote it wrong here

thorny hinge
#

Well

quiet bobcat
#

Got it to work

thorny hinge
#
if(isNaN(args[0]))
quiet bobcat
#

Somehow didn't recognize it as a function

dire kernel
#

yeah you missed a closed bracket

thorny hinge
#

its not a bracket

dire kernel
#

parenthesis

thorny hinge
#

Yeah

dire kernel
#

lol

glass inlet
#

are there any limitations for updating counts via the API?

lethal sun
#

yes, dont spam

languid dragon
#

Im not 100% what it is, but it looks reallyyyyy good

glass inlet
#

@exotic girder how often is it recommended to post counts? every hour?

gusty topaz
#

every time you get a new guild

#

or you loose a guild

glass inlet
#

an active bot would be "spammy"

bitter sundial
#

every 30 min?

gusty topaz
#

well

#

active bots would be "spammy" but quite accurate

exotic girder
#

why the honk

#

do you ask me

#

lol

glass inlet
#

@exotic girder assumed you know since you replied with yes lol

#

30 min it is then

topaz fjord
#

anyone here use passport-discord?

bitter sundial
#

y tho

#

but I think I can solve an issue you might be having with it

topaz fjord
#

who me?

#

@bitter sundial

bitter sundial
#

yes

topaz fjord
#

i need to pass scopes

#

but i cant figure out how

bitter sundial
#

in the same place as your clientid and secret

#

as scope

#

or where you call authenticate

topaz fjord
#

oke ty

bitter sundial
topaz fjord
#

and i just figured out i spelled identify wrong

#

fuck

agile basalt
#
    url = f"https://discordbots.org/api/bots/{bot.user.id}/stats"
    headers = {
        'Authorization': dbltoken,
        'content-type': 'application/json'
    }
    payload = {
        'server_count': len(bot.guilds)
    }
    async with aiohttp.ClientSession() as session:
        async with session.post(url, data=json.dumps(payload), headers=headers) as dblpost:
            print(dblpost.status)
strange lintel
#

Ok

#

I can help

agile basalt
#

ok

#

thx

#

so it prints the status code as 200

strange lintel
#

Did you put your token for dbl where it says dbltoken

agile basalt
#

yes

#

it worked previously

#

then stopped working recently

#

i didn't touch it

icy lynx
#
Lib: Discord.py
Requires: aiohttp

(NOTE: This code is inspired by @await self._dbl_post() , but uses the aiohttp approach, which is/seems to be faster)

Code:

import aiohttp

dbltoken = "token"
url = "https://discordbots.org/api/bots/" + bot.user.id + "/stats"
headers = {"Authorization" : dbltoken}

async def on_ready():
    payload = {"server_count"  : len(bot.servers)}
    async with aiohttp.ClientSession() as aioclient:
            await aioclient.post(url, data=payload, headers=headers)

async def on_server_join(server):
    payload = {"server_count"  : len(bot.servers)}
    async with aiohttp.ClientSession() as aioclient:
            await aioclient.post(url, data=payload, headers=headers)

async def on_server_remove(server):
    payload = {"server_count"  : len(bot.servers)}
    async with aiohttp.ClientSession() as aioclient:
            await aioclient.post(url, data=payload, headers=headers)

^ working code

strange lintel
#

Are you posting it on server join and on server leave

agile basalt
#

yes

strange lintel
#

Use the code hugop said

#

It works

icy lynx
#

Also, there should be an await

agile basalt
#

where

strange lintel
#
Language: Python
Lib: Discord.py
Requires: aiohttp

(NOTE: This code is inspired by @await self._dbl_post() , but uses the aiohttp approach, which is/seems to be faster)

Code:

import aiohttp

dbltoken = "token"
url = "https://discordbots.org/api/bots/" + bot.user.id + "/stats"
headers = {"Authorization" : dbltoken}

async def on_ready():
    payload = {"server_count"  : len(bot.servers)}
    async with aiohttp.ClientSession() as aioclient:
            await aioclient.post(url, data=payload, headers=headers)

async def on_server_join(server):
    payload = {"server_count"  : len(bot.servers)}
    async with aiohttp.ClientSession() as aioclient:
            await aioclient.post(url, data=payload, headers=headers)

async def on_server_remove(server):
    payload = {"server_count"  : len(bot.servers)}
    async with aiohttp.ClientSession() as aioclient:
            await aioclient.post(url, data=payload, headers=headers)
#

That

icy lynx
#

I think you missed something, lemme check docs

agile basalt
#

urs looks a little bit different than mine

icy lynx
#

But ye, mine works 100%

agile basalt
#

ok

#

ill try it

strange lintel
#

Youre saying its giving you 200?

agile basalt
#

yea

strange lintel
#

Is it giving you any json

agile basalt
#

no, i just made it print the status

icy lynx
#

async def fetch(session, url): with async_timeout.timeout(10): async with session.get(url) as response: return await response.text()

#

(Rip format)

#

But as you see, it uses await

#

If it doesnt use await, then it mught not work

#

So print(await dblpost) instead of your print might fix it

#

@agile basalt

agile basalt
#

ugh

#

errors

#
url = f"https://discordbots.org/api/bots/{bot.user.id}/stats"
#

this line

#

@icy lynx

#

hello