#development

1 messages · Page 190 of 1

frosty gale
#

how does it perform on tiny messages

#

because im not sure compression is worth the overhead if most of the messages are gonna be tiny

humble gyro
#

effectively just binary data

#

what are you trying to send?

#

most of Miki runs on protobuf internally and we dont use compression

#

most payloads are <1kb

quartz kindle
#

otherwise no

#

normal compression starts being worth at around 200+ bytes

#

shared context is already worth at as little as 20 bytes

#

that is, if your goal is reducing bandwidth/size

#

cpu-wise its probably only worth on bigger payloads

frosty gale
#

and some odd events here and there

#

protobuf is possible but i fear added complexity and reduced accessibility for developers

#

and added development time

humble gyro
#

Shruge proto does add a bunch of weird rules since you pipe json to proto and i assume back?

#

e.g. proto does not allow for undefined properties

#

... well it kinda does?

#

not all languages handle it as well

#

are you intending to expose it to other developers?

#

just use json then

#

if discord is able to scale on json then you can too 🤓

frosty gale
#

i think their websockets are relatively stable now but they used to be spotty

#

especially since introducing intents

humble gyro
#

i don't think that's a matter of how they serialize their data though

frosty gale
#

but that doesnt really affect users since they should get all events anyways so theyre probably doing a decent job

frosty gale
#

my main goal is to reduce events as it is

humble gyro
#

either way, json is a great developer-focused decision because it has a super low buy-in cost

#

if you need to sell your solution to other developers, that's important

frosty gale
#

stupid developers

#

im sure devin ai wouldnt care if my api uses protobuf or not

quartz kindle
#

json with compression is usually more than enough

#

you can also go for some alternative schema-less formats like messagepack

#

are you working with node/js?

frosty gale
#

frontend obviously browser js with server being nodejs

#

a dream pair

quartz kindle
#

front-end performance wont matter since it only runs a single client

#

backend performance is whats important

#

you can stay with raw json, compress it in an nginx reverse proxy, and let the browser decompress it by itself

humble gyro
#

does the browser decompress on a websocket level?

quartz kindle
#

not sure tbh

#

theres a websocket extension for compression: permessage-deflate

#

there is some source code about it in chrome

#

i believe the native WebSocket api does support it

frosty gale
quartz kindle
#

the ws lib?

frosty gale
#

yep

quartz kindle
#

have you tried uwebsockets.js?

frosty gale
#

nope

#

how does it compare to ws

quartz kindle
#

uwebsockets.js goes wooooooosh

#

welll, they self-advertise it as being 8-10x faster, but it always depends on individual workloads

#

µWebSockets.js is a web server bypass for Node.js that reimplements eventing, networking, encryption, web protocols, routing and pub/sub in highly optimized C++. As such, µWebSockets.js delivers web serving for Node.js, 8.5x that of Fastify and at least 10x that of Socket.IO. It is also the built-in web server of Bun even though µWebSockets.js for Node.js runs 80% faster than Bun.

solemn latch
#

Neat

rose warren
#

uwusockets.js?

humble gyro
#

dev, works

#

prod, instantly explodes

frosty gale
#

why does a websocket library come with a http server though

quartz kindle
frosty gale
#

yes but do they let you build an entire http server with it

#

if so why don't they just bundle it in another library

#

besides ws doesn't need the entire http spec implemented (at least I don't think so)

#

it's only a hello I would like ws connection, ok 101 status we have ws now send me your config frames or whatever

eternal osprey
#

Like a websocket uses tcp, but for that it usually intiates a 3-way handshake over http after which it will switch over to the tcp protocol, after the communication "tunnel" has been created.

#

i could be wrong, but i don't think so

quartz kindle
#

http spec is pretty simple compared to websocket

#

there are quite a few http libs on npm that use uws under the hood for "performance"

sharp geyser
humble gyro
#

?

#

oh

sharp geyser
#

It was a joke based off what egg said lol

humble gyro
#

more like ewsockets

sharp geyser
#

More like ezsockets

solemn latch
#

oWOOsockets

sharp geyser
#

Websockets ez

eternal osprey
#

hey guys i need some design help with my backup bot. Like it stores messages of users (which opt-in user data collection, and opt-out features as well). Members can then load this backup. But what if the channels that these messages were sent in don't exist? Would it just create those channels THEN send the messages?

devout nest
sharp geyser
#

Unless it’s important don’t that’s too much work

#

It will also likely be api spammy

eternal osprey
#

and it kinda is importante

earnest phoenix
#

Setting up Mongo as a sharded replica set config server and when forking I get the attached error. When not forking, it hangs at starting and the logs say nothing useful.

frosty gale
#

it feels illegal a websocket library to also happen to be one of the fastest http servers for node

frosty gale
#

is it simply to backup user messages?

#

if so you could maybe do with an embed that lets you scroll through messages with pagination

#

and maybe have a button that lets you do what you said and print the messages to that channel (although the volume might be large)

#

then you can have additional handling for if the channel does not exist anymore like making a new one or using current channel

dusky idol
# eternal osprey hey guys i need some design help with my backup bot. Like it stores messages of ...

A bot that can store and send 1000s of messages that were deleted? That sounds very unrealistic to accomplish for a bot that's in a lot of servers
If you really are willing to do that then pagination might be the go-to.
Maybe a embed with 5-8 fields per page, field name is the name of user and field's value is the message that was deleted.

There can be a next and previous button to swap through pages.
A search button which allows you to search messages with specific words in them like "hello" so messages with hello will be shown per page
Search button can have more filters like filter with specific user so only the user's messages are shown etc.

Regardless of whatever you do, it's kinda useless for a public backup bot and too messy to manage imo.

#

I didn't even know that half of it was possible before checking this page muidead

sharp geyser
#

using css

dusky idol
sharp geyser
#

there is

#

you can use most html tags in your description and edit some of the css classes

dusky idol
#

When it comes to css I can barely do anything significant

sharp geyser
#

unless someone has documented all the classes then you will have to view the page yourself and find the classes you want to edit

dusky idol
#

Probably will have to ask someone to assist xD

sharp geyser
#

but yea, top.gg supports markdown and html tags in their description to a limit

dusky idol
sharp geyser
north cairn
#

hey i have shifted from replit to vsc
And encountering some issues
pls help

