#development

1 messages · Page 1080 of 1

delicate shore
#

What u mean

#

But how to do that

solemn latch
#

you keep track of how many times they have done a command recently, if its above a certain amount, do nothing

#

I added it, when people started abusing commands, honestly the djs guide needs to explain better cooldown systems

wanton nova
#

yeah because you can just spam the cooldown message

slender wagon
#

or don't give a cooldown message at all

delicate shore
#

^

wanton nova
#

yeah that might make users confused though

delicate shore
#

Maybe react to their msg ?

#

With a cross

wanton nova
#

that also requires a request

delicate shore
#

When they are on cooldown

slender wagon
#

he would probably understand that the problem isn't with the bot it is with him lmao

delicate shore
#

o

wanton nova
#

thats also kinda confusing

solemn latch
#

I give a max of one cooldown message per cooldown period

delicate shore
#

Ok

solemn latch
#

Unless its a command with extended cooldown periods

wanton nova
#

@slender wagon you don't understand how stupid some discord users are do you lol

slender wagon
#

reacting to a messages requires more effort than sending a message i think

wanton nova
#

wdym @fleet hornet

slender wagon
#

u should pick the size ur self

delicate shore
#

It responds two times

slender wagon
#

becouse the new version made it small by its default

#

1 sec

solemn latch
#

?size=128 or something

#

Avatar url might have an option for it already

delicate shore
#

Yes

#

yes

slender wagon
#

if u are using a embed .setImage(user.displayAvatarURL({format: "png", dynamic: true, size: 1024}))

slender wagon
#

np

delicate shore
#

This is before and after

#

Of doing what woo said

wooden ember
#

how do I get async in a command file?

sudden geyser
#

What do you mean

slender wagon
#

um have u got sc?

#

screenshots*

wooden ember
#

ons sec

#
module.exports = {name: 'ping',description: 'shows latency',execute(msg) {

    const t = await msg.channel.send("loading...");
        t.edit(`Pong! Latency is ${(t.createdTimestamp - msg.createdTimestamp) / 2}ms.`);
        console.log(`ping${(t.createdTimestamp - msg.createdTimestamp) / 2}ms`);
        return
    }



 });
``` this is the command I whant to use but it needs async
slender wagon
#

@fleet hornet what's the error

sudden geyser
#

Mark execute as async by adding async before it.

solemn latch
#

^

#

Just like any function

wooden ember
#

ah ok thx

crimson vapor
#

@fleet hornet is that the entire error, that doesnt really tell us anything

misty sigil
#

Why do you have more than 11 listeners

wooden ember
#

Im rewriting my bot as it was just one file

solemn latch
#

You only need one

slender wagon
#

Im rewriting my bot as it was just one file
@wooden ember if u are a starter that's just fine, but as u move on u should start using command handlers

wooden ember
#

yeah im rewriting it to use a command handler

slender wagon
#

u are using v12 right?

wooden ember
#

me?

slender wagon
#

no

wooden ember
#

ah

crimson vapor
#

v12 is amazing

#

just go to the docs

still merlin
#

Check the docs

misty sigil
#

is your bot on the same server as the site

#

get yourself a custom domain

#

idk

still merlin
#

Can I have some help please. I get a undefined error with nicknames, I'm nicknamed to "Henry" on a discord server for a nickname test thing but it comes out undefined, Code

slender thistle
#

Is user a User object?

#

displayName is only for guild members

still merlin
#

OH i fixed it sorry

acoustic orchid
#

if you need help with an error, or a specific thing, we can help.
general questions, like yours isnt easy to answer @acoustic orchid
@solemn latch ok

opal plank
#

Reee! why people dont use ADDFIELD(S) instead of adding 30 addField() ?

misty sigil
#

ikr

stiff stream
#

why dose it send none stop puppy's pictures?

sudden geyser
#

Reee! why people dont use ADDFIELD(S) instead of adding 30 addField() ?
@opal plank us men don't use ADDFIELDS. we use raw objects

opal plank
#

indeed

#

i dont use builders

#

waste of power

#

even d.js collections

#

i still havent seen a use for em instead of using Maps

stiff stream
still merlin
#

my bot is saying a persons highest role is bot founder but there role is server moderator

#

highest role is server moderator*

#

the code is message.member.roles.highest

sudden geyser
#

@stiff stream you shouldn't be nesting events.

#

For every new message sent (including your own bot, which can cause an infinite loop), it'll get a random puppy image and sent it to the current channel.

#

Try removing the bot.on('message', async message => {}) part.

earnest phoenix
#

how can i get the voters username

solemn latch
#

pretty sure the vote doesnt give you usernames

#

youd likely need to fetch the user from discord

earnest phoenix
#

ight thanks

ornate flax
#

Can you give my bot the command to set prefix specific to servers? Discord.js v11

sudden geyser
#

We can't just throw an entire block of code for you to use in your project. It's your bot and we don't know how it works, so you'll probably need to write it yourself. Either way, to make a customizable prefix, you'll need a database to store prefixes per guild.

stiff stream
willow river
thick gull
#

perhaps try reading it

pure lion
#

@stiff stream log stuff

#

Nvm

#

What is randomPuppy()

thick gull
#

Its a api for reddit

stiff stream
#

@stiff stream log stuff
@pure lion what do you mean?

sudden geyser
#

@stiff stream what is your case statement referring to. is meme supposed to be the command name? Why do you have a run variable you're setting to a function?

stiff stream
#

@sudden geyser yes, meme is the command name. and the run to make it work is it?

sudden geyser
#

But you're not calling it?

stiff stream
#

wdym?

sudden geyser
#

Where do you call the run function.

stiff stream
#

i need to const it?

celest schooner
#

@stiff stream

#

.setImage

#

not .setimage

sudden geyser
#

Do you know what a function is

stiff stream
#

@celest schooner still isnt sending

celest schooner
#

does ur command handler even work

stiff stream
#

yes

solemn latch
#

i agree with lite, you need to call run.

celest schooner
#

v12

#

or v11

#

@stiff stream

#

of discord.js

stiff stream
#

v12

celest schooner
#

discord.js

#

v12

stiff stream
#

yes

celest schooner
#

doesnt have RichEmbed()

#

Its MessageEmbed()

stiff stream
#

where do you see RichEmbed()?

celest schooner
#

Just replace
const { MessageEmbed } = require('discord.js')

stiff stream
#

oh

#

ok

celest schooner
#

and use const embed = new MessageEmbed()

stiff stream
#

i did that

#

let me see now

#

nope

celest schooner
#

¯_(ツ)_/¯

stiff stream
#

didnt sent anything

celest schooner
#

then ur bot broke or something idk

#

i cant help u

stiff stream
#

ok

#

ty for trying

sudden geyser
#

Like I said, it's not working because they're probably not calling it.

stiff stream
#

how do i define run then?

sudden geyser
#

Do you really need to wrap your command in a run function.

#

You showed in your source code that you defined it as run = (client, message, args) => {...}

pure lion
#

What version of discord js are you?

solemn latch
#

you already defined run, you just are not running run

stiff stream
#

v12

pure lion
#

It's messagwembed

#

Ejdiwjd

celest schooner
#

thats not the problem

sudden geyser
#

the version does not matter here.

celest schooner
#

i just told him that

pure lion
#

Jsjsjsjsjss

#

I'm tired okay

sudden geyser
#

it'll be an issue later on but actually calling it is priority

stiff stream
#

its ok nvm

#

thx to anyone who tried to help

sour cargo
#

hey guys

#

im getting this error

#
client_session: <aiohttp.client.ClientSession object at 0x105a91908>```
#

