#development
1 messages ยท Page 1441 of 1
Its setauthor
You have your class indented by 1. It needs to have no indentation. Like this
can you show the code
Sorry im on mu phone now i can show later
Yes. You entire class is indented by 1 extra tab. You need to select the entire thing and then pess shift + tab to un-intend it by 1.
are you trying to do .setAuthor(message.author.displayAvatarURL()) @timber fractal
Ye
S
yea it will only show the link for that
Oh
again same problem
if you want the image
Yes
do something like .setAuthor(message.author.tag, message.author.displayAvatarURL())
Ok
That's all I can see wrong from the screenshot. Would you mind sending me the full file so I can check it myself?
wait
@timber fractal difference there without and with message.author.tag https://i.imgur.com/BLbhxk2.png
dont have to be tag either can be whatever else there is
Okay thank u
@weak parrot
you took that from github
hmm
@pale vessel poggers https://www.npmjs.com/package/jason.db
Can someone send a screenshot of that file
Did you shift tab the entire file or just that class? Cause I can't make heads or tails of where functions begin or end
only class
oof
OOF
@slender thistle https://pastebin.com/5hB7cR7z
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
pastebin 
Yes
@weak parrot help me please
wdym
Fixed it I think? https://pastebin.com/aXX5iC6L
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
hastebin > pastebin
@weak parrot class problem solved now new problem came
wait for what?
for nesting
Imagine giving a fuck about what service people use to share code ๐ฉ
I don't know Discord.py so if it's anything related to that I can't help
I just know basic Python
Like saveToDB("guilds", "264445053596991498.prefix", "a") and when you use getFromDB("guilds", "264445053596991498") it shows the whole object, with the prefix property
Simple keys can't do that
Split periods
and loop through them and create the property if not exist
I also have another suggestion
Make the method names simple
sure what should I rename
get(), set()
how can i get vars i set during a func with python?
return?
like i want to return multiple things
wdym object?
same
it does
yes they have objects
like guild object etc
ok
@pale vessel could you help me make a function to turn all of the x.y into x: { y: }
I'm trying right now for the past 5 minutes
xD
oh
flaze
we can turn the input into an array and call the function again with an array
wait
hmm
still gives the problem of how to set the values
how can i like just use the vars of a func
so i run the func
and i can use it's vars prob with return
but not just like paste or something
@drifting wedge you could use tuples, dictionaries, lists
I personally use tuples but make sure to document what I return
I think I got it
nice
bruh
Ah js right
wdym
I was getting ready to write Python code for this
but then when running the func how can i get the dif vars?
id do dict = func
etc
dict func()?
=
def func():
return 1, 2
one, two = func()
print(one, two)
https://gyazo.com/ec21828c97e58552d7d5565c53fefbc8
I did mention a user... How can I fix my unban command? -_-
//java
if (ReplacePrefix.startsWith("unban")) {
if (event.getMember().hasPermission(Permission.BAN_MEMBERS)) {
try {
event.getGuild().unban(event.getMessage().getMentionedUsers().get(0)).queue();
event.getChannel().sendMessage("Successfully unbanned " + event.getMessage().getMentionedUsers().get(0).getName()).queue();
} catch (IndexOutOfBoundsException e) {
event.getChannel().sendMessage("Please mention a user!").queue();
event.getChannel().sendMessage("Exception: " + e.toString()).queue();
}
} else {
event.getChannel().sendMessage("You must have the `Ban Members` permission to use this command!").queue();
}
}
that doesn't look like it should work
ty
shivaco is legit the python god lmao
how long have u been doing python shiv?
If it doesn't involve asyncio, threading, or anything of that sort
About 3 years now but I haven't done much other than Discord bots and Flask/Sanic
same 

