#development
1 messages · Page 2010 of 1
my database is called database though?
If you're running the query already in your database, you can remove it then
lmfao
the entire string?
I mean you can use VARCHAR without length, which ends up to be max 65.535 chars, too
The question remains... why in the world

Good luck bruteforcing that, bitch
Taking 5 years computing time to hash the password probably
😂 Only 5?

the entire part?
cause removing just that gives me a syntax error
:/
CREATE TABLE `users` (`id` INT NOT NULL AUTO_INCREMENT , `name` VARCHAR NOT NULL , `password` VARCHAR NOT NULL , PRIMARY KEY (`id`)) ENGINE = InnoDB;
no begging please, I mean you really need to get into the basics of anything before working with it
I did that
gives me a syntax error
I'm not that dumb
which error
lmao just switch to MongoDB to make the pain go away
okay but then where do I specify it's name?
Tbh this
bro I wanted to but everybody made me choose sqlite
You don't need an entire sqlite db to store several passwords and usernames
😢
Who did
You don't you're probably already executing the query in the database
Tim and two other people but I forgot their username
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;"
);
createDatabase.run({
username: "test",
password: "test",
});
var getDatabase = db.prepare(
"SELECT * FROM users WHERE username = ? AND password = ?"
);
response.json({ success: true });
told you to remove database my gosh
🤣
CREATE TABLE `users`
use an ORM D:
I already told you that gives me a syntax error
As long as you're going to be storing a few passwords and usernames (I believe this is what you said earlier) a MongoDB Atlas cluster is going to be more than enough. It's lighter, and hosted on the cloud so you can change data in it anytime.
(And easier than an SQL db)
Yeah most simple queries in MongoDB are shorter and easier to read, too
For people who aren’t as experienced with SQL at least
I really don't wanna change that after wasting 3 hours on making sqldb even work
Gambler’s fallacy
the data too
at this point I'd rather use RAW json client side cause I'm tired
ion wanna do this anymore
like using json as a db...?
just if you don't use sql
this is the only way
It’s not the only way
I can't use a DB cause I don't know how to
There have been several suggestions made
You can probably get MongoDB working in ~10 minutes
I doubt it, I know it will quickly turn into an entire days worth
And their nodejs driver is intuitive
nah
It would take you probably 20 mins max
promise me that 😦
Promise<{ pending }>
okay you primised enough hahah
i agree mongodb is easy
let me install that real quick then
https://www.mongodb.com/cloud/atlas/register1 create an account, then create a free cluster which should give you 512MB of storage
I hate having to do that
it is what it is though
Then don't use AI
CREATE TABLE `users` (`name` VARCHAR(32) NOT NULL , `password` VARCHAR(64) NOT NULL , PRIMARY KEY (`name`)) ENGINE = InnoDB;
not even sure if the engine is supported by your package
sqlite is too confusing
the language is all messed up I'd rather take a security risk and use json instead of that
thats only for mysql/mariadb
what sort of engine is it then?
sqlite uses its own engine
confusing
doesn't have time to learn
theres no such option in sqlite
db.prepare("CREATE TABLE IF NOT EXISTS users (name TEXT PRIMARY KEY, password TEXT NOT NULL)").run()
omg text
should I try this before switching to mongodb then?
I haven't deleted the package just yet
try it
I mean...
but does glich use an ephemeral file system?
if it does, then it will randomly delete your database file
CREATE TABLE users (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name VARCHAR(32) NOT NULL,
password VARCHAR(64) NOT NULL
);
seems to have worked
sqlite doesnt need varchar numbers specified
How would I check if a string ends with a string with something after it?
Ex.
let str = "Hello! I am char982734662 asdf 34ih23";
let str2 = "i am something with char12345678 idk";
if (str.endsWith("char" + something)) {
// true
}
if (str2.endsWith("char" + something)) {
// true
}
how can I display it as a json though?
also doesnt need an id autoincrement, it has a hidden rowid column
while in his case the name as KEY makes more sense I guess
the table I mean
I'd reckon you need to know what the something is first
I guess I'm kinda looking for the situation in which I don't which stumps me. Cause if I have:
let str = "something char";
I could just do:
if (str.endsWith("char")) return true;
But I'm looking for the case in which I don't know what anything after that character is. However, I don't want to use includes cause I'm looking for the case that there's something similar to:
https://myurl.com/search=?some+search&key=token
Token could be a random set of characters, but I want to check if the URL ends with some+search
I see... SQLite is a bit different here
SELECT * FROM users WHERE username = ? AND password = ?" how exactly does listing work?
if you dont know what the string ends with, then you cant use endsWith
without specifing probably based on the rowid ASC by default
ah ic
you need to use something like includes or indexOf
okay. thank you!
that detects strings in the middle of another string
wdym listing?
without specifing probably based on the rowid ASC by default
list everything to a json
db.prepare("SELECT * FROM users").all()
createDatabase.run({
username: "test",
password: "test",
});
result
{
username: "test",
password: "test",
}
you get your result, then do with it what kind of stuff you need to do
TypeError: Expected first argument to be a string
what is createDatabase?
it's
var createDatabase = db.prepare("CREATE TABLE IF NOT EXISTS users (name TEXT NOT NULL, password TEXT NOT NULL)");
from reading the docs I thought that's how you add to the database?
thats only for creating the table, you dont use that for anything else afterwards
engine: yes
oh
encoding: whatever works

