#development

1 messages · Page 1494 of 1

crimson vapor
#

Erwin are you ok?

opal plank
#

if that triggers we know its your handlers thats fucked

willow mirage
#

dang it smart

crimson vapor
#

something is wrong

opal plank
#

of course im not okay, im angry as fuck and not drunk

willow mirage
#

Oh the handler has problem

crimson vapor
#

Erwin never hands people code

lusty quest
#

its his own code

opal plank
#

normally i'd normally tell people to fuckoff and learn to debug

lusty quest
#

just 1 line added

crimson vapor
#

yea

opal plank
#

but 1 line is fine

crimson vapor
#

oh ok

willow mirage
#
const { readdirSync } = require("fs")

module.exports = (client) => {
    try {
        const load = dirs => {
            const events = readdirSync(`./events/${dirs}/`).filter(d => d.endsWith('.js'));
            for (let file of events) {
                const evt = require(`../events/${dirs}/${file}`);
                let eName = file.split('.')[0];
                client.on(eName, evt.bind(null, client));
            };
        };
        readdirSync("./events/").forEach(x => load(x));
    } catch (e) {
        return require("../tools/functions/error")(e, undefined)
    }
}; 

This is my handler file

odd stratus
#

Is Erela.js better than Lavacord for a Lavalink client

opal plank
#

actually

#

just going to ask this

crimson vapor
#

readdirSync

opal plank
#

Cat

crimson vapor
#

yikes

opal plank
#

do you use VSC?

crimson vapor
#

oh no

willow mirage
#

yep

opal plank
#

then add a breakpoint on it

#

on the first line of your ready handler

willow mirage
#

where

opal plank
#

on the try

lusty quest
#

the path in the loader is wrong

#

first one uses ./events the 2nd one ../events

willow mirage
#

The ready is not lunching

#

@lusty quest nope

opal plank
#

if its not launching then add it on your index

willow mirage
#

the "fs" is alway on the main dir

crimson vapor
#

no its not

#

require is weird

lusty quest
#

well then

opal plank
#

and step into

crimson vapor
#

I love the differences in the way people like to code

willow mirage
#

ye i did

opal plank
#

and?

willow mirage
#

it works normaly

opal plank
#

clearly not

#

actually

#

i might have an idea of whats going on

willow mirage
#

uhu

opal plank
#

isnt the client emitting ready before the event even is bind?

willow mirage
#

oh shit

lusty quest
#

i have my ready event also in a external file and its fine

willow mirage
#

ah

#

fuck

opal plank
#

that'd explain why the event isnt ereror'ing but it also isnt triggering

willow mirage
#

imma do .then()

opal plank
#

client might be finishing before, specially if you have `´await`` int your code

#

in the handlers

willow mirage
#

or then()

opal plank
#

not sure if client is a promise

#

i know it fires an event when its ready

#

thats it

willow mirage
#
const {Client, Collection} = require("discord.js");
const client = new Client();
require('dotenv').config();

require('./handlers/commands')(client);
require('./handlers/events')(client).then(() => {
    client.start = new Date();
    client.chats = 0;
    client.aliases = new Collection();
    client.commands = new Collection();
    client.guild = new Collection();
    
    client.on('ready', () => console.log('Index ready'))
    
    console.log(process.env)
    client.login(process.env.BOT); 
})

#

op

lusty quest
#

but the debug event doesnt showed any event. if you login it should show the Ready and a Guild Create event

willow mirage
#

wait it wont work

opal plank
#

he said all the other events are working

willow mirage
#

yep

#

the debug works normal

opal plank
#

i think im on the money about client emitting ready before he's bidning the event

odd stratus
#

Does anyone here use Lavalink

crimson vapor
#

I think you are correct Erwin

lusty quest
#

the debug event is something different this doesnt rely on the websocket.

#

or did you got a debug.js?

willow mirage
#

yeo

lusty quest
#

ok then its probably what erwin thinks about

opal plank
#

if you got a for loop on the events

willow mirage
#

yes

opal plank
#

push the ready event all the way up

#

so its the first one to be bind

crimson vapor
#

hmm

#

bind is a weird function imo

opal plank
#

its handy af

#

but you gotta know how this works

crimson vapor
#

ive got no idea how it works

opal plank
#

then thats why you think its weird

willow mirage
#
const { readdirSync } = require("fs")

module.exports = (client) => {
    try {
        const ready = require('../events/client/ready.js');
        client.on('ready', ready.bind(null, client));
        const load = dirs => {
            const events = readdirSync(`./events/${dirs}/`).filter(d => d.endsWith('.js'));
            for (let file of events) {
                const evt = require(`../events/${dirs}/${file}`);
                let eName = file.split('.')[0];
                if(eName != "ready"){
                    client.on(eName, evt.bind(null, client));
                }
            };
        };
        readdirSync("./events/").forEach(x => load(x));
    } catch (e) {
        return require("../tools/functions/error")(e, undefined)
    }
}; 
crimson vapor
#

yeah

willow mirage
#

some thing liek this?

opal plank
#

i think so? im not sure how your handler does stuff

willow mirage
#

well

opal plank
#

wait what?

crimson vapor
#

does it work?

willow mirage
#

just read file in a folder

crimson vapor
#

if it works then its good

willow mirage
#

and then require it

opal plank
#

why not require ready seperate?

#

before you even do that try/catch

crimson vapor
#

why not just hardcode ready

willow mirage
#

Im done, imma just remove the event handler

opal plank
#

ACK is heartbeat interval iirc

crimson vapor
#

probably

opal plank
crimson vapor
#

whats this

#

lines in your code?

opal plank
#

thats just ONE file

crimson vapor
#

what theme do you use?

opal plank
#

i dont use a theme

#

theme for scrubs

crimson vapor
#

oh

#

I use it to make it easier to read

#

more contrast good

opal plank
#

jesus christ, i was shitting on d.js for caching too much shit

crimson vapor
#

wdym

#

im confused

#

do you regret your choices?

willow mirage
#

Finally ready

opal plank
#

17 methods, 15 properties, and 2 maps

Thats my USER object btw, for EACH user

crimson vapor
#

yikes

opal plank
#

fun

crimson vapor
#

any reason why you need so many maps?

opal plank
#

yes

willow mirage
#
module.exports = function remove(text) {
    return text.slice(2, 3) == " " ? text.slice(2).join("") : text.slice(1).join("");
};
(node:11568) UnhandledPromiseRejectionWarning: TypeError: text.slice(...).join is not a function

btw why

opal plank
#

one of them is for characters, the other is for entities

crimson vapor
#

oh

opal plank
#

slice() slices a string

#

not an array

#

slice() returns another string

crimson vapor
#

it should work on an array

opal plank
#

string.join() is not a thing

willow mirage
#

ah

#

ah

crimson vapor
#

no?

opal plank
#

yes

crimson vapor
#

Erwin I see why you like ts so much

cinder patio
#

but if text is a string slice returns a string

opal plank
#

if you naming your text variable as an array, i'll murder you

crimson vapor
#

no need to worry about stupid fuckin wrong types

opal plank
#

stupid fucking wrong types is why ts is good

#

enjoy post production bug catching, scrub

crimson vapor
#

lol

willow mirage
#

this bitch

crimson vapor
#

I also see why you don't like any

willow mirage
#

im making some ML

crimson vapor
#

no intellisense

opal plank
#

there are very few use-cases for any

#

same as var

crimson vapor
#

what

#

why var?

#

it actually has a use-case?

opal plank
#

var ignores scopes

crimson vapor
#

actally?

willow mirage
#

global variable

#

you meant

opal plank
#

sometimes you either need to put it as a global to be used across or using var

#

var gets hoisted on initialization too

#

which is good for some use cases

willow mirage
#

but sometime it is bad

opal plank
#

99.999999999999% of the time its bad

#

but it does have use-cases

willow mirage
#

but you can use let too, with this.

opal plank
#

a good example of why not to use var

crimson vapor
#

var could be nice to use instead of

let x;
try {
  x = something
} catch (err) {
  throw new Error(err)
}
x()```
opal plank
#