Cya have fun
why would you say js is poopy lol
imo the syntax is 10x better
but it doesn't handle variables well
doesn't mean its worse than py
we arent supposed to have lang wars but whatever
nah
imo I feel python is superior, because it's syntax is easier to understand
and it's modules can go really far
do you still want to do collections
kinda
but nesting > collections
tbh I will be changing the code a bit so a collection is a class
can anyone help
f
hours
how
Whats the easiest way to to encode a request? in python?
just change to 4 then
after this
and ctrl F at the end for the quotes
Hello! ๐
Can someone give me an example on how I can filter, can seem to figure it out.
mongodb?
Yes.
wdym filter?
u wanna use a key
i would give u some pseudo code but idk wat lang?
Like I want to find a specific userID, for example.
the mongodb website doesnt work well for this
not for me @crimson vapor
JavaScript is a horrible masterpiece.
Oh waitt, I wrote it wrong. It now works.
its perfect
I would rather learn python! ๐
JS or PY, go for the one that suits you the best
You need to try other languages to understand JS' face-front shortcomings

imo yes
๐
No need for a lang war really, program in peace
So in the future, you will need to change as well. Or else what's the point.
Poggers
find one you like and stick with that. JS can be better than PY in some situations
You don't "need" to change, stay with it unless you come to the point where you can't do the thing you're planning to make with that specific language
Yes. But I am saying the benefits of PY, and I am not that JS is good or bad or etc.
Every language has it's own limitations
As an example
JS doesn't support really big integers
PY is single threaded
voltrex
JS is as well
๐คทโโ๏ธ
im creating a new object with new Class, inside another class, how can I access the first class from the second class, js ofc
Python has its good and bad too. Look no further than GIL - global interpreter lock.
responsible for Python's slowness
Like
class Bruh {
// Stuff
class Moment {
// Stuff again
}
}``` you want to access `Bruh`?
umm
I don't think you can do that.
In Java I know you can, but in JS I don't think nesting classes is allowed.
huh
nice
and set
rip
Hi, I have had problems creating an embed, someone can give me their embed code, it can be discord.js or discord.py
You use two libs at the same time? 
flaze how much do you have left to do?
One of my python embeds
@client.command()
async def somecommandname (ctx):
embed=discord.Embed(title=f"My Title Lol", color=0x00dcff)
embed.add_field(name="Idk, 1234", value="Something here", inline=False)
await ctx.send(embed=embed)```
thanks
can i delete the data.json in tmp
okay i'll just keep it
tbh delete it since its useless
Have someone every programmed a MusicBot for Discord?
yeah it's gone after I use it
yep
MILLON which language?
js
can you help me in Java? I am not understanding LavaPlayer lol
million what in the living fuck did you do
wdym
did you change the spacing back
you guys are still doing the json db thing? lmao
yes
oh fuck me
Are you familier with LavaPlayer and Javba?
nope
wdym
damn
never used them
javba is cool
bro I use npp
javba hahahaha..
u have a space
like commandname(ctx)
u want like ^
not commandname (ctx)
waddup?
kinda
console:```
Function: move786563415716003871
Function: move487511010886942720
Function: checkEaten786563415716003871
Function: checkEaten487511010886942720
Function: checkDied786563415716003871
786563415716003871
Function: checkDied487511010886942720
487511010886942720
Start
Start
Function: generateGui487511010886942720
Function: generateMap
Function: generateGui487511010886942720
Function: generateMap
Stop
Stop
Function: encode487511010886942720
Function: encode487511010886942720
So what happened was, instead of being at different. It kinda overwrites
normally it would be
786563415716003871
487511010886942720
but after the checkDied function, it changes to
487511010886942720
487511010886942720
@crimson vapor Should've been Boolean (for the has() method)
the typings was correct though
alright ill change it
i forgot to change that one
I am moving all the has get set functions to the collection class
is the bug on the checkDied function or the generateGui function?
so DB.collection('collectionName').get('yes.no') // returns no.yes
generateGui:```js
async function generateGui(userId) {
console.log("Start");
let ins = await games.find((g) => (g.userId = userId));
console.log("Function: generateGui" + ins.userId);
let map = await generateMap();
await ins.game.snake.forEach(async (arr) => {
let toReplace = [...arr];
let clone = [...arr];
toReplace.unshift("black");
let index = map.findIndex((x) => x.toString() === toReplace.toString());
clone.unshift("green");
map[index] = clone;
});
let food = [...ins.game.food];
let toReplace = [...food];
toReplace.unshift("black");
let index = map.findIndex((x) => x.toString() === toReplace.toString());
food.unshift("red");
map[index] = food;
ins.map = map;
console.log("Stop");
return map;
}
checkDied:
async function checkDied(userId) {
let ins = games.find((g) => g.userId == userId);
console.log("Function: checkDied" + ins.userId);
let head = [...ins.game.snake[0]];
let body = [...ins.game.snake];
body.shift();
if (
body.some((a) => head.every((v, i) => v === a[i])) &&
ins.game.heading != "stop"
) {
console.log("Overlap");
let index = games.indexOf(ins);
games.splice(index, 1);
return;
}
head.forEach((x) => {
if (x > defaultX || x < 0) {
console.log("Border");
let index = games.indexOf(ins);
games.splice(index, 1);
return;
}
});
console.log(ins.userId);
}
@quartz kindle Can ya help me?
@carmine summit
uh.
let me just scream very very load as i havent figured this out for 2 hours
excuse me
ok.
Thanks
Tim literally spots every error in less than 15 seconds, he's speedrunning error checks
Tim 100% should get his own role
๐ฟ Or i may say, speedrunning knowledge
jesus @pale vessel https://million.is-a.computer/files/ZIj65DeT0TPocby.png
How can I create meme embeds?
All for that node 14 and below support
yea ik
What are you making flaz
it looks kinda strange
json db

