#development

1 messages · Page 451 of 1

proper forum
#

What writing?

earnest phoenix
#

I mean when you do ~mod help or something and the embeded writing you have is exactly like title text except that it isnt in blue when you look at it on mobile

proper forum
#

Probably because my title doesn't have a link, you can just make it linkless.

earnest phoenix
#

It doesnt have a link in it and it is only on mobile this happens

proper forum
#

Yes, that's how I did it I suppose.

earnest phoenix
#

I mean my embedded doesnt have any link in it at all but and it is completely normal on a pc but on mobile it is blue and emojis just come out as text

#

But yours does not have this problem (at least with the blue writing)

proper forum
#

@uncut slate maybe you have an idea?

#

I can point you to the source code if you wish, I really don't know how embeds in mobile work, they are completely seperate from desktop ones.

uncut slate
#

-mod help doesn't have any hyperlinked/blue text, not on mobile or on desktop

proper forum
#

Sorry for not being of help, I need to go, good luck.

blazing gorge
#

..

earnest phoenix
blazing gorge
#

....

night imp
#

yeah

earnest phoenix
#

Ive got another problem with my botlist command. This time its converting svg to png with node. It just crashes my bot

#

@anyone?

#

that isn't even a ping

#

Ik it was a joke lol

quartz kindle
#

whats the error?

earnest phoenix
#

No error. The bot doesn't run

quartz kindle
#

the bot doesnt run?

#

if it doesnt even run, there has to be an error somewhere

earnest phoenix
#

Well its obviously not logging the error now is it

quartz kindle
#

then log it

#

try using a try catch

earnest phoenix
#

I will try catch my way through the mud of errors

#

@night imp how

night imp
#

Oh you mean an embed

#

I don’t think they support gradients

earnest phoenix
#

can i put the picture

sullen path
#

no

earnest phoenix
#

Can some help?

warm prairie
#

with?

earnest phoenix
#

I need to setup a database

#

but idk how

warm prairie
#

what lang?

earnest phoenix
#

js

warm prairie
#

what database?

earnest phoenix
#

thats the first task

#

idk what database to use

warm prairie
#

what are your options?

earnest phoenix
#

any free database

#

¯_(ツ)_/¯

warm prairie
#

I personally like Postgres SQL

earnest phoenix
#

ok

wild tide
#

you can make an SQLite Database, JSON ones tend to go corrupt after a while

sick cloud
#

RethinkDB ✨

earnest phoenix
#

how do I make an SQLite database?

wild tide
#

read this

earnest phoenix
#

k thanks

warm prairie
#

SQLite has some issues with file corruption too

wild tide
#

JSON is worse

#

I mean, its really fs that ruins the JSON database, since in the long term some servers would be creating data, while fs would be saving data at the same time, meaning corruption. If you sharded though it would mostly prevent corruption

warm prairie
#

Postgres isn't exactly a JSON database anyway, it has JSON/JSONB support

earnest phoenix
cunning orchid
#

The bot doesn't run at all?

#

When you launch the script what happens?

earnest phoenix
#

It does nothing the bot doesnt appear in its hoisted spot in my server, nothing

quartz kindle
#

define "nothing"

#

does the command prompt stay blinking/active, or does it return to idle?

earnest phoenix
#

I run pm2 start 12 && pm2 logs 12 it starts up and when it tries to load the the dbl command, the process kills

quartz kindle
#

are you sure the code you posted is the problem? try commenting it out completely, and see if it runs

earnest phoenix
#

Ye

cunning orchid
#

It just dies silently?

#

Can you run other commands?

quartz kindle
#

comment out everything and uncomment one line at a time

#

to see which line is killing it

earnest phoenix
#

Yes @cunning orchid it dies silently

#

No it turns out it is not that file

#

I may have just restarted it too many times and went over the rate limit madman madman

cunning orchid
#

Should still get an error

earnest phoenix
#

I am getting a discordapierror but its too skewed to read

split lantern
#

@earnest phoenix send GWfroggyAngryEyes

earnest phoenix
#

how do you check if a message was sent through dms in eris?

heady zinc
#

if the <Message>.channel.guild property doesn't exist

earnest phoenix
#

Ik: dont use eris

heady zinc
#

then it's dm

quartz kindle
#

probably channel.type

#

in d.js channel.type returns text, voice or dm

#

in eris it should be similar

earnest phoenix
#

ik how to do it in djs

#

but im giving eris a try

heady zinc
#

i answered the most intuitive solution

#

channel.type indeed exist but it uses the raw type number from discord's api

quartz kindle
#

in the eris docs they have channel.type but it returns a number

earnest phoenix
#

so i should be able to do a if (!msg.channel.guild) return?

heady zinc
#

eg, channel.type === 1 means its dm

quartz kindle
#

so find out which number represents dm

heady zinc
#

ye

earnest phoenix
#

ok

#

thanks

heady zinc
#

did you blocked me tim

quartz kindle
#

me?

heady zinc
#

yes

quartz kindle
#

no?

heady zinc
#

you just ignored what i said angeryBOYE

quartz kindle
#

i didnt

#

i wrote it at the same time you did

wild tide
#

he could of just missed your message

#

^^

#

I sometimes do that

quartz kindle
#

when im writing, i dont read at the same time

#

lmao

heady zinc
#

eh

wild tide
#

aye

safe steppe
#
        channel_log = ctx.message.channel.id
        server_id = ctx.message.guild.id
        await ctx.send(f'**{author}** set {channel_log} to mod log!')
        async with self.bot.pool.acquire() as connection:
            async with connection.transaction():
                await connection.execute('''UPDATE uwu.serversettings SET modlogchan = $1 WHERE serverid = $2;''', (channel_log, server_id))

That doesn't add the channel id where the command was called to the database. I'm using asyncpg as the library and postgres for the database

quartz kindle
#

idk the database part, i dont use postgre

#

but where are you getting ctx from?

#

usually people use message as the entry point

#

but if channel_log and server_id are being set correctly, then idk

