#development
1 messages · Page 2009 of 1
["Hello!", "https://hello.com/"] is this res?
Yes
ah
wait
no
sry its a json object in an array
[
{
"text": "Hello",
"url": "https://hello.com/",
},
{
"text": "asdf",
"url": "https://asdf.com/",
}
]
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
try to see by putting something other than a url if it works?
aight
same thing. i tried setting value as asdf. ill try label rq
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
thats a really unique scenerio, can you not just set it as a variable for each layer of iframe?
Two options cannot have the same value
oh ic. that might be why actually. ty.
I found it in every way (already tried and not working, where can be badly done) I'm out of ideas
That doesn't seem to be the issue weirdly enough. Even having one value doesn't work ig.
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?
does package.json say "type": "module" ?
nope
make it say
wait, i'll try
nvm I'm a chicken
ignore me
wha t😀
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
And what’s the error
it doesn't give me the answer
.size is a function not a prop isn’t it? Haven’t done anything like that in a while
nah it's a proper
prop
Interesting
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
Been doing too much Java recently 
You haven’t shown an error
We need to see an error if you said there’s an error
it doesn't give me the answer
What?
Maybe that code doesn't get executed at all
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
playing: '.help or .h | juancitocubo Is GOD | ${client.guilds.cache.size} servers, ${client.users.cache.size} users'
how do you say to put it
what
playing: '.help or .h | juancitocubo Is GOD | ${client.guilds.cache.size} servers, ${client.users.cache.size} users'
Use backticks, we’ve said it a few times now
Replace your single quotes with backticks
That means you have nothing cached
ok and then what do i do
Cache is not a reliable way to tell how many servers your bot is in or how many users it has
this was totally worth a 5 minute scroll lmao
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?
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
It needs to be 250 I believe.
"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."
Sorry, 100 servers for verification
Fake servers won’t work

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"
}
You put it inside an array and add another object
sorry im very new with this but what does this mean, i have added my bot to my server and its fine...
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"
}
]
sorry it should be "type": "commonjs"
That's wrong, a select menu accepts an array of options
or values
I'm using the dev build which changed a few things with how select menus work
I was told from the DJS Discord thing that now select menus only accept rest parameters for options
.addOptions({...}, {...}); then
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
.addOptions(...array)
I can't pass an array into options.
sry im not trying to make things difficult im kinda stuck on this myself
Alright then show code and error
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/"
}
]
.addOptions(...options)
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
is there a limit on how many bots you can upload?
my last bot keep getting deleted and i don't know why,...
yea nvm sry. i had a dumb syntax error. ty for your help and sry for wasting ur time
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.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
-notified
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.
i just joined the server thats why
thx byw
Today I learned...
for user and message
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. 🙂
...
any suggestions?
not entirely sure, but it might be because the bot is public, but hasnt set an in-app invite link yet
how do i set that
turning that off on dev portal might remove the error, but that might not be ideal
how do i set the invite link
the default authorization link
but im only guessing, idk for sure if thats what is causing the issue
yea, thats the button you get when you set it up ^
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
You can pass an array of permissions to has() but you can't use a logical operator in there
where?
Yes, as I said you can't use logical operators (||) in there
not OR not wouldn't make sense anyway
so if I first check it there is anything
and then
if .has(command.userPermissions)
correct?
without || []
What do wanna check actually?
Just if the member has a single permission - or more - or less?
any
yes
Then simply remove || []
how long does this usually take as i am already in 98 servers lol
no because if there is no userPermissions it will throw an error
what does that have to do with it
Then make sure if the user has no permissions userPermissions is an empty array
Message content intent
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...
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
creating a simple self extracting batch adding the app to the ms defender as safe is easier and cheaper
its so that when users go to download it, it doesnt show as some untrusted dev app
and run it too i guess
That's what I'm doing in my installer...
powershell -Command "& { Add-MpPreference -ExclusionPath "%DIR_APPROOT%" -Force }"

problem solved
how that that actually help tho? im confused lol
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
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 😛
electron 💀
@quartz kindle @boreal iron bro i need you guys
i dont think i can live like this
well then bai
so i got a new laptop yeah (btw thanks for the office thing tim)