Hmm
fkin works
same
it said "save" on your get method too
flap wat bot u make?
I copy paste too
pog
What do I do for my bot to send memes embeds?
const client = new Client({
disableEveryone: true
});
client.on("ready" , () => {
console.log("I am online");
})
client.login("Token") // I replaced my actual bot token with this so it doesn't gets exposed```
Someone please tell if this server is right or not
I am new to javascript
that should work
yes
you should also use ``` not `
very wise of you to remove the token
for code blocks
fuck
oh wait
ik what I did
why
sets cursor
returns data
No
how can i make that the bot will DM me the top 10 servers with most users in them?
languages are js, python and all of them right?
so languages are discord.js and all of them?
there and on if (value)
is this a good way to make an app in js:
delete myself
python has entered the chat
self
myself is None
wait what
what if i put 0 as value
oh
should I change cursor[property] == undefined?
ty
then it might not save it
that's fine
null === undefined?
no but null == undefined though
they're 2 different values ๐
so x === undefined but y !== undefined right
You can, actually, do x == undefined or y != undefined and it'll take both null and undefined btw
what about 0?
that's a different value
we want to allow null
if you want to take all falsey value, just do if(x) or if(!y)
that's 0, null, undefined, false
This is a JSON db by the way LOL
ye
What? why? 
If you're not doing atomic reads and writes, don't make a json db wrapper, you're not helping anyone with that shit
yea I would use jsoning if I want a json db
since it has atomic write
still, why
might as well use a real db
I'd use nedb for god's sake it already exists.
yeah
Yeah I love building boats with holes in them for fun, not like anyone would ever sail them.
I did it cause I was bored
@crimson vapor You can use https://www.npmjs.com/package/write-file-atomic
or
too late evie
I could publish it