safe steppe
#
    @commands.guild_only()
    @commands.has_permissions(administrator=True)
    @commands.cooldown(1, 5, BucketType.user) 
    async def modlog(self, ctx):```
#

thats my async def

#

its not giving errors

quartz kindle
#

have you tried to console.log channel_log and server_id?

safe steppe
#

no

quartz kindle
#

try it just to make sure they are correct

safe steppe
#

ok

quartz kindle
#

if they are, then the problem is with the db command, i which case i cant help you

earnest phoenix
#

now im having problems sending dms

#

with eris

#

im fetching the user dmchannel

#

then creating a message for it

#

but nope

quartz kindle
#

is the dm targeted at the same person who used the command?

#

in d.js there's a shortcut for that, idk about eris

#

msg.author.send

earnest phoenix
#

i'm doing var chan = bot.getDMChannel(msg.author.id) bot.createMessage(chan, "text here")

#

gives me an error

#

TypeError [ERR_UNESCAPED_CHARACTERS]: Request path contains unescaped characters

quartz kindle
#

according to the docs, you dont need to create a message

#

Get a DM channel with a user, or create one if it does not exist

#

i think it already creates one

#

but idk

earnest phoenix
#

so how do it send a message through it

quartz kindle
#

getdmchannel().send?

earnest phoenix
#

.send ?

quartz kindle
#

oh eris doesnt have .send

earnest phoenix
#

yup

#

it's createMessage

#

thats what i doing

quartz kindle
#

then if im understanding the docs correctly, it should be getdmchannel(id).createmessage(message)

earnest phoenix
#

i'm doing pretty much the same

#

var chan = bot.getDMChannel(msg.author.id)
bot.createMessage(chan,"ok")

quartz kindle
#

in your code, try changing bot.create to chan.create

earnest phoenix
#

hm

quartz kindle
#

also, according to the docs, its createMessage(content, file)

earnest phoenix
#

gives me an api error

quartz kindle
#

so the "ok" part in your code is wrong

earnest phoenix
#

thats weird

#

i have another command that is working

#

that sends a message to the channel

quartz kindle
#

hmm then idk, i havent actually used eris

#

im just reading the docs

heady zinc
#

because bot.createMessage() doesn't take the same arguments

#

channel.createMessage() actually pass the channel to bot.createMessage()

#

it just acts as a middle-man to be easier to use

earnest phoenix
#

does that work

#

actually nvm i tried

#

didnt work

quartz kindle
#

bot.createmessage creates a message without a defined channel, so it needs to have a channel specified

earnest phoenix
#

var chan = bot.getDMChannel(msg.author.id) bot.createMessage("ok")

#

the channel is specified

quartz kindle
#

while channel.createmessage doesnt, because it already has a target channel

heady zinc
#

ye

quartz kindle
#

did you try chan.createmessage?

earnest phoenix
#

yes

heady zinc
#

bot.getDMChannel() returns a promise

#

because it requests from the api

#

so you have to await it

#

or use .then()

quartz kindle
#

oh

#

good to know

heady zinc
#

channel.createMessage() should work tho

earnest phoenix
#

so i just make my function async

#

and it fixes it?

quartz kindle
#

supposedly

#

try it out

heady zinc
earnest phoenix
#

this is what i get TypeError [ERR_UNESCAPED_CHARACTERS]: Request path contains unescaped characters

quartz kindle
#

if you guys are interested in shortcuts, you could always setup a browser with node, such as electron or nw.js and use the chrome console to interact directly with your discord code

#

thats what i do xD

sick cloud
#

@heady zinc can i dm you for a sec

heady zinc
#

sure cutie

sick cloud
#

owo ok

heady zinc
#

what code do you use exactly nao cuteThink

earnest phoenix
#

im getting something now

#

Error: No content, file, or embed

#

btw im not trying to send message to a guild

#

i wanna send a msg to a user through dms

heady zinc
#

ye my screenshot was in dms

earnest phoenix
#

k

#

this is what i have now

#

var channel = bot.getDMChannel(msg.author.id) if (!channel) return

#

what now?

heady zinc
#

this isn't right

#

if you have access to the message, you don't need to get the dm channel

#

because msg.channel already is the channel

earnest phoenix
#

no

#

i want the user to type in the command in a guild

#

and the bot to send a dm

heady zinc
#

oh then

earnest phoenix
#

it says i need to specify a user dm channel

#

thats what i did

uncut slate
#

it returns a promise

heady zinc
#
//Either
(async() => {
    let channel = await bot.getDMChannel(msg.author.id);
    channel.createMessage("owo");
})();
//Or
bot.getDMChannel(msg.author.id)
    .then(channel => {
        channel.createMessage("owo");
    });```
uncut slate
#

🥄

earnest phoenix
#

lmao

#

true

#

let me try

heady zinc
#

it isn't spoonfeed if eris voluntarily makes it stupidly hard to send a dm

earnest phoenix
#

working now

#

thanks!

#

used the async method

heady zinc
#

by the way aeth

#

do you still work on dank memer

uncut slate
#

@heady zinc giving someone code to resolve a promise has nothing to do with eris

#

and yes

heady zinc
#

how much shards do you put in a cluster

uncut slate
#

6-7

heady zinc
#

hmmm i see

earnest phoenix
#

this is probably one of the few times i got spoonfed anyway

#

so idc really

heady zinc
#

i mean it has a little to do with it

#

if it was d.js you wouldn't need to resolve the promise

#

i mean at least catching it is better but see what i mean

earnest phoenix
#

they could specify in the docs you have to do async or promise

#

i dont think they did

uncut slate
#

the docs specify that it returns a promise

earnest phoenix
#

let me check

heady zinc
#

the docs indeed specify it returns a promise, it just doesn't give any example on how to handle it like d.js

earnest phoenix
#

ah it says it in the bottom part

uncut slate
#

@heady zinc just because d.js has functionality Eris doesn't, doesn't mean you can spoon-feed people code

earnest phoenix
#

does it bother you that much?

#

ive spoonfed people here as well

uncut slate
earnest phoenix
#

i wouldn't call myself a beginner, nor a professional

#

more like amateur lol

uncut slate
#

not relevant

heady zinc
#

right

#

do you have any link to an article explaining promises in details though

#

i don't have any sadcatte

uncut slate
#

googling "how do promises work javascript" should do

heady zinc
#

do you really google like that ZoomEyes

#

smh that edit

uncut slate
#

I'd rather Google it and learn on my own than get spoon-fed

warm prairie
#

Whats the issue here?

uncut slate
#

anyways, off topic now

wild tide
#

I can't get the bot to check if a member has a role on another guild. The bot is on both servers.
Here is the code I wrote:

var accepted = false


const checkguild = client.guilds.get("id-hidden-is-correct");

const acceptedRole = checkguild.roles.get("id-hidden-is-correct");

    if(message.member.roles.has(acceptedRole)){

        accepted = true

        message.channel.send("Accepted!").catch(error => console.log);

    } else if(!message.member.roles.has(acceptedRole)){

        accepted = false

        message.channel.send("Denied!").catch(error => console.log);

    };```
lib = discord.js
It says Denied, even if you have the role every time
The command should check the author, no args or mentions for other users
sick cloud
#

message.member comes from the server the command is used in

wild tide
#

ah

sick cloud
#

if your checking for another guild, you'd need the member from that guild

wild tide
#

what do I replace it with>

#

member.checkGuild?

sick cloud
#

guild.members.get(author.id)

bright spear
wild tide
#

ah thank you

bright spear
#

mine is more complete @sick cloud

sick cloud
#

yours is more 🥄 @bright spear

wild tide
#

lol

bright spear
#

¯_(ツ)_/¯

wild tide
#
var accepted = false


const checkguild = client.guilds.get("id-hidden-is-correct");

const acceptedRole = checkguild.roles.get("id-hidden-is-correct");

    if(checkguild.members.get(message.author.id).roles.has(acceptedRole)){

        accepted = true

        message.channel.send("Accepted!").catch(error => console.log);

    } else {

        accepted = false

        message.channel.send("Denied!").catch(error => console.log);

    };``` still returns `Denied!`
bright spear
wild tide
#

ok

#

returns error TypeError: Cannot read property 'id' of undefined

#

since acceptedRole already defines the id

#

I believe

sick cloud
#
const acceptedRole = checkguild.roles.get("id-hidden-is-correct");

