#development

1 messages · Page 2066 of 1

sharp geyser
#

I spent hours on this just to get dynamic imports to work

#

😔

wheat mesa
#

And then have all your locales loaded in memory unless specified otherwise

#

Then have like Locale.t('en', 'bot.message')

#

I’m probably missing something here but it feels wrong to need to await localization like that

#

I understand the ts being dummy thing but still

sharp geyser
#

well you don't need to await it

#

that is if oyu don't want the contents

wheat mesa
#

How are localization files normally formatted

#

Like a key value I assume?

sharp geyser
#

yes

wheat mesa
#

Then why do you need the dotprop package

#

If it’s already key value

sharp geyser
#

Cause dot prop allows to go deeper than just 1 lookup

wheat mesa
#

You could do some sort of syntax like Locale.get('en.message');

sharp geyser
#
{
  "bot": {
    "message": "Hello, World",
    "id": 1231313321,
    "blah": {
      "blah2": {
        "something": "asomerasd"
      },
      "something": "somethingelse"
    }
  }
}
#

so you can nest

wheat mesa
#

Oh localization uses objects too?

round cove
#

Nest what though?

wheat mesa
#

I thought localization was just one string value to each key

round cove
#

Same

#

What does the nest8ng do though? More?

sharp geyser
#

the idea behind nesting is to organize your shit

round cove
#

Organize what

wheat mesa
#

But localization is about translating phrases

#

I don’t see why you’d need nesting for that

sharp geyser
#
{
  "bot": {
    "welcome": {
      "mainMessage": "Hello, there blah",
      "someOtherImportantMessage": "Something idfk",
    },
    "somethingImportant": "asdadsasd"
  }
}

This is what I was idealing about

#

whatever though ig

#

I can do it like you guys suggest

wheat mesa
#

Do what you want to do

sharp geyser
#

ruining my fun hmph

#

I just don't see why nesting isn't a thing

#

like why not allow nesting?

round cove
#

Oh

#

Lol

#

At work we do this

sharp geyser
#

It would make your localization files easier to read

wheat mesa
#

It seems more complex to handle and you have to do that janky ts thing

sharp geyser
#

I only have to do it for now

#

until the ts devs decide to fix it

wheat mesa
#

(never)

sharp geyser
#

waffle we remain hopeful here

round cove
#
{
  "CLOUD:NAME": "ProductName",
  "CLOUD:SIGNIN:USERNAME": "Username",
  "CLOUD:SIGNIN:PASSWORD": "Password"
}```
wheat mesa
#

Yeah that seems to make more sense

#

But it’s all up to you

sharp geyser
#

Mmmm

#

I just feel like going by dot notation is easier for me to handle

#

I also gotta work on allowing them to have placeholders in their localization files

round cove
#

So here we could do

{
  "WELCOME:MAIN_MESSAGE": "Hello World",
  "WELCOME_SOME_OTHER_THING": "Something else",
}```
#

This is the i18n standard btw

sharp geyser
#

which I could probably just do a .replace on

wheat mesa
#

You might want to look at how mainstream localization is standardized

round cove
#

the language translation tool

sharp geyser
#

😔

#

why the fuck do I have to follow standards

round cove
#

Not saying you do I'm just saying this is i18n's

#

That's what we use at work

#

I imagine it's a little bit easier than object parsing.

wheat mesa
#

Standards are good misty don’t go down this hole 🤬

sharp geyser
#

no fuck you waffle

wheat mesa
#

Standards make life easier for the developer

round cove
#

Misty breaks the norms LETSFUCKINGGO

sharp geyser
#

I make my own standards

wheat mesa
#

Based

sharp geyser
#

that just looks stupid

#

welcome.message just looks better

round cove
#

I don't think it looks that bad...

wheat mesa
#

I think that it would be smart to make sure you at least support the standard way of doing things, otherwise people probably won’t use it

sharp geyser
#

I am treating this as if you are looking up stuff from actual objects dylan that is the only reason I say this

round cove
#

Then it goes to like this.translation("KEYHERE");

wheat mesa
#

Most people that would use your package likely already have i18n built in

#

And therefore likely adhere to the standards

sharp geyser
#

waffle I am doing this for dumb djs devs

#

do you think they care about standards

round cove
#

Yes

wheat mesa
#

Yes but not all djs devs are dumb

earnest phoenix
round cove
#

No

sharp geyser
#

Waffle you really want me to cry more don't ya

wheat mesa
#

No I’m just trying to help you

earnest phoenix
sharp geyser
#

okay fuck dot prop then

wheat mesa
#

Make it how you want to make it, just be aware of standards

sharp geyser
#

I at least know how to bypass dynamic imports transpiling to require now

#

so I learned something

wheat mesa
#

Lol

#

Even bigger brain, make your own import function that just does that but in a function so you don’t have to see the jankiness

sharp geyser
#

so it is like this

{
  "KEY:NAME": "VALUE"
}
#

?

round cove
#

Right

#

It's just json

earnest phoenix
#

yea? isnt that basic json?

sharp geyser
sharp geyser
#

I know it is just json

round cove
#

Right, and presumably you have a command that handles changing languages and loading the correct JSON file for each language so that it can key the right one

earnest phoenix
#

ok bye bye

round cove
#

bye person

sharp geyser
round cove
#

that sounds good.

#

Might get bad if you have a LOT of keys.

#

and lots of languages

sharp geyser
#

How many languages will a bot really support tho

round cove
#

True

sharp geyser
#

I doubt some mf going to support all the languages in the world

wheat mesa
#

There’s not really a good solution for that issue

sharp geyser
#

maps are fast as it is

#

and idc about the data

#

let them worry about that

wheat mesa
#

Loading it into memory once is pretty much the best solution, if you’re supporting that much i18n then you’ve probably got a good enough vps to handle the damage

round cove
#

Yeah loading it into a map once is fine.

#

Like misty's current solution

quartz kindle
#

you're fine with maps as long as you have less than 8 million keys

wheat mesa
#

Lol

round cove
sharp geyser
#

Should I handle place holders e.g "WELCOME:MAIN_MESSAGE": "Welcome to %s"

#

or smth

wheat mesa
#

Why

round cove
#

You could

#

That's something totally different tho

#

lmao

sharp geyser
#

Well yea

#

I was wondering if I should add that in

#

there is no real reason to ig

wheat mesa
#

You could but that seems like it would be up to the developer to do that

sharp geyser
#

mmm true

wheat mesa
#

Plus js already has string interpolation

sharp geyser
#

I was going to hand hold em

wanton pawn
round cove
#
export interface ITranslatedText {
  [k: string]: string;
}