not sure where to close the session, do u guys know where i should close it?

solemn latch
#

any time you need to close the session

pure lion
#

Unplug your fridge

sour cargo
#

;-;

#

not helping Its werid tho ive been running the bot for 2 months

#

and i just got this error, heroku also deleted my app without any warning

celest schooner
#

rip

sour cargo
#

so i tried to rerun the local code first

#

and i kept getting that error

still merlin
earnest phoenix
#

?

solemn latch
#

🤔

#

weird

sour cargo
#

anyone know about this issue

client_session: <aiohttp.client.ClientSession object at 0x105a91908>```

@sour cargo

solemn latch
#

yeah

#

close the session

#

when your done with it

misty sigil
still merlin
#

What do you mean by because its message member, not them

#

I have message.member in my code

misty sigil
#

it’s you not them

solemn latch
#

message.member gets the author member object

earnest phoenix
#

yeah

#

lmao

sour cargo
#

when your done with it
@solemn latch I tried doing await client.close() but that didnt work

earnest phoenix
#

try client.destroy?

sour cargo
#

okk

sour cargo
#

hmm

#

right so this is my client client = commands.Bot(command_prefix='p.', status='Online', case_insensitive=True)

#

and at the end i do client.run('Token')

#

so im not sure where i shld await to close it

#

do u wanna see my code

#

i have it on github

solemn latch
#

im confused, your bot client uses aiohttp?

sour cargo
#

it doesnt.. thats why im confused too

#

heres all of the error

solemn latch
#

@slender thistle sorry for ping, i think youd be better at helping for this one if your available.

sour cargo
solemn latch
#

dbl python issues 🤷‍♂️

slender thistle
#

I'm busy

solemn latch
#

mk

earnest phoenix
#

So i've encountered this issue, status code error 492 on ytdl-core, aka too many requests... Is there a way around this or do i have to wait to get rid of the ratelimit?

sour cargo
#

this came out of nowhere, i was saying before that heroku deleted my app for no reason so i remade it and i got this error, but i ran it locally and got the same error

restive furnace
#

ip rotating AkaneShrug @earnest phoenix

sour cargo
#

so it has to do with the code

earnest phoenix
#

@earnest phoenix lol rate limited

#

Ip rotation is an absolute bruh moment

#

I agree

#

@earnest phoenix i don't even know how tf did i get ratelimited

restive furnace
#

just buy a vps with built-in ip rotation

tight plinth
#

Don't use ytdl then

earnest phoenix
#

Bruh

#

@restive furnace oh yea? What host provides that

restive furnace
earnest phoenix
#

Lol thats a load of bullshit

restive furnace
#

well, i dont make music bots, so i dont need to know these things even.

earnest phoenix
#

Idk i host on a vps, lemme check if it has any @restive furnace

#

@restive furnace dont give any input if you are unsure

solemn latch
#

🤔

restive furnace
#

well im not unsure about ip rotating.

solemn latch
#

the minimodding today is real with ya

earnest phoenix
#

Okay then dont give any false info

restive furnace
#

i didnt? did i?

earnest phoenix
#

@solemn latch it just pisses me off when someone gives false info

lavish skiff
#

Who knows a good vps not too expensive?

solemn latch
#

ip rotation is the correct solution

#

🤔

lusty quest
#

@lavish skiff what is your budged?

earnest phoenix
#

Who knows a good vps not too expensive?
I use accuratenode

lavish skiff
#

@lusty quest 10

misty sigil
#

4gb for £6 a month

lusty quest
#

can recommend digitalocean (5$/month)

misty sigil
#

Or 2gb for £3/month

#

it’s good

unique nimbus
#

Contabo is good

#

also

misty sigil
#

I use it for my bot

unique nimbus
#

8gb for €5 a month

restive furnace
#

galaxygate is good i heard

solemn latch
#

i like gg

lusty quest
#

also Amazon AWS is ok

#

the same goes for Google

#

with Amazon AWS you can also use Cloud9 for instant deploying

earnest phoenix
#

@earnest phoenix show us the entire error? Let's see which line the error is happening

solemn latch
#

your not giving enough info

lusty quest
#

your code?

lavish skiff
#

@misty sigil thx

misty sigil
#

You going for oxide?

lusty quest
#

looks like you try to check permissions but your bitfield is invalid

lavish skiff
#

yeah

earnest phoenix
#

@earnest phoenix show 85th line

misty sigil
#

I’ll go and dm you the support server if you want

earnest phoenix
#

In index.js

lavish skiff
#

@misty sigil yes give me please

earnest phoenix
#

Yea MANAGE_SERVER is not a valid flag

#

It's MANAGE_GUILD

#

Np

sour cargo
#

can anyone help me please?

#

a bunch of servers kind of depend on this and i dont know how to fix it..

opal plank
#

dont ask to ask

#

just ask

sour cargo
#

i asked 2 times

opal plank
#

i missed

sour cargo
#

woo tried helping but it didnt resolve

#

wait ill copy paste it again >.<

stable oyster
#

Hi

sour cargo
#
client_session: <aiohttp.client.ClientSession object at 0x105a91908>```
opal plank
#