then how do I add to the database?
by inserting
db.prepare("INSERT INTO users (name, password) VALUES (?, ?)").run("username", "password")
this is confusing but thank you @boreal iron @quartz kindle
think I may finally be getting the hang of it
why is it confusing? you need to make a request to your database anytime you wanna do something
INSERT INTO users (name, password) VALUES (?, ?) this is the actual sql
it'll do exactly what you read
insert -> query database to insert my values
select -> query database to select my search
delete -> query database to delete some rows
etc.
it'll insert into users (in columns name and password) the values ? and ?
because of the way the language is structured
it's structured in english
and I get the errors which I don't even know the cause of TypeError: Expected first argument to be a string
like is it not a string?
I just added into it
what did u put?
You first argument is an object
Not a string
See the correct verison
sql isn't like mongo where you pass objects left and right
So the error message is totally accurate
yeah that worked
as you'd if you had a human secretary of some sort
RangeError [ERR_HTTP_INVALID_STATUS_CODE]: Invalid status code: { success: true }
getting a different kind of error now though
like imagine you come to your secretary and say {username: "test", password: "test"}
they'd call the police
that error has nothing to do with sql
yeah I just noticed
only thing you can actually blame sql for are the error messages
yep
DELETE FROM users (name, password) VALUES (?, ?)
why does this give me a syntax error....
no values
I do
think about it, it makes no sense
DELETE FROM users WHERE name = ?
var removeDatabase = db.prepare("DELETE FROM users (name, password) VALUES (?, ?)");
removeDatabase.run(
"username",
"password"
);
think about how it'd sound if you were talking to your database

I AMMMMMM
WHAT I WROTE SOUNDED... OKAY?
how would this work?
"Hey, could you please delete from users name and password values ? and ?"
against "Hey, could you please delete from users where name is ? and password is ?"
first one sounds like someone during a stroke
kuuhualwagabanke stop dude, laughing my ass off
ohhhhhhhhhhhhhhhhhhhhhhh
buy a new ass then
should have expected this