#
const {readdirSync}=require("fs"); 
 const ascii = require("ascii-table"); 
 const client= require("discord.js"); 
 let table= new ascii("Commands"); 
 table.setHeading("Command Name""Loaded Status"); 
 module.exports =(client)=>{ 
 readdirSync("./commands/").forEach(dir => { 
 const commands = readdirSync(`./commands/${dir}/`).filter((file)=> 
file.endsWith(".cjs") 
); 
for(let file of commands){ 
let pull = require(`../commands/${dir}/${file}`); 
 if(pull.name) { 
client.commands.set(pull.name,pull); 
table.addRow(pull.name,"✅"); 
}else{ 
table.addRow( 
pull.name, 
`❌` 
 ); 
 continue; 
} if (pull.aliases && Array.isArray(pull.aliases)) pull.aliases.forEach(alias => client.aliases.set(alias, pull.name))
 } 
 }); 
 console.log(table.toString()); 
 };```
#

this is the code currently

#

output is coming like this

#

location of files

#

so can someone help

deft wolf
#

The code shows that something like this can only happen when there is no name value in the command

#

Are you sure these commands have this value?

north cairn
#

yes i am

#

so help?

deft wolf
#

I assume it's a command requirement problem then

north cairn
#

wdym

deft wolf
#

Have you checked what happens when there is one dot instead of two in path?

#

There is one dot in path in the rest of the code, so why are there two?

north cairn
#

well still same issue

deft wolf
#

Then conole.log all values ​​and check what they really are

#

It's hard to reproduce this problem without having all the files

frosty gale
#

does it support middleware

#

if so i will switch from fastify

quartz kindle
#

but there are many libs that are built on top of it that do

#

speaking of fastify, i made a small api for a client and i went with fastify

#

and it leaks ram like crazy idk why

sharp geyser
#

It’s bad

quartz kindle
#

like its not even receiving any requests, just idle for days

sharp geyser
#

:)

quartz kindle
#

and ram growing to 200+mb

sharp geyser
#

It’s the djs version of http libs

quartz kindle
#

im sticking with node:http servers for now

sharp geyser
#

Yea only you

quartz kindle
#

lmao

sharp geyser
quartz kindle
#

go back to the junkyard if ya wanna be rusty

sharp geyser
#

No you

sharp geyser
quartz kindle
#

i worked in it quite a bit this week

#

i gotta run some tests now

sharp geyser
#

o neat

north cairn
#
const { readdirSync } = require("fs");

const Discord = require("discord.js")

const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');
const { token } = process.env.token;


const ascii = require("ascii-table");
const client = require("discord.js");
const { clientId }  =  process.env['applicationid'];
let table = new ascii("SlashCommands");
table.setHeading("SlashCommand Name", "Loaded Status");
const slashCommands = []



module.exports = (client) => { 
   
  
  readdirSync("./slashCommands/").forEach(dir => { 
    const commands = readdirSync(`./slashCommands/${dir}/`).filter((file) =>
      file.endsWith(".cjs")
    );
    for (const file of commands) {
      const pull = require(`../slashCommands/${dir}/${file}`);
      slashCommands.push(pull.data.toJSON());
         if (pull.data.name) {
        client.slashCommands.set(pull.data.name, pull)
        table.addRow(pull.data.name, "✅");
      } else {
        table.addRow(
          pull.data.name,
          `❌`
        );
       
      } 
    }
  
  console.log(table.toString());
  });
  client.on('ready', async () => {
  const rest = new REST({ version: '9' }).setToken(process.env.token);

 
    
try {
        console.log('Started refreshing application (/) commands.')
        await rest.put(
            Routes.applicationCommands(process.env.applicationid),
            { body:slashCommands },
    );
  
    console.log('Successfully reloaded application (/) commands.')
  } catch(error) {
    console.log(error) 
}
 });
  }```
#

this is my current code

#

slashCommands.push(pull.data.toJSON());
^

TypeError: Cannot read properties of undefined (reading 'toJSON')
at C:\Users\DELL.vscode\Programs\Test_JS\handlers\slashcommands.cjs:28:36
at Array.forEach (<anonymous>)
at module.exports (C:\Users\DELL.vscode\Programs\Test_JS\handlers\slashcommands.cjs:22:35)
at C:\Users\DELL.vscode\Programs\Test_JS\mini-cricket\src\index.cjs:49:42
at Array.forEach (<anonymous>)
at Object.<anonymous> (C:\Users\DELL.vscode\Programs\Test_JS\mini-cricket\src\index.cjs:48:40)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)

#

gettin this error

sharp geyser
#

I am so confused

#

if you are alrady setting the slash commands to the client slashCommands map

#

why are you also pushing to a local array

#

👀

north cairn
#

idk

#

i did not write the code

#

so can u say what i exactly have to do

sharp geyser
#

no

#

I don't even know where to begin with this

#

also this is likely forked or chatgpt code trollface

north cairn
#

just say what do i have to do now

#

dont need that json thing?

#

why

quartz kindle
# north cairn ```js const { readdirSync } = require("fs"); const Discord = require("discord.j...
const pull = require(`../slashCommands/${dir}/${file}`);

^ this line is saying that you are loading the contents of a command file. this line is repeated for all of your commands, so you're loading all your commands

slashCommands.push(pull.data.toJSON());

^ this line is saying that you want to access the data of each loaded command, and then run the function toJSON() inside the data of that command
Cannot read properties of undefined (reading 'toJSON')
^ this error means that one or more of your commands do not have a data at all, so the code cannot access the toJSON() function if the data doesnt exist in that command

#

so your problem is not in that code, is that you made it so that ALL your commands must have a data property, and if one or more of them dont have it, it will fail

#

so you need to check all your commands, and find which one does not have a data and add it

north cairn
#

i dont think anything wrong with this

wheat mesa
quartz kindle
#
const pull = require(`../slashCommands/${dir}/${file}`);
console.log(dir,file,pull) // <---- add this
slashCommands.push(pull.data.toJSON());
#

and show what it logs

north cairn
north cairn
quartz kindle
north cairn
#

just the table

lyric mountain
#

you should really use table.addRow(file, '❌'); instead of table.addRow(pull.data.name, '❌');

#

because, as you can see in the console, it'll print nothing in "Command Name" if it wasn't able to load it

#

also check if pull has data before using toJSON(), or at least try-catch it

wheat mesa
# north cairn

From this it’s very clear that you have 2 files being loaded, whether you meant to or not. I’d take another look, or maybe screenshot your file structure

north cairn
#

bro thats different
thats for commands

#

and right now i am talking about slashCommands

lyric mountain
#

either attach a debugger or do console.log(file) before slashCommands.push(pull.data.toJSON());

north cairn
#

lemme log file

lyric mountain
#

that's not what I meant by debugger

#

it was caught by runtime

wheat mesa
#

I think asking for a debugger is a stretch here lol

north cairn
#

nothing logged yep

lyric mountain
#

show your current code

#

with the console.log included

north cairn
#

const { readdirSync } = require("fs");

const Discord = require("discord.js")

const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');
const { token } = process.env.token;


const ascii = require("ascii-table");
const client = require("discord.js");
const { clientId }  =  process.env['applicationid'];
let table = new ascii("SlashCommands");
table.setHeading("SlashCommand Name", "Loaded Status");
const slashCommands = []



module.exports = (client) => { 
   
  
  readdirSync("./slashCommands/").forEach(dir => { 
    const commands = readdirSync(`./slashCommands/${dir}/`).filter((file) =>
      file.endsWith(".cjs")
    );
    for (const file of commands) {
      const pull = require(`../slashCommands/${dir}/${file}`);
      //console.log(dir,file,pull)
      console.log(file) 
      slashCommands.push(pull.data.toJSON());
         if (pull.data.name) {
        client.slashCommands.set(pull.data.name, pull)
        table.addRow(pull.data.name, "✅");
      } else {
        table.addRow(
          pull.data.name,
          `❌`
        );
       
      } 
    }
  
  console.log(table.toString());
  });
  client.on('ready', async () => {
  const rest = new REST({ version: '9' }).setToken(process.env.token);

 
    
try {
        console.log('Started refreshing application (/) commands.')
        await rest.put(
            Routes.applicationCommands(process.env.applicationid),
            { body:slashCommands },
    );
  
    console.log('Successfully reloaded application (/) commands.')
  } catch(error) {
    console.log(error) 
}
 });
  }


  