ah, thats py

#

im not familiar with py, sorry

sour cargo
#

ahh all good ty tho

#

idk where the session isnt closed..

opal plank
#

managed to shrunk my index down to 138 lines, finally

restive furnace
#

cool, mines 30 lines

sour cargo
#

showoff .

misty sigil
#

mines 95

silver dust
#

HI

#

NEED HELP

sour cargo
#

im gonna stab my computer

opal plank
#

i could shrink it more tbh 002_think

silver dust
#

node bot.js is not working

solemn latch
#

plebs with their small index's

sour cargo
#

same casstey

silver dust
#

node bot.js is not working
@silver dust on terminal

sour cargo
#

just write it all on one line

#

👀

opal plank
#

just remove command handler and we'll be going to 5 digit lines EASILY

torpid edge
#
} else if (command == 'embed'){
 client.commands.get('embed').execute(message, args);
                             ^

TypeError: Cannot read property 'execute' of undefined

what does it mean, im tryna make an embed
i dont understand cuz im relatively new to the discord bot thing
i started like 3 weeks ago so im not sure what to do

silver dust
#

hm

restive furnace
#

just remove command handler and we'll be going to 5 digit lines EASILY
one line command handler, thats how I do my small lines.

sour cargo
#

is that node.js?

opal plank
#

it means theres no embed to be executed

silver dust
#

is that node.js?
@sour cargo ye

#

but doesnt work

torpid edge
#

but i linked it to my embed file

silver dust
#

on visualstudio

opal plank
#

@torpid edge you didnt set embed on that map

silver dust
#

imma try it with atom

torpid edge
#

what do u mean

silver dust
#

bye

#

visualstudio is trash

opal plank
#

how are you setting your commands?

misty sigil
#

?!

torpid edge
#

like i make my commands in seperate files and then link them

opal plank
#

how

slender thistle
#

@sour cargo Do you still need help or was your issue with __new__() fixed?

sour cargo
#

i need help @slender thistle

#

heres the photo

slender thistle
opal plank
#

good reminder

#

in should do a npm update

haughty igloo
#

@slender thistle wdym discord.py

opal plank
#

been a while since i last updated my modules

slender thistle
#

Your package

torpid edge
#

i make the code for the command in a different file
then i linked the folder of the commands so its easier to link each command's file
then as shown in the message i sent i link them

sour cargo
#

which version @slender thistle

slender thistle
#

the library you use

sour cargo
#

discord.py==1.3.3

slender thistle
#

Literally just pip3 install -U discord.py

sour cargo
#

ok

slender thistle
#

It's 1.3.4

opal plank
#

@torpid edge im asking how are you setting your embed, what is your command handler thats settings the files onto the map?

earnest phoenix
#

Hi
How do I get random emoji from bot-attached servers ?

torpid edge
#

like what app i use?

sour cargo
#

ok im rerunning it now

opal plank
solemn latch
#

whats your code look like

opal plank
#

do you know javascript @torpid edge ?

sour cargo
#

it works @slender thistle

torpid edge
#

kinda

sour cargo
#

didnt know that was the only thing i needed to do..

opal plank
#

you know what Maps are?

sour cargo
#

THANK u so much @slender thistle

#

and thanks @solemn latch !

#

lemme repush to heroku

solemn latch
#

if only i knew it was that easy

earnest phoenix
#

How do I get random emoji from bot-attached servers ?

opal plank
#

bruh wtf

sour cargo
#

haha

#

yea

opal plank
#
switch(test) {
case 'a': 
let c = 'a'
console.log(c);
break;
case 'b': 
let c = 'b' 
console.log(c);
break;
}
// Above Scope error c cannot be redefined 


switch(test) {
case 'a': 
{let c = 'a'
console.log(c);
break;}
case 'b':
{let c = 'b' 
console.log(c);
break;}
}
//blocking them with {} scope prevents it, but im not sure if thats the right thing to do
#

any Ts users here?

#

cuz im confused

#

i thought switch cases had their own scopes

earnest phoenix
#

hello guys, i am new here, i have already created a bot on discord websiite, i want to knwo how to program he

opal plank
#

client mods

ancient nova
#

no it's just css edition on the website

opal plank
#

mods regardless

ancient nova
#

;-;

#

I rewrote the main.js because of the hosting problem that the bot had, deleted some unnecessary code from the bot's main.js also deleted/rewrote few commands which made the bot's performance a bit better, also the main problem that the bot have with the task handling problem is the constant status change which kinda slows the bot down but I will try to increase the performance by deleting some things from the variable base in the future

#

I think I have a command like that but it's when you type for example !leave in a specific server

solemn latch
#

you can eval that.

opal plank
ancient nova
#

discord.js is the best language to make bots, you can't change my mind

opal plank
#

i have my doubts

ancient nova
#

ew python

#

who even uses it

opal plank
#

wheres mister Tim the Tat man when i need em'

misty sigil
#

Tim?

pure lion
#

😏

solemn latch
#

tim vacation ;p

pure lion
#

I am Tim but British and not Tim at all

misty sigil
#

I’m Tim but without js knowledge

#

all I know is turn off and back on again and it works

pure lion
#

Do you know why?

misty sigil
#

why

solemn latch
#

math?

pure lion
#

No

harsh badge
#

Eris > discord.js

pure lion
#

It reinitialises everryhrwjdiwhdieeh4uhe

#

Excuse me what

#

Eris + discord.js < discord.js-light

solemn latch
#

well ofc, using eris and discordjs at the same time would be worse

opal plank
#

Im not even sure Tim uses Type tbh

#

for real though, not a SINGLE soul here uses TypeScript?

earnest phoenix
#

Well some did, but most quit

opal plank
#

fml

zenith terrace
#

what even is the difference between eris and discord.js. I'm looking at an eris tutorial and it looks completely the same unless theres some sort of changes

earnest phoenix
#

Eris has auto sharding

#

But terrible shard resolving

digital ibex
#

you basically code what u want in eris

earnest phoenix
#

So discord.js is better than eris in my opinion

lusty quest
#

d.js got autosharding too

earnest phoenix
#

Wot

lusty quest
#

with V12

valid frigate
#

there is only one problem with eris at the moment and it's unknown close codes

earnest phoenix
#

Oh i know what you mean

valid frigate
#

aka the library cannot handle disconnects properly

earnest phoenix
#

The only difference i can spot in main is just the sharding

valid frigate
#

i'm working on a fix for this right now but atm it's not really viable for sharded bots

lusty quest
#

i think about switching to Discordgo

earnest phoenix
#

Bruh

lusty quest
#

is more efficent than node

valid frigate
#

it's pretty good yeah

opal plank
#

deno

valid frigate
#

go is supposed to be easy to learn

opal plank
digital ibex
#

eris is cleaner, more do it yourself, is maintained by one person only (one opinion on the code), and has always been better with sharding and connections. It has less util functions and also lets you directly call rest

opal plank
#

go deno

valid frigate
#

ive used typescript for 2 years

#

finally sweet release

earnest phoenix
#

@digital ibex Actually no

opal plank
#

Wot

#

theres a typescript angel here?

lusty quest
#

go is pretty easy to learn, it has some stuff similar to js

earnest phoenix
#

Eris is terrible with sharding

digital ibex
#

what

#

how

valid frigate
#

eris is cleaner
not really. the index.d.ts file still produces incorrect types

digital ibex
#

whats wrong with it?

#

i use it

#

perfectly fine for me

earnest phoenix
#

Connection issues mate

opal plank
#

Vysion, i assume you know Ts well then?

digital ibex
#

if ur in around 10k servers, then make ur own

valid frigate
#

yeah ive used typescript for a while

#

not a bad language

opal plank
#

thank fucking god

#

i ported recently all my shit to ts

#

but im somewhat new, still not using interefaces on anything fancy

#

though

#

can u check this rq?

valid frigate
#

interfaces are like a core concept of typescript lol

opal plank
#

im using lax ts

#

using strict mode but not interfaces

earnest phoenix
#

@digital ibex eris's sharding manager has some problems with reconnecting that kills most of the shards alive, and none connects back anymore

#

That's why

digital ibex
#

when does it start to do that?

valid frigate
#

i dont think that's necessarily a typescript problem

digital ibex
#

around 10k servers, yes

earnest phoenix
#

Random

valid frigate
#

hold on

opal plank
#

Js runs it fine

ancient nova
#

I created invite generating command why does it cause such lag?

digital ibex
#

its not random

opal plank
#

but js runs ANYTHING fine

#

even when its wrong

digital ibex
#

not for me anyways

valid frigate
#

true

#

then again why is your switch statement an issue, everything looks fine

#

weird

digital ibex
#

if you think its so bad, make ur own sharding stuff

opal plank
#

it seems like a scope issue

digital ibex
#

but eris is neat imo

earnest phoenix
#

@ancient nova invite generation command? What context is this in

opal plank
#

but i was pretty sure switch cases had scopes f their own

valid frigate
#

switch blocks probably arent meant to have variables defined in the same scope as the block

opal plank
#

its kinda weird to me having to put blocks onto switch cases, so im not sure thats what causing it

#

hmmm that could be true too

valid frigate
#

id point it at scope yeah

opal plank
#

theres quite a few things i still gotta wrap my head around that Ts is way more strict that js, like that for example

valid frigate
#

probably because variable lifetimes are defined by {}

opal plank
#

apparently redeclaring variables is allowed in Js just fine

#

like in that example

#

absolutely no issues running that in Js

valid frigate
#

you might be fighting with the compiler then

#

ts might have type safety idk

opal plank
#

hmmm could be

#

i appreciate the info tho, ty

valid frigate
#

ya np

ancient nova
#
    if (message.content === '1invite') {

        var userId = message.author.id;

        var userInvites = message.guild.fetchInvites().then(invites => invites.find(invite => invite.inviter.id === userId));

        var useAmount = userInvites.uses;

        if (useAmount === undefined) {

            message.channel.send(`${message.author.username} has 0 invites`);
        }

        else {

            message.channel.send(`${message.author.username} has ${useAmount} invites`);
        }
    }
opal plank
#

var

ancient nova
#

for some reason this command causes bot ping to jump

digital ibex
#

nice indents

opal plank
#

im absolutely triggered by that

ancient nova
#

write better command then .-.

digital ibex
opal plank
#
    if (message.content === '1invite') {
        const userId = message.author.id;
        const userInvites = message.guild.fetchInvites().then(invites => invites.find(invite => invite.inviter.id === userId));
        const useAmount = userInvites.uses;
        if (useAmount === undefined) message.channel.send(`${message.author.username} has 0 invites`);
        else message.channel.send(`${message.author.username} has ${useAmount} invites`);
    }
digital ibex
#

indents :o

ancient nova
#

thonks

#

I needed that

opal plank
#

i didnt fix it

ancient nova
#

will this reduce the lag?

opal plank
#

i just removed the cancer

digital ibex
#

erwin, u like that code indent?

opal plank
#

no

ancient nova
#

oh

digital ibex
#

lmfao

valid frigate
#

bot ping is just the amount of time between the moment your bot receives a heartbeat from discord and until it confirms that discord received its heartbeat acknowledgement

opal plank
#

i just removed the cancer

ancient nova
#

eh okay

#

so you telling me I should use const instead of var

valid frigate
#

const is for immutable variables

opal plank
#

user let/const whenever

digital ibex
#

or let

valid frigate
#

there's a difference between let and var i think

ancient nova
#

eh okay

#

thanks anywah

valid frigate
#

in the sense that var can be used outside of its scope

opal plank
#

which is horrid

valid frigate
#
var a = "a"
{
  var b = "b"
}
console.log(b)
#

this would work

opal plank
#

let a = 1
{
a = 2
}
console.log(a) => 2

#

fuck

#

beat me to it

ancient nova
#

why you hate var so much

#

.-.

valid frigate
#

they both have separate use cases

digital ibex
#

var is bad

opal plank
#

cuz they ignore scopes

valid frigate
#

let is part of es6 or smth

opal plank
#

globals and vars, dont use

valid frigate
#

use whatever man

ancient nova
#

welp

opal plank
#

theres a whole list of things you SHOULDNT do

ancient nova
#

Imma switch to const

cinder patio
#

var is only still in javascript because otherwise it would break thousands of web pages

ancient nova
#

I guess

#

I used it too

#

in some commands

opal plank
#

while it doesnt explain, take a look at this

valid frigate
#

ok just remember that if you set a const it's short for constant

earnest phoenix
#

Me wondering why does this error

for(let i = 0; i < 5; i++){
//Loop something
}```
While this works...
```js
for(var i = 0; i < 5; i++){
//Loop something
}```
let and var... Wtf ![Thonk](https://cdn.discordapp.com/emojis/356771720863940608.webp?size=128 "Thonk") ![Thonk](https://cdn.discordapp.com/emojis/356771720863940608.webp?size=128 "Thonk") ![Thonk](https://cdn.discordapp.com/emojis/356771720863940608.webp?size=128 "Thonk") ![Thonk](https://cdn.discordapp.com/emojis/356771720863940608.webp?size=128 "Thonk")
ancient nova
#

should I switch var to const in all my commands?

valid frigate
#

that shouldnt error lol

#

also it's up to you

earnest phoenix
#

How's it erroring then, how

opal plank
valid frigate
#

you can't run es6 code? shrug

cinder patio
#

ItsOkayBae, it depends on how the variable is used. If you aren't changing it, switch to const, if you are editing it, use let

opal plank
#

im running es2020

earnest phoenix
#

I can, it's somehow not working with let on that

opal plank
#

fuck this syntax

#

its killing me

earnest phoenix
#

Well let's try again

valid frigate
#

i'm using es6 since it's stable now

#

in a sense

opal plank
#

i kinda wanna set Ts to esNext

#

but i can see how that can screw me up royally

cinder patio
#

javascript is getting better and better

valid frigate
#

syntax?

#

v8 engine needs improvement

opal plank
#

ES11

earnest phoenix
#

Wtf, it worked with let now... How it did give error before i wonder

opal plank
#

es2020 = ES11

#

im getting on my last wits with the new syntax

#

not syntax

#

but i wasnt using es6

cinder patio
#

What new syntax? the new ? and ?? operator?

opal plank
#

so porting everything to import

#

rather than require

cinder patio
#

oh

opal plank
#

theres a bunch of stuff that i have to switch up

valid frigate
#

a lot of popular npm packages now come with types

opal plank
#

using exports rather than module.exports

#

its a whole deal of headache to catch

valid frigate
#

classes

#

js oop moment

opal plank
#

i got fed up with interfaces when i first look

#

so now you'll see all my variables with :any infront

valid frigate
#

have you ever worked with structs in other languages

opal plank
#

i have not

valid frigate
#

oh

opal plank
#

i do have an idea how it works

cinder patio
#

interfaces in TS is basically how JS objects should look like

opal plank
#

though i havent properly learned yet

valid frigate
#

bruv

opal plank
#

this was me pissed at interfaces

#

just setting everything to :any

cinder patio
#

Interfaces in TS are nothing - literally they are only used to catch type errors

#

you shouldn't use interfaces for those

opal plank
#

well yeah

#

thats just an example

#

throughout the whole code its all any

#

EVERY

#

SINGLE

#

VARIABLE

#

cuz i set Ts type to strict and that fucked me up quite nicely before i realised THATs what was killing my code

cinder patio
#
import Discord from "discord.js"

client.on("...", guild: Discord.Guild => {

});```
#

I am not 100% sure if the syntax is like this though, haven't used TS in a while

opal plank
#

havent touched much with that myself

cinder patio
#

that's specifying the data type for the guild parameter

#

that's like the whole point of TS

opal plank
#

i guess Guild is a interface exported from that lib?

cinder patio
#

It's the Guild class

#

it can also be a class

opal plank
#

oh

#

interesting

cinder patio
#

or a primitive value like string or number

opal plank
#

thats what i mean, i still need to learn all that stuff

#

currently im on lax ts per se

cinder patio
#

If you haven't used statically typed languages before this could be difficult to learn

opal plank
#

its a learning curve for sure, but im down for it

pure lion
#

What in the holy name of hyrule is that

wicked narwhal
#

Can someone teach me how to make your bot's profile picture float up and down on it's page?

pure lion
#

Like this?

wicked narwhal
#

Huh

misty sigil
#

thats css

pure lion
#

No ssh visit my site

#

Like this^^^

#

?

#

But the name

misty sigil
#

put cloudflare on that

wicked narwhal
#

?

pure lion
#

Or wheevevrhehuws

opal plank
#

for the love of god wtf is this

pure lion
#

What formatting is that

wicked narwhal
#

But if anyone knows can you teach me

pure lion
#

It's css

cinder patio
#

Jeyden, not many people here can write their own css for that (including me, lol), just copy paste the first thing from stackoverflow

opal plank
#

is that yours Dice?

#

lmao

pure lion
#

<tag or ID>: hover

#

Yes

wicked narwhal
#

Jeyden, not many people here can write their own css for that (including me, lol), just copy paste the first thing from stackoverflow
@cinder patio wot they have it there?

pure lion
#

That is mine

opal plank
#

quite a bit glicthy when hover on pfp

pure lion
#

How do i center text without the element expanding left or right

#

?

cinder patio
#

Yes, but you should know the basics of css before copy-pasting anyting

#

anything*

opal plank
wicked narwhal
#

....

#

I like Luigi better

pure lion
#

HTML is for structuring the page
CSS is for styling
SCRIPT is for idiots who don't use CSS or you wanna import data for some weirdo ass reason

cinder patio
#

Let's be honest, everybody googles how to do anything more complex than moving something a few pixels/changing simple attributes

opal plank
#

bruv

#

just jQuery

wicked narwhal
#

Let's be honest, everybody googles how to do anything more complex than moving something a few pixels/changing simple attributes
@cinder patio thats what Google is for bruh

pure lion
#

What is jQuery

opal plank
#

incoming mob of angry people

pure lion
#

Uh oh

opal plank
cinder patio
#

a very unnecessary framework that's very outdated

pure lion
#

I've heard that "people" don't like jQuery

hidden lynx
#

framework?

#

Jquery is no framework is it?

earnest phoenix
pure lion
#

What the balls is a j and why is it queer (y)

cinder patio
#

well, framework, library whatever

#

people use it like it's a framework that's for sure

hidden lynx
#

It's basically a library that should make vanilla js syntax in the browser shorter and easier

opal plank
#

JavaScript !== JQuery

JQuery is largely a replacement for the DOM. It provides a lot of tools for working with browser specific stuff, not JavaScript specific.

There's questions about JavaScript itself that can't be answered with "use JQuery". Questions about scope, the way functions work, objects, etc.

However, JQuery can be used beyond questions about JavaScript or the DOM. Just the other day a waitress asked "What would you like?" at a restaurant to which I replied "just use JQuery". She knew precisely what I wanted at that point
some random dude at stackoverflow

cinder patio
#

lmao

wicked narwhal
opal plank
#

DOM is another thing i dont ever wanna face

hidden lynx
#

I mean it's still js. I do think it's still pretty useful when you're making some simple animation stuff or sth in the browser.

#

Why Not Erwin?

opal plank
#

cuz it traumatized me

hidden lynx
#

xD how come

cinder patio
#

It's actually very very simple if you know the basics of HTML

opal plank
#

i dont remember why, i remember sitting down for 4 and a half hours trying DOM and simply rage quit

earnest phoenix
#
   message.guild.createChannel('general', { type: 'text' })
  .then(console.log)
  .catch(console.error);
  message.channel.send('Channel Created!')
}```
I keep getting errors, does anyone know how to fix this?
opal plank
#

huh

hidden lynx
#

You need a parameter for the log I guess

opal plank
#

catch too

hidden lynx
#

Or it's a permission problem

earnest phoenix
#

I literally copied and pasted from the official discord.js website

cinder patio
#

without the errors we can't

earnest phoenix
#

@earnest phoenix v11?

#

yeah

opal plank
#

update to v12

#

you're one month away from it being deprecated

earnest phoenix
#

just updated it

#

What's the errors first and the better thing is to update because v11 is gonna stop working on October 7th of 2020

opal plank
#

^^

earnest phoenix
#

TypeError: channelType.toUpperCase is not a function

#

is the error

#

And now it's same instead of createChannel you need to use channels.create()

#

message.guild.channel.create?

#

Yea

#

No no

#

channels

opal plank
#

isnt that v12?

earnest phoenix
#

He said he updated it tho

opal plank
#

oh

earnest phoenix
#

Yeah, I updated it

opal plank
#

aight its fine then

#

that catch is kinda bugging me

#

.catch((err) => console.log(err));

earnest phoenix
#

Nothing wrong but instead of (err) do err

hidden lynx
#

That should be correct tho

opal plank
#

it'll catch err either way

#

err:any

earnest phoenix
cinder patio
#

passing console.log works too

#

it's even better because you are not creating an extra function just to call console.log

earnest phoenix
#

@earnest phoenix channels.create

#

You forgot an s

#

ok, thanks for the help

stiff stream
#

error

misty sigil
#

message.author

earnest phoenix
#

message.user is not a thing

#

message.author

#

And

stiff stream
#

member?

earnest phoenix
#

Don't user avatarURL

misty sigil
#

message.author.displayAvatarURL

earnest phoenix
#

message.author.displayAvatarURL() use this

opal plank
#

was about to mention that

stiff stream
#

now?

opal plank
#

looks good to me

#

tryitandsee

earnest phoenix
#

Nice

finite bough
#

message.Username

#

nice

earnest phoenix
#

No

opal plank
#

oh yeah

#

author

#

message doesnt have Username

finite bough
#

username

opal plank
#

message.createdAt

#

wait

#

nono

#

my bad

#

thats for message stamp

earnest phoenix
#

message.Username.createAt
Wtf is this supposed to mean

finite bough
#

message.author.createdTimestamp

stiff stream
opal plank
#

yeah ^^

#

what Shiemi sent

#

read error Ron

stiff stream
#

i did

earnest phoenix
#

You defined moment after that line

opal plank
#

then

#

^^

earnest phoenix
#

Always remember to define things you're gonna use on your code a lot on the very top of your code

#

As mainly packages

opal plank
#

hmmm this is a bit infuriating too

stiff stream
opal plank
#

collapsing 'imports'

#

i guess its good for a bunch of packages?

earnest phoenix
#

@stiff stream you already defined moment

stiff stream
#

ik

earnest phoenix
#

You shouldn't define Something twice

stiff stream
#

but the command dosent work

opal plank
#

just define moment ONCE in the top of your code

#

thats all

digital ibex
#

r u using moment more than once?

earnest phoenix
#

People that doesn't define to require them packages on top of their code frustrates me

digital ibex
#

^ opposite for me

opal plank
#

i have reasons to it tbh

#

not atop

digital ibex
#

same

#

performance issues :p

opal plank
#

startup time requires me to do some logging before/after the packacge is loaded

earnest phoenix
#

Wait packages even take time to load when you require them Thonk

amber fractal
#

well nothing can be instant

opal plank
#

not much but yeah

#

try it

digital ibex
#

nothing is global in my code

opal plank
#

let a = new Date.now()
import(module):
let b = new Date.now()
console.log(a - b)

amber fractal
#

It can be sped up a lot because require uses a cache

#

well in node they do

earnest phoenix
#

@opal plank import... I meant require

opal plank
#

same deal

amber fractal
#

idk about other runtime envs

digital ibex
#

yeah, apart from the stuff i'd have to change

earnest phoenix
#

Hmm lemme test then

digital ibex
#

just use client.time

#

lul

earnest phoenix
#

@opal plank
=> ```js
Vx_eval let beforeRequire = Date.now();
require("moment");
let afterRequire = new Date(Date.now());