function translate(key: string): string {
  const myKeydPhrases: ITranslatedText = this.supportedLanguagesMap.get(someGuildConfig.locale);
  const myPhrase = myKeydPhrases[key];
  return myPhrase;
}``` Excuse my crude code example, but this should be fine
sharp geyser
#
    public t<T>(key: string): T | string {
        const contents = this.locales.get(this.options.lng);

        return contents[key] ?? 'Nothing was found there.'
    }
#

literally all I did

round cove
#

yeah

#

Why T

sharp geyser
#

this was for something before

#

I was going to let them set the type of the returned data

round cove
#

Makes sense.

sharp geyser
#

but now it doesn't matter ig

#

cause it becomes useless if you use it with just js

round cove
#

;p

sharp geyser
#
const { Localization } = require("locale");
(async () => {
  const locale = new Localization({ lng: "en" });

  await locale.addMultipleIn("locales");

  console.log(locale.t("WELCOME:MAIN_MESSAG"));
})();

intentional misspelling of the localization key

#

but it works

#

😎

round cove
#

hella

#

good job Clapping

sharp geyser
#

@wheat mesa and here now you don't have to await

wheat mesa
#

see

#

look at how much easier it is this way

sharp geyser
#

I wonder if people will have issues setting the lng though

wheat mesa
#

standards mmLol

sharp geyser
#

well ig not

round cove
#

So no

wheat mesa
#

why do you need to set the lang in the constructor if you're adding all of the localization files in it already

sharp geyser
#

cause that is what is used to query the map

wheat mesa
#

but... why are you using addMultipleIn then

sharp geyser
#

cause that reads all the data in their localization files and adds them to the map with the file name being the key of the map

round cove
#

Did Discord say a while back they're going to support language locale for slash commands?

wheat mesa
sharp geyser
#

for the name and descriptions of options/choices yes

#

Wdym

#

Not sure I follow what you are saying waffle

wheat mesa
#

Say I have localization for english and spanish, how would I access both of them

round cove
#

what

sharp geyser
#

lng is the fall back language waffle

#

one that you'd use as default

#

t takes in 2 params locale being a optional one

wheat mesa
#

Ah, okay

sharp geyser
#

so you can do t('sp', 'key')

#

idk the locale key for spanish

#

I think it is es

wheat mesa
#

es

sharp geyser
wheat mesa
#

So then how are you setting the keys for each of the maps containing the localization

sharp geyser
#
    public t(key: string, locale?: string): any {
        const contents = this.locales.get(locale ?? this.options.lng);

        return contents[key] ?? 'Nothing was found there.'
    }

so the t function looks like this

wheat mesa
#

How do you know which one is en, es, etc

sharp geyser
#

the key are the locales file name

#

so if you named your files like en.json, es.json

#

then en would be the key for english es would be the keys for spanish

wheat mesa
#

Also, I'd throw an error if you can't find the localization text

sharp geyser
#

Mmm alright

wheat mesa
#

Since you wouldn't want it returning "Nothing was found there." because that could end up with bad results

#

Say someone mistypes a key and they don't realize there's something wrong until people start complaining about prod saying "Nothing was found there."

round cove
#

I thought Misty said this was for their bot

wheat mesa
#

he's making a localization package

round cove
#

ah okay

wheat mesa
#

targeted towards discord

#

(I think)

round cove
#

not sure what the targeting part is, since it's just reading a file and translating

sharp geyser
#
C:\Users\dyeaa\Documents\github\misty\price-check>node main.js
Error: WELCOME:MAIN_MESSAG does not exist in your en's file
    at Localization.t (C:\Users\dyeaa\Documents\github\misty\locale\out\struct\Localization.js:15:37)
    at C:\Users\dyeaa\Documents\github\misty\price-check\main.js:7:22
#

so like this?

round cove
#

i18n just returns the key itself if it's not found

wheat mesa
#

I'd maybe make your own error class

sharp geyser
#

yea I was thinking that as well

wheat mesa
round cove
#

Return the key and that tells the end user that it needs to be translated or needs to be fixed.

round cove
sharp geyser
#

to allow easy localization

wheat mesa
#

If that's the standard then I guess go for it, that just seems like an error to me

round cove
#

why crash the program if it can be added later

#

what if a dev is working on a portion of code and has to wait a day for their translators to get back to them

wheat mesa
#

Fair

#

Perhaps have a warnings option in your localization object options, and then log warnings when you can't get a localization for a certain language

#

So that users are still aware, but can turn it off if it's intentional

round cove
#

I feel if you're making a package for others to incorporate into their projects you should NOT be console logging as that area is for the user to do their own outputs.

sharp geyser
#
WELCOME:MAIN_MESSAG was not found. Check your spelling/make sure you are looking in the right localization.
Hola
#

also checked making sure that getting from multiple localizations worked

#

so I can fetch from spanish localizations

wheat mesa
sharp geyser
#

throwing an error is indeed not a good way

round cove
#

Again that's why you return the KEY back up. That's pretty noticeable when it's a VISUAL thing

sharp geyser
#

you don't wanna stop the program

wheat mesa
#

I'm in the school of thought that it should be very explicit in what's wrong

round cove
#

If I see this on my site or in discord

#

Then I know I messed up MY own translation file

#

And I can easily fix

wheat mesa
#

up to you misty ¯_(ツ)_/¯

round cove
#

^^^^^ TRUE

wheat mesa
#

if people don't like warnings, you can remove it; if users want warnings, you can add it

#

just depends on how you want to design it

round cove
#

be based misty

#

make it output random garbage

sharp geyser
#

I will make it output a java like error

round cove
sharp geyser
#

super unhelpful mmLol

#

Instead of what is wrong I will make it output the entire communist manifesto

round cove
#

do it

fallen holly
#

can i find a role by it's permission

round cove
#

I don't think so?

sharp geyser
#

I mean

#

you can filter all the roles in the guild by a specific permission

round cove
#

Lmao I guess

sharp geyser
#

but no telling you will get the exact role you want

round cove
#

doesn't help if multiple have

sharp geyser
#

it will likely end up giving you a collection of em if a lot of roles have that perm

fallen holly
sharp geyser
#

permission overwrites is a thing

wheat mesa
#

^

fallen holly
#

ik

#

but how do it allow the access for admin

sharp geyser
#

I don't remember exactly off the top of my head

#

but I know you can do something like

fallen holly
#

Then climb to the top of your head and think
KEKW KEKW KEKW

sharp geyser
#
<Channel>.permissionOverwrites.set([
  {
    id: roleYouWantToAllow,
    allow: [PermissionsFlagsBit.ViewChannel, someOtherPermsIDK]
  },
  {
    id: guildID, // this allows you to target everyone in the guild
    deny: [PermissionsFlagsBit.ViewChannel, someOtherPermsIDK]
  }
])
wheat mesa
#

I found this cursed piece of shit from my detritus code: ```ts
export function createOverwritesAboveMinPermissionsSet(
minPermissions: bigint,
guild: Structures.Guild,
allowPermissions: bigint[],
denyPermissions: bigint[],
): RequestTypes.CreateChannelOverwrite[] {
const roles = guild.roles.filter(role => (role.permissions & minPermissions) == minPermissions);
const permOverwrites: Array<RequestTypes.CreateChannelOverwrite> = [];
for (const role of roles) {
permOverwrites.push({
allow: permissionsAsAny(allowPermissions),
deny: permissionsAsAny(denyPermissions),
type: OverwriteTypes.ROLE,
id: role.id,
});
}
return permOverwrites;
}