var getCertainUserFromDatabase = db.prepare("SELECT * FROM users WHERE name = ?").run(username);
okay I hope this works
it didn't give me an error but instead of showing me the password it gave me this {"changes":0,"lastInsertRowid":0}
...
synchronous file i/o 
I wonder where the lightning bot is voting
I believe you should use .select() or something like that
since you're not updating/deleting/inserting, only retrieving data
it says that select isn't a function
Discord could troll a lot of bot devs by changing the ID field to "DROP TABLE users;"
when using a js library to a database system, you need to know what is what
1 thing is the library interface/api
the other thing is the database interface/api
better-sqlite3 itself has the following api:
database.prepare(SQLITE API HERE).get/run/all
.get() gets one value from que query
.all() gets all values from the query
.run() runs the query without returning any value
use .run() for anything that does not return a value, like inserting and deleting
use .get() for anything that returns a single value, like select WHERE
use .all() for anything that returns multiple values
I assume you'd do .get()
but all it returns is
{"busy":false,"reader":true,"readonly":true,"source":"SELECT * FROM users WHERE name = ?","database":{"name":"database.db","open":true,"inTransaction":false,"readonly":false,"memory":false}}
instead of the actual json
which is extremely confusing
everything inside prepare(...) is not better-sqlite3, its the sqlite3 database api
getCertainUserFromDatabase.get(username);```
everything outside .prepare(...) is not sqlite3, its specific for the better-sqlite3 library interface
maybe something is wrong but I don't think I can debug it
yep
you are logging the prepared statement, not the return value
also var
I want to get the json from where name = the username variable
what exactly am I doing wrong then?
shush there's nothing wrong with var
log the result of get() instead of the prepare(…)
var getCertainUserFromDatabase = db.prepare("SELECT * FROM users WHERE name = ?");
response.json(getCertainUserFromDatabase.get(username));
``` like this? I'm confusing what do you mean by log?
console.log
seems like expressjs
fun
var getCertainUserFromDatabase = db.prepare("SELECT * FROM users WHERE name = ?")
let databaseResponse = JSON.parse(getCertainUserFromDatabase.get(username));
response.json(databaseResponse.password);
yep
nevermind I don't need to parse it
but it finally worked
now to actually integrate the api into my app is gonna be a pain
yeah just noticed that
why can't I get the password now?
password: databaseResponse.password
thanks
"translate" ??

pseudocode to js i assume

someone come here and kill my internet
haha Tim
suffer the consequences of moving to your current location, Sir
you really need Star Link I guess
dunno about portuguese dollars
yeah so... world wide the same price
500 for premium + 2500 for setup
lol you can setup it your own
Wish I could get paid 2500 to screw in some nuts and bolts
can we build our own antenna + dish and hack into the starlink signal?
like they do in the movies
lmao
lol
probably got some weird key system tied to subscriptions to decrypt the signal
[SayuriPseudocode2JSComplERR] Not enough context data given.
That won't work
how come?
The code inside the req callback will be executed after the rest of the code
so getResponseFromAPI will be undefined
that means I have to resolve it?
outside of that function
I do all the checks inside the function
Put all the code inside the callback or use promises
you don't
I can clearly see the rest of the code using the variable
the callback got executed later and in microtask queue which is after main thread has been executed
so the if hits first
import { Pseudo } from "sayuri"
Pseudo.eval(`
define async function onMessage(message: DiscordMessage)
get message.Mentions.Roles.First -> roleId
await call discordFetch(guildId) -> data
data.users filter (roles in user has roleId) foreach user:
call sendMessage(user.name)
when command.IsUsed -> call oneMessage(...params)
`)
solution: use Promise resolve
[SayuriPseudocode2JSComplERR] Missing context data.
no
bruh you returned
What does req return
@ancient nova wrap this thing inside an async function
callback-based
so it returns void
already is an async function
then what's wrong?
yes
how do u know req doesn't return a promise... many APIs return a promise if a callabck isn't provided, and if a callback is returned they don't return anything but run the callback
i'm merely using the context of callbacks here
Where does the req function come from??
^
req is the request npm
also learn promise and async / callbacks thanks
request?
yep
that's deprecated use something else
using deprecated HTTP libs opens u up to vulnerabilities
plus AFAIK request doesn't have a promise API which is just unacceptable in this day and age
node-fetch better
although I still prefer request
I'm more accustomed to it
i use http
the difference is minimal
I use request in a lot of things in the script so I can't really change right now
but all those are callback-based
so alright, you wanna wrap those in a function
async
for the callback specifically
Failed: FATAL ERROR HAD OCCURRED
Reason: TypeError: Cannot read properties of null (reading 'success')
looks like it can't get the json file from the website
....
man
why though
already is wrapped in async
my entire thing is asynchronous
You have to understand that software always evolves and if you aren't bothered to rewrite sections of your code, then it'll become unmaintainable in the near future
That doesn't matter when you're using callbacks
you don't understand about the event loop
you have to put the ENTIRE code after the callback inside the callback
no need
yes need.
Unless you promisify the function which is probably the best thing they can do
req(`https://transparent-speckle-door.glitch.me/checkPassword?username=${Username}`).then(r => {
getResponseFromAPI = r.body;
});
``` how about this?
but why not use node-fetch at that point
async function request(params)
{
return new Promise((resolve, reject) =>
req(..., (res, err) => {
if (err) reject(err);
resolve(res);
});
}
I really prefer request, I'll use it as long as it works
typing req is muscle memory at this point
then in async funtion
...
const dat = await request(...);
if(...)
...
can you turn it into a constant function?
man they are call callback-based APIs

@_@
you want callback hell or what
rereadability better with constant functions
no
dafuq is a constant function
fuck your arrow functions
req doesn't return a promise remember
:<
you mean a function expression? like const req = function () {}? it doesnt really matter lol
If it did you wouldn't have this problem
you don't even know how to convert that into an arrow function
pretty much
I do
WHAT
then do it???
man i'm losing steam
also for the love of god, learn how the javascript event loop works
thank you
lmao Sayuri is losing his shit
const request = async (params) => new Promise((resolve, reject) => req(..., (res, err) => {
if (err)
reject(err);
resolve(res);
}))
const request = (params) => new Promise((resolve, reject) => req(..., (res, err) => {
if (err)
reject(err);
resolve(res);
}))
``` better?
lol sorry for the madness caused
then in the other async function, you await this function call
be sure to use try catch
that's part of this channel
else it would throw an exception
@ancient nova remember
synchronus code gets executed first
then callbacks
then resolved promises
man just use node-fetch lmao
not about the api, just execution order
not really... it's not certain when a callback is going to be executed, depends on the method
javascript doesn't decide how fast the request is going to be made
then you better back your data up before your computer gets hacked by chance
vurneralbility is never good
why would it get hacked from using request?
security exploits
it's not maintained
also I just noticed the syntax isn't right on this
you run the bot on your pc
const request = (params) => new Promise((resolve, reject) => req(..., (res, err) => {
^ returns a synatx error
if (err)
reject(err);
resolve(res);
}))
take a break
@ancient nova a cleaner way
(res, err) => err ? reject(err) : resolve(res)