but you can exploit this mechanic in some ways for hoisting

willow mirage
#

LMAO

opal plank
#

check the image i sent and you'll see why var is quirky million

crimson vapor
#

nice

#

lmao

#

weird tho

opal plank
#

a gets declared before return a , because its hoisted

crimson vapor
#

probably sucks for ts

opal plank
#

it just doesnt have an assigned value

willow mirage
#

i think ts is useless

#

i won't learn ts

opal plank
#

i think you're useless

crimson vapor
#

was that their strange way to show memory-allocation type

#

like in other languages

opal plank
#

dont talk-shit my lang scrub

crimson vapor
#

I like ts

willow mirage
#

xD

crimson vapor
willow mirage
#

ts is like a framework for js

opal plank
#

not quite

#

ts is js but without the shitty inconsistencies

willow mirage
#

lmao

opal plank
#

in what programming language does ```js
'1' * 4

return 4?
#

a string multiplied by a number

#

should be '1111'

#

or thrown an error

willow mirage
#

ye ?

#

well i haven't tried to multiply a string so . . . i dunno

opal plank
cinder patio
#

it gets converted to a number

opal plank
#

it does, but it shouldnt

cinder patio
#

mm... pretty sure it's intended

opal plank
#

at its core you're multiplying a string by a number

willow mirage
#

if you want to get '1111' you should use .repeat()

opal plank
#

thats the inconsistencies im mentioning, not flaws

#

string * number should either error or return a string pattern

#

the correct way using the js standarts would be parseInt()

willow mirage
#

damm

opal plank
#

thats the inconsistencies im mentioning

crimson vapor
#

what is the difference between parseInt and Number()

willow mirage
#

Number() ?

crimson vapor
#

Number can do "floats"?

willow mirage
#

there is parseFloat()

crimson vapor
#

ive started using Number

willow mirage
#

like

let number = new Number()

???

crimson vapor
#

let num = Number('5')

willow mirage
#

Bruh

#
let number = 5
#

normaly

opal plank
#

now yall starting to realise what i was talking about

willow mirage
#

nah i think it is normal to my fav lang

opal plank
#

just leaving it here again

crimson vapor
#

it all makes sense to me

#

well

#

most

#

mostly has to do with types

willow mirage
opal plank
#

dont get me wrong, its not error, its suppose to work like that, but it breaks its own consistency

crimson vapor
#

and how everything is an object

opal plank
#

i mean

opal plank
#

it IS an OOP

#

this shit also cracks me up everytime i see it

sudden geyser
#

a string multiplied by a number
should be '1111'
or thrown an error
JS wants you to think differently christmasthink

opal plank
#

again

crimson vapor
#

imo it should error

#

string * number

#

why would that work

crimson vapor
#

thats like

#

book * word

#

does it work?

#

no

opal plank
#

actually

#

iirc

sudden geyser
#

A language like Python (for example, with repeating) allows string * number because weakly typed + operator overloading

#

I wouldn't say it's a bad thing. I'd rather say it's another way to think.

opal plank
sudden geyser
#

NaN

crimson vapor
#

that makes sense

opal plank
crimson vapor
#

because ++ = NaN

#

and String(NaN) is 'NaN'

opal plank
#

yeah

#

but its just some weird js things

crimson vapor
#

and 'NaN'.toLowerCase() is 'nan'

sudden geyser
#

JavaScript is a beautiful clusterfuck.

opal plank
#

i had a whole thing somewhere

sudden geyser
#

The best of the worst.

#

Yet it'll always reside.

crimson vapor
sudden geyser
#

two different instances

cinder patio
#

That makes sense because all objects are unique

crimson vapor
#

yea ik

cinder patio
#

Technically '1' * 4 is a thing in C++, but it does not yield 4 because '1' is converted to it's char code

crimson vapor
#

gtg eat

#

have fun

sudden geyser
#

Imo what matters is the language's consistency. JS is everything but consistent. Who's to say string * number is a bad thing? It's quite convenient to go ("na" * 13) + " batman!"

slender thistle
#

Read what it says

willow mirage
#

@opal plank wanna see some ml?

umbral zealot
#

Those JavaScript quirks are well known and understood by any professional developers. In fact, some appear in other languages.

earnest phoenix
#

heroku gets my bot online 24/7?

patent condor
#

how would I use multiple message collectors with 1 command like bot sends x i send y so bot sends z and I send a etc etc

willow mirage
#

@earnest phoenix no

#

only 28days

#

and every day it reloads

#

so your cache will be gone

patent condor
willow mirage
#

nvm

earnest phoenix
#

But

mellow kelp
#

kinda

#

i'm okay with being able to sum booleans

earnest phoenix
#

It's on the cloud, it's not?

cinder patio
#

maybe except the Infinity ones

mellow kelp
#

that comes in handy

regal creek
#

its a discord themed website

#

for my bot

earnest phoenix
#

it's ugly

#

there's no consistency whatsoever

#

the alignment is really bad

#

everything is the same font face and font weight

marble juniper
#

true

#

no spacing

#

bad alignments

regal creek
#

Alright, I didnt ask to get roasted lmao. Where and what exactly is bad with it

#

I understood the font part

mellow kelp
#

hmm maybe make some stuff smaller

#

feels like some sections cover too much screen

earnest phoenix
#

well, first off, follow a design language and don't make things up because it will always end up looking like shit

regal creek
earnest phoenix
#

a design language is a set of rules on how your design should look

#

you're best off using a framework for this

#

material design 2 is trendy right now

regal creek
#

hm

earnest phoenix
#

microsoft follows fluent design

#

etc

regal creek
#

Guess design isnt my thing.

wheat jewel
#

what database should i use

regal creek
#

mongodb or mysql

#

I use mysql

wheat jewel
#

or are they the same?

regal creek
#

mysql is more for "advanced" users. A little bit more tricky than mongodb but in general they are the same. Yeah

wheat jewel
#

more spacing

earnest phoenix
#

Can someone help?

#

So

#

Why is it doing this?

#

Bruh

craggy pine
#

I don't belive you can hyperlink in the title of embeds

earnest phoenix
#

You sure#

#

?

#

Oh yeah you’re right

#

Forgot my bad

craggy pine
#

I use setAuthor when I did mine.

earnest phoenix
#

Oh and why don’t you have verified badge lol?

craggy pine
earnest phoenix
#

Oh yeah

#

When did you make your bot?

craggy pine
#

like 3 years ago

earnest phoenix
#

Then why don’t you have it???

craggy pine
#

My other dev does.

#

The bot isn't apart of a "Team"

earnest phoenix
#

Oh you’re the dev team?

#

Whaaaa...

craggy pine
#

mexShrug idc about the badge

earnest phoenix
#

^ :)!

umbral skiff
#

WARNING: ytdl-core is out of date! Update with "npm install ytdl-core@latest"

#

?

earnest phoenix
#

Most of people are doing it for the badge

sudden geyser
#

I wouldn't say most.

earnest phoenix
#

Showing it again :/?

craggy pine
#

Well, you don't get the badge anymore so

umbral skiff
#

i do that and still WARNING

earnest phoenix
#

Help please

craggy pine
#

probably read the docs

terse swallow
#

you put a comma instead of a semicolon

terse swallow
earnest phoenix
#

Sorry? I forgot what semicolon was

craggy pine
#

;

terse swallow
earnest phoenix
#

I mean the place where it says supportive server

#

Why is that not working?

#

Hi

#

Can I have help please

umbral zealot
earnest phoenix
#

Now I made a ban command but when I try to ban owner the bot can't ban him but he says the user has been banned so can anyone tell me what is the name of the another member that will be banned in JavaScript so I make a permission??

#

@umbral zealot

#

Anyone

craggy pine
#

I mean, without your code to view why it's happening we're not able to help

umbral zealot
#

Can you he patient, and post your code.

earnest phoenix
#

Okay

#

Why is that ^^^ doing this?

umbral zealot
#

Remove the backticks

earnest phoenix
umbral zealot
#

Remove. The. ` around it.