beforeRequire - afterRequire```
<=

0```
opal plank
#

hmm

digital ibex
#

use client.time

opal plank
#

it does log some for me, though there are multiple dependencies

earnest phoenix
#

What does even client.time do

#

How do I create a channel in vs11?
I only need to use the code once so don't tell me to use vs12.

digital ibex
#
client.time('bob');
require('moment');
client.timeEnd('bob');
#

times the code in the whatever

opal plank
#

console has that, no?

digital ibex
#

console.time

#

i need slepe

opal plank
#

yeah

digital ibex
#

mb

earnest phoenix
opal plank
#

client lul

#

i was about to ask

digital ibex
#

lol

opal plank
#

i should switch to that tbh

#

idk if it allows literals or more stuff tbh

#

actually

#

hmmm

#

holdup

digital ibex
#

my pc is shit thats why its so long

opal plank
#

its just too small numbers

#

but it definetly loads em

digital ibex
#

takes 0.000131 seconds lul

earnest phoenix
#

I actually wonder how are we able to use them directly while they load though... Like
require("moment").duration() i think it's magic Thonk

amber fractal
#

well it's synchronous

#

the code is executed the way it's written

digital ibex
#

that must be only for moment..

#

thats pretty cool tho

earnest phoenix
#

It's for every package