couldn't imagine when i do 8+ hours often

that's what she usually does
Probs from request?
What sends an error like this
Oh it's probably ur own custom thing
is it?
it's just a custom error handler but it mostly returns original errors
I TOLD YOU TO USE TRY CATCH DIDN'T I
@_@²
why does it matter ?
😭 ur code is definitely spaghetti I can smell it from here
it shouldn't do that + try catch looks ugly
"why does exception handling matter", you asked
not really I care about how my code looks 100%

it rather looks ugly than letting your program having malfunctions
/** 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*/);
const Database = require("better-sqlite3");
const db = new Database("database.db", { verbose: console.log });
/** GET PASSWORD */
app.get("/checkPassword", 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;
//var createDatabase = db.prepare("CREATE TABLE IF NOT EXISTS users (name TEXT NOT NULL, pass TEXT NOT NULL)")
//createDatabase.run();
//var insertDatabase = db.prepare("INSERT INTO users (name, password) VALUES (?, ?)");
//insertDatabase.run(
// "Zero",
// "Root"
//);
/*var removeDatabase = db.prepare("DELETE FROM users WHERE name = ?");
removeDatabase.run(
"username"
);*/
//var getDatabase = db.prepare("SELECT * FROM users")
//getDatabase.all();
var getCertainUserFromDatabase = db.prepare("SELECT * FROM users WHERE name = ?")
let databaseResponse = getCertainUserFromDatabase.get(username);
if (!databaseResponse) response.json({success:false})
response.json({success:true,password: databaseResponse.password });
});
/** PORT APP */
const listener = app.listen(process.env.PORT, function () {
console.log("Your app is listening on port " + listener.address().port);
});
``` here's the API for exmple
You can use .catch
looks sorted
if you don't catch the error, how can you notify the user?
you used var

my handler uses unhandled exception to catch errors
what's wrong with var?
Template literals strings without any templates inside them too
then why the exception showed up as Unhandled
thats not a good practice
naming collisions: var leaks to outer scope
use let instead
In the grand scheme of things it probably looks a lot worse
also it must be handled
you don't want unhandled stuffs hanging around
not funny
I know, that's why u can always continue using the app after an error
It might look good but that doesn't mean it doesn't have messy logic
and potentially wrong
okay well that's true
then don't ask the solution when it has an error if you insist that your code is perfect then?
PUTOS PUTOS PUTOS
Like using request with a wrapper function to handle promises, instead of just using node-fetch... Still looks pretty, but it's wrong
Handling all unhandled promise rejections can be useful when you don’t want the program to crash, but in reality you should be catching promises that have a chance to fail in the first place
^
(On promises only)
i don't want stinky callbacks
also how do i throttle async requests
seems like they are all executed almost simultaneously
you want to execute them sequentially instead of concurrently?
What's the point of using promises then 🤔
I have no clue
use a queue with await
let getResponseFromAPI;
try {
getResponseFromAPI = await resolveRequest(`https://transparent-speckle-door.glitch.me/checkPassword?username=${Username}`);
} catch (e) {
getResponseFromAPI = null
}
if (getResponseFromAPI != null ? getResponseFromAPI.success == true && getResponseFromAPI.Password != undefined ? Password == getResponseFromAPI.Password : false : _password == "Zero" && _username == "Zero") {
}
``` but I'll just leave it at that, if there's an error, name it null and go back to the hardcoded password lmfao
apparently executing 120+ calls at the same times
I know I just wasted few hours of my life here and I want to cry
stop... I know
One message removed from a suspended account.
Also all those == comparisons ew
One message removed from a suspended account.
One message removed from a suspended account.
yeah... it would've been if I'd only done it a json from the start
const getResponseFromAPI = await resolveRequest(`https://transparent-speckle-door.glitch.me/checkPassword?username=${Username}`).catch(() => null);
if(getResponseFromAPI && getResponseFromAPI.success) {
const password = getResponseFromAPI.Password;
}
(...or MongoDB but you're stubborn as hell)
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Our friend is stubborn on using (note: not learning) SQLite
== comparisions are unsafe given unknown types
sql stinky
not yet
One message removed from a suspended account.
I WANTED TO USE IT FROM THE START...
:<
sqlite is bae
I love Postgre honestly
@quartz kindle suggested sqlite3 and people agreed
I spend like an hour JUST trying to get that thing installed
is there a way to partially bind a function in js?
for example I only want to bind the last argument of a function
One message removed from a suspended account.
well, absolute path xml requests let's go
Your databases bore me 
Make a new function
.call
const bound = (...args) => something(...args, last);
el em ef ay ow
Use .bind
Actually I think bind only does the front
hmm seems like if you pass null to bind you can skip over arguments
I tried that but was facing an infinite recursion error because i was changing that function to itself but with last argument
better-sqlite3 takes that long
if you don't believe me try yourself
ill try doing something else
But what you're talking about is known as currying
i like curry
create a new function out of it
omg same
and pass the new function instead
well the arguments become null for me
I'm not sure what's going on in that pic to be fair
10 is not the answer I expected
One message removed from a suspended account.
One message removed from a suspended account.
null + null = 0
And people are complaining about other stuff... this is the true issue with JS
null
@radiant kraken kek
kek
stop pinging me for this
im tired of it
yes yes my name is null aka the js keyword i get it
ok thats what I was looking for
Use the code I sent u then
🤔 What other solution is there to this
https://transparent-speckle-door.glitch.me/checkPassword?username=Zero for some reason I still can't intercept the damn json from this website
this can't be the fault of request
it works with other APIs just not mine
[] + [[]] = 1
debug and check response
check in Promise callback
don't think so
both err and res are undefined?
just used the function you gave me, but modified to a constant function
const resolveRequest = (params) => new Promise((resolve, reject) => req(params, (res, err) => {
if (err) reject(err);
resolve(res);
}))
then used the thing Tim wrote to assign the json to a variable
const getResponseFromAPI = await resolveRequest(`https://transparent-speckle-door.glitch.me/checkPassword?username=${Username}`).catch(() => null);
if (getResponseFromAPI && getResponseFromAPI.success && Password === getResponseFromAPI.password) {}
``` also this to do the first primary check
Username is an object?
it's a variable
it's a string
CLI readline varable = _username which gets appended to Username = _username;
this too
no clue, would have to log them
give a sec
possibly it went to the catch block
both return undefined @civic scroll
wrong syntax
also you just defined a varible
so ofc it returned undefined
...sorry
💀
Hello!
that's why tim is my one and only code linter / quality checker 🤝
hi

I literally just walked in
a fine mess you just walked into
indeed
@ancient nova
.catch(console.log)
When is downtime done???
this is #development
Sorry
ask your favorite god/deity
just gave an error dump
so large it didn't even fit on my CLI
console
looks like you didn't explicitly request it to be application/json mime type
so it sent you html
evil
so I just add that to the request as an option
It's a header
request?
{
url : https://transparent-speckle-door.glitch.me/checkPassword?username=${Username},
method :"GET",
headers : {
"content-type": "application/json",
},
json: true
}
like this?
no
yea
Looks right
alright so should I try it?
res.json().then(resolve);
ya know unless it completely ignores that and you made it up
what do you mean?
I didn't have any of those options before
check its overloads
what do you mean by that?
a function might have many ways to call
check in your IDE by hitting Ctrl Shift Space while thr cursor is in function's parenthesis
I've got 3 results
Why can't I vote bot ya ka
- server down
- this is development channel
- not reading pins issue
used the options still didn't give me json
stop using var please
let is also 3 characters
it never gave me a issue
var is hoisted and doesn't really care about scopes
okay okay I changed it to let
or even worse, mem leaks
don't have to list everything
most IDEs don't really allow u to even write var without throwing a ton of warning at u
I have never in my life said or even thought that lmao
check if you have the right thing put in
defintely
changing var to let is in the path of "fixing the api"
which icon is better?
2nd
neither
rip lol
tf is that texture?
also i dropped request 2 years ago
the 2nd has a face value while 1st none
... naaaaaaaaaaaaaaaaaa still gave me the same issue
feels like you threw those icons on a federal highway at monday
I can try node fetch ig...
then picked them up after an entire 40°C summer
let me look at my bot's old code
okay
i can easily remove the texture lol
please do it
yea i think that too, but i think the 1st one fits more
what is the first supposed to be btw?
a D
oh is that ur rpc thing?
lol yea
2nd def
2nd better
I'd also remove the border on those inputs, or at least make it lighter
they go lighter when hover/active
actually
still, looks kinda weird when they're this dark
you should look at the error
there is no error
it either returns null or sends the entire body instead of the json
they match the little preview window color
EEh I'd remove the preview border
@ancient nova
but i used node-fetch
since that's what you're mirroring

and give it a box shadow
version?
latest as in Oct 2020
it has a box shadow, at the bottom, but yea, it could be a little more rounded
latest is 3.2.3
use latest then
then you handle in the then callback so you just gonna await the request
oh my fucking god
... I already had nodefetch installed, plus I also had it defined and never used it in the script
PPLEASE
KILL ME
"clean code"
funni
🔫
average js coder
"unused variables"
The public repository of Sayumi, a Discord bot. Contribute to sayuriu/Sayumi_JavaScript development by creating an account on GitHub.
take a look at that
though i can optimise it, it's the code from more than a year ago 
.then() hell
:^)
u don't really need to know how it works in order to use promises
but did you ever do eval(fs.readFileSync()) instead of require? :^)
... I do that right now?
i want to know code execution order
@ancient nova read this for reference
I did
lmao
man you call in terminal
I see no better way of executing commands
pain
planned to do a terminal REPL eval
When it will come back
then halted
let getResponseFromAPI = await fetch(`https://transparent-speckle-door.glitch.me/checkPassword?username=${Username}`).then(async out => {
getResponseFromAPI = await out.json();
})
``` is this legal to do?
this is development channel
read pins in #general
Sorry
I made the border radius closer to discord, but i think im gonna add the border back around the preview. doesnt look right to me without it lol
ye
const fetch = require('node-fetch');
^
Error [ERR_REQUIRE_ESM]: require() of ES Module
``` wat
const res = await fetch(...).then(data => data.json());
Make it rounder and it'll look better
you don't use import statements?
nope, only require();
maybe installing an older version or find a work around
Oct 2020
give me a second
I made a backup I can restore to see which version I used
used version v2.6.1
this one seems to work with require ig
I wonder why the newest one doesn't
the dilema, can you at least you import with require?
try that color I suggested
it still doens't work even after downgrading how come
in favor of module js import syntax
can you use both require and import in one script ?
if so I can just change node fetch to import
require is just a method as any other
I prefer not lol
time for a rewrite
yea so it doesn't work for some reason
meaning?
no error but still doesn't work
there's no require in ESM modules
ESM modules get imported asynchronously so they cannot work with require
I meant having both of them in the same script
require(someotherscript)
import 'this' from some otehr
gave me hope there
not recommended
lmao
Do those imports work with cache too?
Use typescript and you'll have both :p
@lyric mountain I do think i like this bg color for the icon better
As in, can I do those imports in my functions that get called often? Or is there another way?
I've been here since like 11:00 I don't wanna spend another 4 hours rewriting everything to typescript
just please tell me why node-fetch doesn't even work
typescript scares me 😭
You can only use dynamic imports in code
true, root
and tell me what works
but yeah they are most likely cached
LOL
i started writing my bot in 2019...
lmao
it's the same syntax
check if type in your package.json is module
You started working on your bot in 2018 and still don't know some basic concepts of the language you're programming in 😭
what?
WHAT