craggy pine
#

Pretty sure Evie answered you

umbral zealot
#

@earnest phoenix I'm talking to you just so we're clear.

#

Remove the backticks around your text.

earnest phoenix
#

Yes I’m doing it no worries....

#

@umbral zealot thanks

#
      if (!message.member.hasPermission("BAN_MEMBERS")) return message.channel.send("You need permissions!") 

        if (!message.guild.me.hasPermission("BAN_MEMBERS")) return message.channel.send("Bot need permissions!") 
      
      
      
        const target = message.mentions.users.first();
        if(target){
            const memberTarget = message.guild.members.cache.get(target.id);
            memberTarget.ban();
            message.channel.send("User has been banned 🚫");
        }else{
            message.channel.send(`You coudn't ban that member!`);
        }
    }
}
#

See

#

I need when I want to ban owner he says you can't ban owners not user has been banned

umbral zealot
#

Check the member.bannable property

umbral zealot
#

Checking if member.bannable is true or false tells you if the bot can ban. This works for anyone, regardless of reasons.

#

Could be that the member had a higher role for example.

earnest phoenix
earnest phoenix
#

Every time I try changing the color it doesn’t work..

umbral zealot
earnest phoenix
umbral zealot
earnest phoenix
#

@umbral zealot no I’m just copy my coding