amber fractal
#

Well you can do it with any module

#

because like I said, require is sync

#

it will require then run what's after

#

like doing a function inside of a function, but not really

digital ibex
#

:o

#

its for every package?

earnest phoenix
#

Yea

#

I think it's like async/await but hidden and better that it does the requirement first then follows the other things like methods or properties

digital ibex
opal plank
#

its a method

digital ibex
#

yeah

amber fractal
#

eris doesnt have a duration property does it?

digital ibex
#

nope

amber fractal
#

that's why it's undefined then

digital ibex
#

i just tested it because he said it was for every package

opal plank
#

thats kinda cool tho

digital ibex
#

yeah

#

i cant be bothered to put brackets, cba erwin

opal plank
#

lmao

#

fair

#

for a person who literally hot fixed their code by adding :any to every object rather than properly setting types, i understand

earnest phoenix
#

But the only issue with that is, that you can't do
new require("<some package that's a constructor>")

amber fractal
#

Think you can tho

opal plank
#

const {Constructor } = require()

#

?

#

as long as its being exported it should work, no?

earnest phoenix
#

Constructor can't be involved without new?

opal plank
#

hmmm

digital ibex
#

i wonder how google does it 🤔

#

how so fast

opal plank
#

@digital ibex with sanic pc's

amber fractal
#