sharp geyser
#

What the fuck waffle

#

whyyy

fallen holly
#

deleted that

#

mods

sharp geyser
#

that is detritus shit

#

it won't be helpful here cause we can actually use arrays here waffle

fallen holly
sharp geyser
#

just use the guild's id

fallen holly
#

aight i will change that

sharp geyser
#

to find the role you want

#

you can filter through the guild's roles

#
<Guild>.roles.cache.find((r) => r.name === "SomeName")
#

which returns you the role object IF it exists if not you will have issues

fallen holly
#

ok thx

sharp geyser
fallen holly
#

for the guild id is this ok

{
  id: message.guild.id,
  deny:[PermissionsFlagsBit.ViewChannel, someOtherPermsIDK]
},

sharp geyser
#

sure

#

but someOtherPermsIDK is not supposed to be there

round cove
#

Hell yeah dude

fallen holly
#

ik

round cove
#

cool shit unironically proud

fallen holly
#

i'm not dumb

sharp geyser
#

did you read the readme

round cove
#

I JUST saw it lmfao

sharp geyser
#

linked u and waffle

#

kek

round cove
#

i take it back fuck you dummy

#

(indentation)

#

readme's suck with tabs/spaces

sharp geyser
#

IT WAS NOT MY FAULT

round cove
#

I know 😔

sharp geyser
#

read me formatted it weird no matter how I tried to do it

wheat mesa
#

damn this shit sucks I don't wanna be in the readme

#

jk luv u misty

sharp geyser
#

😩

#

ty man

#

I don't know what more I could do to make this package better

#

I think rn it is good how it is

sharp geyser
#

def not pushing it off onto other people

wheat mesa
sharp geyser
#

ah but I love making things harder on myself

wheat mesa
sharp geyser
#

Hey waffle

#

do my read me /s

wheat mesa
#

I tryharded that readme

sharp geyser
#

@wheat mesa tf is this

#

it looked perfectly fine in the preview

#

😔

#

ok

#

3 commits just ot make the fucking readme look good

#

smh

round cove
#

Lmfao

sharp wing
#

back to djs after 8 months cuz old account got deleted lol
could someone please lmk what's wrong here? approved all intents and also has perms

sharp geyser
#

403 usually means missing access/permission

#

when you make the invite link for the bot make sure to click application.commands alongside the normal bot option

wintry tendon
#

does grabbing a guild's id trigger the discord API rate limit ?

sharp geyser
#

Well fetching from the API x times and in a matter of n amount of time can cause a rate limit yes

sharp geyser
wintry tendon
#

am not getting rate limited, i just wanna know if that is a possibility when a lot of people use the bot

near stratus
#

the limit probably gets higher if more guilds use the bot

wintry tendon
#

thats what i thought

near stratus
#

there's no way a bot with 100 guilds and 100000 guilds have the same limit

wintry tendon
#

that would be great but that isn't stated anywhere

sharp geyser
#

You can apply for it iirc unless they changed how they handle it

#

Best bet would be to email them about it and you'll get your answer another method of finding a possible answer is to ask in the dapi server

near stratus
#

there isn't much to do with gateway except changing status

wintry tendon
#

i can't find http limits, ill have to look

near stratus
#

it's different for every user

#

*client

wintry tendon
#

thank you

near stratus
#

np

sharp geyser
#

That was a good read

#

I didn't read that before when making my lib kek

near stratus
#

you made a lib?

sharp geyser
#

I did yes

#

It isn't publicly out cause no one will use it

#

The repo's code is out dated

near stratus
#

discord's api is pain

#

I learned that when I tried some custom things with oauth

sharp geyser
#

I find it rather nice

#

I could 100% make a dashboard now for a bot

#

But I don't know css that well

#

So the only thing holding me back is design

near stratus
#

.......

#

You know css is 782% easier than making a lib

somber ridge
#

design is just pain

#

need to have a lot of patience

#

i'm stuck at a similar situation

sharp geyser
#

Css is by far the hardest thing to me

#

I find making a lib easier than css

somber ridge
#

try using a framework for CSS like tailwind maybe? makes the job a bit easier in my opinion

near stratus
#

I have chakra to carry me

somber ridge
#

that is if you know CSS to a decent level

sharp geyser
#

I use mantine and tailwind.

#

Though I kinda wanna swap back to using angular over react ngl

#

Issue with css is I don't have the patience to sit down and use it

#

I can sit down and work on something like a library for hours though

near stratus
#

That's why you use libs

#

For css

sharp geyser
#

Libs can't do everything for you

near stratus
#

At least most of the annoying things can be done

#

I have to write 300 lines of css instead of 3000

sharp geyser
#

I'ma probably just make a website without any css or component libs to begin with ngl

#

It'll force me to learn css

wheat mesa
#

Using mantine I barely needed custom css

#

Most of the things that I needed with css was just basic

snow urchin
#

How can I stop node-gyp trying to use multiple visual studio versions? I have 2022 version installed, and both yarn and npm config are set to use the 2022 version.

https://i.callum-is.gay/KOPokEhO84.png

sharp geyser
#

Waffle why are you so busy all the time

#

😔

wheat mesa
#

Because I have many things to do

#

Busy week

sharp geyser
#

haven't you been playing pokemon all the time?

wheat mesa
#

No

sharp geyser
#

ah

wheat mesa
#

Spent the whole day cleaning today

sharp geyser
#

Dang

#

I am probably moving soon

#

so i gotta clean as well

#

kek

#

So coming from a design pov, should the Client have access to application properties

#

talking bout my discord lib here

earnest phoenix
#

The second file is the one I was trying to keep from being uploaded

#

Don't mind my rage comment haha

sharp geyser
#

I am wondering what that red is

#

probably not important

#

but hmmm lets see

#