lyric mountain
#

you sure nothing logged?

north cairn
north cairn
lyric mountain
#

silly question, but did you save the file?

#

cuz it's impossible for it not to log

#

put console.log("here") above it

north cairn
#

yea sorry
i am dumb

#

file wasn't

#

saved

#

ping.cjs

#

was logged

lyric mountain
#

show ping

north cairn
#
const { SlashCommandBuilder } = require("@discordjs/builders");
const { MessageEmbed } = require("discord.js");
                                      

module.exports = {
    data: new SlashCommandBuilder()
        .setName('ping')
        .setDescription('Shows Latency Of Bot!'),
    async execute(client,interaction) {
    let pingem =new MessageEmbed()
  .setThumbnail(client.user.displayAvatarURL({dynamic: true}))
  .setDescription(`**🏓 | Pong**
  🔴 **Current Ping Of Bot-**\n **__${Math.round(client.ws.ping)} ms__**`)
  .setFooter("Use /help To Know More About My Commands")
  .setColor("GREEN")
        await interaction.reply({embeds: [pingem]});
    },
};```
wheat mesa
#

is ping saved

lyric mountain
#

what happens if you do console.log(pull)?

north cairn
#

it wont print ping.cjs if it wasn't saved coz i have not made any changes there since i copy pasted from my previous platform

#

i just logged dir,file,pull

lyric mountain
#

yes but what is the result of it?

north cairn
lyric mountain
#

ik the issue

#

you're doing readdirSync("./slashCommands/"), but you're also doing const commands = readdirSync('./slashCommands/${dir}/')

north cairn
#

and i think same issue is there with commands

lyric mountain
#

this means you're looking for the command at the path ./slashCommands/slashCommands/${dir}/${file}

north cairn
#
module.exports = (client) => { 
   
  
  readdirSync("./slashCommands/").forEach(dir => { 
    const commands = readdirSync(`./slashCommands/${dir}/`).filter((file) =>
      file.endsWith(".cjs")
    );```
lyric mountain
#

inside readdirSync you're already inside that folder

north cairn
#

wait i will send u file locations for better looking

lyric mountain
#

also there's require('../slashCommands/${dir}/${file}'), which is double-dotting backwards one folder

#

oh wait, ignore my previous comment, I'm thinking bash-like regarding dir moves

#

but this one is for sure, remove one dot

north cairn
#

./slashCommands

#

?

lyric mountain
#

yes

north cairn
#
node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module './slashCommands/Bot Info/ping.cjs'
Require stack:
- C:\Users\DELL\.vscode\Programs\Test_JS\handlers\slashcommands.cjs
- C:\Users\DELL\.vscode\Programs\Test_JS\mini-cricket\src\index.cjs
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at C:\Users\DELL\.vscode\Programs\Test_JS\handlers\slashcommands.cjs:28:20
    at Array.forEach (<anonymous>)
    at module.exports (C:\Users\DELL\.vscode\Programs\Test_JS\handlers\slashcommands.cjs:23:35)
    at C:\Users\DELL\.vscode\Programs\Test_JS\mini-cricket\src\index.cjs:49:42
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (C:\Users\DELL\.vscode\Programs\Test_JS\mini-cricket\src\index.cjs:48:40) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\DELL\\.vscode\\Programs\\Test_JS\\handlers\\slashcommands.cjs',
    'C:\\Users\\DELL\\.vscode\\Programs\\Test_JS\\mini-cricket\\src\\index.cjs'
  ]
}```
lyric mountain
#

spaces in name

#

never put spaces in your folders

north cairn
#

it worked fine on replit

#

idk whats up with vs code

#

so remove spaces?

#

BotInfo?

lyric mountain
#

try it

north cairn
#

same issue

lyric mountain
#

well, return to what it was then

north cairn
#

anything wrong with this(handler path)

 require(`../../handlers/${handler}.cjs`)(client); 
     });
lyric mountain
# north cairn

but based on this log, your command has nothing inside it at all

wheat mesa
#

yes

lyric mountain
#

see the {}

wheat mesa
#

slashCommands not slashcommands

#

Nvm

#

You didn’t name it that

#

Ignore me

north cairn
lyric mountain
#

just as a test, add test: "abcde" as one of module.exports properties

#

see if it appears on that console.log

north cairn
#

nothing logged

lyric mountain
#

did you uncomment the line?

north cairn
#
module.exports = {
    data: new SlashCommandBuilder()
        .setName('ping')
        .setDescription('Shows Latency Of Bot!'),
    test: "abcde", ```
north cairn
lyric mountain
north cairn
#

yea yea

lyric mountain
#

then save the file

north cairn
#

its saved

lyric mountain
#

run it

#

it should log the same thing

north cairn
#

nothing as i said

#

saved it before only

#

ctrl+s(two times pressed)

lyric mountain
#
const pull = require(`../slashCommands/${dir}/${file}`);
console.log(dir,file,pull)
slashCommands.push(pull.data.toJSON());
``` it should look like this
north cairn
#
.------------------------------.
|           Commands           |
|------------------------------|
| Command Name | Loaded Status |
|--------------|---------------|
|              | ❌             |
|              | ❌             |
'------------------------------'
.---------------------------------------.
|                Events                 |
|---------------------------------------|
|      Event Name       | Loaded Status |
|-----------------------|---------------|
| interactionCreate.cjs | ✅             |
| messageCreate.cjs     | ✅             |
'---------------------------------------'
node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module './slashCommands/Bot Info/ping.cjs'
Require stack:
- C:\Users\DELL\.vscode\Programs\Test_JS\handlers\slashcommands.cjs
- C:\Users\DELL\.vscode\Programs\Test_JS\mini-cricket\src\index.cjs
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at C:\Users\DELL\.vscode\Programs\Test_JS\handlers\slashcommands.cjs:28:20
    at Array.forEach (<anonymous>)
    at module.exports (C:\Users\DELL\.vscode\Programs\Test_JS\handlers\slashcommands.cjs:23:35)
    at C:\Users\DELL\.vscode\Programs\Test_JS\mini-cricket\src\index.cjs:49:42
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (C:\Users\DELL\.vscode\Programs\Test_JS\mini-cricket\src\index.cjs:48:40) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\DELL\\.vscode\\Programs\\Test_JS\\handlers\\slashcommands.cjs',
    'C:\\Users\\DELL\\.vscode\\Programs\\Test_JS\\mini-cricket\\src\\index.cjs'
  ]
}```
lyric mountain
#

return the double dot on the require