like you could do let client = new (require("discord.js").Client)

digital ibex
#

sanic?

opal plank
#

Sanic

#

gotta go fast

earnest phoenix
#

@amber fractal idk i tried but didn't work

digital ibex
#

oh

#

sonic

opal plank
#

Speedy Computers

digital ibex
#

lol

opal plank
#

lul

digital ibex
#

but i mean

earnest phoenix
#

Haha supercomputers go brrr

amber fractal
digital ibex
#

my mongo queries take around 0.2ms with around 160 users

#

thats slow compared to google search

opal plank
#

are you in Dapi?

earnest phoenix
#

@amber fractal i might have used it wrong, wait lemme try again

amber fractal
#

google uses their own database afaik and they have a ton of cache

digital ibex
#

me?

opal plank
#

yeah

digital ibex
#

oh

#

nope

opal plank
#

Not in Discord Api server?

digital ibex
#

i left it

#

y?

native pumice
#

Hi

opal plank
#

cuz i was about to link a test i did there

#

with postgres

#

this was my stress test

digital ibex
#

oh

opal plank
#

Network, database and memory test

#

i was doing a over 10 calls PER row in postgres

#

for every user

#

API bulk call => get user obj => loop users into postgres calls for each property (created stamp, presence, status, last message, everything) => load all in memory and then finish the script