So you added the gitignore, made it ignore the json file, ran git add . then ``git commit` and then pushed it right?

earnest phoenix
#

Yes

#

I've had to reset my bot token four times now because git seems to refuse to listen to .gitignore

sharp geyser
earnest phoenix
#

I'll check it out now

rustic nova
#

Just fyi

#

Since you mentioned you committed before

#

You'll need to remove the remote file, it would otherwise still get pushed

#

Aka the gitignored file on the remote end

pallid zinc
#

Tried to install react native and it gives this error anyone have any idea about this?

sharp geyser
#

I might be wrong but just from reading it, looks like your dependencies require a different version of react then what you are trying to install

pallid zinc
#

I didn't mentioned any version while downloading so i dont think it should be a problem

#

Infact its a on going project with package json file

#

And im just trying npm i

sharp geyser
#

npm i on its own?

sharp geyser
#

Seems like the other packages that rely on react don't support react v18

#

Again I could be wrong cause I suck at reading npm errors but just from a first glance that looks like it is what it is saying

pallid zinc
#

Yup getting you

sharp geyser
fervent moss
#

Does someone have experience with discord auth2 like what topgg has login with discord and then it shows guild i am unable to find my way in it

fervent moss
near stratus
#

"it shows guild i am unable to find my way in it" what?

fervent moss
#

Uhmm....that isn't problem that i wanna do like i mean where to start from making it

#

There are lot less clear tutorial available on yt

quartz kindle
#

you need a webserver

#

like a website or something

#

when people access your website, or a specific url in your website, you redirect them to discord's oauth2 url

#

discord's oauth2 has a callback system that redirects the user back to your website when they login

#

when the user is redirected back to your website, it will have extra stuff in the url, for example yourwebsite.com/url?code="39y9c82yn39c48y29384y9"

#

you have to read this code to access the user's information

fervent moss
#

Yeah ik that system like redirect url invite links

#

Oh and how you get code?

quartz kindle
#

the code will be there in your url

#

after the user is redirected

#

also there are two types of oauth2, explicit and implicit grant

#

the explicit type gives you a refresh token that you can use to keep the user's token valid

fervent moss
#

Oh

quartz kindle
#

the implicit type only gives you temporary access, after which the user has to login again if you want to keep accessing their data

fervent moss
#

Ic

quartz kindle
#

the implicit type is easier to use

#

both are described here

fervent moss
#

Ah looks so complicated to put onto a website tho i will try

quartz kindle
#

for example using the implicit grant

#

you redirect the user to https://discord.com/api/oauth2/authorize?response_type=token&client_id=290926444748734499&state=15773059ghq9183habn&scope=identify

#

the user will be taken to the discord login page

#

once they login, they will be redirected back to your website, in the url you specify in your discord application's redirect uri

#

after they are redirected, you will receive a request to your website like this
https://yourwebsitehere.com/#access_token=RTfP0OK99U3kbRtHOoKLmJbOn45PjL&token_type=Bearer&expires_in=604800&scope=identify&state=15773059ghq9183habn

#

these extra things after the # character is what you use to access their data

fervent moss
#

By redirect you mean like putting redirect url in bot invite and user authorises it and then the url got has token in it from which i can acees user info right?

#

And there are two types one temporary and one permanent

quartz kindle
#

both are temporary but one can be refreshed every X time, the other cant

fervent moss
#

Oh

quartz kindle
#

just adding a redirect url in the bot invite is not enough

#

the redirect url in bot invites only work if the user logs in with discord first

#

first you need to go to your bot's application dashboard, and setup its oauth2 links

near stratus
#

This is from Spotify but the same works for discord

#

damn spotify's docs are better than tutorials

pine nova
wooden ember
#

is there anyway to reload a voice connection on d.js?

winged linden
#

hey, got a question. how can i use axios to search for a specific parm in the api?

for example i wanna search for https:\/\/howrare.is\/unfrgtnorbit\/482 and i wanna get the ranking of that so Rank 1

lyric mountain
#

convert the response to json

winged linden
#

and then? how can i search?

lyric mountain
#

<json>.rank

#

you dont "search" a json, you access a property

winged linden
#

i have the link but not the rank, thats what i mean

lyric mountain
#

that still doesn't make sense

#

if u request the api ur getting a single json no?

#

or does it return more than one?

winged linden
#

1 json, but what i mean. in this json it shows the rank of specific ids. i got the ids and i wanna find the ranks using a command

#

ik its possible but i am doing smth wrong i guess

wheat mesa
#

.find

#

Convert to json, do jsonRes.find(x => x.rank === 69)

#

I assume it’s an array of objects

winged linden
#

will try

idle coral
#

My compile command won't work, I have the full, long, error in this txt file below.

idle coral
quartz kindle
#

until line 17 (including line 17)

idle coral
#
const config = require(`${process.cwd()}/config/config.json`)
var ee = require(`${process.cwd()}/config/embed.json`)
const fetch = require("node-fetch");
const { MessageEmbed } = require(`discord.js`);

module.exports = {
    name: "compile",
    category: "🛑 Others",
    aliases: [""],
    cooldown: 4,
    usage: "compile <Code>",
      description: "Compile code.",

      run: async (client, message, args, cmduser, text, prefix) => {
quartz kindle
#

thats only until line 14? you need to show 3 more lines

idle coral
#

ok

#
const config = require(`${process.cwd()}/config/config.json`)
var ee = require(`${process.cwd()}/config/embed.json`)
const fetch = require("node-fetch");
const { MessageEmbed } = require(`discord.js`);

module.exports = {
    name: "compile",
    category: "🛑 Others",
    aliases: [""],
    cooldown: 4,
    usage: "compile <Code>",
      description: "Compile code.",

      run: async (client, message, args, cmduser, text, prefix) => {
        try {
            const possiblecommands = {
                cpp: "g++ main.cpp -pthread -pedantic -Wall -Wextra && ./a.out",
wheat mesa
#

Just a fair warning if you didn’t already know, running code from unknown people will result in your VPS being absolutely fucked by everyone that can fuck it, especially with C++

#

Also, the error you have doesn’t make sense for the code you posted

cinder patio
#

I mean he's just compiling it

#

but like also just use an API which does this for you there are plenty

wheat mesa
#

He’s also running it

#

&& ./a.out

#

I could imagine somebody abuses this though and compiles so much garbage it just locks your CPU at 100%

#

I’d lock this command to only you and whitelisted people

#

Either that or use an API designed for this

woeful pike
#

you can do a ton of compile time fuckery too

quartz kindle
#

show more lines

split hazel
#

run the script with an api or a docker container with no network access and user account privileges with limited execution time and you should be good

lyric mountain
#

can't c++ directly access hardware?

#

u can literally brick the physical part no?

split hazel
#

programs run under a level called ring 3

#

at that level any program if it malfunctions or is malicious should not be able to harm the hardware or read any other programs data

#

worst case scenario it can delete or read some files at best

green kestrel
#

feeling really short mood wise today

#

one too many idiots over on my own Discord

#

like, "help me or I'll hurt myself" really isn't something I can deal with any way except ban...smh

quartz kindle
#

wtf

green kestrel
#

yeah ikr

rose warren
#

Smh

green kestrel
#

you ever get one of those days where the fail seems constant

#

I'm gonna have to be stricter with spoon feeding I think

#

like you are here

split hazel
#

spoonfeed but dont send them the exact code

#

make them complete it themselves

sick agate
#

i mean yeah

lyric mountain
lyric mountain
open totem
#

/

round cove
#

What's webhook ratelimit again? 20messages every 5 seconds?

fallen holly
#

i want to give all this roles access to a channel i'm making how do i do that

tulip ledge
#

find the role by name so you have the roleobject

#

then give the role permission to view the channel

#

and deny the everyone role (guild id) permission to view the channel

fallen holly
#

this is how i'm pushing all the roles from the guild

#

    message.guild.roles.cache.forEach((roles)=>{
      
      if(roles.permissions.has('ADMINISTRATOR')){
        adminRoles.push(roles.name)
      }
     })

tulip ledge
#

what

#

that's not what I said

#

also why do 5 different roles have the admin perm?

#

and if a role has admin perm you don't have to give them permission to view a channel

#

all you have to do then is just deny the everyone role (guild id) the permission to view the channel

fallen holly
#

ok thx

split hazel
#

just found this is it older than you @quartz kindle

#

think they were a thing at around the 1970s

quartz kindle
#

probably yes

#

In 1963, the GE-235 featured an "Auxiliary Arithmetic Unit" for floating point and double-precision calculations.[5]

split hazel
#

does anyone know if according to the ABI if a functions stack frame is released does the function also release the parameters?

solemn latch
split hazel
#

bro can i just comaplin

#

my laptop is so shit

#

imagine having 4gb ram in 2022

#

its enough to run a single chrome tab on windows without thrashing

#

let alone visual studio code with wsl and heavy c++ compiler tools

boreal iron
#

imagine using chrome

split hazel
#

yeah you know what

#

ima get opera gx on it

#

its light on ram

boreal iron
#

LMFAO

#

opera as bad as ie

#

maybe even worse

split hazel
#

the performance increase of no thrashing will outweigh the performance decrease of operas performance

#

clang takes like 10 seconds to lint shit

#

20 sometimes

split hazel
#

opera needs to swallow its pride and use v8

#

dont know what the ram differences are between them tho

green kestrel
#

and change to a different more lightweight editor

split hazel
#

visual studio

#

that was a joke

#

cant be asked right now i'll just edit with notepad

wooden ember
#

is there anyway to "restart" voice on d.js? cuz my internet sux the connection drops and come back meaning that the bot can join the chat but not play anything

#

it fixes when the bot is restarted but i dont want to have to do that like everyother day

#

is there any way to fix that

#

or am i just screwed

wheat mesa
#

When you drop your connection to discord it’s likely you’ll get an unrecoverable error, or at least a bad state. When your bot disconnects from the gateway, it has to log in all over again

#

You need to find a solution to your internet, not a solution to reconnecting

#

If it happens often you’ll also likely hit your connection ratelimit if you’re automatically reconnecting somehow

lament rock
#

session resumes dont have a ratelimit other than the standard sending 120 gateway messages a minute

wooden ember
#

welp we might get fibre at some point depends

#

half of it is just my internet being adsl

#

and the other half is just our 10 year old router

wheat mesa
#

You probably shouldn’t be self hosting then

#

I’d say it’s probably more likely your computer is the issue with your connection dropping, some motherboards with built in wifi suck, and if you’re using a wifi card, sometimes those can break and cause issues like that

#

Personally I have had to replace my PCIE network card once so far

#

Had a similar issue where my ping would spike to 6000 and/or disconnect for a few seconds periodically

wooden ember
#

nah the router sometimes just reboots when im doing alot of stuff

#

also its ethernet

#

and the vc bot is just for my own server and doent affect my main bot so eh

woeful pike
#

what in gods name is that data structure

lyric mountain
#

it's CSON lmao

#

comma-separated object notation KEKW

#

tf is that url

sharp geyser
wintry tendon
#

hello, am trying to add the slash commands to my bot.

#

do i just remove the guild=discord.Object(id=MY_GUILD_ID)
to make available for all the servers ?

#

because i tried it but it doesn't work 😄 am i missing something ?

dry imp
#

what lib?

spark flint
#

looks like dpy

dry imp
#

disgusting

wintry tendon
dry imp
#

cant help you sorry, i use py-cord

wintry tendon
#

oh i see

sharp geyser
#

smh

wintry tendon
#

by the way, discord.py is getting updated again, its not shutdown anymore

dry imp
#

d.py so ugly i rather go to hell first

#

yea i know

sharp geyser
#

bitch you're already here

#

tf you mean go to

wintry tendon
#

they are all the same xd

dry imp
#

you are in hell alone misty

sharp geyser
#

😔

#

ik

dry imp
#

those burning fire makes you hallucinate

wintry tendon
#

i tried to switch to js, but i had trouble reading and writing to files using fs, python is just easy and quick with fewer lines

dry imp
earnest phoenix
#

Hey I have a question
So I was trying to deploy my website with vercel. I have got mongodb on the website and stored it in process.env file

#

I got this error

#

When the environment variable starts with mongodb+srv://

wooden tusk
#

How to get the total vote number ?

sharp geyser
#

I don't think you can

#

not from the vote webhook as far as I know

boreal iron
#

No he can’t

#

The webhook only includes data about the currently happening vote

sharp geyser
#

yea

boreal iron
#

The total number of votes should be possible to get sending a request to the api

lyric mountain
#

People try to use api for vote notifs and webhooks for vote total

boreal iron
#

And/or by listening to the webhooks continuously and storing/counting them

#

Which might not be accurate sometimes since some webhooks may not make it to your endpoint

#

For various reasons

wheat mesa
#

Request API on startup, keep count yourself after that. Maybe fetch from API every now and then (like 30 minutes or 2 hours or something like that) and correct your count

wheat mesa
#

Log your env variable, vercel might have their own way of injecting envs into your program

earnest phoenix
#

Oki

bright hornet
#
{$pull: {inventory: {Name: "marriage ring"}}}``` can't pull when the string has space
#