umbral zealot
umbral zealot
#

I heard the first time

earnest phoenix
#

Yes but I just wanted to make sure..

umbral zealot
#

Can I get 2 damn seconds to answer, Jesus Christ.

earnest phoenix
#

...

#

@umbral zealot if you can help me can you write the code to do that please 🥺

umbral zealot
#

Glitch has a system where it reboots the bot only after a certain interval so probably it's waiting that time before rebooting.

earnest phoenix
#

I was just copy and pasting my old coding...

umbral zealot
earnest phoenix
#

?

#

My help command doesn’t work every time I change the color?

umbral zealot
#

Because it's restarting.

earnest phoenix
#

I did restart it plenty of times before

umbral zealot
#

Because glitch restarts every time you edit your code, even a single character.

#

It takes time to restart

earnest phoenix
#

Yea it’s not because I restarting

umbral zealot
#

Oh shit you're right that's repl not glitch

earnest phoenix
#

Since I waited like 20 mins now

umbral zealot
#

Too small on my screen.

earnest phoenix
#

lol

umbral zealot
#

Well check the error logs maybe you broke the code.

earnest phoenix
#

Hm that’s weird

#

HOLLY GRACCA MOLLY

#

damn wtf

craggy pine
#

try color 'hexHere'

earnest phoenix
#

Okie

wheat jewel
#
const uri = "";
const mongo = new MongoClient(uri, { useNewUrlParser: true,   useUnifiedTopology: true  });
mongo.connect(err => {
  const collection = mongo.db("test")

    
     collection.collection("customers").insertOne('myobj', function(err, res) {
    if (err) throw err;
    console.log("1 document inserted");
  });
    mongo.close();

  // perform actions on the collection object
});``` Im trying to use mongodb and this is not doing anything, anyone know why?
earnest phoenix
#

@craggy pine

craggy pine
earnest phoenix
#

Can you give me the code for black color may be because of something..

craggy pine
#

you can google black hex

#

and it'll give you it.

worn siren
#

What is the best way to check if a user is less than 7 days old in discord.js?

craggy pine
#

store the date created and check if it's less than 7 days old from current date.

wheat jewel
#

@earnest phoenix put the hex in ""

earnest phoenix
#

@craggy pine ayyy worked :)!

umbral zealot
#

Users do have a createdTimestamp property for that.

craggy pine
#

👍

worn siren
#

So I'm not sure how to check if it was less than 7 days ago

umbral zealot
#

Timestamps are milliseconds

wheat jewel
#

does anyone here know how to use mongodb

umbral zealot
#

You should be able to figure out how many milliseconds in a week easily

worn siren
#

Ah ok

#

ez

#

ty

wheat jewel
#
const uri = "";
const mongo = new MongoClient(uri, { useNewUrlParser: true,   useUnifiedTopology: true  });
mongo.connect(err => {
  const collection = mongo.db("test")

    
     collection.collection("customers").insertOne('myobj', function(err, res) {
    if (err) throw err;
    console.log("1 document inserted");
  });
    mongo.close();

  // perform actions on the collection object
});``` Im trying to use mongodb and this is not doing anything, anyone know why?
umbral zealot
#

Log your err variable maybe...

earnest phoenix
#

Which is better?

umbral zealot
#

Whichever one you prefer.

craggy pine
#

Spaced is easier on the eyes I suppose.

earnest phoenix
#

I prefer the one is spaced

#

Yea same

#

I’m proud of myself lol

umbral zealot
#

I mean, it's a step...

craggy pine
#

Indeed.

earnest phoenix
#

Hm why is the purge command only allowed to delete 99 messages?

craggy pine
#

Discord limitation

crimson vapor
#

so I have this map of commands, and every command I add using js const command = new (require(commandPath))(this) this.commands.set(command.options.name, command)
the issue is that every command.options is showing up as the last command that was added to the map