bruh
and because of many software i am locked into the windows ecosystem
OH NO how dare you
and like how am i gonna compile and run MY FUCKING OS
Install the linux subsystem if you need it tho
windows does not have the tools i need to turn my os binary into an iso let alone compile it
yeah but
how interactive is the bridge between windows and linux
if that makes sense
like can windows access the filesystem
Is a fully workable linux environment you can access and use also from the windows command prompt
ah i never knew that existed
unfortunately our Indian tech scammer guy got banned
That exists for a long time in Windows (10)
But the first implementation was a desaster
lmao is it the golden apple guy
if its not this message is awkward
It has recently become a real powerful and fully usable environment
yeah, it's him who got banned
Idk just saw the ban in mod-logs by accident
long shot but can i also run gui programs in the subsystem
like qemu
i mean theres a version for windows but like
I think you can even use a GUI distro, yes
Test it out
System > Windows Apps > Install / Remove WSL
just a few clicks
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 💀
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
what if 99% are windows services 💀
if i wasnt locked into windows i wouldve installed kubuntu on here already
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
interesting
i saw a guy install a stripped version of 11 and it halfed his memory usage
Eww please let's not talk about the 11 shit
Worst Winshit ever
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
bro hates 11
Because it's trash on so many levels...
Espacially with tons of hardcoded stuff you could manipulate in 10
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
Enlighten us
im finding so many amusing stuff
no but i will in a second
How do you have time to search for stuff like that, Tim?
its a compilation of github drama and disagreements on various repos
this one is from the nodejs repo
bruh
wth
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
just proofs once again the world would be better without humans
check this
which led to this: https://www.reddit.com/r/programmingcirclejerk/comments/9nh59c/big_brain_webshit_explains_how_removing_1_line/e7mhmqy/
another unrelated thing which i found fun
yeah, found some python thread spanning ~100 comments from it about some linter
xD
here it is https://github.com/ambv/black/issues/118
lmao that wasnt the problem
i just figured it out
i was sending the userPermissions
not botPermissions
for bot perms
vice versa
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
I mean, the answer's kind of in the thread.
The opal team, though, is not a technology. Contributing to a software project also means contributing to the works of others, requiring mutual respect.
im reading the entire thread @_@
im not even gonna comment about it because obvious reasons lmao
One message removed from a suspended account.
@sage bobcat @sage bobcat
To the work... not necessarily to the people 
but that work involves the people 
Quiet, now!
@quartz kindle found some more

lmfao
this is exactly how i fucking feel
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
is it because tensorflow is targeting more advanced users or is just hard to use in general
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
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
a hundred comments into that transgender issue and now here we are
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
uh maybe wrap the thing with (?:...){43,}
wtf
yeah messed up one char
killed his credibility with one word
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
funny meme
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 = {...}
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?
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
then convert it to one
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
honestly tho wouldn't concern me what he does at home as long as he gets the job done
that's the reason we all work anyways
any one can help
in one process bot sending multiple responses
try rebooting the pc / vm
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)
The issue with that thought process though is it doesn't concern the human
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
does this check for the letters in the alphabet?
if I run it and add a "text" it returns true and if I run it and do "_ a_" if returns false
that's weird
Why is that weird?
There aren’t whitespaces in a valid base64 encoded string
I know, I just wanted to check what it would do
also does anyone know an easy way for a login system in nodejs?
preferably a simple API one
Ideas?
check again cause it's impossible it would be invalid
I've checked it many, many times, compared both, it just won't work.
how so? show me screenshots of both clients
Did You Make Website From Replit
I don't understand, what exactly are you doing with the token?
Made it myself, tried it on repl.it cause it didn't work on my own.
Creating a client and logging in to a Discord bot.
so normal client and a normal client.login?? In that case you're more likely to get support from https://discord.gg/discord-developers
because this seems like an API issue
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 🤷♂️
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)
Reset Token And Reenter ig
If I understand something wrong
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
@timber fractal What d.js version are you on? Are you sure the token you have is correct?
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