it gets the role property

#

role must be undefined

wild tide
#

oh

#

so I define the role id in the if block

sick cloud
#

no

#

the role can't be found in the target guild

wild tide
#

the role ID is an actual role, it should be able to be found

#

should I find the name of the role instead?

sick cloud
#
const acceptedRole = checkguild.roles.find(r => r.id === 'your id here');
if (!acceptedRole) return console.log('role not found');

Try something like this?

wild tide
#

ok

#

returns 'role not found'

#

so it must be undefined

#

but why?

earnest phoenix
#
console.log(checkguild.roles.map(r => r.name))
#

see if the role you want is actually in the guild

#

or do the id

wild tide
#

well this just got confusing

#

It can find the role name.

#

its in the array

earnest phoenix
#

ok so you have the wrong id

wild tide
#

ah

#

I mentioned the role name and did 'Copy ID'

earnest phoenix
#

you probably copied the message id where you sent it

wild tide
#

could I put a backslash in front to grab it that way?

bright spear
#

yes

wild tide
#

okey

bright spear
#

right clicking role mentions does nothing

earnest phoenix
#
console.log(checkguild.roles.find(r => r.name === 'role name').id);
wild tide
#

hmm

#

ok, so I got the role ID via the backslash

#

however now its always returning 'Denied!' again

earnest phoenix
#

make sure the ids are a string

wild tide
#

they are

earnest phoenix
#

then they dont have the role?

wild tide
#

No

#

they have the role

#

this is really confusing GWfroggyBlobThonk

earnest phoenix
#