Map(6) {
'avatar' => AvatarCommand {
options: {
name: 'rank',
aliases: [Array],
requiredPermissions: null,
botPermissions: 100,
description: 'Get your rank.',
disabled: false
},
client: Client
},
'eval' => EvalCommand {
options: {
name: 'rank',
aliases: [Array],
requiredPermissions: null,
botPermissions: 100,
description: 'Get your rank.',
disabled: false
},
}
and such```
#

anyone know what could cause this?

umbral zealot
earnest phoenix
#

What’s the reason for this?

#

I mean I can show the coding buts it’s a lot

wheat jewel
#

its undefined @earnest phoenix

crimson vapor
#

but there should be no way for all of my commands to have the same name as the last command I made

umbral zealot
crimson vapor
#

so its some issue with the code

earnest phoenix
#

Lol

#

Lemme send ya guys the code

umbral zealot
wheat jewel
#

do

#

if null or isNaN()

umbral zealot
#

quick.db can only store data as strings

#

So... Yeah.

earnest phoenix
#

So it can’t be fixed?

umbral zealot
#

You have to convert them with parseInt()

earnest phoenix
#

Which line?

umbral zealot
#

All of them.

#

Any that gets a thing that should be a number but isn't.

earnest phoenix
#

Alr I’ll see what I can do

umbral zealot
#

Either from the database or from the message content.

crimson vapor
earnest phoenix
#

@umbral zealot I read some documents learned few stuff lol

#

I know this is kinda stupid but why isn’t it showing the footer?

umbral zealot
#

because you put the footer inside a field object.

#

fields don't have footers.

umbral zealot
crimson vapor
#
footer: {
  text: string,
  icon_url: string
}```
sudden geyser
#

Evie that face is scary

crimson vapor
#

its multiple files, would you prefer the repo?

umbral zealot
#

oh yeah if you have the repo that's perfect

crimson vapor
#
const { Command } = require("../../dist/index");

class PingCommand extends Command {
  constructor(...args) {
    super({
      name: 'ping',
      aliases: ['p'],
      requiredPermissions: null,
      botPermissions: 0,
      description: 'Get the bot\'s ping.',
      disabled: false,
    }, ...args);
  }

  run(message, args) {
    message.channel.send('Pong!');
  }
}

module.exports = PingCommand;
``` example command
umbral zealot
#

hmm

#

this.... almost feels like it's an error by reference

#

It doesn't look like one... but it... feels like one

crimson vapor
#

what do you mean?

umbral zealot
#

What I mean is, because it's the last command that overrides the others, it's as if the name property was being kept in memory, so it's literally the same name

crimson vapor
#

oh

umbral zealot
#

so instead of having different names, every one of them points to the same memory reference

crimson vapor
#

I see

#

do you know whats causing that or how I could fix that?

umbral zealot
#

I haven't done a class-based handler in a while and my TS is basic at best, so I'm not totally sure

crimson vapor
#

my ts is pretty basic

#

yeah so doing that works

#

and the name isnt overwritten

#

so I guess ill just do that since there is no real reason to not

indigo folio
#

not to*

crimson vapor
#

fuck you

indigo folio
#

fuck you

crimson vapor
#

same

umbral zealot
#

you fuck

crimson vapor
#

lol

umbral zealot
#

Anyways the reason using this.thing worked is... probably because Object.assign isn't the same thing as this.thing. It's probably assigning it to the class not the instance.

#

or something like that

terse swallow
#

how to have instead of what I surrounded a word which when one clicks it executes this link?

crimson vapor
#

probably

#

use markdown

calm goblet
crimson vapor
#

ty evie

#

it worked

terse swallow
#

thank ^^

earnest phoenix
#

I know this probably not uh possible but is there’s somehow a way to add a footer?

umbral zealot
#

yeah.

#

outside the field array

#

as in not where you put your fields.

earnest phoenix
#

So it’s not possible?

umbral zealot
#

... yes, it is

terse swallow
#

yes it's possible

umbral zealot
#

Just move the footer

#

outside the array

earnest phoenix
#

Which line?

umbral zealot
earnest phoenix
#

So outside in-line?

umbral zealot
#

outside the array

earnest phoenix
#

Ok

umbral zealot
#

Do you see why you need to keep learning javascript?

earnest phoenix
#

So outside } and the rest

#

Yea I do

earnest phoenix
#

Yea I’m saving that link

terse swallow
earnest phoenix
#

@terse swallow what’s that red thingy?

terse swallow
#

I wanted with the pen but I told myself that it was more practical with the highlighter and I forgot to erase it

#

sorry for the mistakes i'm french

scarlet stratus
#

I mafe a little design update

terse swallow
#

ok

scarlet stratus
#

I never even took a look on the design possibillities

#

Never tough it would be that stressfull :/

earnest phoenix
#

@umbral zealot do you have an online course for JavaScript good for me

#

@umbral zealot hm i did it outside field still didn’t work

#

Oh myx

#

2 pings..

mellow kelp
#

panik

terse swallow
#

I made my embed thanks to its

earnest phoenix
#

Ohh

terse swallow
#

discord.js is the center of everything to find all the commands related to java script to create a discord bot

earnest phoenix
#

Guys

#

Thanks

#

@terse swallow I appreciate you

terse swallow
#

You're welcome

earnest phoenix
#

Does anyone knows a teaching online lesson for JavaScript

umbral zealot
#

I've already linked you resources

summer torrent
#

check pins also

umbral zealot
umbral zealot
#

go where

terse swallow
#

I'm going to bed, good night and good coding

umbral zealot
#

some clients just don't work right with canary links

raven yoke
#

i write code now how i start my bot?

scarlet stratus
raven yoke
#

JS

scarlet stratus
#

i write code now how i start my bot?
@raven yoke on what are you coding?

scarlet stratus
#

...

#

I ment os

raven yoke
#

lol

#

Visual Studio Code JavaScript

scarlet stratus
#

Omg no xD

raven yoke
#

i don't understaaaand

scarlet stratus
#

Like windows

#

Or linux

#

Or android

raven yoke
#

lol windows

#

Sorry qwq

scarlet stratus
#

I broke my pc so i host on android lmao

raven yoke
#

lmao

scarlet stratus
raven yoke
#

f

scarlet stratus
#

Check this iut

#

Out

#

Thats sort of rapbian

#

And pydroid

#

@raven yoke try [filename].js

#

On cmd

raven yoke
#

I need to start bot

#

qwq

#

idk how start

scarlet stratus
#

Yeah

#

Thats what i am talking about

raven yoke
#

How i start him ? qwq

nocturne dagger
lone palm
raven yoke
#

Ohh ok

lone palm
scarlet stratus
#

Uy

#

I wanted to learn js but i like python too much to stop

#

:/

sudden geyser
#

Python's cooler

lone palm
#

No

sudden geyser
#

yes

mellow kelp
#

ah yes

#

yet another js vs py fight

sudden geyser
#

always

mellow kelp
#

im gonna grab my popcorn

lone palm
#

Learn that language that you like

mellow kelp
#

hold on guys

sudden geyser
#

You can put away the popcorn

mellow kelp
#

dang

lone palm
#

xd

scarlet stratus
#

Python id cooler

#

:/

mellow kelp
#

k

scarlet stratus
#

But js easier

#

So both are same

#

But very different when it comes to coding

#

So lets say java is trash lmao

#

:)

summer torrent
#

do you know java

mellow kelp
#

stop thrashing on other languages KEKW

scarlet stratus
#

I tried

#

I learned python eazier

mellow kelp
#

yeah of course python is easier

#

but they work for different things

scarlet stratus
#

Python is cool for ai's

sudden geyser
#

All you need to do is show a beginner the hello world for python and java and it's already game over /s

scarlet stratus
#

Mine keeps saying fuck you everytime i say sonethin, on every other person it is normal

lone palm
#

Programming languages ​​are the same as martial arts, everyone will recommend a martial arts sport, but only if you have a good command of your programming language will you be the winner

sudden geyser
#

In reality I don't care what language someone chooses.

lone palm
#

unless you choose html 😂

sudden geyser
#

yeah fuck the web

mellow kelp
#

nah

#

fuck app stores

#

me and my homies use pwa's

lone palm
gilded olive
#

Fuck the web

sick cloud
#

vue is a bother

mellow kelp
#

maybe you're looking for a for/of loop?

sick cloud
#

nah

mellow kelp
#

o

#

aight

sick cloud
#

it just needs a bind

#

so <div v-else v-for="collection in collections" v-bind:key="collection.id">

mellow kelp
#

ohh yeah that thing

sudden geyser
#

Technically, but Discord likes to say "Doing something in a short period of time on an interval is bad". See #development message

daring goblet
#

türk varmı

hasty mulch
#

Is there a Twitch API for Python?

summer torrent
odd stratus
#

What's the best cloud provider out of these three that you'd recommend?

odd stratus
#

Are the other two slower in performance?

hasty mulch
#

And not saying that because I worked at Amazon

odd stratus
#

lol

hasty mulch
#

I don’t remember the process for doing so, however, nor how much it costs

#

I think CNBC did a YouTube video about it a while back

hasty mulch
summer torrent
#

dm what

hasty mulch
#

The link I replied to you on?

#

@summer torrent

opal plank
#

i feel bad for people trying Twitch, its such a shit API its not even worth trying

gilded olive
#

Uploads

#

"Hey @everyone {streamer} just went live"

#

Thats a pretty popular thing

opal plank
#

nono, the API itself is shit

#

those things are basic

mellow kelp
#

those are webhooks ig

opal plank
#

also that

mellow kelp
#

there's not much to do with the api anyways i think

#

tried to make a bot and got stuck with basic moderation

opal plank
#

tldr, trust me, dont do twitch

#

try something else thats worth your time

mellow kelp
#

hmm aight

gilded olive
#

Nightbot is already the mee6 of twitch

#

Twitch is kinda trash tho

#

I wouldnt even bother

mellow kelp
#

they banned the words "virgin", "incel" and "simp" KEKW

gilded olive
harsh rose
#

Anyone help me

heavy anchor
harsh rose
#

Wait

#
console.log(`${bot.user.username} Is Ready Now!`)
    let totalUsers = bot.guilds.cache.reduce((acc, value) => acc + value.memberCount, 0)
    var activities = [ `${bot.guilds.cache.size} Servers`, `${totalUsers} users`,`https://mate-rowdyking.glitch.me`,`Made By ROWDY KING` ], i = 0;
    setInterval(() => bot.user.setActivity(`${PREFIX}help | ${activities[i++ % activities.length]}`, { type: "PLAYING" }),5000)
}
);```
#

@heavy anchor

sudden geyser
#

What's the issue?

#

Is the total user count not being updated?

umbral zealot
#

So here's an interesting fact. That code does not correspond to what this screenshot is showing.

harsh rose
umbral zealot
#

Neither of those 2 things show prefixhelp | X users

#

so where does that come from?

opal plank
#

huh?

umbral zealot
#

Or am I misreading that code

opal plank
#

xD

sudden geyser
#

It looks correct

bot.user.setActivity(${PREFIX}help | ${activities[i++ % activities.length]}

opal plank
#

i was about to mention

#

you are

umbral zealot
#

OH YES I'm misreading it. nevermind.

opal plank
#

{PREFIX} is a var

umbral zealot
#

bot.guilds.cache.reduce((acc, value) => acc + value.memberCount, 0) most definitely looks like perfectly functional code, I've used this myself.

sudden geyser
#

The code itself looks correct. The only thing that looks wrong is they're not re-evaluating the number of users in the interval, so it'll stay the same.

#

I don't see why it would say NaN

opal plank
#

i'd use a for loop, but thats because im a stubborn mule and i love for loops

umbral zealot
harsh rose
#

So what can i do next

opal plank
#

log totalusers

#

and make sure its a number

#

if it isnt, your reducer is broken somehow

umbral zealot
#

It's not I just copy/pasted it 😂

opal plank
#

i cant even think node version would fuck that up

umbral zealot
#

Definitely not

#

and discord.js versions wouldn't either, since v11 just wouldn't work at all and v12 should be fine with that code

opal plank
#

oh

umbral zealot
#

An empty guilds cache would show 0 because of the initial value in the reduce

#

It all looks perfectly fine

opal plank
#

yeah i was about to say that

#

nono

#

not that

#

intents?

#

if theres no cache it'd return NaN

umbral zealot
#

no it would return 0

opal plank
#

hmmmmm

#

that'd still be bad though, since the ready event is fired once and he's setting an interval there, it wont update the totalUser amount

#

it'd just reference that variable, not calculate it every time its fired

harsh rose
#

bot.guilds.cache.reduce((acc, value) => acc + value.memberCount, 0) Now i put it

opal plank
harsh rose
#

Replace totaluser

umbral zealot
#
bot.guilds.cache.reduce((acc, value) => {
  return acc + value.memberCount;
}, 0)

The , means it's the second argument to the reduce method, where the first is a function

#

really this is correct code

opal plank
#

still wouldnt update,but thats another issue

umbral zealot
#

indeed

earnest phoenix
#

you could also just console.log and see where the problem is instead of guessing

opal plank
#

which is what i proposed, but that reducer seems fine

#

console log totalUsers and see its value

umbral zealot
#

And maybe console.log the activities

opal plank
#

that i in the end intrigues me

#

why not the normal way with Math.random()?

#

rather than i %

earnest phoenix
#

it's more than likely copypasted from someone else

opal plank
#

0 % Number doesnt seem like a smart way to do

umbral zealot
#

Well that way it's rotating and not random

opal plank
#

hmmm i see

earnest phoenix
#

also that interval is happening way too often

#

you're going to hit a gateway ratelimit or kill your connection

opal plank
#

how many bugs/bad design did we find in a 5 line snippet? jesus christ

umbral zealot
#

None, honestly.

earnest phoenix
#

nvm i forgot djs swallows all gateway errors and reconnects as if nothing happened

umbral zealot
#

minor syntax issues, and a 5-second loop isn't actually that bad.

opal plank
#

it kinda is

#

at least considering API standards

#

Discord has a very loose interpretation of API abuse; as quoted by them:

American Jake01/21/2018
@​​Danny automating the API in that way /is/ abuse. Automatically doing "X" every N is generally not a good idea. Where X could be posting a message, changing someone s nickname, renaming a role, changing a channel topic, etc... 

Generally bots should only react to user actions... 

Although, for very large N we generally don t care. But for small N, we do care. Think rainbow bots, etc....```