LOL
only reason I would ever use a json db is if im starting a project and don't want to deal with setting up a real db
tbh you can make the same thing but with mongodb
wdym
What do you mean by "real db" though
lol nm just use mongoose at this point
one that isnt json
do you mean like you don't want to setup a database server?
like setting it up to work with the new project
Cool. Just use https://enmap.evie.dev/ then, it was literally made for you
shhhhh
"I have a small project and don't want to setup a database" is precisely what enmap was made for.
just saying.
lurkin'
Your reason should be "I want to practice" and nothing else, no need to justify it by trying to find excuses ๐
nah the real reason was I thought it was funny
even the name is a meme
yep
What's funny is that Enmap started out as an idea of "What if I took discord.js collections and made them persistent"
ive never even used enmap lol
same
It's basically like discord.js collections but with more features and an sqlite file to store the data.
ยฏ_(ใ)_/ยฏ
evie whats the @returns keyword in the comments before a function used for
well returns
but
how do you use it correctly
It tells jsdocs what returns from the function
what's sqlite
sql but @sudden geyser ?
lmao
Tim
Haha, I knew Tim would see that ๐
hi
it's @return {type} description
๐
for example: ```js
/**
- Retrieves a key from the enmap. If fetchAll is false, returns a promise.
- @param {string} key The key to retrieve from the enmap.
- @param {string} path Optional. The property to retrieve from the object or array.
- Can be a path with dot notation, such as "prop1.subprop2.subprop3"
- @example
- const myKeyValue = enmap.get("myKey");
- console.log(myKeyValue);
- const someSubValue = enmap.get("anObjectKey", "someprop.someOtherSubProp");
- @return {*} The value for this key.
*/
technically you are already destroying yourself since yesterday
LOL
Yeah "I'm making a json db" is basically a glorified way of saying you're an idiot tbh.
yeah but no one was calling me out
LOL
also evie why are you using jsdoc on gitbook
I convert it to markdown
An idiot, as we all know, implies someone of lower intelligence. I wouldn't necessarily call someone an idiot for saying that, more so ignorant.
how would you jsdoc a return value that is both an array and an object?
Literally I have a conversion script.
I see idiot as more of a phrase
but yeah it is kinda ignorant if you use the real definition
You can't be making a db while being ignorant of it deficiencies. lol.
people will tell you
you can't return both an array and an object. Do you mean an array OF objects, or do you mean and array OR an object?
json db go brrrrrr
uhm
@return {ifuckedup} Some shit you won't want to use ? lol
lol
every data type in javascript extends Object so umm
i need it to be that way lmao
The real answer is "don't do that"
Yes
because the return value is coming from a C lib
and the C lib returns multiple things at once
Or, in other words, use a class instead. probably.
Return an object with its respective instantiated properties so that you have a clear representation of what you're returning.
this is js tho
Just my 2 cents, of course.
i mean sure i can just return {1:something,2:somethingelse,a:10,b:20}
but the function explicitly returns an array of doubles from C land
oh
and extra return values for error messages and function status
Parse the array of doubles from the C lib, and create an object / map to return.
i thought you were talking about the programming language C
Basically, this.
i am

Heh
this
i did it that way because it just felt like it was the most approximate thing to the original i could get
return an array with an attached property for error and status
lmao
Sounds like an object ๐ค
arrays are objects anyway
I mean, at the ending of the day, do whatever works best for you; however, 'best practice' would dictate returning something that can be represented in a readable way.
everything is an Object in js
Object is an Object too
the C function is literally this ```c
double returnValue [6]
char errorString [256]
int32 status = functionTHing(arg1,arg2,arg3,returnValue,errorString)
i have to return all of them
int status, error string and array of 6 doubles
Is that a reputable C library?
tim forgot to put the code syntax lmao
yes its an official library thats been in development since the 90s
i need the api key of discord bots, i made a discord bot and uploaded it, but it still says i have no bots
what can i do/?
@obsidian cairn wdym uploaded
i guess i should just do this then ```js
return {
value: array,
status: number,
error: string
}
reload your profile page
but it feels weird having to access another property
Agreed, Tim
did it but it still says the same
because "officially" the function returns an array
Like said, do whatever you think is best ๐
and since you're whitename you probably have no approved bot
how do i get my bot approved?
wait
wait for a bot reviewer to check it
how much time does that take?
if it follows #rules-and-info then it will get approved
it takes around a week right now
(don't be angry we're faster than discord verification)
A week or more for approval
bruh
Best case, is a week.
I had to wait so much longer than a week
last time i heard it was 5 weeks lmao
Tim you should rate my code now
Mine got approved in a bout a week and a day.
But it was over the thanksgiving holiday.
mine got approved in 6 days
thats the file im testing to on
you should make it .jason
can u send me the link of you bot? @earnest phoenix
it is
By default?
no
on DM pls @earnest phoenix
default is specified by user
oh never mind you can - yeah
ok
because realistically the extention shouldnt matter right
@obsidian cairn you can just join my server and see it too lazy to get the invite link for bot
see my epic status ad
I have now rewritten console from node.js https://github.com/SodiumApp/BoxJS/blob/master/src/BoxJS/src/lib/console.js 
can someone help lol
send me your server pls
bruh
You rewrote over the standard console.log?
discord fucks my status everytime
technically i wrote my own console.everything because im writing my own embedded javascript runtime designed for workers
https://hasteb.in/qekerafe.js
im getting an error in some servers (the reply)
can someone help? serverinfo command (it can't get owner tag)
check that repo's root directory
Where is console.table()
Interesting. For embedded applications, a more minimalist language would have sufficed
not there yet

console.table > kitchen.table
Well Javascript is fairly fast on its own, promises arent really designed for what they are used for commonly but it suffices, mainly its for things like worker applications, like cloudflare workers for example
people just write JS and throw it on the web
stuff is safe from out of memory exceptions too(V8/node is not for some reason)
Yeah, I use AWS Lambda at my job. We leverage GO, and it's incredibly fast - both from a coldstart perspective and compute perspective. Not knocking your decision though.
Yeah I use Go and its probably what our front-ish API will use, that or Rust since they have nice organization for web stuff(bless macros)
.Jason 
Lmao
Currently the thing with this, im trying to keep the startup times extremely low to not even have cold starts, every single run is run on a random worker-assignment-container in kube, one container can run as many javascript runtimes as you give it. Contrast that to cloudflare workers which uses V8 without memory safety which forces each one to be spun in its own container, which is slow. Here our start times are less than 3ms for one Runtime and about 20ms for the actual assignment-nodes that create the workers
So if you hit something 50 times it wont run in one container until its out of use(probably), it will run on 50 different containers really fast and die quickly, presumably with a 10mb memory limit or so in place
Yep, understandable. That's why we chose GO. By default, it had the fastest coldstart time.
Yep. On AWS, if the lambda sits for longer than 5 minutes - it destroys the container on the backend ... so the next run will be a coldstart.
Yeah, im being kinda ambitious with the idea but the most daunting part of this is usually the container technology and ive already gotten really close to getting that up perfectly
What are you using the workers for?
Not sure I entirely understand ๐ค
Also Lambda runs everything in individual containers with alpine start times so thats why, you would think with Cloudflare workers using plain V8/Wasm it would be way faster but each worker has its own container because of V8's inability(by choice) to go up the stack on OOM, it will kill the process and everything on it. So yeah blame google V8 for cold-starts lmao
Honestly, the only way to do something like that is to keep the worker warm (unless Cloudflare provides some sort of functionality for that). Keep in mind, you're basically running a server at that point if you're running your 'workers' for the sake of running them ๐
That method is only implemented on discord.js v13 @earnest phoenix
Which isn't out yet
Well heres the thing, each worker is not a container, its a virtual instance thats created within a worker-node which can hold many workers at once and create and delete them with sub 5ms times
You can set memory limits for each runtime too, so basically creating like 50 of them in two seconds is completely doable, and you would have Kubernates with many nodes too
But, I'm assuming the worker would need to 'shutdown' at some point unless you consistently hit it - right?
The worker is shutdown instantly after the web handle function is run, each request creates a new temporary runtime on a worker-node with low limits and the moment it returns response that worker will be killed
response time 10ms if you dont count server latency
Ill probably implement some stateful timeout later on but worker-starts are basically instant so it will be more of an efficiency thing
if i import a piece of code from another file in node, would the variables in the file that imported the other file work with the code imported?
example:
// source.js
exports.addLanguage = function(langName) {
programmingLanguages.push(langName);
}
// index.js
const { addLanguage } = require("source.js");
const programmingLanguages = ["Python","JavaScript","C++"];
addLanguage("C#");
If you can make it work, go for it - haha. I just don't believe that's their intended functionality ... unless I'm mistaken.
It's really a serverless compute where you can execute it for 1-off executions. If you need to do it again, great - just do it again. 0 management
But, you obviously know that ๐
I am testing my vps apis with postman and everything works fine, I am able to get my json response.
Now, on my vue website, I'm using axios to make the exact same request but as res.data I don't get the json I need, instead I get the full html page of my vue website (also the res status is 200)
Why?
do you have a 404 on the vue page or conflicing routes?
What do you mean?
I'm trying to fetch apis from another server so it's totally another thing from the website
Thats my philosophy there, hoping i can get it to be efficient running once for each execution
thats the definition of a serverless function
different state for each request
?
talking to someone before
anyone?
@pale vessel so basically importing code in node is kinda like read file then eval(exports)
what does Discord.Structures do?
most objects you get in d.js has structures
like guild, channel, role, etc
you can extend them
how would i make it so it doesnt generate the same pcode twice
let pcode = makeid(20)
let invalid = db.fetch(`code_${pcode}`)
if (pcode === invalid)```
pcode is a new code, then im checking if its in the db already. if its in the db then uh what do i do
let type = args[0].toUpperCase()
if(!type) return message.channel.send("You need to specify a type of code to generate.")
function makeid(length) {
var result = `${type}` + "-";
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
var charactersLength = characters.length;
for ( var i = 0; i < length; i++ ) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
return result;
}```
type is like "giveaway" so giveaway-codehere
(node:2424) UnhandledPromiseRejectionWarning: Missing permissions: I not have permissions to Manage Messages in this channel to delete reactions.
what does this error mean lol
thats not the best way to generate a unique code
if (userMessage.content.toLowerCase() === 'confirm') {
client.awaitingMessage.delete(message.author.id);
var embed = new MessageEmbed()
.setTitle(`Item Purchased!`)
.setDescription(`You have purchased x${amount} **${items[item].name}** ${items[item].emoji} for **${functions.commas(coinsNeeded)}** coins!`)
.setFooter(`Requested by ${message.author.username}`, message.author.displayAvatarURL({ dynamic: true })).setTimestamp()
.setColor(client.color);
message.channel.send(embed);
}
};```
this is when it happens
to generate a unique code, you need a random component, which you already have, and also a date component
for what though
so that even if by any chance you get two equal codes, if they are both generated 1 millisecond apart they are still unique
embeds i guess?
manage msg + embeds
why the manage message? i dont get it
(node:2424) UnhandledPromiseRejectionWarning: Missing permissions: I not have permissions to Manage Messages in this channel to delete reactions.
thats the error you provided
it cant delete reactions without it
you can simply add result += Date.now().toString(36).toUpperCase() after the for loop
yes. but how is the bot requiring the manage msg perms, its not removing a message
perhaps a different command?
oh
its removing a reaction
it cant remove a reaction
of someone else's
without having that perm
it's not removing a reaction tho
@gentle lynx you know you can just do number.toLocaleString() instead of functions.commas
iirc
well yes it is
client.awaitingMessage.delete(message.author.id);```
its deleteing an awaitingMessage
deleting*
thats a set in the code
ok im back
client.awaitingMessage = new Set();
uhh
its still supposed to delete a msg in discord right??
no
it sometimes work and sometimes doesnt
so confusing
well anyway, ill just make the bot send an error message if it doesnt have manage msg perms
no
client.awaitingMessage is a Set not a message object
Set#delete removes a key from the Set
hmm
no
thats odd
anywho,
db.set(`code_${pcode}`, "true")```
this sets a code, but if i wanted to fetch *all* existing codes, how would i do that?
db.all does not work, it gets everything instead of just the codes
well can you set code as an object and add pcode: true?
code: {
`${pcode}`: true
}```
db.get('code')
do code.${pcode} instead of _
im not sure but maybe you can do code. instead of code_ and code will be an object
ye
what does code.${pcode} do?
also, i can do that for a DB
?
code: {
`${pcode}`: true
}```
this
it makes your data object
so db.get('code') would work?
it will return all pcodes you have
aight
is there a list of permission codes for role permissions for guild members in the discord API?
they don't always name the permission code as BASICALLY_THE_PERMISSION_NAME_BUT_MARCO_CASE
bruh
that's a template string
PLEASE learn javascript before trying to make a bot
most of your errors can be solved with common sense
no
please tell me that this isnt acceptable
it isn't because xCoord and yCoord are defined earlier and their values are changed per loop
why not just use let
how come something returns as object object
to create an object
also that class name
var myObject = {
myProperty: "my property value"
};
db.set("myDatabase.myDatabaseProperty", myObject);
heavy w3schools ripoff by putting my in every variable name
lol
yeah but
let codes = db.fetch(`code`)```
wont work
since its not in json
i mean i think it isnt because it returns as object Object
ah i got it
JSON.stringify(codes)```
ez
ok it works now
so my money is set like money_id
no
that's not how it works
wait i seriously need to know, is it ok to create an object from a function like this? I'm assuming no
it's not
ok good
Probably the wrong guild to ask this on, but I want to know if anyone has any experience with the MSAL library. I'm trying to get an Access Token for an API, but getting an exception after attempting to authenticate interactively
that shouldnt work
it does though ๐ข
the this inside that function will point to the global scope
so you are basically doing global.x = x
Tim am I able to have key be of type string or number https://million.is-a.computer/files/zpHUmZmPldXV1Lx.png
or window.x = x in a browser
yeah but it changes each time you call the function
so something like .set(key: string or number, data: any)
yes because you're defining them in the global scope, every time you call the function you change the global values again
sure why not
I mean how do I make it look that way
key: string | number
ty
nvm what i said, thats actually the correct way to create classes before ES6
yeah i tried logging window.x, returned undefined
pretty sure it works because of the new before it
really weird though
dunno why my teacher doesnt just teach about classes
because you aren't learning oop yet?
hes teaching pre-ES6 js?
yeah lol
he uses vars everywhere too
Tim how would you suggest I go about trying to corrupt my json file?
lol
epic
very
writeFile(...)
process.exit()
trying to corrupt a file
ok lol
how can I do that with writeFileSync()?
idk if you can do it from within the process
but if you ctrl+C it while its writing, it will work
hmm
maybe
first ig I should ask if it is even possible to crash if I save to another file then rename it
do you use .cache.get()?
yes
I'm guessing you're not fetching them and/or they're not cached ยฏ_(ใ)_/ยฏ
is there a way to easily split a line into multiple defined strings argument?
might be easier to just do the standard <@id>
var tl = await db.all(`money_`, { sort: ".data" });```
since your just using tags anyway
yea
let discord handle it
whats the difference between db.all('money_', { sort: <sort>}) and (await db.all('money') ).sort(<sort>)
ah global variable, dont let erwin see that ;p
lol
global.client = new Discord.Client()
I guess you could say the bot would be everywhere
fair
may i have the quick.db documentaire
not fair
you would have had it by the time you typed that
false
wrong link @crimson vapor its this one
https://lmgtfy.app/?q=quick+db+docs
Actually the function park should work just fine...
actually useful for a person who doesnt know quickdb well
quick.db uses sqlite
Tim please rate my json db
but fixed it
Youโve had errors on it?
Like what
no I've already fixed it
but
like
name it after jason voorhees
better sqlite3 install script error
a killer db
idk
ok i figured it out but
let all = db.all();
all = all.filter(e => e.ID.startsWith('money_'));
all = all.sort();
for(let i = 0; i < all.length; i++) {
let finallb = (`<@${all[i].ID.slice(4)}>: ${all[i].data}coins`);
message.channel.send(finallb)
}```
this doesnt sort it
Thats an issue with you not sqlite3
it also adds y_ before the user id?
is there any way to make a command that makes the bot leave the current guild?
Yeah
sure
this is what it returns
ah wait i sliced it nvm
also, this doesnt send as one message
for some odd reason
aaaa i finally have an lb ;D
lmao
any1 know how to make it send all in one msg
instead of it sending different msgs
let all = db.all();
all = all.filter(e => e.ID.startsWith('money_'));
all = all.sort();
for(let i = 0; i < all.length; i++) {
let finallb = (`<@${all[i].ID.slice(4)}>: ${all[i].data}coins`);
message.channel.send(finallb)
}```
those r two separate msgs
dont .send() inside the loop
lol
I would add tthat to a string
sort by decending I think
that might be unexpected behavior if you sort
im not quite sure which is a and which is b in a sort function