#

that was the best i could do to stress test everything at once

digital ibex
#
const e = require('../../models/Member');
console.time('query');
e.findOne({ id: message.author.id });
console.timeEnd('query')``` takes 0.18ms 🙁
solemn latch
#

🤔

digital ibex
solemn latch
#

.18 of 1/1000th of a second? 🤔

cloud ravine
#

approve my bot

digital ibex
#

yeah

solemn latch
#

no you approve my bot

opal plank
#

@cloud ravine no

cloud ravine
#

y

opal plank
#

your bot stinks

cloud ravine
#

y don't evn kno it

opal plank
#

wrong channel, also you arent suppose to ask for bot approval

cloud ravine
#

oh ok

opal plank
digital ibex
#

but it could be faster, a bot with a dashboard in the actual bots code, not separate and which holds more data, is faster AND its in TS

opal plank
#

Ts

solemn latch
#

my bot has an api, which serves data to the dashboard.
but the user never actually sends any requests to the bots api

cloud ravine
#

y is it showing ???? and N/A

solemn latch
#

it needs to be accepted before it can show online

digital ibex
#

wdym they dont send requests?

cloud ravine
#

ok

solemn latch
#

the webserver that hosts the dashboard makes requests to the api

#

and then sends that data to the user

cloud ravine
#

ok?

solemn latch
#

its an extra step, but helps prevent any ip leaks 🤷‍♂️

#

also lets the webserver cache some data, so less requests

digital ibex
#

i just added some security stuff on my dashboard, its so hot i love it

#

express security tutorials are interesting

#

they're not tutorials, more like guides but ya

torn ravine
#

anyone here work with particles.js

digital ibex
#

just ask ur question lul

cloud ravine
#

wat do u guys think wat is the average time ur bot gets approved

misty sigil
#

3+ weeks

cloud ravine
#

WAT NO

digital ibex
#

this isnt the correct channel to ask

cloud ravine
#

where should i ask then

digital ibex
#

if u wanna ask more question, #support is the place

cloud ravine
#

ok yhx

#

wat this for then

digital ibex
#

read the channel topic

cloud ravine
#

oh ok

solemn latch
#

Its totally a wip still.
Hardly started on the front end

ancient nova
#

took me a while but I finally repaired the high lag

#

it was all multitasking fault

#

beacuse I had enabled like 30 utilities at once

#

that I wrote code for

#

so yeah I made so it'll enable only once it detects, it decreased lag a bit

sick cloud
#

sort then by their position property

earnest phoenix
#
2- sort by dividing their position by sort()
3- map them by it's name or whatever you want```
slender thistle
#