any thoughts?

#

y

bright hornet
#

https://sourceb.in/0t9L61e9VM, How should I base on ms on database instead of cooldown in commands?
The cooldown is working fine

Issue: when the bot restarts, the ms ignored

bright hornet
#

all done

fossil bronze
#

Looks like you were storing data objects (so in memory) holding the cd information?

ancient nova
#

I've gotten like 30 missing permissions errors in my console then this dropped and my bot died even the PM didn't bring it back

#

ERROR Uncaught Exception: Error: WebSocket was closed before the connection was established

#

the fucking problem is it doesn't tell me which script / package the errors are coming from

#

xd so I'm stuck with them

fossil bronze
sharp geyser
fossil bronze
#

Looks like maybe you have something like

process.on('unhandledRejection', (reason, promise) => {})
sharp geyser
#

That won't be very helpful here

#

The error is being caused by something internally with djs

#

the debug event logs nearly everything that happens in djs from the first hello, to identifying and so on so forth

fossil bronze
#

If you don't have a handler, it will normally show more information (traceback), at least it does for me

#

That's why I think they have a handler that doesn't log set up

forest cosmos
#

So how can one check for a Top.GG vote for a bot?

whole knot
forest cosmos
#

thanks...

whole knot
#

What library are you using?

forest cosmos
#

maybe python?

whole knot
#

I think they’re well explained and with a little adaption you should be good to go

#

Whenever the vote event fires, store the timestamp of it and then compare it with the next vote that comes in from the user ID

forest cosmos
#

thanks

ancient nova
#

which uses the unhandledRejection event

#

guys I wanna make a hangman game, but if I take the input from the chat anyone could play and it would really clog the chat the command is executed in

#

buttons won't work either

#

because I can't add buttons for the entire alphabet

#

:/

#

any ideas?

pine nova
#

just use filter for message collector?

#

only allow the author

#

to answer

ancient nova
#

yeah but I want the game to be played with multiple people

pine nova
wheat mesa
#