Lmao
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
🤣
that's why u use VSC
it will tell you always when there's an unicode
even the no width unicodes it will highlight it
use notepad
Well like any app supporting syntax highlighting can show you that
Not really any kind of magic tho
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.
yep, but useful af
If you're looking for a one-liner for a login system you won't find it anywhere lol
but you can get close
with sql it'll get very close to a one-liner
If it’s supposed to be thatsimple why don’t u doing it yourself?
also you said u don't want to register
cause I don't know how lol
I would be the only one who can add and modify users
it's an admin type login thing
SELECT 1 FROM users WHERE login = :login AND password = :pass
Register > check if account already exists in db > if not add them to the db
Login > check if entered credentials exist in db and if they match exactly
bash?
As easy as that
sql
that's sql?

-> Hash password and upload them to the cloud, possibly with the bcrypt library
-> When a person is logging in compare passwords
-> Ez
seriously lol
...that's the most universally known sql example btw
4 lines of code
I meannnnn
I never used sql before
s/he will be the one defining the passwords, no need to hash
Pfff imagine hashing password
How can you send the user an email with his forgotten password then

can you send the lib or an entire example cause I won't know what to actually do with this
sqlite3 package
read the examples
but you said you'll be storing the passwords on the cloud? What do you need sql for
make a simple table with name + login + password
Unless you're hosting the database on a different server
but I don't think that's what you meant
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
I mean, you COULD hardcode the login + pass combo in the code
but then you'd need to restart on every single alteration
I could make it private, I also have a builtin simple encryption system I could use that
pass encrypted passwords to the API and encrypt them after getting them from the API
I already have a hardcoded, but clientside login "system"
wait let me show u
oh god
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
maybe storing it in a json and reading?

I'm really out of ideas lol
Jason db - always the winner 
Who would ever hardcode passwords in production env?
My old company: 🙈
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
encryption wont save u if the pass is visible by pressing F12
you see, unless it's hashed it can be reversed
can you decrypt my encryption?
someone WILL reverse it
I doubt anyone would actually go through the trouble of doing that
we're talking about the internet
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
There ain’t bad things in the net Sir
I use text -> char -> byte -> hex + password and scramble technique for my encryption
and I doubt even with this knowledge you'd decrypt it
if it can be reversed, it will be reversed
no idea how to make one tho
why do u think all sane business use unreversible hash for credentials?
Just use existing algorithms like sha
they have enough money to hire a master encrypter to make an uncrackeable algo
don't want to waste my time integrating that
Even md5 is better than a decryptable password
so when the database gets breached the passwords cannot easily be reversed back to text
even checksum damn
if I wanted undecryptable encryption I would just use AES
"undecryptable encryption" doesn't exist sir/madam
aes you can basically breach through brute force
AES is basically undecryptable though
you can't brute force AES
right