"N" is not really defined, as rate limits are not a good thing to try to get very close to. You re going to have to mostly use common sense here, compare how close you are the rate limit, how often you do this, etc.
https://cdn.discordapp.com/attachments/272764566411149314/604449094680707072/unknown.png
#

5 secs falls into small numbers

#

and iirc i know theres a 15 second delay for presences, after that it backlogs, im not sure about normal status activity

zenith terrace
#

I posted in wrong channel lol

drifting wedge
#

how do i do like: on text edit, run function in js?

solemn latch
#

on text edit?

drifting wedge
#

like when someone edits or types a new character in website

#

it runs a js func

crimson vapor
#

should be Channel.nsfw iirc

#

so message.channel.nsfw

#

or how ever you get the channel

drifting wedge
#

if message.channel.nsfw

#

i think

#

ty woo @solemn latch

crimson vapor
#

oh my bad

#

umm

#

does it not send the channel id?

drifting wedge
#

can anyone help me understand this? ```js
const input = document.getElementById('welcomecard');
const log = document.getElementById('values');

input.addEventListener('input', updateValue);

function updateValue(e) {
log.textContent = e.target.value;
}```

#

this is from the docs ```js
const input = document.querySelector('input');
const log = document.getElementById('values');

input.addEventListener('input', updateValue);

function updateValue(e) {
log.textContent = e.target.value;
}```