Then allow people to opt in

pine nova
#

ye

ancient nova
#

oh I see maybe like a 30 second thing with a join button

#

should I make it minimum 3 people?

pine nova
#

ur choice

ancient nova
#

well I have an idea of how it could look like potentially...

#

well I'll start coding ig

pine nova
#

gl

ancient nova
#

thank

pine nova
#

man i cant find the motivation to design my portfolio on figma 😔

ancient nova
#

what's figma?

pine nova
#

but a bit better imo

ancient nova
#

just go with the flow KEKW

pine nova
#

💀

#

lmao

#

i just started using it too

#

but i suck at frontend and designing so practicing

ancient nova
#

I'm decent at frontend but I have to have a set idea of what I'm doing otherwise I'll be stuck

#

cause I'm not very imaginative

pine nova
#

same

ancient nova
#

I can make a game with AAA graphics but no gameplay

pine nova
#

lmao

ancient nova
#

😭

pine nova
#

i really gotta practice frontend shit fr

#

backend developers ain't got any reputation fr

ancient nova
#
const challengeCheck = await msg2.awaitReactions({ filter, time: 30000, max: 5 });
``` any way I can execute some code each time someone reacts?
pine nova
#

reactionAdd event?

ancient nova
#

I want to update the text to update who joined the game

ancient nova
pine nova
#

idk never used it

ancient nova
#

oh wait I can't use a global event for a command

pine nova
#

but there was an event

ancient nova
#

it would suck to integrate it

pine nova
#

like when someone reacts it shows the member data

#

who reacted to what emoji

#

prolly

ancient nova
#
        challengeCheck.on('collect', ({emoji}) => {
            if (emoji.name === '👍') {
                joinedCount++; whoJoined.push(...)
                msg2.edit(`Hey peeps! ${message.member} started a game of Hangman. React to the message to join. You have 30 seconds.\n\nJoined ${joinedCount}/5`);
            }
        });
        
        challengeCheck.on('end', (collected, reason) => {
            if (collected.count < 5) {
                msg2.edit("Not enough people joined the game. Cancelling the game.")
                return false;
            } else {
                msg.delete();
                return true;
            }
        });
#

I have a whoJoined array

#

I want to push there IDs of people who joined the game

#

how do I fetch them?

pine nova
ancient nova
#
        challengeCheck.on('end', (collected, reason) => {
            if (collected.count < 5) {
                msg2.edit("Not enough people joined the game. Cancelling the game.");
                return false;
            } else {
                msg2.delete(); whoJoined = collected.users;
                return true;
            }
        });
    }

    // Now lets ask the mentioned member if they wanna play using the function we made above.
    let validation = await validateUser(message);

    // If it went through let's now start our game.
    if (validation === true) {
        return message.channel.send(`The game would normally start but I haven't coded that part yet. ${whoJoined.join(", ")}`);
    }
``` the end event doesn't work
#

the count doesn't show up when it's less than 5 members

#

message does delete, butreturn message.channel.send(`The game would normally start but I haven't coded that part yet. ${whoJoined.join(", ")}`) doesn't send

#

any ideas?

#

so I'm making a collector to collect all the users who react and update the count on a previously sent message. The message sends and everyone can react to it and the count updates, but it doesn't end somehow when 5 people react, the message just deletes itself and the validation === "done" message doesn't send afterwards. It deletes itself even if there isn't enough people. I'm really confused. Any ideas?

    let whoJoined = [], joinedCount = 1;

    const validateUser = async function (message) {
        const msg2 = await message.channel.send(`Hey peeps!\n${message.member} started a game of Hangman.\nYou can react to the message to join!\n\nJoined ${joinedCount}/5`);
        msg2.react("👍");

        const filter = (reaction, member) => "👍" === reaction.emoji.name && member.id != client.user.id;

        const challengeCheck = await msg2.createReactionCollector({ filter, time: 30000, max: 5 })
        
        challengeCheck.on('collect', ({emoji}) => {
            if (emoji.name === '👍') {
                joinedCount++;
                msg2.edit(`Hey peeps!\n${message.member} started a game of Hangman.\nYou can react to the message to join!\n\nJoined ${joinedCount}/5`);
            }
        });
        
        challengeCheck.on('end', (collected, reason) => {
            if (collected.count > 5) {
                return msg2.edit("Not enough people joined the game. Cancelling the game.");
            } else {
                msg2.delete(); whoJoined = collected.users;
                return "done";
            }
        });
    }

    let validation = await validateUser(message);

    if (validation === "done") {
        return message.channel.send(`The game would normally start but I haven't coded that part yet. ${whoJoined.join(", ")}`);
    }
sharp geyser
#

Well your logic in the if statement is off

#

Shouldn't it be count < 5

#

Your code is very hard to read on mobile

woeful pike
#

this is like async programming 101, you might wanna read up on callbacks and promises

ancient nova
#

I can't really format it better

ancient nova
#
        // And create a end event when the timer finishes or the max of 5 people joined.
        const endFunc = function(canStartGame, joinedUsers) {
            if (canStartGame === true) {
                msg2.delete(); whoJoined = joinedUsers.users;
                return message.channel.send(`The game would normally start but I haven't coded that part yet. ${whoJoined}`);
                
                // Define our hangman game.
                const Hangman = require('../games/hangman.js'); const hangman = new Hangman();
        
                // And start a new instance.
                hangman.newGame(message);
            } else {
                msg2.reactions.remove();
                return msg2.edit("Not enough people joined the game. Cancelling the game.");
            }
        }
        challengeCheck.on('end', (collected, reason) => {
            if (collected.size <= 3 || collected.size === 5) {
                endFunc(true, collected);
            } else {
                endFunc(false, collected);
            }
        });
``` anyone know why whoJoined is undefined?
#

it works now but whoJoined is undefined. it's set using joinedUsers.users which derives from the collected variable in the end event of challengeCheck

#

any ideas how to fix that?

sharp geyser
#

Could be joinedUsers.users is undefined

ancient nova
#

the docs said it's collection.users

woeful pike
#

you're making this way more complicated than it has to be. Just return a promise

return new Promise(res => {
  challengeCheck.on("end", (collected) => {
    res(collected)
  })
})

and then await your async function normally

ancient nova
woeful pike
#

it just resolves the collection the end even emits

ancient nova
woeful pike
#

you await the promise nootlikethis

ancient nova
#

how does await collection get users out of it

#

I'm so confused even in the discord.js server they did that

#

how

#

do you get collection.users by awaiting collection?

#

how?

woeful pike
#

the reason why you can't do what you're trying to do is because the "end" event emits at an unpredictable time. Your function doesn't wait for that event. So you wrap it with a promise and only resolve it when it's done

#
const validateUser = async function(message) {
  const filter = (reaction, member) => "👍" === reaction.emoji.name && member.id != client.user.id;

  const challengeCheck = await msg2.createReactionCollector({
    filter,
    time: 30000,
    max: 5
  })

  challengeCheck.on('collect', ({ emoji }) => {
    // whatever
  });

  return new Promise(res => {
    challengeCheck.on('end', (collected) => {
      res(collected);
    });
  })
}

let collected = await validateUser(message);

if (collected.count > 5) {
  return msg2.edit("Not enough people joined the game. Cancelling the game.");
} else {
  msg2.delete();
  return message.channel.send(`The game would normally start but I haven't coded that part yet. ${whoJoined.join(", ")}`);
}
#