north cairn
#
.------------------------------.
|           Commands           |
|------------------------------|
| Command Name | Loaded Status |
|--------------|---------------|
|              | ❌             |
|              | ❌             |
'------------------------------'
.---------------------------------------.
|                Events                 |
|---------------------------------------|
|      Event Name       | Loaded Status |
|-----------------------|---------------|
| interactionCreate.cjs | ✅             |
| messageCreate.cjs     | ✅             |
'---------------------------------------'
Bot Info ping.cjs {
  data: SlashCommandBuilder {
    options: [],
    name: 'ping',
    name_localizations: undefined,
    description: 'Shows Latency Of Bot!',
    description_localizations: undefined,
    default_permission: undefined,
    default_member_permissions: undefined,
    dm_permission: undefined
  },
  test: 'abcde',
  execute: [AsyncFunction: execute]
}
ping.cjs
.-----------------------------------.
|           SlashCommands           |
|-----------------------------------|
| SlashCommand Name | Loaded Status |
|-------------------|---------------|
| ping              | ✅             |
'-----------------------------------'
Started refreshing application (/) commands.
[READY] Sheru#1721 has logged in.
Successfully reloaded application (/) commands.
#

listen can u share smth about those paths

#

i am troubling with them

#

some docs os vids

#

or*

lyric mountain
#

what did u change besides test: 'abcde'?

lyric mountain
north cairn
lyric mountain
#

yes ik, that's because data appeared there

north cairn
north cairn
lyric mountain
#

but you're at exactly the same state you were when we started

#

I think u didn't save the file at all before

lyric mountain
#

../../foo/bar/../baz/file.js reads "Go back 2 folders, inside foo, inside bar, back 1 folder, inside baz, read file.js"

north cairn
#

whats up with above and below?

lyric mountain
#

you need to navigate to the file you want

north cairn
#

yea ik ,i mean what to do if below

lyric mountain
#

there's no below

#

there's only "above" and "inside"

#

or parent and child whatever

north cairn
#

if i want to go from command to handlers

lyric mountain
#

you're viewing it as if it was vertical, it isn't

north cairn
#

yes yes

lyric mountain
#

this is how you should view it

#

no belows, only insides

north cairn
#

right left?!

