#development

1 messages · Page 2009 of 1

simple stump
#

I don't believe so. I'll double check

#

Yeah only 15 options.

proven lantern
#

["Hello!", "https://hello.com/"] is this res?

simple stump
#

Yes

proven lantern
#

ah

simple stump
#

wait

#

no

#

sry its a json object in an array

#
[
  {
    "text": "Hello",
    "url": "https://hello.com/",
  },
  {
    "text": "asdf",
    "url": "https://asdf.com/",
  }
]
split hazel
#

tfw your laptop only has 4gb ram but the ssd is so fast you dont notice the performance change because of swap

#

those nand chips be getting tired tho

wicked pivot
simple stump
#

aight

simple stump
#

yea same thing

#

options logs

[
  { label: 'asdf', value: 'asdf' },
  { label: 'asdf', value: 'asdf' },
  { label: 'asdf', value: 'asdf' },
  { label: 'asdf', value: 'asdf' },
  { label: 'asdf', value: 'asdf' },
  { label: 'asdf', value: 'asdf' },
  { label: 'asdf', value: 'asdf' },
  { label: 'asdf', value: 'asdf' },
  { label: 'asdf', value: 'asdf' },
  { label: 'asdf', value: 'asdf' },
  { label: 'asdf', value: 'asdf' },
  { label: 'asdf', value: 'asdf' },
  { label: 'asdf', value: 'asdf' },
  { label: 'asdf', value: 'asdf' },
  { label: 'asdf', value: 'asdf' }
]

and this is my select menu code:

const embed = new Discord.EmbedBuilder()
  .setColor(0x2f3136)
  .setTitle("Results")
  .setDescription("Select which site you want to use!")
  .setTimestamp();

const selectMenu = new Discord.ActionRowBuilder()
  .addComponents(
    new Discord.SelectMenuBuilder()
      .setCustomId("website-" + interaction.member.id)
      .setPlaceholder('Select')
      .addOptions(options),
);

message.edit({ embeds: [embed], components: [selectMenu] });
#

when setting label and value to asdf

solemn latch
#

thats a really unique scenerio, can you not just set it as a variable for each layer of iframe?

wicked pivot
simple stump
#

oh ic. that might be why actually. ty.

wicked pivot
simple stump
hollow depot
#

im using electron js, i keep getting this error, even if all the modules are imported with import module from "module", what can i do?

near stratus
hollow depot
#

nope

near stratus
#

make it say

hollow depot
#

wait, i'll try

near stratus
#

nvm I'm a chicken
ignore me

hollow depot
#

wha t😀

bright dagger
#

Does anyone know why these variables don't work for me?
is that it gives me an error when I put it in playing
${client.guilds.cache.size} servers, ${client.users.cache.size} users

wheat mesa
#

And what’s the error

bright dagger
#

it doesn't give me the answer

wheat mesa
#

.size is a function not a prop isn’t it? Haven’t done anything like that in a while

hollow depot
cinder patio
#

nah it's a proper

wheat mesa
#

Interesting

bright dagger
#

is that I want the state of the bot to put me on how many servers it is in total and how many users there are in total on all the servers

wheat mesa
#

Been doing too much Java recently KEKW

#

You haven’t shown an error

#

We need to see an error if you said there’s an error

bright dagger
#

it doesn't give me the answer

wheat mesa
#

What?

hollow depot
#

can you post a screenshot?

#

like, what does it do

cinder patio
#

Maybe that code doesn't get executed at all

wheat mesa
#

The information given isn’t enough for us to know what’s going on

#

We’re just speculating potential issues, you have to describe more about your issue for us to help @bright dagger

bright dagger
#

the bot does not take the variable

cinder patio
#

You need to use ```

#

`

#

quotes instead of " or '

bright dagger
#

playing: '.help or .h | juancitocubo Is GOD | ${client.guilds.cache.size} servers, ${client.users.cache.size} users'

#

how do you say to put it

wheat mesa
#

You need backticks

#

``

earnest phoenix
bright dagger
#

playing: '.help or .h | juancitocubo Is GOD | ${client.guilds.cache.size} servers, ${client.users.cache.size} users'

wheat mesa
#

Use backticks, we’ve said it a few times now

#

Replace your single quotes with backticks

bright dagger
#

ok ready

#

but it stays at 0

wheat mesa
#

That means you have nothing cached

bright dagger
#

ok and then what do i do

wheat mesa
#

Cache is not a reliable way to tell how many servers your bot is in or how many users it has

bright dagger
#

And how do I find out exactly?

#

How many servers is my bot on?

neat ingot
#

this was totally worth a 5 minute scroll lmao

snow vector
#

my bot is in in 77 servers however i am not able to verify it there is no option on the site and i have not received the dm yet. What should i do?

simple stump
#

Found the answer to my previous question. Now I'm just a bit stuck since I have this array:

[
  {
    "text": "My Website",
    "url": "https://mywebsite.com/"
  },
  {
    "text": "Another Website",
    "url": "https://asdf.com/"
  }
]

And I wish to convert it to this:

{
  "label": "My Website",
  "url": "https://mywebsite.com/"
},
{
  "label": "Another Website",
  "url": "https://asdf.com/"
}

The reason for this is that I'm trying to send a select menu, but since I'm using DJS v14 (the development build), I was told that options can only take rest parameters. To my understanding, I can't store an array as the options, only a JSON object (correct me if I'm wrong haha). I got about as far as this:

let options = res.map(({text,url}) => ({label: text, value: url}));

const selectMenu = new Discord.ActionRowBuilder()
  .addComponents(
    new Discord.SelectMenuBuilder()
      .setCustomId("website")
      .setPlaceholder('Select')
      .addOptions(options),
);

But then get the error that label and value are required fields:

DiscordAPIError[50035]: Invalid Form Body
components[0].components[0].options[0].label[BASE_TYPE_REQUIRED]: This field is required
components[0].components[0].options[0].value[BASE_TYPE_REQUIRED]: This field is required
simple stump
snow vector
#

"Until your bot is verified, you will not be able to grow past 100 servers. If your bot is already in more than 100 servers, it will not be able to join any more."

simple stump
#

Sorry, 100 servers for verification

glacial sun
#

Fake servers won’t work

simple stump
#

If I have this:

{
  label: "item1",
  value: "value"
}