validateUser doesn't resolve until challengeCheck ends

ancient nova
#

that's what I've had up until now

#
    const validateUser = async function (message) {
        const msg2 = await message.channel.send(`Hey peeps!\n${message.member} started a game of Hangman.\nYou can react to the message to join! (You have 30 seconds.)\n\nJoined ${joinedCount}/5`);
        msg2.react("👍");

        const filter = (reaction, member) => "👍" === reaction.emoji.name && member.id != client.user.id;

        const challengeCheck = await msg2.createReactionCollector({ filter, time: 30000, max: 5 })
        
        challengeCheck.on('collect', ({emoji}) => {
            if (emoji.name === '👍') {
                joinedCount++;
                msg2.edit(`Hey peeps!\n${message.member} started a game of Hangman.\nYou can react to the message to join! (You have 30 seconds.)\n\nJoined ${joinedCount}/5`);
            }
        });
        
        const endFunc = function(canStartGame, joinedUsers) {
            if (canStartGame === true) {
                msg2.delete(); 
                return message.channel.send(`The game would normally start but I haven't coded that part yet. ${joinedUsers}`);
                
                const Hangman = require('../games/hangman.js'); const hangman = new Hangman();
        
                hangman.newGame(message);
            } else {
                msg2.reactions.removeAll();
                return msg2.edit("Not enough people joined the game. Cancelling the game.");
            }
        }
        challengeCheck.on('end', async (collected) => {
            const collectedUsers = await collected;
            if (collected.size >= 3 || collected.size === 5) {
                endFunc(true, collectedUsers);
            } else {
                endFunc(false, collectedUsers);
            }
        });
    }; await validateUser(message);
#

it actually worked

#

though it returns Object [map] as users

sharp geyser
#

Makes a lot more sense when the code is given to you

ancient nova
#
        return new Promise(res => {
            challengeCheck.on('end', async (collected) => {
                //const collectedUsers = await collected;
                if (collected.size <= 3 || collected.size === 5) {
                    endFunc(true, res(collected));
                } else {
                    endFunc(false, res(collected));
                }
            });
        });