the problem is

    if(checkguild.members.get(message.author.id).roles.has(acceptedRole)){
wild tide
#

how do I fix it?

earnest phoenix
wild tide
#

ah

bright spear
#

didnt i say change it to .id GWjustinHyperThink

earnest phoenix
#

🥄 @bright spear ree

wild tide
#

it is already an id

#

why change an id to an id?

earnest phoenix
#
const acceptedRole = checkguild.roles.get("id-hidden-is-correct"); //not an id

    if(checkguild.members.get(message.author.id).roles.has(acceptedRole)){ //doing .has on a role object :clap:
bright spear
#

^

#

if you do roles.get you get a role object

earnest phoenix
#

d.js collection extends map

#

besides whats the point of getting a role by ID, then using the id property

#

if ur not checkign that the role exists after

wild tide
#
const checkguild = client.guilds.get("437966640332668928");

//const oldacceptedRole = checkguild.roles.get("469733141918253077");

const acceptedRole = checkguild.roles.find(r => r.id === "469733141918253077");
if (!acceptedRole) return console.log('role not found');



    if(checkguild.members.get(message.author.id).roles.get(acceptedRole)){

        accepted = true

        message.channel.send("Accepted!").catch(error => console.log);

    } else {

        accepted = false

        message.channel.send("Denied!").catch(error => console.log);

       
    };```
#

still returns Denied!

earnest phoenix
#

.get(key)

#

role object is not a key

wild tide
#

how do I define a 'key'?

earnest phoenix
#

the key is the id

wild tide
#

This is completely foreign for me XD

#

ok

earnest phoenix
#

u know wot

#

lemme help u 1 sec

wild tide
#

ok?

earnest phoenix
#

ok so is the guild id/role id gonna change or is it hardcoded?

wild tide
#

hardcoded

#

shouldn't the .has be a .get?

earnest phoenix
#
const acceptedRole = checkguild.roles.find(r => r.id === "469733141918253077"); // this is a role
    if(checkguild.members.get(message.author.id).roles.has(acceptedRole)){ //.has on a ROLE, wrong
    if(checkguild.members.get(message.author.id).roles.has(acceptedRole)){ //.get on a ROLE, wrong
    if(checkguild.members.get(message.author.id).roles.has(acceptedRole.id)){ //wow this works
#

comprende?

wild tide
#

yep

earnest phoenix
#

so next time you open d.js docs and click 'Collection' on the side

#

and it says Collection extends Map at the top

#

so you go to MDN and lookup Map.get() or .has() and see that it wants the key

#

and in this case the key is the id

wild tide
#

ah

earnest phoenix
#

so when you give it the id, it works 🎉

wild tide
#

ok

#

wow it works

#

Thank you soooooooo much! GWfroggySheepAww

earnest phoenix
#

GWsplOof I need help setting up a database

#

I'm thinking of this

#

idk how to set it up though

wild tide
#

google it

#

'how to set up a obvibase'

#

done

earnest phoenix
#

this database seems bad

#

idk which ones are good

sick cloud
#

RethinkDB, any kind of SQL/NoSQL, literally anything tbf.

#

Just not JSON 👀

cinder patio
#

sequelize

#

It's an ORM

patent tinsel
#

no man json is great use json to store everythin

wild tide
#

^ if you have only 5 or less guilds

patent tinsel
#

json

#

everything

wild tide
#

dood

#

JSON will corrupt

patent tinsel
#

no man gotta have faith in the object notation

wild tide
#

just use SQLite

#

k?

cunning orchid
#

my database is a series of word documents haha

#

but you could totally do that couldn't you word is just XML on the backend

patent tinsel
#

word is actually json

cunning orchid
#

pretty confident it's XML but I will check because I now doubt both of us

wild tide
#

I'm putting random jokes as comments in my code for some reason

patent tinsel
#

json is everywhere

#

funfact: windows forms use json

#

funfact: json made me lose my house, my car, and my wife

wild tide
#
//It was at this moment he realised, he just got beaned!
member.ban()```
cunning orchid
#

yeah its xml

patent tinsel
#

looks like json tome

wild tide
#

its xml boi

patent tinsel
#

tjat

#

that's totes json

wild tide
#

how bout yml doe?

earnest phoenix
#

Anyone know how to edit a message? (send by the bot ofc) (js)

grizzled isle
#

I defined the message as "const msg = message.channel.send(message here)
Then you can say "mag.edit(new message)"

OOOR

message.channel.send(message).then(msg => msg.edit(new message))

earnest phoenix
#

mag?

grizzled isle
#

I'm on mobile but you get the idea.

earnest phoenix
#

ok

#

Didn't work

grizzled isle
#

Code?

earnest phoenix
#
client.on('message', async message => {
  const prefix = jsonfile.readFileSync("memory/prefix.json")[message.guild.id]
  if(message == prefix + "beg") {
    const msg = message.channel.send('Hmm, let me think...')
    setTimeout(decideandsay, 3000);
    function decideandsay() {
     const randInt = Math.random()
     const parsedrandInt = parseInt(randInt)
     if(parsedrandInt = 1) {
      msg.edit("Here, have some coin")
    if(parsedrandInt = 0) {
      msg.edit("Nah, screw you")
    }
     }  
    }   
  }   
});
#

ignore the fact I'm basically copying dank memer

cunning orchid
#

put js after your three backticks to syntax highlight btw

grizzled isle
#
client.on("message", async message => {
const prefix = "✓"
if (message.content.startsWith(prefix + "beg") {
message.channel.send("Lemme think on that...").then(msg => {
setTimeout(() => {//Code here. Be sure to use msg.edit here}, 3000)
}
})

//note: some notation i.e. brackets and parenthesis may be incorrect due to my current state of being mobile.
earnest phoenix
#

how can I put the whole code in the timeout?

#

because if isn't expected inside the timeout thing

#

oh nvm

#

I'm stupid

cinder patio
#

give me ideas for a discord bot

cunning orchid
#

a bot that interacts with discord in a meaningful way

earnest phoenix
#

Music bot

#

this has problems

#

How do I edit messages?

#

I heard that message.Update was a thing

#

but that doesn't work

#

;-;

cunning orchid
#

@earnest phoenix D.js?

earnest phoenix
#

yes

cunning orchid
#

.edit

#

Oh

earnest phoenix
#

edit don't work

cunning orchid
#

Should do

earnest phoenix
#
message.send("ummm")
setTimeout(editsay, 3000);
function editsay() {
message.edit("oof")
}
#

that doesn't work

cinder patio
#

yes because you are trying to edit the author's message

quiet bobcat
#

and you're not even calling the function

earnest phoenix
#

oh

quiet bobcat
#

functions need to have () at the end

cinder patio
#
message.channel.send("Hi").then(msg => {
    msg.edit("Goodbye");
});```
austere meadow
#

@quiet bobcat actually no

#

one sec

#

ok sorry i was just eating some spicy chips

cunning orchid
#

are they good?

austere meadow
#

setTimeout as well as setInterval take Function objects

#

they are fucking hot

quiet bobcat
#

oh

cunning orchid
#

... sexy hot?

quiet bobcat
#

well

#

shit

#

i dun goofed

austere meadow
#

all g

earnest phoenix
#
message.channel.send("Hi").then(msg => {
    msg.edit("Goodbye");
});

changes the message imediately

#

oh I get it

#

oof

#

I'm stupid

cinder patio
#

I haven't included your stuff

#

that was just an example of message.edit()

earnest phoenix
#

nvm

#
 if(message == prefix + "beg") {
    message.channel.send("Hi").then(msg => {
    setTimeout(decideandsay, 3000);
    function decideandsay() {
     const randInt = Math.random()
     const parsedrandInt = parseInt(randInt)
     if(parsedrandInt = 1) {
      msg.edit("Here, have some coin")
    if(parsedrandInt = 0) {
      msg.edit("Nah, screw you")
#

not working

#

ik i'm probably doing something wrong

#

I just don't know what

austere meadow
#

you should pass the new message object into the function arguments

#

setTimeout(decideandsay, 3000, msg);

cinder patio
#

are you getting an error, or is it just not doing it?

earnest phoenix
#

I'm not getting errors

#

just not editing

cinder patio
#

console log parsedrandInt

#

maybe it's neither 1 or 0

#

also

#

it should be == not =

earnest phoenix
#

How do you make a warn command using python?

austere meadow
#

@earnest phoenix we can't spoonfeed you code
if you need help on a specific part in making the command we're more than happy to help

cinder patio
#

@earnest phoenix = changes the constant's value to the second variable's value, while == compares the 2 variables values.

#

and === compares their data types and values

earnest phoenix
#

thanks guys

#

its working

#

@austere meadow I do need help with a specific part the code

austere meadow
#

whats up

cinder patio
#

well, then show code and explain your problem

#

we can't do anything without seeing what you've done so far

#

and on which part you're stuck

#

Guys, do you think a bot who gives the guild admins the power to make any command (even profile commands) unavailable (in that guild) to some / all users

earnest phoenix
#

await client.send_message (message. channel ‘ “%s” % (args.join [3] ))

If message.content.upper () . (“?SAY”)

: args = content.split (“ ”)```
@austere meadow ^^
#

Is that correct?

austere meadow
#

im not big on python unfortunately but i notice you're using the wrong quotes for strings

#

vs "

stiff urchin
#

‘ is wrong as well i think

slender thistle
#

Oh also

#

await client.send_message(message.channel, "%s" % (args.join[3])) if I get it correctly

#

You are missing a comma there, otherwords

earnest phoenix
#

Ok

neon swift
#

if keyword should be all lowercase

slender thistle
#

And the "indentation" is just kinda bad in your code

stiff urchin
#

what are you trying to do Firefreak?

slender thistle
#

No idea if you code would work with that indentation, either way

neon swift
#

Yeah, how is your IDE not lighting itself on fire

earnest phoenix
#

Well I basicly know nothing about coding bc I just started but I'm trying to make a warn command

slender thistle
#

Better to learn Python basics first, ya know

neon swift
neon swift
#

Does he have python 3 tuts?

stiff urchin
#

yea

#

3.4

neon swift
#

So, after watching these, learn fstrings and async notation, and you are good

earnest phoenix
#

I have been watching Foggy I/0

neon swift
#

also download rewrite, d.py async isn't supported anymore

wide ruin
#

does anybody know how to make a bot put emojis on a server?

slender thistle
#

What language is the bot written in

wide ruin
slender thistle
#

But is it <:name:id> in all languages GWfroggyBlobWokeThink

neon swift
slender thistle
#

Well I forgot the emotes formatting

neon swift
#

It's what ever comes out when you put \ in before the emote

wide ruin
#

so, what code do i add?

stiff urchin
#

@earnest phoenix Foggy I/O doesnt go over python in general. You should learn some python first

earnest phoenix
#

Ok

stiff urchin
#

check the playlist I linked. Bucky / TheNewBoston is pretty good

neon swift
#

The best

#

If I had known he actually does have python3 tutorials I would have recommended them to other people as well sooner

stiff urchin
#

I didnt know before now, I just searched it up to see

#

he has everything dude

#

"How to build a car"

wide ruin
#

what code add emojis? discord.js

neon swift
#

Are we allowed to link people to dapi server?

uncut slate
#

on-topic invite links to servers like DAPI are allowed

neon swift
#

@wide ruin

stiff urchin
#

@neon swift is node widely used for discord bots?

neon swift
#

I don't know anything about javascript

#

The two most popular libs are d.js and eris, I don't think you can download them via node

stiff urchin
#

like two most popular libs across all programming languages or just for js?

wide ruin
#

@stiff urchin you want to use java to make a bot?

stiff urchin
#

@wide ruin absolutely not, why?

wide ruin
#

sorry, didnt look back in chat

neon swift
#

d.js is the most popular, I think one of the c# libs was next, then d.py, and then everything else, I think eris was only top 10

#

I can't find the source of that info anymore, I just know somebody compiled the list using discord bot list website

stiff urchin
#

alright, thanks

#

I was just curious

neon swift
stiff urchin
#

Thank you

#

Really surprised that javascript is that popular for discord bots

#

node is a mess

neon swift
#

discord.js is just super easy for a simple bot

#

althought discord.py would be too if you already know some python

stiff urchin
#

I guess

#

It uses promises atleast, so less callback hell

uncut slate
#

at this point any modern lib uses promises

#

and if it doesn't, there's always promisifiers you can use

stiff urchin
#

I didnt know that, maybe I used some old libs

#

I fiddled with it in late may/early june, but the majority of the libs I used didnt use promises

uncut slate
#

yee, typical node callback hell isn't as prominent as it used to be

#

async/await is slowly taking over and I dig it

stiff urchin
#

Cool, maybe I left it too soon

#

the d.js documentation looks really good as well

#

like really extensive

uncut slate
#

d.js docs are the best docs I've ever had the joy of using, not just for discord wrappers, for libs in general

cinder patio
#

d.js is great

ebon bolt
#

Hey, I know this server ain't for help but I'm having a fuck of a time trying to get an index of an item in an array and wondering if anyone is willing to provide some... input. 😆

earnest phoenix
#

Show code

#

@ebon bolt The example code of array

var itzarray = {
ItzVariable: "ItzText"
};

//Print itzarray->ItzVariable
console.log(itzarray.ItzVariable);
cinder patio
#

um.. isn't that an object

#

like just an obect

#

Well I guess he's talking about objects

cold niche
#

If you have a webapp/control panel for your bot, what do you use for that?

#

I have to choose between nodejs/spring/django/flask...

Currently I am planning to make it in nodejs, because it is good for webapps and I have some experience in it (but I only wrote CLI things). Spring with Java feels like a bit of overkill and RAM consumer but that'd be great to handle the huge traffic... And django/flask... I like Python, but it isn't so good in multiprocessing/doing things simultaneously. I know it is possible, but Python threads are not parallel, so I'd need load balancing with Flask...

#

So yeah, I need to choose 😄

earnest phoenix
#

Can someone help me out?

lament meteor
#

with?

earnest phoenix
#

a command in a way

#

I already made it but idk how to solve a issue

ruby dust
#

your not giving any information to work with, also you don't have to ask to ask

earnest phoenix
#

ask to ask?

split lantern
#

@earnest phoenix Dont ask for somebody to help you out lol
Just ask your question

earnest phoenix
#

oh ok

#

umm I made a prune command after it finishes deleting messages it sends a response then deletes it in 5 seconds but if i run the command twice it causes a error after 5 seconds...

ruby dust
#

show your prune command code

earnest phoenix
#

let mss = await msg.channel.getMessages(args[0], recentID); let msgIDs = mss.map(m => m.id); await bot.deleteMessages(msg.channel.id, msgIDs).then(() => { bot.createMessage(msg.channel.id,${short.reply} ${args[0]}); });

ruby dust
#

put your code in this format:
```language
code
```

earnest phoenix
#

uhh

#
    let mss = await msg.channel.getMessages(args[0], recentID);
    let msgIDs = mss.map(m => m.id);
    await bot.deleteMessages(msg.channel.id, msgIDs).then(() => {
      bot.createMessage(msg.channel.id, `${short.reply} ${args[0]}`).then(done => {
        setTimeout(async () => await done.delete(), 5000)
      });
    });```
#

there

split lantern
#

well the 2nd prune will delete the frists prune finish message

earnest phoenix
#

yeah

#

it causes a message not found error

split lantern
#

so after 5 secs the 1rst cant delete it

earnest phoenix
#

huh?

#

so do i handle it as a .catch?

bitter sundial
#

why are you awaiting and using then at the same time

earnest phoenix
#

¯_(ツ)_/¯

#

it wasn't inside a then before so i didnt notice

uncut slate
#

you don't need the setTimeout to be async either

#

awaiting that promise is useless

#

you can just setTimeout(() => done.delete(), 5000)

earnest phoenix
#

k

#

this still doesnt help me deal with the error

bitter sundial
#

what is the error

earnest phoenix
#
(node:16492) [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.```
bitter sundial
#

was the message already deleted before the code runs

earnest phoenix
#

yeah

#

if prune is run twice

bitter sundial
#

right

#

just add a catch with an empty function

earnest phoenix
#

ok

#

where exactly should i put the catch?

uncut slate
#

at the end of the delete() call

earnest phoenix
#

ok

#

Thanks it works now

chilly trout
#

Hey everyone ! Hopefully this is ok in here . I’m looking to have a bot for my discord channel to function in correlation to my project . I will compensate for assistance so if anyone is interested , please feel free to message me . Thanks everyone ! Cheers

sullen path
#

It would help if you gave an idea of what we would be doing 🤷

chilly trout
#

Lol I don’t even know , I’m sorry . I was hoping to chat with someone and run ideas

sullen path
#

Ah ok

ruby dust
#

I asked it once a while ago but I didn't understand

#

what does atomic parameter mean in discord.py's .add_roles?

earnest phoenix
#

Does anyone know what lexical declaration cannot appear in a single-statement context means?

#

No

earnest phoenix
#

Okay, im logging this to the console and it says undefined...

if(command === "cb") {
  if(premiumConfigRow.premium === "False") return message.channel.send({embed: { color: embedColourVar, title: `Chatbot | ${message.author.username}`, description: `**Sorry, Only Premium Users have access to this!**\n**[--=====[Click to Purchase Premium]=====--](${config.patreonLink})**`}}).catch(console.error);
  if(premiumConfigRow.premium === "True") {
    let chatbotmessage = message.content.split(/\s+/g).slice(1).join(" ");
    clbot.setNick("Gamer");
    clbot.create(function (err, session) {
      clbot.ask(chatbotmessage, function (err, response) {
        message.channel.startTyping();
        setTimeout(() => {
          console.log(response)
          message.channel.send({embed: { color: embedColourVar, title: `Chatbot | ${message.author.username}`, description: `:speaking_head: | ${response}`}}).catch(console.error);
          return message.channel.stopTyping();
        }, Math.random() * (1 - 3) + 1 * 1000);
      });
    });
  }
}
#

@earnest phoenix what is undefined?

#

response

knotty steeple
#

why do you have a setTimeout

earnest phoenix
#

For the Typing Icon

knotty steeple
#

typing icon?

earnest phoenix
#

.startTyping()

knotty steeple
#

you dont need setTimeout for that

earnest phoenix
#

It has a random stop time

#

I got it from Yorks Cleverbot Example. Dw

#

But I changed the code a bit

#

Seems that other bots respond with undefined with their cleverbots. Might be the cleverbot.io thats messing up

knotty steeple
earnest phoenix
#

have you tried logging the response

#

if it doesn't show anything something's wrong

#

Yes. Undefined

#

Its not the code. Other bots with cleverbot respond with undefined, the api might be down

#

Then why did you ask for help lol

knotty steeple
#

he didnt know before

earnest phoenix
#

I just realised when equilizer responded with undefined 😂

#

In that case you should probably send a message saying the api might be down or smth

#

Through your bot

#

Instead of just logging the errors

#

Meh, nobody uses my bot... Will just clean up the code and wait until its back online

#

Plus the command is for premium users only, I only have 1 Premium user atm

earnest phoenix
#

Lool

tiny dune
#

so, if i have a bot in production, and i want to keep it running while i start up another one for development/debugging, what happens? do any messages hit both the bots? does the first one get logged out? does magic happen and it will work just fine?

earnest phoenix
#

Pm2

tiny dune
#

lol

#

it happens

earnest phoenix
#

i am about to add an npm search command to my bot... bye!

#

is anyone else having issues uploading their bot avatars through the dev portal?

#

Naw

#

i tried uploading mine but it gets very blurry

#

it didnt do that before

#

Hmm, take it up with discord

#

is there no way to go back to the old dev portal

#

?

#

Probably not

#

well that sucks

#

Theres a server where you can report buts like that

#

do you have an invite

#

Ill dm you an invite

#

I cant get an invite anymore. Seems as if they completely locked up invites

#

ah

#

darn

#

Damn you @cyan hill!

#

(Discord administrator)

digital heath
#

help my token is right but when i want to testing my bot with cmder is not worked

#

help me

unique nimbus
#

dont do JS

digital heath
#

i doesn't know why

#

?

#

why i don't do JS

unique nimbus
#

the token is not the same

#

i do python

#

never tried JS

digital heath
#

ok

earnest phoenix
#

i get this out put when i run my dbl command with dyno, it comes specificly from where the svg is converted to png buffer:

12|mini-me | Error: SVG element open tag not found in input. Check the SVG input
12|mini-me |     at Converter.[convert] (/home/node/mini-me-stable/node_modules/convert-svg-core/src/Converter.js:202:13)
12|mini-me |     at Converter.convert (/home/node/mini-me-stable/node_modules/convert-svg-core/src/Converter.js:114:40)
12|mini-me |     at API.convert (/home/node/mini-me-stable/node_modules/convert-svg-core/src/API.js:80:32)
12|mini-me |     at Object.exports.run (/home/node/mini-me-stable/commands/dbl.js:9:32)
12|mini-me |     at <anonymous>
12|mini-me |     at process._tickDomainCallback (internal/process/next_tick.js:228:7)
12|mini-me | TypeError: Cannot read property 'pipe' of undefined
12|mini-me |     at ClientDataResolver.resolveFile (/home/node/mini-me-stable/node_modules/discord.js/src/client/ClientDataResolver.js:274:25)
12|mini-me |     at Promise.all.options.files.map.file (/home/node/mini-me-stable/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:154:30)
12|mini-me |     at Array.map (<anonymous>)
12|mini-me |     at TextChannel.send (/home/node/mini-me-stable/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:153:40)
12|mini-me |     at Object.exports.run (/home/node/mini-me-stable/commands/dbl.js:11:24)
12|mini-me |     at <anonymous>
12|mini-me |     at process._tickDomainCallback (internal/process/next_tick.js:228:7)

IT IS AN ERROR

#

Can someone help?

simple bramble
earnest phoenix
#

wtf its C# figure it out

#

lol jk

knotty steeple
#

@digital heath why do you have a comma

#

near msg.content

digital heath
#

i don't finish yet

knotty steeple
#

well if you want to fix the error remove it

digital heath
#

okayi try it again

#

it doesn't works

earnest phoenix
#
12|mini-me | Error: SVG element open tag not found in input. Check the SVG input
12|mini-me |     at Converter.[convert] (/home/node/mini-me-stable/node_modules/convert-svg-core/src/Converter.js:202:13)
12|mini-me |     at Converter.convert (/home/node/mini-me-stable/node_modules/convert-svg-core/src/Converter.js:114:40)
12|mini-me |     at API.convert (/home/node/mini-me-stable/node_modules/convert-svg-core/src/API.js:80:32)
12|mini-me |     at Object.exports.run (/home/node/mini-me-stable/commands/dbl.js:9:32)
12|mini-me |     at <anonymous>
12|mini-me |     at process._tickDomainCallback (internal/process/next_tick.js:228:7)
12|mini-me | TypeError: Cannot read property 'pipe' of undefined
12|mini-me |     at ClientDataResolver.resolveFile (/home/node/mini-me-stable/node_modules/discord.js/src/client/ClientDataResolver.js:274:25)
12|mini-me |     at Promise.all.options.files.map.file (/home/node/mini-me-stable/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:154:30)
12|mini-me |     at Array.map (<anonymous>)
12|mini-me |     at TextChannel.send (/home/node/mini-me-stable/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:153:40)
12|mini-me |     at Object.exports.run (/home/node/mini-me-stable/commands/dbl.js:11:24)
12|mini-me |     at <anonymous>
12|mini-me |     at process._tickDomainCallback (internal/process/next_tick.js:228:7)

once again i need help. i am testig my dbl command with dyno and i get this error when it tries to convert the svg it gets to a png.

digital heath
#

holy crep

#

my main.js doesn't works on

earnest phoenix
#

(I would really apperciate som hel-p

knotty steeple
#

wait for someone who can answer to help

earnest phoenix
#

ye

#

is there a way i can ban certain servers from using my bot

#

in Eris when I editPermission(overwriteID, allow, deny, type, reason) if i want to deny multiple perms how do i write it?

digital heath
#

my configuration doesn't work

devout flicker
#

do u pass a string or file umu

knotty steeple
#

@earnest phoenix use an array i assume

earnest phoenix
#

oh

#

...

digital heath
#

😭

earnest phoenix
#

the documentation just says number

simple bramble
knotty steeple
#

@earnest phoenix you have to make your own blacklist feature

#

if bot is in server with a specific id just make it leave

earnest phoenix
#

@digital heath your token is incorrect probably

knotty steeple
#

kinda how server blacklisting works

earnest phoenix
#

or your json is bad

digital heath
#

no my token with my bot is exaktly

knotty steeple
#

new JSON.parse() Thonk

earnest phoenix
#

what's your json like

knotty steeple
#

you dont need that

#

just require the json file

#

¯_(ツ)_/¯

earnest phoenix
#

it should be {"token": "123"}

#

ohh

#

ik now how to do it

simple bramble
earnest phoenix
#

@digital heath also to require your config file just do var token = require("./pathtotokenfile.json").token

knotty steeple
#

look ath the docs

earnest phoenix
#

if im not mistaken

knotty steeple
#

no thats how

earnest phoenix
#

You may or may not have to include the .json format in your path

#

You were trying to parse the json file but that's unnecessary

digital heath
#

it doesn't works again

#

my configs it yet broken

earnest phoenix
#

What does your config file look like?

#

btw hide your token if you're posting the code

digital heath
earnest phoenix
#

Lol

#

youe client is not Client

#

look at the last line

#

"Client.login" uppercase

#

not client lowercase

digital heath
#

What does that mean

earnest phoenix
#

it means you have a client variable but you're not using it to login

digital heath
#

how can I change that?

earnest phoenix
#

Your last code line

#

Where it says Client login

sullen path
#

Make it all lowercase I think

earnest phoenix
#

rename to client

sullen path
#

The last line

earnest phoenix
#

This is super easy

digital heath
earnest phoenix
#

I got spoonfed yesterday and the mods tried to kill me yet I'm spoonfeeding rn

#

@digital heath learn how to code before trying to make a bot pls

cunning orchid
#

@earnest phoenix You gotta install Discord

#

Do you know how to use Pip?

earnest phoenix
#

no

cunning orchid
#

Do you know which version of Discord.py you want to be using?

earnest phoenix
#

Google it

cunning orchid
#

ie rewrite or async?

earnest phoenix
#

how to use pip

#

@cunning orchid he has no idea about what those are i believe

#

If he can't even use pip

cunning orchid
#

I wouldn't imagine so

#

but they seem to have code written

#

so maybe

earnest phoenix
#

I'm a real noob at python yet i know how to install packages at least

#

my friend has been helping me and we both dont know what to do

#

so you're both clueless

#

ig

#

Have you tried watching tutorials

#

There's quite the few on python

#

i have but it always says no module named 'Discord'

#

Diascord isn't not a module

#

Tf

#

Auto correct

#

You have to install the discord package for python before you can use it

cunning orchid
#

Using something called "pip"

earnest phoenix
#

You're using it without it being installed

#

That's a no no

#

ok

cunning orchid
#

Have you got the d.py docs up at all?

earnest phoenix
cunning orchid
#

excuse u

#

I was literally going to say to read the front page

earnest phoenix
#

ok

earnest phoenix
#

How do I collect messages in Eris?

gilded blaze
earnest phoenix
#

Ehh

#

I looked

#

I only found the reaction button one

gilded blaze
earnest phoenix
#

...

#

but it doesnt have the timeout like the reaction one

gilded blaze
#

Oh have you used Discord.js?

#

Eris doesn't have an explicit method to collect reactions or messages over a span of time.

#

As far as I know

earnest phoenix
#

it does for reactions

#

options.reactionButtons

gilded blaze
#

Oh. Not familiar with the command handler.

earnest phoenix
#

so I would just need to use getMessages?

gilded blaze
#

You could. There are other ways like making a system use the Message event and processing it.

earnest phoenix
#

hm

#

ill try

earnest phoenix
#

how would i check the ping of my eris bot?

#

i tried searching the docs for something like djs client.ping but nothing

knotty steeple
#

iirc you get latency of shard 0

earnest phoenix
#

hmm

#

I had 0 luck making it

#

@knotty steeple so i just need to get the client's shard?

#

I get the shard of the guild

knotty steeple
#

yes

#

iirc

#

i dont use eris GWqlabsHyperSweats

#

well i did make a bot with it once

earnest phoenix
#

I used a ternary operator

#

getting both the shard 0 latency

#

and the guild shard

knotty steeple
#

guild shard Thonk GWqlabsHyperSweats

earnest phoenix
#

yah

#

msg.channel.guild.shard.latency

#

can confirm its working

#

Nao

#

what

#

Have you tried making a msg collector in eris?

#

not yet

#

._.

#

im still new to eris

#

havent gotten used to it much

#

ok

#

is it hard?

#

idk

#

im having 0 luck making it

#

reading the docs it reminds me of djs

#

for some reason eris sometimes removes my bot status

#

weird

#

but once i restart the bot it puts the status again

#

bot restarting?

#

my uptime also randomly gets reset

#

havent checked that yet

#

but i noticed the status goes away randomly

#

hm

#

and never comes back unless i restart

#

What are you using to host it?

#

localhost node 10.4.0

#

oh

#

console shows no errors

#

¯_(ツ)_/¯

#

this is my ready event

#
    run: (bot) => {
        bot.on("ready", () => {
            bot.editStatus("online", {
                "name": "smth",
                "type": 3
            })
        })
    }
}
#

type?

#

yes

#

w

#

what was that again?

#

playing/watching/listening

#

oh

#

yea

#

3 is watching

#

i'll have to see if the bot is randomly disconnecting or smth

#

maybe a timeout function that logs the uptime

knotty steeple
#

how would i go making 2 pages on my bot's help command

zenith vector
#

U cant

#

Lol jk

earnest phoenix
#

Is it possible to push all the guild members into an array of just their ID's whenever a bot joins a new guild. Then have it one by one add each user ID to a row in a database and then remove them from the list?

ruby dust
#

so you technically want to add guild members into a database?

earnest phoenix
#

Yes

ruby dust
#

why?

earnest phoenix
#

So the bot wont have to create a database when someone enters a help command

#

The bot sometimes returns nothing if they have not got a row in the database

#

this is in js btw

gilded blaze
#

Sounds extremely inefficient.

ruby dust
#

but what's the point/benefit of that for you

earnest phoenix
#

Premium stuff, Personal Prefixes etc

#

You dont need to know why.

ruby dust
#

yes but well sometimes people ask that stuff just because they want to log a lot of stuff for no reason

#

I just wanted to know if you are one of those

earnest phoenix
#

no lol

#

So? Is it possible? and if so, is there any examples you could show me?

ruby dust
#

idk js, but what you can do is loop through guild member objects and attempt to add each of their ids into a db, assuming your table is set to have unique ids so it doesn't add the ones that are already in db

earnest phoenix
#

...

#

I already tried but idk lol

ruby dust
#

what do you use for db?

earnest phoenix
#

SQLITE

devout flicker
#

CosmosDB

earnest phoenix
#

He was speaking to me

devout flicker
buoyant oak
#

how did y'all make custom prefixes ?

quasi marsh
#

Store in a database

buoyant oak
#

I mean

#

for each server

quasi marsh
#

Yeah

buoyant oak
#

so different servers

#

what

quasi marsh
#

You need to store them by ID

#

so like

#

server:prefix = '!'

#

Simplified

buoyant oak
#

huh

quasi marsh
#

Then when you get a new message, check msg.server:prefix

buoyant oak
#

where can I read about that

quasi marsh
#

You need to know which database you want to use and how it works

buoyant oak
#

im using mysql rn

#

Im just confused cuz

#
bot = commands.Bot(command_prefix='-')
#

and I'm using python

#

and not rewrite either

#

idk if that makes a difference ._.

quasi marsh
#

Well I would strongly recommend rewrite

#

It's just way better

#

For me it's like this Bot(command_prefix=utils.PrefixHelper.return_prefix, description=description)

knotty steeple
#

how would i go on making pages for my help command

quasi marsh
#

Which would call this funciton

#
class PrefixHelper:
    def get_prefix(self, message):
        guild_id = message.guild.id
        try:
            prefix = DatabaseHandler.db.get(str(guild_id) + ':prefix').decode()
        except AttributeError:
            prefix = SettingsLoader.config['prefix']
        return prefix

    async def return_prefix(bot, message):
        prefixes = PrefixHelper.get_prefix(PrefixHelper, message=message)
        return commands.when_mentioned_or(prefixes)(bot, message)
#

@knotty steeple That's a difficult question depending on lib, command structure etc

#

My help command autogenerates and paginates based on categories

knotty steeple
quasi marsh
#

categories are defined by folder name for me

knotty steeple
#

i just store command description, usage and name in a collection

#

and i use discord.js

#

i also store the file name and aliases

buoyant oak
#

hmm I see

#

I already wrote too much tho

#

it's too late D:

upper ember
#
[2018-07-23 22:00:32]: ERROR Uncaught Exception: TypeError: Cannot read property 'exp' of undefined
    at Statement.db.get (/root/jarvis/events/message.js:17:19)
--> in Database#get('SELECT exp FROM users WHERE id = ?', [ '209479806620925955' ], [Function])
    at module.exports (/root/jarvis/events/message.js:7:6)
    at Client.emit (events.js:182:13)
    at MessageCreateHandler.handle (/root/jarvis/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34)
    at WebSocketPacketManager.handle (/root/jarvis/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:103:65)
    at WebSocketConnection.onPacket (/root/jarvis/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:333:35)
    at WebSocketConnection.onMessage (/root/jarvis/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:296:17)
    at WebSocket.onMessage (/root/jarvis/node_modules/ws/lib/event-target.js:120:16)
    at WebSocket.emit (events.js:182:13)
    at Receiver._receiver.onmessage (/root/jarvis/node_modules/ws/lib/websocket.js:137:47)
error: Forever detected script exited with code: 1
error: Script restart attempt #2```
#
const sqlite3 = require('sqlite3').verbose();
  const db = new sqlite3.Database('./db/levels.db')
  var userid = message.author.id;
  db.get(`SELECT exp FROM users WHERE id = ?`, [userid], (err, row) => {
    if (err) {
      return console.error(err.message);
    }
    if (!row) {
      db.run(`INSERT INTO users(id) VALUES(?)`, [userid], function(err) {
        if (err) {
          return console.log(err.message);
        }
        console.log("added user to exp database")
      })
    }
    var exp = row.exp + 1;
    db.run(`UPDATE users SET exp = ? WHERE id = ?`, [exp, userid], function(err) {
      if (err) {
        return console.error(err.message);
      }
      db.get(`SELECT level, exp FROM users WHERE id = ?`, [userid], (err, row2) => {
        if (row2.exp > row2.level * 10) {
          var levelup = row2.level + 1
          db.run(`UPDATE users SET exp = ?, level = ? WHERE id = ?`, [1, levelup, userid], (err) => {
            if (err) return console.log(`Error in MESSAGE event : line 17`)
          })
        }
      });
    });
  })
#

a little help here

nocturne flicker
#

i was wondering. my friend is trying to set the bot.users.size, does that show the current online or the people in the discords all in one?

#

or the people in the discord auth

sick cloud
#

@nocturne flicker, all the users the bot has access to that are cached.

heady zinc
#

nop

#

fucking edits

#

why does this feature exist

sick cloud
earnest phoenix
#

sending embeds with eris is easier than i thought eh

#

just gotta pass it an embed object

plucky fox
#

z!help

#

z!help

#

🤔

#

@muted slate

#

z!ping

#

missing permissions to speak

#

apparently

#

oh wrong channel

#

i'm retarded sorry

#

i need some late night coffee

bright spear
#

thus is when you would use that facepalm emote where the hand goes through the face

plucky fox
#

;-;

earnest phoenix
warm prairie
#

anyone know if there is tool to reverse the permissions bitfield into a list of permissions

earnest phoenix
#

hey im trying to make an embed with eris that adds fields as needed (fetching data from database then passing objects into an array), how would i program a for loop to add fields to the embed?

#

for every object inside the array i want to add a field to the embed

#

i was able to do this with djs but i cant remember how

earnest phoenix
#

nevermind got it

real ocean
#

@noble elm

# discord imports
import discord

bot = discord.Client()

@bot.event
async def on_ready():
    print(f"Logged in as {bot.user.name} - {bot.user.id}")
            
@bot.event
async def on_message(message):

    if "procrastin" in message.content and message.author != bot.user:
        await message.channel.send("Stop procrastinating >:(")

bot.run("BOT_TOKEN")
earnest phoenix
#

Can some1 code me a Bot like Dyno? For free Dm me

tulip snow
#

Can someone show me an example of how to write text on a image when using canvas?

shy rose
restive silo
#

memes

earnest phoenix
#

type faster blake

austere meadow
#

no

earnest phoenix
#

plz

shy rose
#

GWfroggyFeelsUpMan wait why did i think blake was a mod

#

i mean see admin

#

but thought you were mod

austere meadow
#

in CSS, is it possible to directly affect one div, but not another div inside the affected div? https://zblake.xyz/0wC8bbjj.gif
basically what i want to achieve is something where the background of the card is darkened, but the buttons stand out and aren't affected by the class

to { 
        background-color: black; 
        color: black;
        opacity: 0.66; 
    }

right now the buttons are also being affected by this CSS, is there a way to negate just the buttons?

earnest phoenix
#

resigned

shy rose
#

so you want to scope the affect to parent div but not child?

austere meadow
#

yeah

shy rose
#

afik the only way to do that is apply the reverse effects to the child

#

cause css applys down the div tree so until something says other wise it keeps going

austere meadow
#

hmm

#

i guess i could apply a class that would reverse the effects of the one im adding but that just seems inefficient

#

nevermind this doesn't seem to work

#

even when using !important

earnest phoenix
#

I need help

#

I need to convert string vals to number vals

#

js btw

earnest phoenix
#

pls help

#

I also need help with waiting for user input

#

So like

#

its says a message

#

then it waits for the input

#

and sets a variable to the input

split lantern
#

Google is helpfull

earnest phoenix
#

Is this right?

#
if(command === "play") {
    if (!message.member.voiceChannel) return message.channel.send(':no_entry_sign: Please join a voice channel.');
    if (message.guild.me.voiceChannel) return message.channel.send(':no_entry_sign: Error, the bot is already connected to another music channel or a song is playing.');
    if (!args[0]) return message.channel.send(':no_entry_sign: Error, please enter a **URL** following the command.');

    let validate = await ytdl.validateURL(args[0]);
   
    if (!validate) return message.channel.send(':no_entry_sign: Error, please input a __valid__ url following the command.');

    let info = await ytdl.getInfo(args[0]);
   
    let connection = await message.member.voiceChannel.join();
    let dispatcher = await connection.playStream(ytdl(args[0], {
        filter: 'audioonly'
    }));

    let playembed = new Discord.RichEmbed()
    .setTitle("Now playing")
    .setDescription(`${info.title}`)
    
    message.channel.send(playembed);
}
lament meteor
#

looks right just that you can only play 1 song at a time no queue

earnest phoenix
#

Thats the problem rn

lament meteor
#

make a temp queue ie. var queue = {} then add songs per guild

#

u should make the thing that plays the music a function

earnest phoenix
#

Hey uhm like, how to make an array of strings that have a characters limit of 2000 in python?

#

Hoi

#

Hoi 👀

abstract mango
#

idk any builtin way to limit list length (why do you want to do this anyways) but you could probably loop through the list like for nou in list: and have a if statement if nou > 2000:

for nou in list:
    if nou > 2000:
        return 'no'
    else:
        pass
#

that's a code example

#

:p

neat falcon
#

hi how do i make a cool queue in discord.js v12 for my music system

sinful lotus
#

just create a kool queue using discord.js v12, ytdl and simple yt api

quartz kindle
#

hi how do i make a cool self-programming sentient 200iq bot

sinful lotus
#
// main.js
const meme = new Map();

// on command stuff.

// make some code here that would check and join the channel.
// get the channel data / and other stuff you collected.

// Maybe make it an object then array stuff there so that we can store moar meme data like song queue
const obj = {
  data: 'stuff',
  moarmeme: []
};
obj.moarmeme.push(/*maybe the yt api data collected here*/);
meme.set(msg.guild.id, obj);

// get the data from the meme map then shape it according on what you want
cinder patio
#

omg now your bot's profile picture actually changes when you change it in the developer documentation

hardy fiber
#

What about name?

unreal plover
#

Guys is there something wrong?