#development
1 messages ยท Page 2013 of 1
so should I treat it like one?
It is one.
after fetching should I just do
fetched.records[0]?
oh I didn't even notice, no wonder I couldn't get it to work
To get the first three elements from the array just run response.result.records.slice(0, 3);.
i dont see much of a difference, node-fetch does it in 854 ms and undici did it in 850
Try sending concurrent requests, that's where undici shines.
is that like a function or? idk i never used undici
I could just do the above since I do have a custom formatting
And to answer your original question, you can cache DNS records for a start.
Sure. Good luck!
thanks lol
i yeah my bot had a 18k latency
No.
Discord UI becomes your help command.
best feature
okey
do you know where sending concurrent requests is? i cant find that anywhere in the undici documentation and I'm really new to using their module
You have to do that yourself, it's a scenario where you send parallel requests instead of sending one after another.
do I have to iterate through them to do a list of all of them?
you have to let the impostor in
await axios.post(`https://discord.com/api/v8/channels/${message.member.voice.channel.id}/invites`, {
data: {
max_age: 86400,
max_uses: 0,
target_application_id: "880218394199220334",
target_type: 2,
temporary: false,
validate: null
},
headers: {
"Content-Type": "application/json",
Authentication: `Bot ${discord.Client.token}`
}
}).then(res => res.data).then(async invite => {
await message.replyT(`${bot.config.emojis.success} | Click the following invite to start playing the selected game! https://discord.com/invite/${invite.code}`);
});
```Hi, I'm trying to get activities to work. However, it returns the status code 401. I'm not sure what I am doing wrong.
lmfaooo my code is so bad it literally breaks Visual Studio's syntax highlighting hahahahahahha
why axios man :/
Why not axios
axios is good

Exactly.
bro why tf my neck started hurting so bad right after I said axios is bad
the devs tryna kill me
๐ฎ
hopefully it gets phased out soon because nodejs added native fetch support under the experimental flag
LOL
ayo chill
it uses some efficient http library under the hood
I use node-fetch
Iโll use node-fetch again once itโs built in.
axios is like Russia
having nukes but losing to Ukraine
bro no cap my neck is legit hurting as if someone stabbed me
back again
should I go see a doctor
bros dying as we speak in development ๐
We basically bundled https://undici.nodejs.org into the Node.js runtime 
A HTTP/1.1 client, written from scratch for Node.js.
yeah that library
bro no cap ion even know what happened
it's built in browser
btw I beat the next level of bad code
since tim said its good i say its good
I 100% disagree with you in many different levels, ways, religion, and more
I never saw someone disagree to that level
LMAO
boi
If Iโm being honest, the only reason I use axios is because the package version of node-fetch uses import. So I cannot use future versions of it.
Just use ESM
what's better request, node-fetch or http
axios
dont like how libraries suddenly decided to be quirky and "phase out" require through peer pressure despite imports not being enabled by default ๐
๐
EXACTLY
Thatโs why I donโt like node-fetch.
node-fetch stopped working with require is what made me dislike it
altho using old version also works
yep
I wonder what voltrex may be typing that's this long
But if I have a volderability I would be fucked.
volderability lol
man
CJS is just a workaround we've implemented when JavaScript did not have modules, as the specification now officially has modules, which ESM, it's better to use and more performant under the hood, and the reason this is not enabled by default is to not break user code as most people are used to CJS rather than ESM, and the the global require() function and module object doesn't exist in ESM, so that would be extremely breaking
I doubt it
wait
@random maple
wrong person
@earnest phoenix can you use import and require in the same script?
my guy writing a whole speech ๐
thanks though I will check it out
yeah it'd be great if all of this would be backwards compatible
me trying to do a subdomain scrapper be like:
lol
You can, in CJS, you can only use the global require() function and dynamic imports (import()) not import statements, in ESM however, you can use import statements, dynamic imports and even the global require() function, although in ESM it's not global, but can be constructed:
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
require(...);
huh that's weird
which one should you use though: require(...), import(...), or import ... ? ...
I mean
that's why I used request npm up until like 2 days ago
bruh
I was set on using it cause I was most used to it
learn import syntax
I prefer not
will be useful if one day you switch to typescript
why so
why lucky? any serious language shouldn't be seeking to break existing systems because something better exists today
you can transpile typescript to javascripr
that's actually true
module js came
and now we have import syn in js
it's transitioning
anywho
it's up to you
your project, your choice
i would rather have silly errors in development than hard-to-trace insanity-inducing error in production code 
static typed languages are clearly superior
but js is good if you need quick prototyping
but you need to know what you are doing
you're not wrong although I'll prefer to use what I know instead of having new errors every week because one of the thousand things I use everyday been updated
no???
there are no breaking changes
bruh they are not gonna release breaking changes in every update
by errors I mean new stuff or stuff I was used to that they changed or updated to work differently
come on you know what I mean
I refuse to believe you've never had an issue like that
What exactly are you using?
let response = await axios({
method: "GET",
url: "https://crt.sh/",
params: {
q: %.${domain},
output: "json"
}
});
can you use this with node-fetch instead of axios? lol
sorry for the question just curious
yeah
trying to do the subdomain finder thing but no get type npm wanted to cooperate
Would look something like this:
fetch("https://crt.sh/?" + URLSearchParams({...}), {
method: "GET"
})
pretty sure could do it like this
let settings = {
method: "GET",
url: "https://crt.sh/",
params: {
q: %.${domain},
output: "json"
}
};
fetch(settings);
no need to hassle
I don't think node-fetch uses params: ...
It doesn't have such query helper, just use the URL search params
new URLSearchParams({ q: ..., output: ... }).toString()
For example
that's a built in function, right?
The URLSearchParams class is global and built-in yes
alright let me try
never used that before
@earnest phoenix so I'm pretty sure it would look like this?```js
return new Promise((resolve, reject) => {
const settings = new URLSearchParams({ q: %.${domain}, output: "json" }).toString();
fetch(https://crt.sh/ + settings, {
method: "GET"
}, (error, response, body) => {
return resolve({ body, response});
});
Yes
awesome
Wait a second
wat?
Why are you using a callback
because this is a part of my lib
I need to await it in my main script in order to resolve the promise
If that's generally the fetch() function derived from node-fetch, it just returns a promise you can directly resolve without having to use a callback, unless you've modified it
Then you can just do
return fetch(...).then((response) => ({
response,
body: response.body
}));
ah... yeah I guess I could although I still prefer doing the above
I'll then use regex to turn the body into a json file lmao
since the website doesn't have an API I can just do that instead
yeah that won't work lol
it doesn't actually return a json visit the site
Free CT Log Certificate Search Tool from Sectigo (formerly Comodo CA)
I'd "reformat" it into a json using regex
Oh then alright
hopefully it's gonna be as easy as it sounds
anyone know the code for when someone joins the server it sends a welcome message?
Verision: 12.5.3
Discord.js
discord.js has a v15?
meant 12
isn't that going to die next month
think so
i need to change my whole code tho
and when ever i try changing the version it wont let my bot go online
still sounds better than letting it die ๐
but what you're looking for is the guildMemberAdd event and the members intent
i got guildMemberAdd and people told me it was add
including the videos on youtube
but like i dont get any errors and when i test it out it doesnt work
can you show us what you currently have
if (member.user.bot) return
const welcomeChan = member.guild.channels.cache.get('945862410802192384')
if (welcomeChan.type === 'GUILD_TEXT') welcomeChan.type === 'GUILD_TEXT'
else return
welcomeChan.send(`:right: Welcome to the server ${member}!`)
})```
TypeError: result.map is not a function?
result is a json file, least I think so
as far as I know my regex is working since I got no errors
Try logging the value of welcomeChan
also don't use .type === 'GUILD_TEXT'
Also note that the second welcomeChan.type === 'GUILD_TEXT' is redundant since you should really have if (welcomeChan.type !== 'GUILD_TEXT') return;
use whatever djs's equivalent of ChannelTypes.GUILD_TEXT is
Reason: TypeError: Cannot read properties of undefined (reading 'split')
WHY
wait maybe
because it's undefined
can someone like remake the code. my brain is off n been coding all day so idk what to change
I don't think anyone here is going to spoonfeed you
its just one time
no
nobody is going to write your code for you
that defeats the purpose of this channel
because you'll eventually come back for the same issues since you didn't learn how to fix them the first time, we can help, but we're not going to write it for you
const result = `[${body.replace(/}{/g, '},{')}]`
result = JSON.parse(result.map(value=>value.name_value.split("\n")));
console.log(result);
``` trying to parse it right now
i fixed it. dont gotta write me a whole essay about why ppl cant do the code for me
TypeError: result.map is not a function
TypeError: Assignment to constant variable.
?????????????///
yeah I realized it
changed it to let because if I used var you would've killed me lol
TypeError: Cannot read properties of undefined (reading 'split')
and I thought I had it
why can't I split it now
because JSON.parse returns an object, doesn't it?
actually wait no I didn't read the error
happy you got it
it means your json isn't parsing
why?
let result = `[${body.replace(/}{/g, '},{')}]`
result = JSON.parse(result);
result = result.map(value=>value.name_value.split("\n"));
console.log(result);
``` this is the code and I can show you the entire json if you want
from thje looks of it you're trying to parse an array
hold on lemme look at it more in a sec
the result is using regex because I'm rather making a body into an array then trying to parse it
ok it means name_value is undefined
it can't be
because result is a string, and strings don't have properties like that
log it, you'll see
give sec
just show the json
Free CT Log Certificate Search Tool from Sectigo (formerly Comodo CA)
this is the body which I'm changing into json
with the regex above
do you guys want me to log result and send it too?
just put the json u have here buddy
if it's too long cut repeating parts
and obviously, hide secret stuff
^^
okay I didn't want to cause I have to use fs to write it into a file
obviously can't copy from console because it's too large
nope
just the GUI of my program
which is a CLI

I mean I kinda turned it into a GUI for my program
which is CLI based
ยฏ_(ใ)_/ยฏ
it takes a while to turn on sorry lol
TypeError [ERR_INVALID_CALLBACK]: Callback must be a function. Received undefined
what even is this
anything is CLI-based if you lower the bar enough
this chat is a cli
I'm literally dying
it means you didn't give a callback to run for some sort of function you're calling, or an event or something of that matter
I'm just doing fs.writeFile though ๐ญ
okay
got it
@wheat mesa @lyric mountain
posted about my rpc app on reddit earlier... people seem really salty there for somer eason ๐
JSONCompare is an advanced comparison and lint online tool for JSON. Directly input JSON code, upload multiple files simultaneously, or compare and merge two objects.
I want to commit die
formatted json for better visualization
well still I can't do much with it
// myfile.php
die();
thanks now I can die in php
json-stringify-pretty-compact is a nice node module to spit out pretty json ๐
I don't need pretty json !!! just need it to work!!!!!
try to transform into an object THEN map values
๐ญ
that's what I'm doing
let result = `[${body.replace(/}{/g, '},{')}]`
result = JSON.parse(result);
result = result.map(value=>value.name_value.split("\n"));
console.log(result);
``` first result is body turned into a json, then parsing, then mapping
WHY DOES IT NOT WORK!!!!!!!!!!!!!!!!!
cuz u have a 2-level array
wait what
first of all, remove [] from let result
ur nesting an array inside an array
so value indeed doesn't have a name_value property
because it's an array
oh my god
YEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
tbh, why are u even replacing it?
wdym?
I know it takes like 5000ms to finish however what do you expect me to do
write a 500 line parser
"body" is legit just a body of a webpage
wdym though
the above isn't what body is
body is html of https://crt.sh/
Free CT Log Certificate Search Tool from Sectigo (formerly Comodo CA)
in json format or in standard html? I would assume json
since you're getting a json response from the page
you do you
I don't get it, how else am I gonna clean the other stuff from the webpage
NO WAY
yep.. 100% authentic real life actual way.
console.log(white(`\n${lineRepeat()}\n`));
console.log(white(`${cyan("[ZERO]")} SCRAPPING RESULTS... THIS MAY TAKE UP TO 10 SECONDS...`));
let result = `${body.replace(/}{/g, '},{')}`
result = JSON.parse(result);
result = result.map(value=>value.name_value.split("\n"));
result = result.filter((value, index, array) => array.indexOf(value) === index && !/^\*/.test(value));
console.log(result);
how did you even find this?
I was about to go all out with the regex
i literally guessed
99 times out of 100 the solution is not regex to every problem
no way lol such luck
I see people using regex to solve everything, definitely not the way to go
tried adding &json=true to the query, no luck, tried adding json before the ?, luck.
I know, I just didn't wanna write a long piece of code if regex can do it in like 10 chars
ยฟ
regex usually increases the complexity and length of your code
that never happened
99/100 times I used regex in my current program I had to write less instead of more
what could be a complex function is one if statement thanks to regex
regex is slow, unreadable, and a bad practice if there's a more practical solution
I know that you're right, but using regex is just easy for me
said nobody ever
regex has some use cases, but it's usually not the solution
chances are there's better options
I mean you can try turn some of my code if you want
I don't really want to if regex just works
Thatโs not a good mindset to have but you do you ๐
don't mean to be rude I just prefer to use regex if I can turn a whole function into one if statement
cough cough
well that was because I was out of solutions
This is precisely the reason you donโt want to be in a habit of โoh I couldnโt think of a solution so Iโll look up a regex for itโ
Very bad thing to do
The worst response to that statement ever
โBut it worksโ is the epitome of every programming meme
Definitely donโt want to be using regex for stuff like that
/^-?\d+$/ tell me what this regex does
Without looking it up
uhh
please let's not enter in that topic again
not after the wall of text we had a few days ago
Hint: itโs the same function you wrote
even when I'm writing my regex code
You just proved my point ๐
You literally used that regex, please donโt use regex everywhere. Nobody will be able to understand it, and you wonโt be able to either without looking it up or using a tool
Now about about this?
function isNumber(x) {
return /^-?\d+$/.test(x);
}
It leads to unmaintainable hellholes of obscure regexes that have way better solutions
that's similar to what I wrote
above
That is what he wrote above
okay you win
but I'll keep the regex I already wrote
I don't wanna rewrite anything
let me list some things from the top of my head
what even is the usage for that regex?
an domain validity checker, proxy checker, IP checker , IP Corrector
string checker and float checker
specific character finder
there's more
For which one?
that's literally "somestring".contains("a")
the one in topic
contains didn't work so I used regex in my case lol
???
It is better to have a few if/else statements than a complex regex imo.
Better readability and maintainability down the line
I forgot since I already finished and got it working with regex
also depending on the case regex is EXTREMELY costly to use
it was ages ago when I done that
like in this spotify case
Like indexOf()?
If youโre using regex for it, thereโs probably a better solution is my rule of thumb
There are exceptions
And has a few issues with ReDoS if you mess up
But they are few and far
indexOf may be a better solution ig
forgot about this function
also
like to check if something is an url
Yes
result = result.filter((value, index, array) => array.indexOf(value) === index && !/^\*/.test(value));
What the fuck
have a better idea to do this without using regex?
Does that do
filters things that are the same in the array or similar
ok, the regex there is /^\*/
so anything that starts with *
there literally "somestring".startsWith("*")
.startsWith?
...
startsWith is an incredibly basic function, but I couldnโt even understand what that regex did. See my point? Donโt get used to using regex to solve everything
Itโs supposed to be a concise method to pattern match complex things, not an infinite spool of duct tape to patch everything up
that's cuz they didn't enclose the regex in ()
Lmao
it took me some time to understand what that ! meant
I think that's just you guys
my bad
took me 2 seconds to figure out what it did
it's meant to represent is not
like, not wanting to put you down, but we might need to review ur regex usages
albeit "cool", regex is a very expensive operation
okay
prepare to be amazed
/(\d{1,3}.){3}\d{1,3}/.test(ip) ? ip.match(/(\d{1,3}.){3}\d{1,3}/)[0] + ip[4] : (i % 3 === 0) ? ip += '.' : ip += user.toString()[i];
and should only be used when the alternative code would be monstruous or too slow compared to regex
ip check
guess what ^ is
nope
yes it is
splits numbers into groups of 3
it's not
closeeeeee
\d{1,3} will match from 1 to 3 digits
it'll match that 3 times then end with a final check for 3 more digits
it seems to be building the ip lol
Multiple experienced devs guessing what a regex does and still getting it wrong precisely proves my point
yeah but it's not used for an IP check
it is
so an ip checker
I have a different regex for checking IP
// returns true if given string is a valid url
static isValidURL(string) {
return /(http(s)?:\/\/.)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/g.test(String(string));
}
I hate regexp
I love this code
regex is fun
can I yoink it? @neat ingot lol
though I think the url module in node.js does url checking
sure lol
the full url checker is huge
// returns true if given string is a valid image url
static isImageURL(string) {
if (!this.isValidURL(string)) return false;
return /.(jpg|gif|png|jpeg)$/i.test(string);
}```
^ goes along with it
This is a valid use of regex
Itโs way more valid than using regex for checking if a string is a number
amazing
according to very lengthy google searches, that seemed to be the most reommended way lol
I assume there is no function called endsWith?
there is
fuck
You can do basically anything with the built in string methods, just saying
there can be an if statement but you're gonna have to do || 4 times
or a switch case
soooo
regex gud
No
This is the one I always use
Stop
file can also be considered valid
Regex is for niche cases
as can many others
but yea that'd work for my use case too tbh
Thats why it checks protocol
If you donโt work on your project for like 2 weeks youโll come back, look at your regexes, and be like, โwhat the fuck does this doโ
When you could make something infinitely more readable for a small bit more space
Not to mention regex is slow
yea i might switch to that tbh. that regexp i have is a nasty long one lol
.length()
array.length()
oh I forgot that existed
๐
no cap I was thinking that
how would you even pull that off

Flatten the array to a string and regex for a comma or something kek
What annoys me the most about regex is the amount of people that use it to validate IP addresses in Node
There is a built in util for it 
https://nodejs.org/api/net.html#netisipinput for anyone that feels targeted by my above statement
because that's easy to write
and like
easy to write? what?
a few ms of delay isn't gonna hurt anyone
Lol
well it's definitely easier than other stuff I can think of
Those ms add up when you keep using regex for incredibly inefficient use cases
never said I use it constantly
Except it definitely seems like it
even though like 20% of my script is just regex it isn't slow
Ok to be fair, isIP uses regex behind the scenes 
// IPv4 Segment
const v4Seg = '(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])';
const v4Str = `(${v4Seg}[.]){3}${v4Seg}`;
const IPv4Reg = new RegExp(`^${v4Str}$`);
// IPv6 Segment
const v6Seg = '(?:[0-9a-fA-F]{1,4})';
const IPv6Reg = new RegExp('^(' +
`(?:${v6Seg}:){7}(?:${v6Seg}|:)|` +
`(?:${v6Seg}:){6}(?:${v4Str}|:${v6Seg}|:)|` +
`(?:${v6Seg}:){5}(?::${v4Str}|(:${v6Seg}){1,2}|:)|` +
`(?:${v6Seg}:){4}(?:(:${v6Seg}){0,1}:${v4Str}|(:${v6Seg}){1,3}|:)|` +
`(?:${v6Seg}:){3}(?:(:${v6Seg}){0,2}:${v4Str}|(:${v6Seg}){1,4}|:)|` +
`(?:${v6Seg}:){2}(?:(:${v6Seg}){0,3}:${v4Str}|(:${v6Seg}){1,5}|:)|` +
`(?:${v6Seg}:){1}(?:(:${v6Seg}){0,4}:${v4Str}|(:${v6Seg}){1,6}|:)|` +
`(?::((?::${v6Seg}){0,5}:${v4Str}|(?::${v6Seg}){1,7}|:))` +
')(%[0-9a-zA-Z-.:]{1,})?$');
function isIPv4(s) {
return RegExpPrototypeTest(IPv4Reg, s);
}
function isIPv6(s) {
return RegExpPrototypeTest(IPv6Reg, s);
}
function isIP(s) {
if (isIPv4(s)) return 4;
if (isIPv6(s)) return 6;
return 0;
}
WTF IS THIS
AND YOU SAID MINE WAS TERRIBLE
it does
I said it was easier to use the built in one kek
but the repetition
should've specified
isIP is a great example about regexs
Like I would rather have the node lib folks be responsible for the security and accuracy of isIP than myself
Means your json is incorrectly formatted
even though it isn't using its own parser we don't mind it since it's named
I assure you it's okay
or is it?
Where is that from?
Iโm going to trust the error
okay.. let me log the json
Usually errors donโt occur for no reason so itโs probably malformed :p
a post I made on reddit this morning about the rpc app i made. seemed to trigger people for idk why ๐
lol
actually nvm
instead of getting the body and parsing it I'll just do response.json
I think that's better
Purchased partall.no and oddetall.no today. Now need to find a use for the domains
It means "even" and "odd" in Norwegian
I forgot I could do the above lol
I'm sorry
I didn't use any regex though ๐
ofc the answer is either an api for validating if numbers are even or odd, or an api to randomly generate even/odd numbers ๐
does awaiting work though? or do I have to do .then()?
Kinda wanted to take a spin of https://isevenapi.xyz/
Just mock some large Norwegian companies page layout
yea thats kinda like what i meant ๐
nobody would be insane enough to attempt a ipv6 matcher
function isEven(number){
if (number = 1 )return false
if (number = 2)return true
if (number = 3 )return false
... and so on
}
the pro way of doing things ^
Crashed my tab 
https://github.com/Jwaffled/my_first_calculator.rs
Made a similar one in rust
As long as it is made in rust, it cant be slow right?
True!
Rust = speed = not performant functions does not matter
I generated a 188 million line py file with that one
nice! good solid logic there too.
7gb
WHY IS THIS SO MASSIVE
Because it was auto generated
nice
^
I shouldโve, but I was learning rust at the time and didnโt have much time 
now compile it with movfuscator
[ZERO] STATUS: FAILURE REASON: WRONG TYPE OF DOMAIN GIVEN.
if (response.statusCode !== 200) {
console.log(white(\n${lineRepeat()}\n\n${cyan("[ZERO]")} STATUS: ${red("FAILURE")} REASON: WRONG TYPE OF DOMAIN GIVEN.\n\n${lineRepeat()}\n));
return recursiveAsyncReadLine();
}
why would it not be returning 200 if it gives me the json I'm confused?
jsfuck
Uh
can at least rust to jsfuck ๐
now that is the language that we should be using instead of regexp!
better than brainfuck lol
thats just messing with my mind tbh
code in english 
any other language โ
https://crt.sh/json?q=spotify.com is this down or what
Works fine for me
node-fetch has either trouble fetching or somethings wrong with my code
I meannn if you want to
i preffer using bent over node-fetch. for just grabbing json its really nice and clean imo
await fetch(`https://crt.sh/json?q=${_domain}`).then((response) => {
response.json((out) => {
resolvedResult = out;
resolvedResult = resolvedResult.map(value => value.name_value.split("\n"));
resolvedResult = resolvedResult.filter((value, index, array) => array.indexOf(value) === index && value.startsWith("*"));
``` basically my code
why does this not work?
const bent = require('bent')
const getJSON = bent('json')
let obj = await getJSON('http://site.com/json.api')
``` so clean โค๏ธ
well boooooo! ๐
I am keen on not using npms for things I can do myself
your using node fetch...
Yeah, why use npm when you can make a 40,000 char regex am I right
thats a node package that you could have done yourself.
In theory, you could just make node.js yourself!
didnt the node js dev go off and make deno or something?
I'm boutto ditch node-fetch and go back to request
one of the largest contributors afaik
Use node 17
Enable built in fetch
request? lmao
the builtin sucks
How do I send a message that only he can see when he clicks the button?
isn't it like that?
Wut, Node 17 fetch is the same as browser
?????
const res = await fetch(jobsApiUrl);
const json = await res.json();
console.debug(new Date(), `Found ${json.length} job postings`);
With node --experimental-fetch dist/index.js
Node 17 fetch is literally just node-fetch built into node as a native package
They need to hurry up and overhaul the date API though
Yeah
Just sayin
Oh wait read that wrong No I think I read it right
thx
I like how not even one person noticed anything wrong with this and told me instead of having me destroy my braincells to figure out the simplest fucking mistake I made ๐ญ
Oh, I did not see the question ๐
I thought you was just sharing code lol
what's wrong with my formatting ๐ฆ
what are you even trying to do here?
dafuq is that filter supposed to do?
subdomain scrapper
Yeah Iโm just as confused
filter the same json results and results than end with *
Didnt really bother to look too much into it
thanks lol
Iโm on mobile and I see callback hell, no thank you sir
Isnโt it supposed to be response.json().then(callbackHell => ...)?
Thought response.json() was a promise, isnโt it?
it is
you mean this?
const response = await fetch(`https://crt.sh/json?q=${_domain}`).then(response => response.json());
const result = response.map(value => value.name_value.split("\n").filter(x => x.startsWith("*"))).flat();
that's why there's two ."then()"to resolve it
Not in this one that you sent ๐
Wtf is happening in this
no way you did all of my code in 2 lines bruh
Why are you parsing the already parsed json data
because I had an error that array.lenth() wasn't a function
tell me this isnt nicer to look at!
try {
const response = await fetch(`https://crt.sh/json?q=${_domain}`);
const json = response.json();
const filter = v => v.startsWith("*");
const mapper = v=> v.name_value.split("\n");
return json.map(mapper).filter(filter);
} catch (error) {
console.error(error);
}
thought that the string didn't parse to json
array.indexOf(value) === index is pointless too
so many questions
would be if there wasn't a try catch there
I suppose errors are a nice thing to look at too, if youโre into that
๐
I have a custom error handler soooo
no need for that
What exactly is the point of that though
and I have an edit of the official CLI terminal
handly too
To funnel console output to a file?
and looks nice cause I can have a custom background
const logger = new HTTPTransport({path});;
logger.log("some message sent to my server?! what?!");
opacity and many more
no it's an error handler
let me show u an example
I wasnโt talking about your thing, but sure
I use it in my bot log handler, mostly for saving error files, but nice to have the options for http logging ๐
(That sounded rude, didnโt mean it like that)
don't worry lol
you still wanna see it tho?
Sure
also rate the GUI I talked so much about
preparestoroastrate
Also what theme is that? Looks nice
uhh, synthwave 84 im sure
Iโll have to give it a try
Personally I use Tokyo night but itโs getting a little old
ive been using it for years now. makes things so easy to differentiate ๐
oh hey my rpc thing has like 11 stars on github ~ im a celebrity โค๏ธ
woah
fatal error is the one that normally would stop the application from continuing
Fancy ANSI codes too
not gonna lie, that looks better than expected considering you rendered it with regexp ๐
lmao thanks
that looks amazing
i tried to say great and amazing at the same time ;-;
console. I used a couple CLI tricks to colour and center the text properly
display the ASCII text also
used a different encoding
ok i know how to c olor console text ~ my logger does that too ~ but how to get the bg image into the console? 0o
and the background is an overlayed image on top of the console. also used regedit to change the opacity
it's like innovative as fuck
nice result though.. good job so far imo ๐
I never saw anyone actually do that
took me agess to get it to look like that
if you notice it's a V2
the V1 looks entirely different, and much worse
so uhhh, whats it actually do?
then you notice linux has thait built-in kekw
at first I used it like a tool but then started turning it into a sort of program that can do anything
you can implement into codes that work as commands from almost any language
right now you can do batch, javascript and python
** **
but plan to add more
shhhh
so how long will it take for it to finish coding my bot if i give it the files?
ehhhhhhhh I doubt it can do that lol
but... you said... 

i was gonna do an app to build a bot, but then i seen the price on steam for well established competitor apps was pennies ~ not much point ๐
i once made a batch script to generate a bot template xd
i lost it doe
theres actually apps for that lol?
ye
yea a few
dbm, dbd, db(insert any letter here)
Yeah, none of them are very good lmao
nothing that codes for you is good
a lot of db
yea, the nicer looking ones are just like, meh, and the functional ones seem old af
"Discord Bot"
because it's not an array
I thought it was finally a json

sometimes I wonder, how tf do yall code without ever pressing ctrl + space to check if something exists?
An array length is a property, string length is a function, right?
I never do that lol
like, at least in java I can't really live without intellisense
Or did js not take a page out of the Java book
what is this wizardy?!
you are correct
ctrl space?
array.length not array.length()
you can't even have visual errors when something doesn't exist cuz in js everything is schrodinger
soo... intellisense?
TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received an instance of Array
yea
data needs to be an array or string ect..
intellisense is just one of the many nicknames for it
const response = await fetch(`https://crt.sh/json?q=${_domain}`).then(response => response.json());
const result = response.map(value => value.name_value.split("\n").filter(x => x.startsWith("*"))).flat();
I used tims correction of my code
I can't understand how people code without it
didnt know you coult ctrl+space to bring it up ๐
tf
Kuu is a wizard
i just try to type the name of what i think something is and it might appear
same
it just gets suggested when i type ๐
also if ur using any jetbrains ide u can use alt + enter to open quick fixes
^ can anyone actually check what'ss wrong with my code this time
I donโt understand what the point of calling .flat here is
Oh nvm
and alt + insert to generate methods
I always forget what flat does
alt + O to generate overrides
so what exactly is wrong?
const arr1 = [0, 1, 2, [3, 4]];
console.log(arr1.flat());
// expected output: [0, 1, 2, 3, 4]
const arr2 = [0, 1, 2, [[[3, 4]]]];
console.log(arr2.flat(2));
// expected output: [0, 1, 2, [3, 4]]
You have an error handler, but it doesnโt show the stacktrace does it?
unfortunately not
it flattens your array depth
Just saying that stacktrace is very useful for debugging
it just shows simple error messages
might add it later
omitting the stacktrace is terrible
I would consider adding it now
so should I start writing it again
^
I wanna go to sleep
like, it exists for one single reason
Stacktrace is one of the most important parts of an error
so rather
I'll add it as my next project
Well to be honest, itโs difficult to tell what that error is referring to without a stacktrace
unless it's something tiny
i mean, its as easy as~ instead of logging error.message, log the error object - stack trace ensues
^
I want it formatted
might use regex to separate stack trace from the error message
Formatting isnโt important when youโre debugging :p
just this once
I hope thatโs a joke
format the logs that dont break your app ๐
but it's an error handler
soo want it looking nice
that isnt giving you a means to handle errors efficiently...
okay you win
I mean, if I owned a plane, I would rather it be painted with cow shit and fly than look nice and not fly
okay give me a second
thats as formatted as your getting with a stacktrace
but at least you can figure out what went wrong
okay I now know how to fix it
in my case, i tried to eval 'breakme'
i love colorful logs โค๏ธ
i've missed them so much!! ๐
that comparison though 
๐
show your code?
const response = await fetch(https://crt.sh/json?q=${_domain}).then(response => response.json());
const result = response.map(value => value.name_value.split("\n")); //.filter(x => x.startsWith("*"))).flat();
const arrayLength = result.length();
just this
you

i was trying to count them with regexp, dunno what you guys were upto ๐
Lmao
also you guys wanna know something
sur
I have a piece of my code that literally breaks visual studio code's syntax highlighting lol
it'll be slightly faster than mapping before filtering
less items to be processed
seems fair
yk, that function on the last line...
SAID TO IGNORE IT!!!
wrong cropping makes it sus
you knew that wasnt gonna happen.
STOP
scrapesubdomain
I notice youโre using a lot of the built in lambda functions like .map
exatly 
yep, they're useful
Again not always the best solution to chain 40 of those together
but well, you could change that regex with length
like, catch everything with length less than or equal to 2 chars
it's fineeee
maybe a little fine
Not really
Not gonna go back to the whole regex debate again though
Weโd just go in circles
I don't think combining the maps into one would actually be better performance and maintenance wise
Iโm not saying that Iโm just saying that mapping over and over and over seems wrong
what gets me is trying to cram 10 lines into one.
Yeah
that's good
less bloat
What lmfao
looks better
The only thing less about that is readability
like, you know you can define your functions that you pass into functions like filter and map beforehand using es6 style arrow function decleration?
doesn't sequential map chains get merged by the compiler?
doubt it
chaotic neutral compiler
worry about bloat when you ship your functional code, and then run it through a minifyer if its of concern, or an obfuscator if its not and needs protecting ๐
like, an extra line or two to help readability wouldnt hurt is all im saying ๐
well yeah, we're probably talking about nanoseconds of difference
I wasnโt even talking about performance
speaking of obfuscation
the time saved during maintenance will pay for it
I was just talking about putting it on separate lines
I recently got an obfuscator wanted to test if anyone can deobfuscate it
for testing
they aren't trained in the java way of life
Anyone can de obfuscate anything
purposes
Just so you know
A simple but powerful deobfuscator to remove common JavaScript
obfuscation techniques
Deobfuscation is easy, obfuscation does nothing
ask the website ๐
200kb of code for only console.log("hello world")
except potentially deter a few users who dont want to invest time
If you want to hide your code, donโt let other people use your program :p
๐
There is always a way to get the source code of everything, unless itโs on a remote server
verytrue
let's not talk about that dude who wanted to hide html sourcecode
Lmfao
lmao
or that node-ipc dude