#
 module.exports =(client)=>{ 
 readdirSync("./commands/").forEach(dir => { 
 const commands = readdirSync(`./commands/${dir}/`).filter((file)=> 
file.endsWith(".cjs") 
); 
for(let file of commands){ 
let pull = require(`../commands/${dir}/${file}`); 

 if(pull.data.name) { 
client.commands.set(pull.data.name,pull); 
table.addRow(pull.data.name,"✅"); 
}else{ 
table.addRow( 
pull.data.name, 
`❌` 
 ); ```
lyric mountain
#

vscode makes it harder by barely adding any indent to subfiles

north cairn
#

anything wrong with this/?

lyric mountain
#

imagine as if it was a json, yes yes

#

this should make it easier to understand

#

json doesn't have above or below, left or right

#

only properties, which can also be json

lyric mountain
north cairn
#

TypeError: Cannot read properties of undefined (reading 'name')

#

this is very weird

#

ok lemme try logging

#

and if i cant solve

#

i'll get back

lyric mountain
#

go save your files first

north cairn
#

saved bro

lyric mountain
#

save again to be sure

earnest phoenix
#

wait, what if a shard server fails (or all of them are lost)? is there not a way to have failover when a shard goes bye bye?

north cairn
#

"bye bye" 💀

lyric mountain
earnest phoenix
lyric mountain
#

data's probably redundant among shards

north cairn
#

ctrl+s saves the file in vs cdoe right?

earnest phoenix
#

"probably"?

lyric mountain
#

meaning if one falls, the others have it

#

yes probably, because I dont use mongo

#

but that's how it works on postgres

#

you don't shard for storage reasons, you shard because a single server wasn't able to coup with the demand

earnest phoenix
earnest phoenix
lyric mountain
#

just shutdown one of your shards and see if you can access the data

earnest phoenix
#

i don't have any shards yet lol

lyric mountain
#

same folder

lyric mountain
lyric mountain
#

double dot is up, dot is here

north cairn
#

triple dots exists?

#

or doube max

#

double*

lyric mountain
#

buddy ffs it's just "above", "here" and "inside"

#

don't think about it too much

sharp geyser
#

In simple terms, one traverses out of the current folder the other accesses the current folder

#

You can chain them to keep going further out

#

It’s not rocket science

north cairn
#

just tell me what to do if i have to go from commands to lets say node_modules

sharp geyser
#

../../node_modules 💀

lyric mountain
#

relative file paths are always where you are currently, the answer depends entirely where you are

sharp geyser
#

You should not be programming if you don’t even understand the file system

lyric mountain
#

a few hours on (headless) linux would help understanding it easily

quartz kindle
#

./ current folder
../ previous folder
../../ previous previous folder
../abc/ previous folder then inside folder "abc"
../abc/../ previous folder, then inside folder "abc", then back to previous folder again

sharp geyser
#

Tim that will likely confuse them more 😭

north cairn
#

fck man 3 ppl trying make me understand and i still do not get it

#

😦

lyric mountain
#

tho windows would solve this too, but people rarely use windows through cmdline

sharp geyser
#

Told you

lyric mountain
#

press Win + R and type cmd

north cairn
#

ok go ahead

lyric mountain
#

Win is the key with windows logo

north cairn
#

💀

lyric mountain
#

now type dir

#

it'll show you the current directory

north cairn
#

ye

lyric mountain
#

choose a folder and type cd thatFolder

#

it'll move you inside it

north cairn
#

yes

lyric mountain
#

now type dir again to see what's inside it

north cairn
#

yes

lyric mountain
#

type cd .. to go back

sharp geyser
lyric mountain
#

dir again to see you're back in the initial folder

north cairn
#

i am starting to understand a bit

lyric mountain
#

now do dir .\thatFolder\..

#

it'll do exactly what you just did

#

but in a single line

north cairn
#

excuse me for 20 mins
gtg for food

sharp geyser
#

It’s really not that hard to understand

sharp geyser
#

:)

lyric mountain
#

lul

#

that's part of why I think every dev should at least once in a lifetime have a linux vps

sharp geyser
#

He’s not even a developer bro

lyric mountain
#

you don't get gui so u must navigate through cli

sharp geyser
#

He found that code somewhere

#

😭

lyric mountain
#

very likely

sharp geyser
#

He admitted it wasn’t his

#

So

#

Linux for the win

north cairn
sharp geyser
#

?

north cairn
#

i mean laptop is not mine

#

i use father's laptop

north cairn
#

btw thanks for that video

radiant kraken
ionic schooner
#

fr

sharp geyser
radiant kraken
#

🙀

lyric mountain
sharp geyser
#

Ayo

green kestrel
#

e.g. so that each row's height for its code block is the same height

#

i cant know how many chars fit on a row, so i cant guess it

lyric mountain
#

only way is by padding the smaller blocks

#

if you dont know how many lines there'll be...well, you're SOL

green kestrel
#

yeah, its just free flowing text

#

and the width of the box varies depending on device

#

because responsive

#

and based on how many other items are in that row

#

i think theyre using flex boxes under the hood or something

lyric mountain
#

they are

#

nothing you can do sadly, the control over embeds is fairly weak

green kestrel
#

yeah

#

i cant even use images in the fields

#

if each field could be an image, theres a solution, albeit a resource heavy one

earnest phoenix
#

because surely there would still be no failover?

#

because the config servers still refer to the same shards???

lyric mountain
#

simply manually create some shards and kill one or two to check if the data is still available

earnest phoenix
#

because each of the confjg servers still point to all of the shards, right?

#

if you only run the command on one of the config servers

lyric mountain
#

not sure I get what you mean

#

you want to know whether shard downtime affects data availability, so simply make some shards, kill half and try to fetch the data

civic scroll
pale vessel
#

imagine if there's a new property

#

what would come after z?

lyric mountain
#

z

humble gyro
civic scroll
#

all just for a type cast

humble gyro
#

hell yeah

#

we LOVE C# casting

lyric mountain
#

veldev

humble gyro
#

yes

civic scroll
#

looks versatile

#

can it parse css

humble gyro
#

no

#

its mainly used for miki autocomplete

civic scroll
#

my dissapointment is immesurable

humble gyro
civic scroll
#

o

#

mona
veld is cultured

humble gyro
#

true

civic scroll
#

become astrology

humble gyro
#

we love our astro brokie

civic scroll
#

also can i do a webserver in vs console app template

humble gyro
#

i think so

#

u just need a web server package

civic scroll
#

just wondering, since my backend class uses c# and i wonder if i can reuse my playground for it

#

ah

#

package manager?

#

or

humble gyro
#

yea

civic scroll
humble gyro
#

yea

civic scroll
#

on console app template?

humble gyro
#

but u need to target the asp.net core sdk

#

in your csproj

civic scroll
#

where

#

if you have enough time to spare

#
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net7.0</TargetFramework>
    <RootNamespace>cs_playgorund</RootNamespace>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="RestSharp" Version="110.2.0" />
  </ItemGroup>

</Project>
humble gyro
#

usually it says "<Project Sdk="Microsoft.NET.Sdk">"

civic scroll
#

o

#

it changed

#

and then i use them via Microsoft.AspNetCore ?

humble gyro
#

yeah

shell lake
#

how do i start off making a discord bot?

wintry ice
#
    at /home/container/index.js:40:82
    at /home/container/index.js:110:11
    at /home/container/node_modules/@top-gg/sdk/dist/structs/Webhook.js:106:23
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
(node:26) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)
#

what could the reason of the issue

sharp geyser
#

whatever you are accessing id on id null

lyric mountain
wintry ice
# sharp geyser whatever you are accessing id on id null

huh? anything wrong over here?

const Discord = require("discord.js");

const { MessageEmbed, MessageCollector, Collection } = require("discord.js");

//const Discord = require('discord.js');
//const client = new Discord.Client();//const Discord = require('discord.js');
const client = new Discord.Client();
exports.client = client
const express = require("express");

const app = express();

const User = require('./models/user.js');

const Guild = require('./models/guild.js');

const config = require("./config");

const Topgg = require("@top-gg/sdk");

const axios = require('axios')

const webhook = new Topgg.Webhook(config.topgg.auth);

const jsonParser = require("body-parser").json();

//const color = "70fffb"


    app.get("/", (request, response) => {

        response.status(200).send("I AM ALIVE MAN :D");

    })

    .post("/dblwebhook", jsonParser, webhook.listener(vote => {

        (async () => {

            let votes = await axios.get("https://top.gg/api/bots/" + client.user.id + "/votes", { headers: { 'Authorization': config.topgg.token } });
lyric mountain
#

that way you'll have a much easier time learning how to make a bot

lyric mountain
wintry ice
#

now it gives 403

lyric mountain
#

you didn't solve it then

#

you're just ratelimited

wintry ice
#
(node:26) UnhandledPromiseRejectionWarning: Error: Request failed with status code 403
    at createError (/home/container/node_modules/axios/lib/core/createError.js:16:15)
    at settle (/home/container/node_modules/axios/lib/core/settle.js:17:12)
    at IncomingMessage.handleStreamEnd (/home/container/node_modules/axios/lib/adapters/http.js:269:11)
    at IncomingMessage.emit (events.js:412:35)
    at endReadableNT (internal/streams/readable.js:1333:12)
    at processTicksAndRejections (internal/process/task_queues.js:82:21)
wintry ice
lyric mountain
#

yes, as I said, nothing was solved, the site is simply saying "Please stop trying, fix the code first"

#

you can't client.user.id before you connect the client

lyric mountain
#

yes, you cant use anything from client before connecting

#

because those data dont exist yet

wintry ice
#

uh

lyric mountain
#

aka your bot isn't online

#

not online = no data about the bot

#

no data = no id either

wintry ice
#

no first the server file runs and the bot goes online after it ive another file indexjs which runs this topgg api

#

so ig that shouldnt cause it

lyric mountain
#

what?

#

you're initializing the client in that file ```js
const client = new Discord.Client();
exports.client = client

sharp geyser
#

wth is brodie on about

lyric mountain
#

considering the amount of attempts at getting the client, I suppose they're following a tutorial ```js
const Discord = require("discord.js");

const { MessageEmbed, MessageCollector, Collection } = require("discord.js");

//const Discord = require('discord.js');
//const client = new Discord.Client();//const Discord = require('discord.js');
const client = new Discord.Client();
exports.client = client

sharp geyser
#

yikes

lyric mountain
#

or well, I hope they are following something

pale vessel
#

following intellisense Trol

lyric mountain
#

anyway, tl;dr you cant get the bot id before you connect the bot to discord

#

so connect FIRST and then send that request

wintry ice
#

ok nvm

#

but wb 403

lyric mountain
#

also you dont need to send a request for getting bot vote count, you already have it inside /dblwebhook

lyric mountain
#

print the body of the response, it should have the timeout

frosty gale
#

trial and error is the name of the game

#

even the 10x developers do it

sharp geyser
#

I never trial and error

#

I trial then yell at the errors

wide pendant
frosty gale
radiant burrow
covert palm
#

If it doesn't work, you're not yelling loud enough

covert ingot
#

I have stopped programming so I am a little rusty.

      <h1>My Quotes</h1>
      <br />
      <div class="row gy-5">
         <% constants.quotes.forEach((quote) => { %>
         <div class="col-6">
            <div class="p-3 border"><%- quote %></div>
         </div>
         <% }); %>
      </div>
   </div>``` `constants.quotes` WAS just an array of quotes and it worked as expected no problems. However, I want to key each quote so I can do `website.com/quotes#whatever` to link a specific quote. so `constants.quotes` now looks something like this: `[{ 'key': 'value' }]`
#

and I am getting this:

#

I understand what object object is, but to work around this in the frontend (i have never been good at) is difficult for me. can anyone assist me please & thanks

sharp geyser
#

with my self esteem

radiant burrow
#

you're right, that semicolon DOESN'T need to be there

sharp geyser
#

I still have another 2h before my flight 😭

#

sitting at the gate for 4 hours pain

covert ingot
#

Let me try

covert ingot
deft wolf
#

Okay, can you send a screenshot of an example quote object?

covert ingot
pale vessel
#

why's it an array?

covert ingot
#

It was an array so I can just add [ '...', '...'] as I please. however this doesn't seem to be working as intended anymore now I am trying to key - how do you suggest I frame it instead?

pale vessel
#

right now u have an object that contains all the quotes inside an array

#

u can remove the [] surrounding the object to turn it to an object

covert ingot
#

do you suggest [ { }, { }, { } ] ?

#

let me try

pale vessel
#

sure

pale vessel
#

u can use Object.keys(quotes) to access the keys and Object.values(quotes) to access the values

#

or even simpler, just have an array that contains the quotes, like ["quote 1", "quote 2", ...]

covert ingot
covert ingot
#

Also for this ^ how would I make it add a new text box like previously ?

quartz kindle
#

fragment urls like #whatever are designed for client side navigation, so to use that you'd need to load all quotes then use browser js to show the desired quote

#

if you want the quote to be loaded server side, use a parameterized url or a query parameter

covert ingot
#

im not sure about parameterized but for query parameters, it seems inefficient I believe the word is? would there be no way to automate?

#

how would parameterized url work?

quartz kindle
#

parameterized url is what a lot of libraries do

#

for example .get("/quotes/:id")

#

the :id is the parameter url

rose warren
#

https://timwisdom.js.org/api/v1/quotes?query=your+skill+issue+solution&limit=1000&sort=asc

covert ingot
#

ah, I believe I got query parameters and this mixed up then I believe

quartz kindle
#

i assume you're using a nodejs server, since youre using EJS

covert ingot
#

yes

quartz kindle
#

query parameters would be /quotes?id=something

quartz kindle
#

mordekaiser es #1

rose warren
quartz kindle
#

it only handles 1 concurrent request

rose warren
#

Rip

quartz kindle
#

and sometimes each response takes several seconds

covert ingot
# quartz kindle for example `.get("/quotes/:id")`

which would be easier to just add in the future? lets say I want to add a new quote in 3 days doing this seems long and surely there has to be an easier way even if it will require me to write a larger peice of code now

#

?

rose warren
#

Needs to move to uwusockets.js

quartz kindle
#

should be pretty straight forward

sharp geyser
covert ingot
#

pretty straightforward and not necessarily long, however I would most definitely prefer just adding to the constants.quotes

#

im sure there is a way to do this as well. the idea im trying to materialise isn't something out of this world i dont believe and is very doable

quartz kindle
#
const quotes = {
  abc: "my quote",
  xyz: "my other quote"
}

server.get("/quotes/:id", (req, res) => {
  const quote = quotes[req.params.id];
  // build EJS with quote
});
covert ingot
#

ah

#

my misunderstanding

#

I will go try out and let you know, thank you.

frosty gale
covert ingot
#

I appreciate the abstract thinking, however was a metaphor to explain my programming skills.

covert ingot
quartz kindle
sharp geyser
#

I support that message by Chloe

#

Rust best language for beginners smirk

frosty gale
#

i dont actually mind rust but i hate that rust people keep rewriting perfectly good libraries written in c/c++ in rust "just because its rust"

quartz kindle
#

exdee

#

isnt rust able to just load binaries compiled by c/c++?

covert ingot
#

that works - now constants.quotes[req.params.id] is undefined. Apologies if these are very simple questions

frosty gale
#

exactly

#

i believe it can also use c headers

#

and link to them just fine

covert ingot
#

which is strange i believe, it should return hi ? i done /quotes/hi

quartz kindle
covert ingot
#

ah

#

It is working

#

I have the relevant data now - now to display it.

lament rock
#

Got my app working for users now. Big Discord W

sharp geyser
#

What even is going on

lament rock
#

Regarding?

quartz kindle
sharp geyser
#

sex?

covert ingot
#

I am totally stuck

#

I don't know how you do this

quartz kindle
sharp geyser
#

An array of objects?

covert ingot
#

Probably wrong but how I view: to display correct number of text boxes, I need to use an array so I can just do forEach

sharp geyser
#

If you’re handling multiple quotes sure

quartz kindle
#

you can do that using Object.values()

sharp geyser
#

But you’re only handling one no?

covert ingot
#

Then all quotes compile into one text box, instead of induvidual

covert ingot
#

an array

#

ha

quartz kindle
#

first of all you need to think of how to structure your data based on what makes the most sense for the data itself.
arrays are good if you have data that dont have direct access, like lists
objects are good if you have data that has direct access, like accessible with a key

sharp geyser
#

Well from the looks of your example you were only handling one

quartz kindle
#

so if you want your quotes to have direct access, for example using an url

#

its better to use an object

#

or a Map

#

from there on, doing what you want to do is just a matter of adapting

covert ingot
#

I have always been terrible with frontend and to display multiple textboxes using objects is incomprehensible to me

quartz kindle
#

for example you have an object like this:

{
  a: "abc",
  hi: "oeufhouwf",
  brazil: "huehuehuehue"
}
#

you can access it directly like you're already doing, with the :id parameter

#

and if you need to list all of them, for example in another /quotes route, that doesnt have a :id parameter

#

you can convert it to an array

#

using Object.values()

#

or Object.keys()

covert ingot
#

         <% constants.quotes.forEach((q) => { %>
         <div class="col-6">
            <div class="p-3 border"><%- Object.values(q) %></div>
         </div>
         <% }); %>``` this works for arrays, not objects however. Let me try the map
#

Same with map

quartz kindle
#
         <% Object.values(constants.quotes).forEach((q) => { %>
         <div class="col-6">
            <div class="p-3 border"><%- q %></div>
         </div>
         <% }); %>
covert ingot
#

Thank you, let me try

quartz kindle
#

heres how it works

#
const quotes = {
  a: "abc",
  hi: "oeufhouwf",
  brazil: "huehuehuehue"
}

Object.values(quotes) // ["abc", "oeufhouwf", "huehuehuehue"]
Object.keys(quotes) // ["a", "hi", "brazil"]
Object.entries(quotes) // [["a", "abc"], ["hi", "oeufhouwf"], ["brazil", "huehuehuehue"]]
frosty gale
#

"hi", "brazil"

#

so patriotic

quartz kindle
covert ingot
#

You have a deep understanding of basic things. I respect it

#

Let me try comprehend, one moment

sharp geyser
quartz kindle
#

in programming, the basics are the most important

#

once you understand the basics, there is nothing you cannot do

covert ingot
#

preach

sharp geyser
#

Except get a girlfriend

#

Tim has yet to do that

quartz kindle
#

lmao

sharp geyser
#

Hey with the new Mee6 stuff Tim you’re in luck

#

:D

lament rock
#

Just code one

covert ingot
eternal osprey
quartz kindle
covert ingot
#

you are smart

#

it works, thank you.

#

now I switched from arrays to objects, half the job done. I'll probably be back - thank you.

lament rock
#

personal apps are kinda weird but cool

covert ingot
#

idc about the app itself, moreso use it as a status thing irl

#

losers call it shallow; I call it playing the game to my advantage

lament rock
#

Im talking about this

covert ingot
#

I'm talking about me

#

@quartz kindle Running into an issue. Haven't really progressed been stuck most of this time,

#

I have got the key,

    if (keys.includes(req.params.id)) {
        console.log('yes' + req.params.id)
        key = req.params.id;
    } else {
        console.log('no')
    }``` and and I send `key` to the frontend. How do I change`key`s css ?
#

Struggling slightly to articulate my problem but I think it makes sense

quartz kindle
#

the key's css?

#

you're gonna need to explain better

#

@real rose

real rose
#

ty

quartz kindle
#

lmao

real rose
#

deleting thaty other message

#

out of context

#

not good

frosty gale
#

went from shit discord bots to kernels

#

the shit discord bots somehow provided that foundation

quartz kindle
#

but you're insane, im not

#

psychopat

#

exdee

frosty gale
#

its actually fun you don't understand until you try it

#

yes it's hell at the beginning but it becomes easier as you implement things

#

I don't even touch assembly or io ports anymore in the system there's a function or structure for whatever I wanna do

#

it becomes like developing a Windows/Linux app but on your own custom system

quartz kindle
#

i stop having fun programming whenever things get too complex

#

i like to overoptimize small functions instead

lament rock
#

shoot tim, you for hire and if so whats your rates?

frosty gale
#

in js microoptimizing does have a big impact in performance actually

#

but try that in c or any compiled language it becomes extremely hard because the compiler does such a good job at optimising shit code

#

your 3+ weeks refactor might only speed your program up by 2 milliseconds

#

so it becomes more important in identifying if there's an actual problem before optimising

lament rock
#

Depending on the app, 2ms might actually be huge

#

in VR rendering, you only have like 11 or 12ms to hit 90fps (which is accepted as a great framerate to have close to your eyes)

harsh aspen
#

hey guys I'm so confused, what is better ig?

quartz kindle
humble gyro
#

isnt that ARM?

quartz kindle
#

ye

harsh aspen
#

aight let's stay with intel

quartz kindle
#

4 cores should be more or less same price than intel 2 cores

harsh aspen
#

+4 GB ram also

quartz kindle
#

technically it depends on what you're gonna use it for

#

but overall, that will give you a much bigger bang for the buck

#

the only thing intel cpus are better at is cryptography and code that is optimized with complex instructions like AVX

#

but still 4 cpus will beat 2 cpus by far if multithreading is used

harsh aspen
#

I need that AVX too lol for mongodb

quartz kindle
#

buy both, benchmark both, cancel the worse one

#

:)

harsh aspen
#

that's a nice idea

wintry ice
#

(node:26) UnhandledPromiseRejectionWarning: Error: Request failed with status code 403
at createError (/home/container/node_modules/axios/lib/core/createError.js:16:15)
at settle (/home/container/node_modules/axios/lib/core/settle.js:17:12)
at IncomingMessage.handleStreamEnd (/home/container/node_modules/axios/lib/adapters/http.js:269:11)
at IncomingMessage.emit (events.js:412:35)

#

why an i getting 403?

earnest phoenix
#

mongo again... Invalid shard identity document found when initializing sharding state :: caused by :: Invalid shard identity document: the shard name for a shard server cannot be \"config\"" what on earth is this error???

north cairn
#
const { MessageEmbed} = require("discord.js")
const Discord = require("discord.js")
//import fetch from  'node-fetch'
const fetch = require("node-fetch")


module.exports = {
  name: "meme",
  aliases: [],
  description: "This command sends you random memes",
  run: async (client, message, args ) => {
    try {
      const url = await fetch("https://www.reddit.com/r/memes/random/.json");
      const meme = await url.json();
      
      const permalink = meme[0].data.children[0].data.permalink;
      const memeURL = `https://reddit.com${permalink}`;
      const upvotes = meme[0].data.children[0].data.ups;
      const downvotes = meme[0].data.children[0].data.downs
       const comments = meme[0].data.children[0].data.num_comments;

      const embed = new MessageEmbed()
        .setTitle(meme[0].data.children[0].data.title)
        .setURL( `${memeURL}`)
        .setColor("RANDOM")
        .setFooter(`👍 ${upvotes} 👎 ${downvotes} 💬 ${comments}`)
        .setImage(meme[0].data.children[0].data.url)
      
      .setTimestamp()
      
      
        

      await message.channel.send({ embeds: [embed] });
    } catch (error) {
      console.log(error);
    }

}
}```
#

this is the current code

#
const fetch = require("node-fetch")
              ^

Error [ERR_REQUIRE_ESM]: require() of ES Module C:\Users\DELL\.vscode\Programs\Test_JS\node_modules\node-fetch\src\index.js from C:\Users\DELL\.vscode\Programs\Test_JS\commands\Fun\meme.cjs not supported.
Instead change the require of index.js in C:\Users\DELL\.vscode\Programs\Test_JS\commands\Fun\meme.cjs to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (C:\Users\DELL\.vscode\Programs\Test_JS\commands\Fun\meme.cjs:4:15)
    at C:\Users\DELL\.vscode\Programs\Test_JS\handlers\command.cjs:12:12
    at Array.forEach (<anonymous>)
    at module.exports (C:\Users\DELL\.vscode\Programs\Test_JS\handlers\command.cjs:7:29)
    at C:\Users\DELL\.vscode\Programs\Test_JS\mini-cricket\src\index.cjs:49:42
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (C:\Users\DELL\.vscode\Programs\Test_JS\mini-cricket\src\index.cjs:48:40) {
  code: 'ERR_REQUIRE_ESM'
}```
#

getting this error

#

and even if i use import
it then says cannot use import outside a module

earnest phoenix
north cairn
#

1

#

using old versiona s it matches the version i was using on previous platofrm(replit)

earnest phoenix
#

iirc their docs say which version

#

but why do you need the version to match replit?

north cairn
#

i did download the version that matched the previous one

#

in replit the node-fetch version was 3.3.0

#

and i same i downloaded

north cairn
#

so currently i want to stick to what i was using before

earnest phoenix
earnest phoenix
#
  1. try to switch to esm it'll really help you
#
  1. failing that, use node-fetch@2
#
  1. are you sure you weren't using esm on replit?
north cairn
#

yes

#

i was using require

#

and it worked fine

#

it used to give me this warning

north cairn
earnest phoenix
north cairn
#

i dont want change so many files man

earnest phoenix
#

just use vsc

#

vsc lets you make a file esm using two clicks

north cairn
#

i mean that i would have change require into import

#

in many files

#

which i want to avoid

#

any alternative options?

earnest phoenix
#

yeah vsc would do that for you

north cairn
#

hmmm

#

then say

#

no option sed

earnest phoenix
#

huh

north cairn
#

say how do i do

north cairn
earnest phoenix
#

no but if i can do it you can

north cairn
#

....

quartz kindle
#

it installed @replit/node-fetch instead of node-fetch

#

so just install replits version, or install version 2

#

btw on node 18+ fetch is built in, there is no need to install node-fetch anymore

#

node-fetch is a defunct library

#

node is not like discord.js, upgrading to newer versions will not break your code

civic scroll
frosty gale
frosty gale
#

discordjs devs need to seriously read up on why standardisations exist and what happens if your updates break syntax constantly

civic scroll
#

not syntax but api 😔

quartz kindle
#

so they made the default node-fetch install compatible

north cairn
#

i cant use node version 18 coz then i'll have to change many things in the code

#

so trynna stick to 16.15.1 only rn

#

i think its working fine

#

yep it does after i installed replits version

#

thanks guys

quartz kindle
#

the only change is that you can use fetch without installing anything

#

everything else should be the same

north cairn
#

i would then install the most latest version simple

#

i hope there should not be any issue with other packages coz they are of older versions

lyric mountain
#

take an advice from someone who went through dependency hell - DO NOT STAY OUTDATED

north cairn
#

👀

lyric mountain
#

struggle as much as needed, stay awake as long as required but

#

UPDATE. THE. STUFF.

north cairn
#

but i have no knowledge of djs v14

lyric mountain
#

then re-learn djs v14 if needed, but do it

civic scroll
#

uhh well

#

esm time

#

heheheha

lyric mountain
#

there'll be a point where everything breaks and you wont find a single reliable source of info

north cairn
#

i'll be honest

#

i am lazy

lyric mountain
#

or versions will simply cease to exist

civic scroll
#

this will be a great opportunity for a rewrite and optimization

#

hi kuu

harsh nova
#

Djs changing dramatically for every update speedrun

lyric mountain
#

hi sayu

civic scroll
#

and sigh

#

fish

north cairn
#

hey btw can i have some dc bot ideas

civic scroll
#

i can't type today

harsh nova
lyric mountain
#

but truly, I kid you not, never let your versions stay below latest

#

my former coworker did

#

and now I'm rewriting the entire corpo app from scratch

lyric mountain
#

because turns out the entirety of packages.json is broken

north cairn
north cairn
lyric mountain
civic scroll
#

FLUTTER

lyric mountain
#

but still, the app is big

civic scroll
#

i'm making the thesis in flutter

#

i'm so done with react native 😔

lyric mountain
#

flutter is neat, tho it lacks in certain areas

#

but definitely better than react

civic scroll
#

if it can do anims, it is my area

north cairn
#

guys dont ingnore
bot ideas pls

quartz kindle
#

i mean

civic scroll
#

bot idea: a bot that draws anime girls

lyric mountain
civic scroll
#

by hand

quartz kindle
#

if you dont wanna use djs v14, you can keep using v13

#

you can still use v13 in node 20+

north cairn
civic scroll
north cairn
#

cmon guys spit out creativity

civic scroll
#

also hi tim

civic scroll
quartz kindle
#

hi css jail

civic scroll
#

i quit discord bot a long time ago

#

i'm graduated

civic scroll
quartz kindle
#

:^)

civic scroll
#

how is tim

quartz kindle
#

how is your husbando

lyric mountain
#

the rest is dealing with renpy

civic scroll
north cairn
#

ayo ppl here are married

quartz kindle
#

rip

#

topgg banned him and ruined his love life as well

#

topgg evil

civic scroll
quartz kindle
north cairn
civic scroll
#

rain

#

and c#

#

but atlas, i'm getting used to it

quartz kindle
#

welcome to exhausted club

#

ive been carrying bricks all morning

#

working on my house's construction

north cairn
#

its your house after all

civic scroll
#

oh wait the html is not done yet omegalul

quartz kindle
#

i wish i could

#

build irl with html and css

north cairn
#

bro trynna bully tim

quartz kindle
#

actually you know what would be cool

#

if you could build irl like minecraft

#

with 1m x 1m x 1m blocks

north cairn
#

gravity of minecraft hell naw

civic scroll
#

we bully each other

north cairn
#

i can see that

quartz kindle
#

in this day and age, bullying people is pretty much flirting

civic scroll
neon leaf
quartz kindle
north cairn
quartz kindle
#

from the amount of bullying you get here, i'd say you are very loved

neon leaf
#

Can confirm

north cairn
#

India is different then

quartz kindle
#

thats how it works on the internet

#

:^)

north cairn
#

saying things on internet is easy

north cairn
civic scroll
#

😔

north cairn
#

guys since many of you are software developers here,can you guys say where to actually start from

civic scroll
#

i'm not a software dev

#

i'm just a silly noob artist

north cairn
#

like learn beginner language and then get into web dev?!

north cairn
#

tim might answer this

civic scroll
#

jokes aside

#

i started from eloquent javascript

north cairn
#

yea so after javscript what should i do

civic scroll
#

yes

north cairn
#

make bots or like what

civic scroll
#

do javascript first then we talk

#

if you want to explore more though

north cairn
#

but i cant really write my own code sometimes

civic scroll
#

do you really know js after saying that sentence

north cairn
#

uhm idk

north cairn
civic scroll
#

see the link above

north cairn
#

i dont understand anything there

quartz kindle
#

for example can you look at some RFC standard and reimplement it in js?

north cairn
#

💀

quartz kindle
#
IETF Datatracker

The WebSocket Protocol enables two-way communication between a client running untrusted code in a controlled environment to a remote host that has opted-in to communications from that code. The security model used for this is the origin-based security model commonly used by web browsers. The protocol consists of an opening handshake followed by ...

#

you can say you are a good programmer when you can look at something like that, understand it, and code it in your language of choice

#

without any lib

north cairn
#

i'll be honest

#

i still dont understand that

#

i am very beginner (i have seen codes of js so i say that ik some js)

#

for eg ik about classes a bit and general knowledge of objects,variables etc

quartz kindle
#

thats good

north cairn
#

i wanted to know that where to start from

#

like master one language

#

or wot

quartz kindle
#

start with the basics, if there is anything that you know how to use, but dont know how it works inside, study that

#

you know objects, arrays, variables, etc

north cairn
#

yes

quartz kindle
#

but do you know how they work inside the engine? under the hood?

north cairn
#

variables are like storing smth in a specific container?!

quartz kindle
#

somewhat

#

this sort of knowledge takes you a bit out of the language itself, and into computer science

#

sometimes its not enough to know the language, sometimes you must know the computer as well

#

for example, using js is one thing, using js to manipulate bytes and memory blocks directly is another thing, it requires computer science knowledge

north cairn
#

btw the thing u said RFc,that has smth to do with building protocols?!!

quartz kindle
#

it goes hand in hand, you can only truly master a language if you know how the language works

#

and to know how the language works, you need to know the computer science behind it

quartz kindle
#

it defines how websockets work

north cairn
#

hmm basically so i need to practice what i learn and master a language yeah

quartz kindle
#

there are thousands of RFCs for different things

#

an RFC is created by a group of people to define how something should work, so that when programmers go and code it, it works the same way everywhere, and is compatible with each other

#

for example there's an RFC for the PNG image format

north cairn
#

interesting

quartz kindle
#

so that programmers know how to create and read PNG files

#

the same way everywhere

north cairn
#

so technically they make something that would be used to make apps,websites or any code

#

ike building blocks

quartz kindle
#

yes, these kinds of standards are used to create the foundations and building blocks of many things people do

#

and they are used to create the libraries that do it for you

north cairn
#

very interesting but needs too much experience and knoweldge

quartz kindle
#

exactly

#

so you start with a language, then when you're confident with the language, you need to look past the language and into the science behind the language

north cairn
north cairn
#

alright so i'll dive in javascript

#

any preferred docs or vids?!

quartz kindle
north cairn
quartz kindle
#

yes basically

north cairn
#

i am afraid only top level enginners can do that

#

engineers*

north cairn
quartz kindle
#

thats what it takes to be a top level programmer

quartz kindle
#

for example videos about data structures

#

check some videos about data structures and try to create them in js

#

one very simple data structure that is not built in in JS is a linked list and a rope, its very easy to make one

north cairn
#

dsa is not smth for beginners imo?!

quartz kindle
#

its looking beyond the language

#

once you're comfortable with it

#

if you're not comfortable with it yet, get some more experience with basic js

north cairn
#

yea so i dont think i should jump in data structures right

lyric mountain
#

Start with a calculator

#

Best project to start with

quartz kindle
#

where is that huge list of codign challenges from easy to very hard

north cairn
lyric mountain
#

Yes