come on
What in the world…
Which fucking language hasn’t native support for at least md5
Didn't have my phone with me amd 2fa backup didn't work.
js
gave it a search, u need a lib for that
or implement ur own algo
which is what I did
no
v13, token is 100% correct cause on repl.it the exact same codeworks, bot logs in, and on my own pc it works too bot with the website code and normal bot code.
and js isn't a real language
Not really
how about python then .-.
damn right to the head
lib too
I'm just saying
However it’s called there
HOWEVER, it does support md5 natively
A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.
There you go
no need to think, just do what we're saying
js has native crypto lul, both node and browser
database + hashed passwords
does it? google results didn't talk abt it for some reason
ye
I still need somewhere to start from, I never done a database of this type before I got no clue where to start
ah
sus link
Oh oh
google -> sqlite3 npm
now thats even more sus
lmao
that'll cover the database part
this will cover the hash part
yeah I got that part, how would I add all of those functions I'd need tho, does it have a documentation
...it does right in the npm readme
I just need 3, deletePassword, createPassword and a public one checkPassword
Those are simply 3 queries you do in your code
why createPassword and deletePassword if you'll be the one setting them?
yeah that's why they're gonna be private
but why?
Well create probably means insert here
just modify the database directly
to make my life easier
I mean
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
How many passwords are you going to be storing?
a couple, like I said it's gonna be an admin login type thing
that's why no registration
Then why not only have 1 hardcoded password?
you mean a clientside hardcoded? that's unsafe, also different admin accounts are gonna have a different permission flags based on what they can do with the program
server-side of course
probably something of these sorts -> a VIP user -> an Admin -> and an owner flags
I just found this
it seems pretty simple
you think I should use this instead?
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
(I also tried it as a constant)
Every time I install jest I remind myself that it's a 40MB library and start to cry 😩
why does my API on glitch keep going to sleep when I close out of the website
you're trying to use djs in a esm environment?
you need to do like the error says
import djs from "discord.js"
Yes
then djs.ClientEvents
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
Well global commands of course
if the command should be able to be used in all guilds, then global
You only need to register them once
Yea works thanks
but need to wait one or few hour
only one times for the server?
You register (new) slash commands just one time
They will be rolled out to all guilds then
In about an hour or less, yeah
ok
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
wym "register cmd on any startup"?
People like to copy and paste stuff into their applications, keep on registering those commands on any startup of their app
ok
but after few hour, the bot only register the slash command to the only server
why
what?
ye, it just register for the server only
Well you don't register them as global commands then, means you're doing it wrong
hm
Even checked that, it's completely correct but I'll just make sure and check once more.
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? :/
iirc seeing others talking about that, that's a tos break
what's a tos break?
you mean keeping a project up 24/7 is a tos break or what?
if it is then I'll move to repl.it
first time using glitch.com lol
@boreal iron u know how to return JSON?
content type
trying to do it like this
JSON.stringify({key:request.query.username})
I mean that's correct
Just make sure the endpoint requesting this also has application/json as content type in his header
I think I got that handled
now for the encryption part
should I do it client side?
security standards any% speedrun
lmaooo
I really have no other idea tho
use hash to check if pass is valid
you gotta encode that on the server side
so after query is passed I encode it?
One message removed from a suspended account.
I don't really get why u insist in using decryptable credentials
your password is saved encrypted in your database, means you check if ( passwordEncrypting(query_password) === database set )
because it's easier
How is that easier?
I mean, hashing is a single word
look
Just when somebody enters the password -> encrypt it -> check if it matches your database set
just 2 simply steps
you wont be writing the whole sha256 algo
password entered -> encrypt -> check for database match
you'll just use it
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
alright then
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?
// 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
hold on let me try something
@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?
why do you get a json from a sql database?
json you get from sqlite database 🤔
lmao
yea with all the info
why would get it in that format
I want to compare usernames and get the password
don't store json in your db
you add a column username, password etc. in your user table
nope but here, yes
Welcome to programming.
how can a table confuse someone
id | username | password
1 | klay | hash
Java ... calling 911 for some exorcist now
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?
the map is pointless
for (const thing of dir) {
const property = thing.config.name;
// rest of the code...
}
Although, is it an efficient way to remove multiple objects.
I'll make this change, too.
As efficient as it can get I'd say, if you remove that map
👍
hmmm... wait no. You can do better
Hmm?
done
this is just an example
in node you'd have less verbosity
for some reason browser crypto is async
@ancient nova cm here
A d.js bot my friend runs apparently has a memory leak somewhere
that works
I know, does this part go to the database or the server side?
...copypaste that code and I'll haunt u forever
I WON'T
it goes on server side
I'm just curious
but wouldn't matter really
the important part is, the password isn't stored as plaintext
Is it
isn't
I can't get sqlite to work no matter what I try
I'm trying
mongo only "seems" easier, you'll have just as much trouble down the road
this would be your database data
wait
I ust noticed something
how tf do I generate the "database.db" file??
touch database.db
what?
Wait are you trying to write your own password hasher
encrypter in her/his case
so what to do I put in it?
Is that really a good idea
nothing
nope, that's why we're trying to steer her/him away from that idea
tf are u a him or a her?
what can go wrong with decryptable passwords
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
They ftw
because we give a fuck
ah yes, the "everyone is a fat 30yo guy unless proved otherwise" internet rule