solemn latch
#

seems to be an event listener, that runs a function on that event

drifting wedge
#

ye

solemn latch
#

and sets the content to the value

drifting wedge
#

but like wats querySelector

crimson vapor
#

are you able to log the response of a / command?

#

ive got no idea then

drifting wedge
#

welcome_card.js:1 Uncaught TypeError: Cannot read property 'addEventListener' of null js document.getElementById("welcomecard").addEventListener("input", updateValue);

crimson vapor
#

show the welcomecard

drifting wedge
#

wsdym

#
                                    <a style="color: white;" id="values"></a>```?
crimson vapor
#

well the getElementByID is returning null

#

im not sure why

drifting wedge
#

i mean orgininally its empty?

crimson vapor
#

but you aren't getting the value, you are getting the input

drifting wedge
#

oh true

#

mb

#

always happens

#

lmfao

crimson vapor
#

its fine

drifting wedge
#

wait

#

wot

#

it doesnt make sense

#
  • its not working
crimson vapor
#

what doesn't make sense?

drifting wedge
#

likejs document.getElementById("welcomecard").addEventListener("input", updateValue); let input = document.getElementById("welcomecard").value; function updateValue() { document.getElementById("values").innerHTML = input; }

#

this is the js

crimson vapor
#

what is "values"

drifting wedge
#

<a style="color: white;" id="values"></a>

#

where i wanna show the card

crimson vapor
#

in an a field?

#

ok

drifting wedge
#

wait i have a unrelated question

crimson vapor
#

well it is text

#

so ig whatever

drifting wedge
#

is there a web library to write in images?

#

like for example, if i wanna show the welcome card

crimson vapor
#

I assume you mean canvas

pale vessel
#

canvas

drifting wedge
#

mhm

#

does it use a lot of resoucrces?

pale vessel
#

no

drifting wedge
#

o ok nice

#

so basically no ideas why its not working?

crimson vapor
#

nope, you could search to see if there is a stackoveflow post explaining why its returning null

drifting wedge
#

its saying its the first line of the js

#

document.getElementById("welcomecard").addEventListener("input", updateValue);

crimson vapor
#

yeah

drifting wedge
#

do i have to add .value after the event listner?

crimson vapor
#

cannot read property addEventListener of null

#

you shouldn't

drifting wedge
#

input is the event right?

#

like a "change" in the text

crimson vapor
#

the issue is that document.getElementById("welcomecard") is null

#

one problem at a time lol

drifting wedge
#

<input id="welcomecard" type="text" style="border-radius: 5px; outline: none; padding: 10px; border: #6b69e4 1px solid; background-color: #111213; color: white; width: 100%; margin-bottom: 20px;" maxlength="100">

#

this is the "welcomecard" id

crimson vapor
#

yeah but idk the issue since it is returning null

drifting wedge
#

alr lemme google it

hollow sedge
#

where are you running

document.getElementById("welcomecard").addEventListener("input", updateValue);
``` @drifting wedge ?
drifting wedge
#