How would I "add on" to that since it doesn't have a specific key/property?
Goal:

{
  label: "item1",
  value: "value"
}

->

{
  label: "item1",
  value: "value"
},
{
  label: "item2",
  value: "value2"
}
cinder patio
#

You put it inside an array and add another object

snow vector
#

sorry im very new with this but what does this mean, i have added my bot to my server and its fine...

simple stump
#

This is for select menus which only take a singular JSON object unfortunately. So this works:

{
  label: "item1",
  value: "value"
},
{
  label: "item2",
  value: "value2"
}

But this doesn't:

[
  {
    label: "item1",
    value: "value"
  },
  {
    label: "item2",
    value: "value2"
  }
]
near stratus
cinder patio
#

or values

simple stump
#

I was told from the DJS Discord thing that now select menus only accept rest parameters for options

cinder patio
#

.addOptions({...}, {...}); then

simple stump
#

I need to loop through an array of JSON objects, though which is what I'm mostly stuck on

#

since if i were to map it the object would end up in an array

cinder patio
#

.addOptions(...array)

simple stump
#

sry im not trying to make things difficult im kinda stuck on this myself

cinder patio
#

Alright then show code and error

simple stump
#
let options = res.map(({text,url}) => ({label: text, value: url}));

const selectMenu = new Discord.ActionRowBuilder()
  .addComponents(
    new Discord.SelectMenuBuilder()
      .setCustomId("website")
      .setPlaceholder('Select')
      .addOptions(options),
);
DiscordAPIError[50035]: Invalid Form Body
components[0].components[0].options[0].label[BASE_TYPE_REQUIRED]: This field is required
components[0].components[0].options[0].value[BASE_TYPE_REQUIRED]: This field is required

res is an array of JSON objects:

[
  {
    label: "My Website",
    value: "https://website.com/"
  }
]
cinder patio
#

.addOptions(...options)

earnest phoenix
#

hello

#

weird question

simple stump
#

That returns the error:

DiscordAPIError[50035]: Invalid Form Body
components[0].components[0].options[0].label[BASE_TYPE_REQUIRED]: This field is required
components[0].components[0].options[0].value[BASE_TYPE_REQUIRED]: This field is required
#

wait lemme try again rq i mightve changed smth sry

earnest phoenix
#

is there a limit on how many bots you can upload?

#

my last bot keep getting deleted and i don't know why,...

simple stump
sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

earnest phoenix
#

ok, thx

#

just didn't get a reason

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

solemn latch
#

-notified

gilded plankBOT
#

If your bot is approved:
You'll get a DM from @gilded plank and you'll be assigned the <@&265125253443878912> role here.

If your bot is declined:
You'll get a DM from @gilded plank and you'll also get a ping in #mod-logs.

💡 Please make sure you have your DMs activated for this server.

earnest phoenix
#

thx byw

neat ingot
#

Today I learned...

sudden geyser
#

yeah that exists

#