I started programming in like 2016 earliest, and since then I learned like over 15 languages
js isn't the only one
wait what?
lmao
jack of all trades, master of none
Started mine in august 2020
well it's better to know many than master one
Not really
started in aug 2020
color me curious... what other languages do you know?
can you build a game in javascript, no
yes
Yes
i have an entire game engine
You can
a bad game
no
can't do much in js
OFC YOU CAN
???
its actually really nice lol
;-;
People can learn a lot in a month... it all depends on the person
That is the most upside down logic I’ve ever heard
can you make a 3D game with raytracing and support for every platform in JS?
I’d say it’s infinitely more useful to master one or two languages than know a little bit of 20
sure enough
you can
no
probably
i literally only use js now cause it can do almost everything 😄
you cannot
Yes you can lol
You can on the browser
there are 3d libs for js yes
Unity compiled to WebAssembly
quite a few
okay but you can't make an application
Yes you can
browser supports webgl
i literall am ~ in node electron
Electron
it switched to c#
Lmfao
electron
React native
funni
ok ok I give up
also fun fact
Discord is made in either electron or react native I believe
electron
discord is a js app
discord is made in electron, so is vs code
sorry for shattering your dreams
but js is much more powerful now
than what it used to be
the question is SHOULD you use js
you can also easily turn webpages into mobile apps
have you guys checked out ultralight?
no
hoo dat?
my phone is at 9%
oh
0o
thought discoed theme
i was looking on PixiJS
render html to a bitmap 0o
Looks promising
pixijs is what my engine uses as a renderer 🙂
its super quick
check your package.json config and compare to mine
should not be wrong if ver 2.6.1
planning to use it with Live2D SDK
The license though...
seems fine
ahh yea, ive seen a few projects that use live2d. i went for dragonbones armatures instead, but i wrote a converter for live2d/spriter/dragonbones to go from any to another 🙂
I guess if you make $100K annual revenue you wouldn't have a problem to pay for the subscription license lol
only difference is the discord related modules
but I still don't like it
yeah the licensing is not that nice
but the project seems to have a lot of potential
make it work
pog
yea, overall they havent sold me on a download 😄
it had tons of issues last time i tried it tho
finally
it's enough to make a grown man cry
🤷♂️
let getResponseFromAPI = fetch(`https://transparent-speckle-door.glitch.me/checkPassword?username=${Username}`)
.then(res => res.json())
.then(out => getResponseFromAPI = out);
``` only reason node-fetch didn't work was because I didn't resolve it first
and yes, I didn't use var in this one
bruuuuh
use await
.then(out => getResponseFromAPI = out); this is not how it's done
it does work tho?
lmao