yes

#

oh

hollow sedge
#

where

drifting wedge
#

in js file?

hollow sedge
#

yes

drifting wedge
#

where? first line

hollow sedge
#

the html hasnt loaded yet

#

you need to put it in the onload function

drifting wedge
#

oh

#

lmao

#

lmfao

#

function onload() {

#

?

pale vessel
#

just put it on the bottom of the page

drifting wedge
#

o ok

#

ty

hollow sedge
#

no..?

#

what

solemn latch
#

or, you are naming something welcomecard twice.

drifting wedge
#

ty

hollow sedge
#

just do:

onload = function(){

}
drifting wedge
#

i put @ bottom

hollow sedge
#

thats not going to fix it but alright

drifting wedge
#

alr

#

gimme a min

#

onload function

#

run the other funcs?

hollow sedge
#

its the same as window.addEventListener("onload", function(){});

drifting wedge
#

like this?

#
onload = function(){
    document.getElementById("welcomecard").addEventListener("input", updateValue);
    let input = document.getElementById("welcomecard").value;
    function updateValue() {
        document.getElementById("values").innerHTML = input;
    }
}```
hollow sedge
#

yeah..you dont have to put other functions in it though

#

just declare a global input

drifting wedge
#

wot?

hollow sedge
#
let input = null;

function updateValue() {
        document.getElementById("values").innerHTML = input;
}  

onload = function(){
    document.getElementById("welcomecard").addEventListener("input", updateValue);
   input = document.getElementById("welcomecard").value;
}
#

@drifting wedge

drifting wedge
#

i saw

hollow sedge
#

ok

drifting wedge
#

i dont see any erros

#

but it didnt work

#

when i type, it removes the text i put

#

<a style="color: white;" id="values">t</a>

#

but doesnt put the new one

hollow sedge
#

instead of input = document.getElementById("welcomecard").value; use input = document.getElementById("welcomecard") and get .value whenever you need the value

#

or input will always be nothing because it always has the same value (you set it equal to the value, not the element)

drifting wedge
#

omg it worked

#

ty

hollow sedge
#

np

drifting wedge
hollow sedge
#

lol

drifting wedge
#

uhh also

#

how many chars do you think the welcome message can be max?

hollow sedge
#

🤷 i never know what to limit that stuff to

pale vessel
mellow kelp
#

Probably 1900-2000 or something

pale vessel
#

putting it after worked for me so

hollow sedge
#

yeah i think 2000 is pretty standard

mellow kelp
#

Since thats around the message length limit

#

Probably around 1900 or 1800 just in case

drifting wedge
#

2000 chars?!?!?!!

mellow kelp
#

I mean

#

Theres not much reason for it not to be that much

#

Unless you got a storage limit or something

drifting wedge
#

whats the name of the form type

#

which is like you check one out of a list

#

or something

mellow kelp
#

um

#

wait how do i not know that

pale vessel
#

checkbox

mellow kelp
#

oh its radio

#

or checkbox

pale vessel
#

oh it's radio

#

if you mean only one

mellow kelp
#

radio is for one out of a list

#

checkbox is for as many as the user wants out of the list

bronze mango
#

hello

solemn latch
#

im surprised no one "no hello'ed"

#

hello 🙂

drifting wedge
#

hello

#

so like ill have a way for the user to choose wat they want, dm or in server

#

then if dm, embed, normal message, or card

#

then samr for server

earnest phoenix
#

M..

drifting wedge
#

uhh how do i style radio?

earnest phoenix
#

Is this channel locked for only the people with rank "Bot Developer"?

solemn latch
#

no

earnest phoenix
#

Oh notoced it

drifting wedge
#

uhh also, how do i make a "set" of radio's?

mellow kelp
#

i think you group them by name

earnest phoenix
#

Hey

pale vessel
#

lulw

drifting wedge
#

o

#

make sense

halcyon kite
#

hey guys so i have this problem so it wont show the stats even if I type the right word is something wrong or is it the embed part?

mellow kelp
#

what does db.fetch() return?

halcyon kite
#

db.fetch(`aqua1`) and db.fetch(`aqua2`) they are both making a global var

#

so it gets the total

#

and for some reason it wont send the embed

mellow kelp
#

does it throw an error

halcyon kite
#

no

#

it just does nothing

drifting wedge
#

how do i style "radio" inputs

mellow kelp
#

wdym style?

#

you can use regular css

drifting wedge
#

i mean what things doe?

mellow kelp
#

hm

#

i think it has some pseudoselectors for states like selected and stuff like that

halcyon kite
#

nobody awnser me question on y nothing is happening :/

umbral zealot
#

if it does nothing it probably means the code isn't running

lament cradle
#

hello

umbral zealot
#

maybe try adding logs

halcyon kite
#

pl

#

ok

lament cradle
#

may I ask?

earnest phoenix
#

I am not following the stupid rules in this server.

halcyon kite
#

and no console log

halcyon kite
lament cradle
#

being ignored -_

earnest phoenix
#

@halcyon kite you going to make me?

mellow kelp
#

bruh what

halcyon kite
#

so e

earnest phoenix
#

Nice

#

Oh

halcyon kite
earnest phoenix
#

Why am I here and not in general chat

#

Oops

halcyon kite
#

idk

earnest phoenix
#

Sorry

halcyon kite
#

yeah this development chat

#

:/

halcyon kite
mellow kelp
halcyon kite
umbral zealot
#

logs didn't owrk?

#

as in they didn't output anything?

halcyon kite
#

nope

umbral zealot
#

Then that code simply isn't running.

halcyon kite
#

hmm

#

ill send whole thing

#

and thats that

mellow kelp
#

you got a .then() after a return statement

#

the one that starts the whole thing

halcyon kite
#

ahh ok