but you can only have five of them :(

neat ingot
#

awww really? 😭

#

is that 5 each for user and message contexts? or 5 in total for both?

sudden geyser
#

for user and message

neat ingot
#

im tempted to just make a bunch to test 😛

#

i get that there is limited real estate tho

#

awww, 5 in total? lame.
nvm, got 5 working for each user and message. 🙂

neat ingot
snow vector
#

how do i set that

neat ingot
#

turning that off on dev portal might remove the error, but that might not be ideal

snow vector
#

how do i set the invite link

neat ingot
#

the default authorization link

#

but im only guessing, idk for sure if thats what is causing the issue

solemn latch
#

its probably referring to the default authorization link more specifically

neat ingot
#

yea, thats the button you get when you set it up ^

snow vector
#

ok

#

thank you it worked

earnest phoenix
#

if (!message.member.permissions.has(command.userPermissions || [])){
            if(command.userPermissions.length > 1){
                return message.reply(`This Command Requires the User Permissions: \`${command.userPermissions}\`.`)
            } else {
                return message.reply(`This Command Requires the User Permission: \`${command.userPermissions}\`.`)
            }
        };
    
        if (!message.guild.me.permissions.has(command.botPermissions || [])){
            if(command.botPermissions.length > 1){
                return message.reply(`This Command Requires the Bot Permissions: \`${command.userPermissions}\`.`)
            } else {
                return message.reply(`This Command Requires the Bot Permission: \`${command.userPermissions}\`.`)
            }
        };```
#

is this working?

#

because it mixed up the user and bot perms

boreal iron
#

You can pass an array of permissions to has() but you can't use a logical operator in there

boreal iron
#

to has()

#

has(["permissions1", "permission2"])

earnest phoenix
#

.has(command.userPermissions || [])

#

there?

boreal iron
#

Yes, as I said you can't use logical operators (||) in there

#

not OR not wouldn't make sense anyway

earnest phoenix
#

so if I first check it there is anything

#

and then

#

if .has(command.userPermissions)

#

correct?

#

without || []

boreal iron
#

What do wanna check actually?

#

Just if the member has a single permission - or more - or less?

earnest phoenix
#

any

boreal iron
#

What's command.userPermissions

#

An array?

earnest phoenix
#

yes

boreal iron
#

Then simply remove || []

snow vector
#

how long does this usually take as i am already in 98 servers lol

wheat mesa
#

A long time

#

Especially considering it’s almost April

earnest phoenix
snow vector
boreal iron
wheat mesa
boreal iron
#

Since you still can't use logical operators in has()

#

Or use a shorthand statement

#

...has(((command.userPermissions) ? command.userPermissions : []))

#

whatever command.userPermissions is in your case if the user hasn't any

#

Just make it an empty array...

neat ingot
#

wth since when did digitally signing your app require an annual fee?

#

i swear ive made apps in the past that were signed, but apparently now you can only get certificates from some authority 😦

#

maybe im wrong lol

boreal iron
#

creating a simple self extracting batch adding the app to the ms defender as safe is easier and cheaper

neat ingot
#

its so that when users go to download it, it doesnt show as some untrusted dev app

#

and run it too i guess

boreal iron
#

That's what I'm doing in my installer...
powershell -Command "& { Add-MpPreference -ExclusionPath "%DIR_APPROOT%" -Force }"

#

problem solved

neat ingot
#

how that that actually help tho? im confused lol

boreal iron
#

not when downloading and installing but when running the app from the app root

#

if you don't wanna pay cash

#

I mean installing it once with admin permissions skipping the app is unsafe shit and that's it

neat ingot
#

I've never had a problem with running the electron apps I've created and installed

#

no asking for perms, or any of the untrusted app flags

#

but i need to digitally sign my app to use electrons auto updater feature

#

so unfortunately that does not fix my problem 😛

split hazel
#

electron 💀

#

@quartz kindle @boreal iron bro i need you guys

#

i dont think i can live like this

boreal iron
#

well then bai

split hazel
#

so i got a new laptop yeah (btw thanks for the office thing tim)

boreal iron
split hazel
#

and because of many software i am locked into the windows ecosystem

boreal iron
#

OH NO how dare you

split hazel
#

and like how am i gonna compile and run MY FUCKING OS

boreal iron
#

Install the linux subsystem if you need it tho

split hazel
#

windows does not have the tools i need to turn my os binary into an iso let alone compile it

split hazel
#

how interactive is the bridge between windows and linux

#

if that makes sense

#

like can windows access the filesystem

boreal iron
#

Is a fully workable linux environment you can access and use also from the windows command prompt

split hazel
#

bro set me

#

how lmao

#

i cant stand a minute longer without my os

boreal iron
split hazel
#

ah i never knew that existed

boreal iron
#

unfortunately our Indian tech scammer guy got banned

#

That exists for a long time in Windows (10)

#

But the first implementation was a desaster

split hazel
#

if its not this message is awkward

boreal iron
#

It has recently become a real powerful and fully usable environment

boreal iron
split hazel
#

what did bro do

#

but yeah i'll check it out

boreal iron
#

Idk just saw the ban in mod-logs by accident

split hazel
#

long shot but can i also run gui programs in the subsystem

#

like qemu

#

i mean theres a version for windows but like

boreal iron
#

I think you can even use a GUI distro, yes

#

Test it out

#

System > Windows Apps > Install / Remove WSL

#

just a few clicks

split hazel
#

nice

#

thanks

#

by the way look at this

#

one chrome browser 💀

#

might switch to another browser

#

too much ram

#

i mean yeah i have swap and the ssd is fast af so i wont notice and performance issues but like

#

the nand chips will suffer 💀

boreal iron
#

I can't complain

split hazel
#

bro is there like a windows tweak or something

#

that disables some of the useless background tasks

#

my battery is not great with this kind of activity

boreal iron
#

Yes, disable the apps doing them

#

Or entirely remove them

split hazel
#

what if 99% are windows services 💀

#

if i wasnt locked into windows i wouldve installed kubuntu on here already

boreal iron
#

Open PS
Get-AppxPackage | Select Name, PackageFullName, NonRemovable
Remove Apps
Get-AppxPackage Microsoft.<appname> | Remove-AppxPackage

#

Whenever it's a related OS service it will throw an error

#

anything else can just be removed

split hazel
#

interesting

#

i saw a guy install a stripped version of 11 and it halfed his memory usage

boreal iron
#

Eww please let's not talk about the 11 shit

split hazel
#

😠

#

i literally went out of my way to install 11

boreal iron
#

Worst Winshit ever

split hazel
#

10 was preinstalled here

#

it looks nice tho helps you get bitches

boreal iron
#

Wait until 10 expires, then wait until they delayed the expiration, wait until the delay got delayed, then wait 5 more years, then install Windows 20, but not 11 please

split hazel
#

bro hates 11

boreal iron
#

Because it's trash on so many levels...

#

Espacially with tons of hardcoded stuff you could manipulate in 10

split hazel
#

only thing i really dislike are the context menu "additional options" and more bloat

#

oh and the stupid soft requirements

#

like tpm

#

dont think windows handles battery life well either

#

the surface pros are amazing but the battery sucks ass

#

but you pay the price for all the decked out components

#

in class im prob gonna be hooked up to the charger 24/7

quartz kindle
#

anyone heard of nikolas/github-drama?

#

lmao

boreal iron
#

Enlighten us

quartz kindle
#

im finding so many amusing stuff

split hazel
#

no but i will in a second

boreal iron
#

How do you have time to search for stuff like that, Tim?

quartz kindle
#

its a compilation of github drama and disagreements on various repos

#

this one is from the nodejs repo

split hazel
#

bruh

neat ingot
#

wth

quartz kindle
#

there's a repo where someone tried to change their MIT license to include a clause to ban a list of big companies from using it

boreal iron
#

just proofs once again the world would be better without humans

quartz kindle
#

check this

#

another unrelated thing which i found fun

sudden geyser
quartz kindle
#

xD

sudden geyser
quartz kindle
#

xDDD

earnest phoenix
#

i just figured it out

#

i was sending the userPermissions

#

not botPermissions

#

for bot perms

#

vice versa

boreal iron
# quartz kindle

Funny that people being called out for their personal opinions lmao

#

In which way does it matter if I hate groups, minorities, colors etc. when coding and/or supporting/helping people

#

It's not like people ask for the other guys religion, skin color, ethnique or whatever before talking to him

sudden geyser
quartz kindle
#

im reading the entire thread @_@

#

im not even gonna comment about it because obvious reasons lmao

sage bobcat
#

One message removed from a suspended account.

quartz kindle
#

@sage bobcat @sage bobcat

boreal iron
sudden geyser
#

but that work involves the people KyoukoLaugh

boreal iron
#

Quiet, now!

sudden geyser
#

@quartz kindle found some more

boreal iron
quartz kindle
boreal iron
#

oh no...

#

I need a base64 regex

split hazel
#

its so difficult to use

#

without going through years of university on machine learning/data science and graduating with honors good luck making a model from scratch with tensorflow

#

there is no set tutorial on how to make a model and configure it either

#

i mean it is a wide field and there are so many props to tune but

sudden geyser
#

is it because tensorflow is targeting more advanced users or is just hard to use in general

split hazel
#

i think so yeah

#

otherwise a normal user can really just use mobinet

#

though i did see a new library that aims to abstract tensorflow and make it more high level

boreal iron
split hazel
#
#

i might give it a try soon

#

looks really cool

#

you choose what problem you want to solve then give it data in a friendly object form

#

e.g. classification

#

and it has functions which normalise the data for you on the fly

sudden geyser
#

a hundred comments into that transgender issue and now here we are

boreal iron
#

base64 regex:
/^(?:[a-zA-Z0-9+\/]{4})*(?:|(?:[a-zA-Z0-9+\/]{3}=)|(?:[a-zA-Z0-9+\/]{2}==)|(?:[a-zA-Z0-9+\/]{1}===))$/

How would I require at least 43 chars for the entire haystack

sudden geyser
#

uh maybe wrap the thing with (?:...){43,}

boreal iron
#

I did

#

err I did something wrong, maybe, lemme check

boreal iron
#

yeah messed up one char

sudden geyser
#

killed his credibility with one word

boreal iron
#

doesn't work

#

/^(?:(?:[a-zA-Z0-9+\/]{4})*(?:|(?:[a-zA-Z0-9+\/]{3}=?)|(?:[a-zA-Z0-9+\/]{2}==)|(?:[a-zA-Z0-9+\/]{1}===))){43}$/

#

YV30V4wp6WH+zh/VaA/2VLFUCEqn5h22RD9m80GQ4Jk=

#

valid

#

44 chars

#

YV30V4wp6WH+zh/VaA/2VLFUCEqn5h22RD9m80GQ4J

#

also valid

#

42 chars

#

nvm

#

Can also just check for 43 chars only including the chars from the pattern

quartz kindle
#

lmao

acoustic rover
#

funny meme

earnest phoenix
#

dont wanna be converted

earnest phoenix
#
    async updateUserById(
        @Param(new OnlyValidationPipe()) params: FindUserDto,
        @Body(new OnlyValidationPipe()) updateUserDto: UpdateUserDto,
        @Res() res: Response,
        @Req() req: Request,
        @UserSession() session,
    ) {
        await this.userService.update(params.userId, {
            updatedAt: Date.now(),
            ...updateUserDto,
        });

        req.session.user = { ...session, ...updateUserDto };

        return res.status(200).send({
            message: 'Successfully updated user',
        });
    }

So I made a endpoint with nestjs of updating a user, but the issue is when updating I don't update the session user (which is what is used to return the currently logged in user's info). I am unsure if how I am doing it is logical or if there is a better way req.session.user = {...}

bright thorn
#

Pm2 automatically cloning the process

#

And my bot give me multiple response

#

But when i do pm2 list its shows only one process

#

Who can i fix?

lyric mountain
#

You need to show the code

#

Or at least some images

lament rock
#

takes a whopping 2min for a whole cluster with 3 shards to be ready. Does Discord take this long for others or is it just my logic

lament rock
#

Can someone explain this witchery

#

apparently guildID is being passed as a bigint

marble juniper
#

then convert it to one

lament rock
#

Not a solution I can implement since the websocket I'm using for my lib is converting the IDs to bigint when it shouldn't be doing that

#

Gotta fix my websocket implementation

split hazel
#

that's the reason we all work anyways

bright thorn
#

any one can help

#

in one process bot sending multiple responses

near stratus
#

try rebooting the pc / vm

timber fractal
#

I'm making a web dashboard, but I keep getting an error that the token is invalid. That can't be true, cause the exact same token and code works when I run it on my own pc, or when I run it on repl.it, but when I run it on my own website, it keeps giving an error that the token is invalid. What could cause this, and how can I fix it?

#

(discord bot token)

sudden geyser
#

Later in the issue he says that he'd still accept code from someone who beat and raped his mother as long as it's good code, which makes it quite obvious

#

It's very easy to say "who you are outside doesn't matter here" but it's unrealistic. Now when people think of Opal, they think of douchebags like meh

ancient nova
#

if I run it and add a "text" it returns true and if I run it and do "_ a_" if returns false

boreal iron
#

It’s a valid base64 check

#

There aren’t any whitespaces in there, never

ancient nova
boreal iron
#

Why is that weird?
There aren’t whitespaces in a valid base64 encoded string

ancient nova
#

also does anyone know an easy way for a login system in nodejs?

#

preferably a simple API one

ancient nova
timber fractal
#

I've checked it many, many times, compared both, it just won't work.

ancient nova
#

how so? show me screenshots of both clients

cunning kiln
#

Did You Make Website From Replit

ancient nova
timber fractal
timber fractal
ancient nova
#

because this seems like an API issue

timber fractal
#

Yes.

#

It's an error from the discord.js library, tho.

ancient nova
#

then maybe check with the discord.js lib developers

#

or just delete the string in the library that is causing the error and see what happens 🤷‍♂️

timber fractal
#

Error [TOKEN_INVALID]: An invalid token was provided. at WebSocketManager.connect (node_modules/discord.js/src/client/websocket/WebSocketManager.js:129:26) at Client.login (/node_modules/discord.js/src/client/Client.js:254:21)

cunning kiln
#

If I understand something wrong

#

Sorry

ancient nova
# cunning kiln Sorry

he may just be entering a wrong token I don't see a reason it would say it's wrong if it wasn't actually wrong

slender thistle
#

@timber fractal What d.js version are you on? Are you sure the token you have is correct?

boreal iron
#

I remember a similar case of of guy in here finding out after days he just accidentally entered a whitespace before or behind his token

slender thistle
#

Lmao

boreal iron
#

I mean he was blaming the shit discord devs server, the shit djs server - no one helped him just to find he caused the issue

slender thistle
#

🤣

ancient nova
#

it will tell you always when there's an unicode

#

even the no width unicodes it will highlight it

dry imp
#

use notepad

boreal iron
#

Well like any app supporting syntax highlighting can show you that

#

Not really any kind of magic tho

ancient nova
#

ALSO does anyone PLEASE know how to make VERY SIMPLE login system, I DO NOT want register, just store the strings somewhere in the cloud, I only want to be able to look at the logins and modify them
and to check login just something VERY VERY SIMPLE as such:
let loginCheck = API/PACKAGE or whatever necessary.
loginCheck.login(Username, Password) => will return false for wrong passwords and true for right passwords.

ancient nova
cinder patio
#

If you're looking for a one-liner for a login system you won't find it anywhere lol

#

but you can get close

lyric mountain
boreal iron
#

If it’s supposed to be thatsimple why don’t u doing it yourself?

lyric mountain
#

also you said u don't want to register

ancient nova
#

cause I don't know how lol

lyric mountain
#

but then the user would not have a password

#

you cant login without registering

ancient nova
#

it's an admin type login thing

lyric mountain
#

SELECT 1 FROM users WHERE login = :login AND password = :pass

boreal iron
boreal iron
#

As easy as that

lyric mountain
#

sql

ancient nova
#

that's sql?

boreal iron
cinder patio
#

-> Hash password and upload them to the cloud, possibly with the bcrypt library
-> When a person is logging in compare passwords
-> Ez

ancient nova
#

seriously lol

lyric mountain
#

...that's the most universally known sql example btw

cinder patio
#

4 lines of code

ancient nova
#

I never used sql before

lyric mountain
boreal iron
cinder patio
#

well then just compare passwords???

#

passwordFromCloud === userPassword

ancient nova
lyric mountain
#

read the examples

cinder patio
#

but you said you'll be storing the passwords on the cloud? What do you need sql for

lyric mountain
#

make a simple table with name + login + password

cinder patio
#

Unless you're hosting the database on a different server

#

but I don't think that's what you meant

ancient nova
#

not really, I was hoping I could just host it on glitch.com or something

#

see the logins and be able to modify everything from there

boreal iron
#

Public repo with unhashed passwords

#

lmao

lyric mountain
#

I mean, you COULD hardcode the login + pass combo in the code

#

but then you'd need to restart on every single alteration

ancient nova
#

pass encrypted passwords to the API and encrypt them after getting them from the API

ancient nova
#

wait let me show u

lyric mountain
#

oh god

boreal iron
#

I mean you can also generate simple login combinations for example by using diggest, read the file and check if the entered combination is correct

#

If it has to be that simple

ancient nova
#

it's literally just an if statement

#

😦

ancient nova
boreal iron
ancient nova
boreal iron
#

Jason db - always the winner freerealestate

winter pasture
#

Who would ever hardcode passwords in production env?
My old company: 🙈

ancient nova
#

wait instead of a one liner, would it be possible to do a one-scripter?

#

just a one simple script with 3 functions, addpassword, deletepassword and a public function checkpassword

lyric mountain
#

better yet, make a webpage where pass is hardcoded on source code

#

kekw

ancient nova
#

and a json file where passwords will be stored

#

WITH ENCRYPTION

lyric mountain
#

encryption wont save u if the pass is visible by pressing F12

#

you see, unless it's hashed it can be reversed

ancient nova
lyric mountain
#

someone WILL reverse it

ancient nova
lyric mountain
#

we're talking about the internet

ancient nova
#

well I still doubt my program will get popular enough for someone to want to crack it so I don't see a need to

boreal iron
lyric mountain
#

I wouldn't risk it

#

especially since making an sqlite auth system is easy enough

ancient nova
#

and I doubt even with this knowledge you'd decrypt it

lyric mountain
#

if it can be reversed, it will be reversed

ancient nova
lyric mountain
#

why do u think all sane business use unreversible hash for credentials?

boreal iron
#

Just use existing algorithms like sha

lyric mountain
#

they have enough money to hire a master encrypter to make an uncrackeable algo

ancient nova
boreal iron
#

Even md5 is better than a decryptable password

split hazel
#

so when the database gets breached the passwords cannot easily be reversed back to text

lyric mountain
#

even checksum damn

ancient nova
#

if I wanted undecryptable encryption I would just use AES

lyric mountain
#

"undecryptable encryption" doesn't exist sir/madam

split hazel
#

aes you can basically breach through brute force

ancient nova
ancient nova
split hazel
#

right

lyric mountain
ancient nova
boreal iron
timber fractal
cinder patio
#

Use brcypt and just move on with ur life

#

bcrypt

#

2 extra lines of code

lyric mountain
#

gave it a search, u need a lib for that

#

or implement ur own algo

#
ancient nova
lyric mountain
#

no

boreal iron
#

_Was speaking a real language _

#

Not JS

timber fractal
ancient nova
boreal iron
#

Not really

ancient nova
#

how about python then .-.

lyric mountain
ancient nova
#

it's slower, less compact

#

and syntax is terrible

boreal iron
#

Py doesn’t have a crypto module?

#

or extension

lyric mountain
#

lib too

ancient nova
boreal iron
#

However it’s called there

lyric mountain
#

HOWEVER, it does support md5 natively

ancient nova
#

I think I'll just stick with a json file

#

I'm too tired

#

to think

#

right now

lyric mountain
#

oh wait, sha too

#

yep, python has native support for most hashes

boreal iron
#

There you go

lyric mountain
quartz kindle
#

js has native crypto lul, both node and browser

lyric mountain
#

database + hashed passwords

lyric mountain
quartz kindle
#

ye

ancient nova
quartz kindle
lyric mountain
#

ah

hybrid cargo
boreal iron
#

Oh oh

quartz kindle
boreal iron
#

Ban incoming

#

Bai Tim

hybrid cargo
#

now thats even more sus

quartz kindle
#

lmao

lyric mountain
#

that'll cover the database part

lyric mountain
ancient nova
lyric mountain
#

...it does right in the npm readme

ancient nova
#

I just need 3, deletePassword, createPassword and a public one checkPassword

boreal iron
#

Those are simply 3 queries you do in your code

lyric mountain
#

why createPassword and deletePassword if you'll be the one setting them?

ancient nova
lyric mountain
#

but why?

boreal iron
lyric mountain
#

just modify the database directly

ancient nova
#

to make my life easier

ancient nova
lyric mountain
#

DBMs exist, just open the sqlite file and add the data there

#

if all the data will be final on the user's side just have a function to check if both login and password hash match

cinder patio
#

How many passwords are you going to be storing?

ancient nova
#

that's why no registration

cinder patio
#

Then why not only have 1 hardcoded password?

ancient nova
cinder patio
#

server-side of course

ancient nova
#

probably something of these sorts -> a VIP user -> an Admin -> and an owner flags

ancient nova
#

I just found this

#

it seems pretty simple

#

you think I should use this instead?

cinder patio
#

I don't know I haven't read it yet

#

but I'm gonna say probab;y

#

probably

ancient nova
#

yep, and I hope I'm doing the right thing by doing it in glitch.com

#

I think it's got everything I need

#

delete, patch, put and get

#

and it's got builtin salt encryption

#

PLUS FLAGS

#

no way

earnest phoenix
#

Even though I define ClientEvents as cjs, I can't define it as esm, any ideas?

earnest phoenix
cinder patio
#

Every time I install jest I remind myself that it's a 40MB library and start to cry 😩

ancient nova
#

why does my API on glitch keep going to sleep when I close out of the website

quartz kindle
#

you need to do like the error says

#

import djs from "discord.js"

earnest phoenix
quartz kindle
#

then djs.ClientEvents

earnest phoenix
#

my bot is full slash but idk which to choose

Global command: need to wait few hour to registered to the guild
Guild command: Only for few or one server

boreal iron
#

Well global commands of course

quartz kindle
#

if the command should be able to be used in all guilds, then global

boreal iron
#

You only need to register them once

earnest phoenix
#

but need to wait one or few hour

boreal iron
#

only one time yes

#

At the moment your register them

earnest phoenix
boreal iron
#

You register (new) slash commands just one time

#

They will be rolled out to all guilds then

#

In about an hour or less, yeah

earnest phoenix
#

ok

boreal iron
#

You don't need to register them again of course

#

If you register commands on any startup, what we've seen in here quite a lot, you're doing it wrong

earnest phoenix
boreal iron
#

People like to copy and paste stuff into their applications, keep on registering those commands on any startup of their app

earnest phoenix
#

ok

#

but after few hour, the bot only register the slash command to the only server

#

why

ancient nova
#

why can't I start my nodejs server on glitch

#

it don't start

earnest phoenix
boreal iron
#

Well you don't register them as global commands then, means you're doing it wrong

earnest phoenix
#

hm

timber fractal
ancient nova
#

if I do app.get. how do I get something from an URL?

#

alright I guess I'm getting the hang of it

#

does anyone know how to keep the project up 24/7? :/

boreal iron
#

iirc seeing others talking about that, that's a tos break

ancient nova
#

what's a tos break?

#

you mean keeping a project up 24/7 is a tos break or what?

boreal iron
#

idk, I mean you're using the service, you should know the tos

ancient nova
#

@boreal iron u know how to return JSON?

boreal iron
#

wdym?

#

return myJsonVar;

#

or as content type?

ancient nova
#

trying to do it like this

JSON.stringify({key:request.query.username})
boreal iron
#

I mean that's correct

#

Just make sure the endpoint requesting this also has application/json as content type in his header

ancient nova
#

I think I got that handled

#

now for the encryption part

#

should I do it client side?

boreal iron
#

wtf

#

no

lyric mountain
#

security standards any% speedrun

ancient nova
#

I really have no other idea tho

lyric mountain
#

use hash to check if pass is valid

boreal iron
#

you gotta encode that on the server side

ancient nova
#

so after query is passed I encode it?

sage bobcat
#

One message removed from a suspended account.

lyric mountain
#

I don't really get why u insist in using decryptable credentials

boreal iron
#

your password is saved encrypted in your database, means you check if ( passwordEncrypting(query_password) === database set )

ancient nova
boreal iron
#

How is that easier?

lyric mountain
#

I mean, hashing is a single word

ancient nova
#

look

boreal iron
#

Just when somebody enters the password -> encrypt it -> check if it matches your database set

#

just 2 simply steps

lyric mountain
#

you wont be writing the whole sha256 algo

boreal iron
#

password entered -> encrypt -> check for database match

lyric mountain
#

you'll just use it

ancient nova
#

I'm planning to get the password client side, when the person inputs the password and username I'll send it to an my API, encrypted
it checks password and returns it, decrypted using server side and then compares it

lyric mountain
#

you don't need to decrypt a password at all

#

look, I'll make a console example

ancient nova
#

alright then

feral aspen
#
for (const property of dir.map(c => c.config.name)) availability.commands.push({ id: property });
await Availability.findOneAndUpdate({
    serverID: interaction.guild.id,
}, availability);

How can I do the opposite of this? Instead of pushing, I remove with the said property ID?

boreal iron
#
// md5
user_name = form.field.username;
user_pass = form.field.password;

sql.query("SELECT id FROM users WHERE username = 'user_name' AND password = md5(user_pass)");
#

as easy as that

ancient nova
#

@boreal iron if the json I get from sql database looks like this:

{
  "Usernamehere": {
    "password": "Zero"
  },
  "User123123": {
    "password": "Zero"
  }
}
``` how exactly do I read it?
boreal iron
#

why do you get a json from a sql database?

cinder patio
#

json you get from sqlite database 🤔

boreal iron
#

lmao

ancient nova
#

yea with all the info

quartz kindle
#

why would get it in that format

ancient nova
#

I want to compare usernames and get the password

cinder patio
#

don't store json in your db

boreal iron
#

you add a column username, password etc. in your user table

sudden geyser
#

Storing json in dbs isn't a bad thing

#

But here yeah

boreal iron
#

nope but here, yes

ancient nova
#

😐

#

this is confusing me

feral aspen
#

Welcome to programming.

boreal iron
#

how can a table confuse someone

sudden geyser
#

if they're not familiar with them

#

do you know what a Java record is smirk

boreal iron
#
id | username | password
 1 |     klay |     hash
boreal iron
feral aspen
#
for (const property of dir.map(c => c.config.name)) availability.commands = availability.commands.filter((val) => val.id !== property);
await Availability.findOneAndUpdate({
    serverID: interaction.guild.id,
}, availability);

Is this an efficient way to remove multiple objects from an array called commands?

cinder patio
#

the map is pointless

for (const thing of dir) {
  const property = thing.config.name;
  // rest of the code...
} 
feral aspen
#

Although, is it an efficient way to remove multiple objects.

cinder patio
#

As efficient as it can get I'd say, if you remove that map

feral aspen
#

👍

cinder patio
#

hmmm... wait no. You can do better

feral aspen
#

Hmm?

lyric mountain
#

this is just an example

#

in node you'd have less verbosity

#

for some reason browser crypto is async

#

@ancient nova cm here

slender thistle
#

A d.js bot my friend runs apparently has a memory leak somewhere

ancient nova
lyric mountain
#

it's an example

#

there's a reason I didn't paste the code as text here

ancient nova
#

I know, does this part go to the database or the server side?

lyric mountain
#

...copypaste that code and I'll haunt u forever

ancient nova
#

I WON'T

lyric mountain
#

it goes on server side

ancient nova
#

I'm just curious

lyric mountain
#

but wouldn't matter really

ancient nova
#

I want to switch to mongodb

#

sqlite too hard

lyric mountain
#

the important part is, the password isn't stored as plaintext

slender thistle
#

Is it

lyric mountain
ancient nova
#

I can't get sqlite to work no matter what I try

lyric mountain
#

that's because you're doing a security concern any% speedrun

#

go slow

ancient nova
#

I'm trying

lyric mountain
#

mongo only "seems" easier, you'll have just as much trouble down the road

lyric mountain
#

this would be your database data

ancient nova
#

I ust noticed something

#

how tf do I generate the "database.db" file??

lyric mountain
#

touch database.db

ancient nova
#

what?

lyric mountain
#

right click -> new file -> database.db

#

sqlite is literally a file

sudden geyser
#

Wait are you trying to write your own password hasher

lyric mountain
#

encrypter in her/his case

ancient nova
sudden geyser
#

Is that really a good idea

lyric mountain
lyric mountain
#

tf are u a him or a her?

boreal iron
lyric mountain
#

it's tiresome to keep writing like that

#

I'll just refer as it

boreal iron
#

how does that fucking matter my gosh

#

anything in the 'net is a HIM

#

until he cries about it

#

then it's still a him

slender thistle
#

They ftw

boreal iron
#

because we give a fuck

lyric mountain
#

ah yes, the "everyone is a fat 30yo guy unless proved otherwise" internet rule

boreal iron
#

guess you got it

#

I mean you're assuming someone to be a girl just because of an avatar

ancient nova
# lyric mountain nothing
let database = null;
async () => {
  database = await open({
    filename: path.join(__dirname, "database.db"),
    driver: sqlite3.Database,
  });
};
``` now what?
boreal iron
#

You're even more confusing to me

lyric mountain
ancient nova
cinder patio
ancient nova
#

why

cinder patio
#

database is going to still be null after the function because

  1. You never call it silly
  2. The open function is not sync so that'll happen waaay after the code outside the function is executed
quartz kindle
#

just use better-sqlite3

lyric mountain
#

ah yes, that one looks more clean

cinder patio
#

Or you can

(async () => {
const db = ...
// Rest of your code
}();
lyric mountain
ancient nova
#

ehhhhhhhhhhhhhhhhhhhhhhhhhhhh

#

okay give me a second

#

do I uninstall sqlite3?

lyric mountain
lyric mountain
ancient nova
# lyric mountain yes

can you send me an example of how to do above in the better version of sqlite or do I gotta figure it out by myself?

#

I fully understand if you don't wanna spoonfeed lol

#

better-sqlite3 froze my npm on install wot

quartz kindle
#

it takes a while to build

#

they ship it as a single large c++ file

ancient nova
#

makes sense

#

it's taking a lil long

#

it's still building

#

@quartz kindle is this normal?

#

I think it installed but it doesn't show in the dependencies json file

#

think the website stopped working

#

guys?

lyric mountain
#

back

#

is there any error in the console?

quartz kindle
#

youre using replit?

lyric mountain
#

glitch iirc nvm, it IS glitch

quartz kindle
#

hmm

#

sometimes those platforms kill the installer because it takes too long to build

#

it often works if you try again tho

ancient nova
#
/** DEPENDENCIES */
const express = require("express");
const app = express();

/** DEFAULT */
app.use(express.static("public"));
app.get("/", function (request, response) {
  response.sendFile(__dirname + "/views/index.html");
});

/** IMPORT DATABASE */
//const db = require('better-sqlite3')('database.db'/*, options*/);

/** GET PASSWORD */
app.get("/checkPassword", async function (request, response) {
  response.setHeader("Content-Type", "application/json");
  if (!request.query.username) return response.send(`Query "username" cannot be empty.`);
  if (!request.query.password) return response.send(`Query "password" cannot be empty.`);
  
  const username = request.query.username;
  const password = request.query.password;
  
  //const row = db.prepare('idk what to put here yet').get(username);
  //response.send(row);
});

/** PORT APP */
const listener = app.listen(80, function () {
  console.log("Your app is listening on port " + listener.address().port);
});

#

this is the main js file

#

don't know what's wrong with it

#

it kinda works now but doesn't start

neat ingot
#

your not responding with a valid value for your checkPassword call

#

do something glike respond.json({success:true});

#

not sure if thats the 'problem', or just one of... 😛

ancient nova
neat ingot
#

that seems like some kind of basic response.

ancient nova
#

it seems to have fixed it after I reset all npms

#

now I have to somehow fix the db

neat ingot
#

reinstalled?

ancient nova
#

although I have no clue how to at all

neat ingot
#

sorry, I'm not that good with sql

#

probably for your query it would be something like

SELECT * where username = ? AND password = ?```
#

but that could be way offf lol

ancient nova
#

I think that's actually right lol

neat ingot
#

😮 SnorlaxDab

ancient nova
#

after installing better sqlite again

#

it doesn't work

#

legit doesn't want to work

#

@quartz kindle your package is broken

neat ingot
#

lol check your console logs then 😛

#

not wanting to be rude, but its more likely your own code is broken than tims (not impossible tho) 😛

quartz kindle
ancient nova
#

nothing in the logs

ancient nova
quartz kindle
#

well i never had problems with it

ancient nova
#

did you ever use that package though?

quartz kindle
#

yes i use it all the time

ancient nova
#

hmm I'm unsure on what to do

#

should I just try installing it again

quartz kindle
#

are on you glitch or replit?

#

nvm

#

im blind

neat ingot
ancient nova
#

glitch, once I finish I'll go to repl.it since it's a free host

neat ingot
#

hey, i was right! 😄

ancient nova
neat ingot
#

missed a 'from users' type part, but otherwise, i wasnt wrong 😄

ancient nova
#

yep

quartz kindle
ancient nova
#

right

quartz kindle
#

btw how are you installing it? from the add package button?

ancient nova
#

npm i better-sqlite3

neat ingot
#

also: why glitch?

quartz kindle
#

use the add package button

neat ingot
#

just cause free?

ancient nova
#

unless you pay the app won't stay online

neat ingot
#

then even more why?!

#

how much is that fee?

ancient nova
#

that's why I want to move to repl.it once I finish

ancient nova
neat ingot
#

per month? year?

ancient nova
#

month

neat ingot
#

..............

#

.......

#

.....

#

..

cinder patio
#

no

#

it's $8 per month

quartz kindle
#

i pay 2.75 dollars per month

#

for my vps

neat ingot
#

who wants to launch a glitch rival? only 5per month! 😛

#

i pay like 6 euro ~ contabo vps

ancient nova
cinder patio
#

wtf Google is using glitch? 🤔

#

twitter & stripe too

neat ingot
#

for what?

cinder patio
#

idk

sudden geyser
#

Just because it's easy to host stuff there

ancient nova
neat ingot
#

google literally sells cloud services for hosting...

ancient nova
#

I can't add the damn sqlite3 NPM cause my program keeps FREEZING

timber fractal
#

@slender thistle Damn there actually whas a whitespace in the token, although I did check it... Still gives a different error tho, but the login seems to be successfull. Thanks for your support.

ancient nova
#

it's freezing on this

#

no matter how long I wait nothing happens

neat ingot
#

node gyp lol

sudden geyser
#

Yeah but going through the process to set it up probably exceeds that engineer's will compared to uploading it to glitch: pop, plop, and go

ancient nova
quartz kindle
#

i already told you why

sudden geyser
#

Like, Apple has their own public source license they could be using, but choose to use Apache instead

ancient nova
timber fractal
slender thistle
#

It won't be defined until your bot's cache is all ready to work with

#

Presumably until the ready event has been dispatched

ancient nova
#

Error: Could not locate the bindings file. for better-sqlite3 @quartz kindle installed idk 10 times, used enable-pnpm, installing from add package

#

nothing

#

works

cinder patio
#

for something so simple you could use MongoDB Atlas

#

512 MB free space, good enough

#
  • you can easily edit it online
ancient nova
#

I

#

FIXED IT

#

IT WORKS

#

okay now how do I add stuff to the DB database?

slender thistle
#

Does SQLite work on replit

ancient nova
#

no clue but I hope it does

earnest phoenix
slender thistle
#

Or replit database

earnest phoenix
#

idk replit database

slender thistle
#

Which has its own literal explanation in the Database tab

ancient nova
slender thistle
#

I don't think it ever did

ancient nova
#

;-;

#

which host can I use that supports this then?

#

right now I'm using glitch, but it doesn't host 24/7 so I want to switch

earnest phoenix
#

if you want 24/7 then buy a vps

craggy pine
ancient nova
#

there's free hosting out there I don't have to buy a host

#

especially since am not making any money from what I'm trying to do right now

craggy pine
#

Well you can keep trying to find free ones but they’ll likely continue to cause problems or for a low cost of around $2 / month you can get something you know for sure will do what you want.

slender thistle
#

Free hosting means something of your shit gets sold

#

Electricity and bandwidth isn't free

earnest phoenix
#

It's wrong to try to keep your bot active by pinging it because you're violating the glitch tos

craggy pine
#

^

slender thistle
#

Your best bets for free are replit and Glitch, but Glitch is off the table

earnest phoenix
#

Glitch isnt a hosting

slender thistle
ancient nova
#

repl doesn't work with sqlite and glitch doesn't host 24/7

slender thistle
#

Yup, Glitch isn't meant for hosting

#

Just use repl's database

earnest phoenix
craggy pine
#

^^^^^

slender thistle
#

Or that if you have money, yeah

ancient nova
#

like I said there's free host, the matter is to find the good one

slender thistle
#

Good luck bud

craggy pine
ancient nova
earnest phoenix
slender thistle
#

My free hosting is my friend paying for my $2 VPS monthly 😆

ancient nova
#

the thing doesn't want to wake up again

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
craggy pine
#

?

ancient nova
#

can anyone tell me why creating a table in SQL causes my app not to want to wake up

#

db.prepare("CREATE TABLE users");
db.prepare("INSERT INTO users (username, password) VALUES ('Zero', 'Root');")

earnest phoenix
slender thistle
#

Wew 8 nice

#

I'm fine with my 1 GB RAM

#

Or was it 2...

sage bobcat
slender thistle
earnest phoenix
ancient nova
#

SqliteError: no such table: users

boreal iron
#

probably the price when selecting 6 months payment etc.

ancient nova
#

@boreal iron how to create the damn table man

#

I don't know any SQL I can't figure it out

boreal iron
ancient nova
#

var createDatabase = db.prepare(
"INSERT INTO users VALUES (username, password)"
);

slender thistle
#

Maybe learn SQL, it's not hard

ancient nova
#

maybe it's my first damn time using it

slender thistle
#

Just maybe take a step back and the time to learn it

ancient nova
#

maybe I don't have that time

slender thistle
#

Do you not

ancient nova
#

no

earnest phoenix
ancient nova
#

I wouldn't be coming here every couple seconds if I had time

slender thistle
#

But you have the time to rush developing a bot

ancient nova
#

I'm not developing a bot

#

I'm making a database

#

least trying to

slender thistle
#

Oh wait no not a bot

boreal iron
#
CREATE TABLE `database`.`users` (`id` INT NOT NULL AUTO_INCREMENT , `name` VARCHAR(32) NOT NULL , `password` VARCHAR(64) NOT NULL , PRIMARY KEY (`id`)) ENGINE = InnoDB; 
slender thistle
#

("I don't have time" sounds more like "I suck at time management" to me)

boreal iron
#

I mean I'm not aware of your password length or user name length etc.

slender thistle
#
  • Learning SQL doesn't take hours I'd reckon. Google has a lot of examples
ancient nova
ancient nova
boreal iron
#

There has to be a (max) length

ancient nova
#

var createDatabase = db.prepare(
"CREATE TABLE database.users (id INT NOT NULL AUTO_INCREMENT , name VARCHAR(32) NOT NULL , password VARCHAR(64) NOT NULL , PRIMARY KEY (id)) ENGINE = InnoDB;"
);

slender thistle
#

You can use TEXT instead of VARCHAR, no?

ancient nova
boreal iron
#

text has 65.535 chars

#

Would be a damn long hashed password

ancient nova
#

SqliteError: unknown database database

#

what does this mean?