if I want to update data in real-time on a website, what are my options as a beginner?

honest perch
#

socketio?

#

maybe

slender thistle
#

I'm not familiar with frontend, so please bear with me. 😂

To accomplish what I need, I could use socket.io, open a ws connection once a certain page is open, and depending on events, dynamically update the page?

honest perch
#

well, what exactly do you want to display?

#

/use it for

slender thistle
#

My goal is to make a certain... modified "copy" of Trello

honest perch
#

hmm

slender thistle
#

Either through an API or on the webpage, a user (logged in with Discord OAuth) creates a note and is assigned to it until it's deleted

honest perch
#
#

could have a look at this

cinder patio
#

Websockets are, as far as I know, the only way to update real time data

#

By sending the same event to connected clients when that certain event occurs

slender thistle
#

Huh, that seems quite a spoonfeed for a thing I want to make

#

But, grrr... JS...

tight plinth
#

@earnest phoenix plz no big code block

slender thistle
#

Poor page

tight plinth
#

also u'll get declined for rainbow

honest perch
#

you could hide everything

slender thistle
#

You're making the button's position absolute

#

That's relatively slow so I personally would consider it a pass

tight plinth
#

That's relatively slow so I personally would consider it a pass
@slender thistle personally it hurts my eyes

slender thistle
#

The CSS will either be deleted and you will be notified or you will be requested to remove it in case a moderator is unable to process your CSS

tight plinth
#

i dont like rainbow

#

also maybe that the fact that it's 11pm

misty sigil
#

lumap is british?

tight plinth
#

french

misty sigil
#

me forgetting that my timezone is down, not just the uk

honest perch
#

uk doesnt exist

misty sigil
#

can confirm we do exist

honest perch
#

no

slender thistle
honest perch
#

yo its james may

#

oh sh

#

tbh every channel should just be renamed to offtopic

digital ibex
tight plinth
#

blur?

slender thistle
#

hmm... opacity?

#

Oh, not darken

#

Let me dig up the necessary HTML element

digital ibex
#

i dont think u can

#

just get the div of whatever u wanna darken

#

and do that instead of messing with the background

#

if i understood correctly

earnest phoenix
#

see if firefox supported backdrop filters you could make a nice blur too

slender thistle
#

.wrapper-page apparently

earnest phoenix
#

that's called a child

thick gull
#

Im kinda getting lazy

#

Is there any website or program I can use

#

to create an embed quickly

#

(discord.js v12)

#

This works ig

loud matrix
#

Can someone help me with using REST APIs on djs

digital ibex
#

what do u need?

loud matrix
#

I can't get the actual API, node-fetch just shows me the site information

digital ibex
#

what api?

loud matrix
#

a private one

digital ibex
#

and uh.. yeah?

#

what exactly are u trying to do?

loud matrix
#

1sec

digital ibex
#

is this webdev?

#

if so, frontend or backend

loud matrix
#

?

digital ibex
#

?

loud matrix
#

it's hosted on swaggerhub