guess you got it
I mean you're assuming someone to be a girl just because of an avatar
let database = null;
async () => {
database = await open({
filename: path.join(__dirname, "database.db"),
driver: sqlite3.Database,
});
};
``` now what?
You're even more confusing to me
did ya follow the sqlite3 example?
yep this is how I made this
That's not gonna work out
why
database is going to still be null after the function because
- You never call it silly
- The
openfunction is not sync so that'll happen waaay after the code outside the function is executed
just use better-sqlite3
ah yes, that one looks more clean
Or you can
(async () => {
const db = ...
// Rest of your code
}();
camera aims to the sky
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
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?
youre using replit?
glitch iirc nvm, it IS glitch
hmm
sometimes those platforms kill the installer because it takes too long to build
it often works if you try again tho
/** 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
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... 😛
it wasn't the problem since I didn't get to the respond part yet but ty
^ should be law
that seems like some kind of basic response.
reinstalled?
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
I think that's actually right lol
😮 
after installing better sqlite again
it doesn't work
legit doesn't want to work
@quartz kindle your package is broken
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) 😛
its not my package?
nothing in the logs
I know, meant "yours" as in you suggested it
well i never had problems with it
did you ever use that package though?
yes i use it all the time
hey, i was right! 😄
nice
missed a 'from users' type part, but otherwise, i wasnt wrong 😄
yep
open the glitch console and type enable-pnpm
right
btw how are you installing it? from the add package button?
npm i better-sqlite3
also: why glitch?
use the add package button
just cause free?
it's not actually
unless you pay the app won't stay online
last time I checked it was like 30 or so dollars
per month? year?
month
who wants to launch a glitch rival? only 5per month! 😛
i pay like 6 euro ~ contabo vps
I'll use repl, it's free and will always be online
for what?
idk
Just because it's easy to host stuff there
if it was easy I'd already be hosting my API
imposible
google literally sells cloud services for hosting...
I can't add the damn sqlite3 NPM cause my program keeps FREEZING
@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.
😂 Wonders of technology!
node gyp lol
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
@quartz kindle could you please look at #development message why is it freezing on this part?
i already told you why
Like, Apple has their own public source license they could be using, but choose to use Apache instead
it doesn't explain why
Just getting an error that client.user isn't defined. ¯_(ツ)_/¯
It won't be defined until your bot's cache is all ready to work with
Presumably until the ready event has been dispatched
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
for something so simple you could use MongoDB Atlas
512 MB free space, good enough
- you can easily edit it online
Does SQLite work on replit
no clue but I hope it does
No but you can use mongodb atlas
Or replit database
idk replit database
Which has its own literal explanation in the Database tab
better-sqlite3 does not work with repl now?
I don't think it ever did
;-;
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
if you want 24/7 then buy a vps

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
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.
Free hosting means something of your shit gets sold
Electricity and bandwidth isn't free
It's wrong to try to keep your bot active by pinging it because you're violating the glitch tos
^
Your best bets for free are replit and Glitch, but Glitch is off the table
Glitch isnt a hosting
Which is the opposite of repl
repl doesn't work with sqlite and glitch doesn't host 24/7
Then buy a vps
^^^^^
Or that if you have money, yeah
like I said there's free host, the matter is to find the good one
Good luck bud

Glitch isnt a hosting why is it so hard for you to understand
My free hosting is my friend paying for my $2 VPS monthly 😆
the thing doesn't want to wake up again
One message removed from a suspended account.
i buy Ryzen 9 5900X 8gb ram vps for 8 dollars 
?
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');")
One message removed from a suspended account.
Oh
cheap
SqliteError: no such table: users
starting from
probably the price when selecting 6 months payment etc.
No
@boreal iron how to create the damn table man
I don't know any SQL I can't figure it out

var createDatabase = db.prepare(
"INSERT INTO users VALUES (username, password)"
);
Maybe learn SQL, it's not hard
maybe it's my first damn time using it
Just maybe take a step back and the time to learn it
maybe I don't have that time
Do you not
no

I wouldn't be coming here every couple seconds if I had time
But you have the time to rush developing a bot
Oh wait no not a bot
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;
("I don't have time" sounds more like "I suck at time management" to me)
I mean I'm not aware of your password length or user name length etc.
- Learning SQL doesn't take hours I'd reckon. Google has a lot of examples
there should be no length
do I run it like this:
There has to be a (max) length
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;"
);
You can use TEXT instead of VARCHAR, no?
just do 16 or 32 chars
WTF
text has 65.535 chars
Would be a damn long hashed password