``` so you can't do stuff like this? lol
woeful pike
#

I mean you can but this screams "I don't know how promises work"

#

creating random functions and passing around callbacks gets real painful

median heart
#

when i am viewing my server on gg it will not let anyone vote

#

says an error message #407

lyric mountain
#

407 is proxy error

median heart
#

ok

#

whats that mean

#

?

lyric mountain
#

how many people did you check whether they can vote?

median heart
#

sorry 403

lyric mountain
#

well that makes more sense

#

is your server really added?

median heart
#

what

#

'?

lyric mountain
#

like, did you add the server?

median heart
#

yes

#

lol

#

its added

fossil bronze
median heart
#

just trying to vote

#

and i get that message

lyric mountain
#

is it this one?

#

if so, tell them to clear cache

#

on chrome/edge it's ctrl + F5

fossil bronze
#

I'm waiting for someone to need help

#

Why is there not someone looking for help??

woeful pike
#

join a programming server :p

earnest phoenix
#

^

fossil bronze
#

Also I only want to help with discord bots and not web dev

earnest phoenix
#

they aren't programming web only

#

also if you want to help people from programming, go to stackoverflow 👹

split hazel
#

stack overflow ogs when you ask for help

#

"k but you didnt format your question properly"

fossil bronze
#

Stackoverflow needs an account and I dont wanna make one

split hazel
#

discord needs one too

lament rock
#

maybe people are just getting too smart

#

I know that's false though because I still see a lot of bad code

boreal iron
#

Tbh the general intelligence seems to be falling further with each generation

#

Especially logical thinking and common sense

frigid grotto
#

।।

eager vapor
#

Who play Minecraft

raw nest
#

How do I create something like create-xyz-app and then it installs a couple of stuff I've choosen?

midnight marsh
eager vapor
#

Do you know a person with a sever

harsh nova
eager vapor
#

It's development on my social skills

#

🤣

#

How do you take so long type

spark flint
#

code

harsh nova
eager vapor
#

Your not dumb

harsh nova
#

But this channel is about other types of development in the likes of programming. General discussion happens in #general or #general-int

eager vapor
#

Your smart in your own way

harsh nova
#

I’ll put that in my cv

eager vapor
#

What that

#

Cv

fossil bronze
#

curriculum vitae or something like that

eager vapor
#

The heck

fossil bronze
#

its the list of your education and work

eager vapor
#

Idk what that is

#

Oh i see

#

Cool

fossil bronze
#

lets talk about development

eager vapor
#

Well I'ma go now

#

Cya

harsh nova
#

A document you send in when looking for work. Hpwever, this is not the place to discuss that

fossil bronze
#

ping me if you need help making your discord bot (and you are kinda new at it)

eager vapor
#

Me

#

I am the one who made carl

midnight marsh
eager vapor
#

I know right

slender wagon
#

how do i remove a percentage from a number in js

#

i tried using the number and then - 10%

#

it's returning NaN

wintry tendon
#

anyone has any knowledge on how to get roles from the person who used a slash command with discord.py ??

lyric mountain
#

<string>.replace("%", "")?

#

or do u mean subtract a percentage?

#

@slender wagon forgot to ping

#

if u meant the latter, that's basic calculus, not really a language-specific problem (I doubt ANY language will have n - 10% as a valid operation)

earnest phoenix
#

looks like subtracting a percentage

lyric mountain
#

n - n * 0.1 (10%)

earnest phoenix
#

which you would have to convert that percentage to a decimal and do that way

#

or that

lyric mountain
#

or n * 0.9 (90%)

earnest phoenix
#

same diff

lyric mountain
#

no need to convert anything, 1 is always equivalent to 100%, just think with 2 less zeroes

fallen holly
#

is there a way to check if a channel exists

craggy pine
#

Assuming the code is correct, it would find bots for just the one guild its ran in. But try it and see what happens shrug

lyric mountain
#

do note, that "might" crash your bot if ran in a big enough server

#

I would do a progressive scan

#

like, fetch 100 users per pass

#

split the member count into chunks of N users, fetch those, count, repeat until you finish all chunks

#

about the exact implementation, I have no idea

#

fetching all members at once might cause a temporary spike in ram usage, and if your server isn't strong enough it'll go OOM and crash

slender wagon
lyric mountain
#

yes

#

you could use 10/100 if u must, (% is actually 2 numbers separated by /, the circles represent their positions)

#

like 2⁄3

slender wagon
#
 let sellerReward = price * 0.35 

this worked just fine

#

0.35 is the fee btw

lyric mountain
#

high af fee

slender wagon
#

testing purposes

#

💀

fossil bronze
#

let bots = 0
let members = guild.members.fetch()

for (let i = 0; i < members .length; i++) {
if (members[i].bot) bots++
}

#

höhö

lyric mountain
#

that's what he did but worse

slender wagon
fossil bronze
#

Most basic implementation

lyric mountain
fossil bronze
#

loop >>> array function imo so

lyric mountain
#
value  |  percentage
-------|------------
A      |  100%
B      |  X
#

A being the maximum value, B being the desired value

#

X = B * 100 / A

fossil bronze
#

You'll probably want to round the number after multiplying by 0.35

lyric mountain
fossil bronze
#

let sellerReward = Math.round(price * 0.35 )

slender wagon
lyric mountain
#

just Math.max the value

#

since the value and the fee are inversely proportional, you reverse the value side

#

X = A * 100 / B

#

u can remove * 100 if u want to get a 0..1 range

#

(not necessarily clamped to 0 or 1)

wheat mesa
slender wagon
fallen holly
#

is there a way to make category then make channels inside it

boreal iron
#

Creating the category will return a promise (your category channel) which you can use to create more channels inside

raw nest
#

How do I create something like create-xyz-app and then it installs a couple of stuff I've choosen it to install?

lyric mountain
#

what

#

well, if u mean running that on cmdline, you need to write a console application and add it to PATH (or equivalent)

#

now, if u mean ./create-xyz-app, you just need to write a script

raw nest
#

yes like create-react-app and then it installs something. How do I build that? Any docs/articles for me?

lyric mountain
#

sometimes I wonder why people don't start with console applications anymore

#

just pick your favourite language and hit build

#

the code itself needs to be written by you

#

it literally like making a discord bot, except you'll be working locally instead of discord

lyric mountain
#

when you're starting to learn a language, you usually (or used to) start with console applications

#

hello world, who am I, calculator, snake, etc

#

before you even think about doing UI or using external APIs

raw nest
#

yeah kinda true THIS

boreal iron
#

who am I
calculator

lyric mountain
#

for example, you build

console.log("Hello world")

into test.js

#

then node test.js
it'll print Hello world

raw nest
wheat mesa
#

What

raw nest
lyric mountain
#

then u go more intricate, with conditionals, functions, classes, etc

wheat mesa
#

import static System.out; and then out.println("Hello world"); 😉

lyric mountain
#

a calculator is the perfect project to start, since it involves all of them

#

when u finish, just build it into and executable (or whatever u use to run a js file from PATH) and run it

#

u can also just run the script directly by setting an alias

raw nest
#

well is there a way I get it to run with npx create-aqua-app ?

lyric mountain
#

idk what npx is, but the concept is the same for all languages

#

build something executable and tell the machine where to find it

raw nest
#

nvm I got it^^ thanks

lyric mountain
#

unless u need a complex builder, just write a bash script

#

they're not that hard and work perfectly as buildscripts

raw nest
#

true but I want to learn a bit more about it and try some stuff like options and checking etc. ^^

boreal iron
#

I moved to, too

lyric mountain
#

powershell can go to hell

boreal iron
raw nest
#

even tho bash is also nice especially for beginners

lyric mountain
#

it's nice for all skill ranges

raw nest
#

yeah no questioning but for beginners to also learn the really basics and terminal stuff

lyric mountain
#

ah yes

raw nest
#

but yeah also for advances bash scripts can be very fun and also a challenge if you build a complex one

lyric mountain
#

I always make at least one for all my projects that are going to run in a vps

#

to set envvars, update from git, check files, clear logs, etc

raw nest
#

also nice and pretty helpful

boreal iron
#

Who knows maybe he aims to build stuff on Windows

sick agate
#

you can run bash stuff in Windows

#

with little bit cygwin stuff

boreal iron
#

That’s what a Linux subsystem is for

#

As it’s part of windows nowadays anyways

sick agate
#

well yeah but it's not that native as i know

boreal iron
#

Hmm just needs to be activated in the windows features

#

Shouldn’t even require an internet connection iirc

split hazel
#

anything to do with binary compilation and programming on windows that isnt made by microsoft themselves is hell

lyric mountain
#

even things made by microsoft themselves is hell

#

look at windows search feature

split hazel
#

bro my os is so fat the editor linting takes ages

#

think thats a good sign

wheat mesa
#

@earnest phoenix do you happen to know what the approximate size of a js number type is in v8? I know there’s object overhead and such, but not sure of the actual size

split hazel
#

too fucking big

#

this is why discord js's caching tactics are not best suited for javascript 💀

#

for c++ probably as proven by brain

#

caching everything yet the memory footprint is tiny

#

@green kestrel bet that makes you happy

earnest phoenix
wheat mesa
#

Jesus

earnest phoenix
#

But after some considerable optimization (on the fly of course), it usually settles on 8 bytes or less depending on the size of the number itself

#

Although the optimizations barely apply in some edge cases that usually never happen, or happen way less

wheat mesa
#

Oh alright

green kestrel
#

30 bytes for a damn 8 byte 64 bit value

#

I laughed

#

it'll be a string

earnest phoenix
#

You can't really expect much from an interpreted language, it's even bigger in Python's internal side

green kestrel
#

because even bigint stores stuff as a string

wheat mesa
#

v8 is a fucking powerhouse to be fair

green kestrel
#

lol

#

less powerhouse more dead horse

wheat mesa
#

The language wasn’t even meant to be as performant as v8 has made it

#

Pretty incredible how fast it’s become

green kestrel
#

it was never meant to be for backend work, node is a crutch

wheat mesa
#

I think it’s a great backend language if you don’t need incredible speed

green kestrel
#

at scale you often do need incredible speed

wheat mesa
#

My uncle used to work in the industry in the 90s-2000s, he said that they would write their apps and such in Java, and anything that needed to be fast they would just write in C

green kestrel
#

yeah java is still more efficient than js

wheat mesa
#

Not back then

green kestrel
#

java at least stores native types in a sane format in ram

wheat mesa
#

(Compared to v8 now)

green kestrel
#

java has never used 30 bytes to store a 64 bit int

#

not even close

wheat mesa
#

There’s big differences between the languages

green kestrel
#

sure, javas garbage collector was more garbage than collector back then ...

wheat mesa
#

I’m sure that v8 now was way faster than the JVM then

green kestrel
#

but it was still pretty efficient at storage, it needed to map 1:1 with native types for jni

#

just the collector never freed stuff

earnest phoenix
#

Well when I said 30 bytes that's just an approximate, I haven't even checked the size in a while as they change often, but looking at it now, it would probably be around 15 bytes or less now

#

While even optimized to be way lower on the fly

green kestrel
#

it has to be the length of the value as a string plus \0 terminator or length count

#

so 18 is reasonable minimum

wheat mesa
#

I’m sure it’s a complex system of optimizations

green kestrel
#

nope

#

you can see the source

#

there are optimisations on calculations done with it, and assignments

wheat mesa
#

At runtime

green kestrel
#

V8 is designed to run fast not take small amount of ram