#development

1 messages ยท Page 1441 of 1

zenith terrace
#

which part of the embed are you trying to add it to, e.g. setAuthor

weak parrot
zenith terrace
earnest phoenix
#
class VoiceState():
#

Do you mean this?

#

@weak parrot

timber fractal
weak parrot
#

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.

earnest phoenix
#

ok

#

wait

zenith terrace
#

are you trying to do .setAuthor(message.author.displayAvatarURL()) @timber fractal

zenith terrace
#

yea it will only show the link for that

timber fractal
#

Oh

zenith terrace
#

if you want the image

timber fractal
#

Yes

zenith terrace
#

do something like .setAuthor(message.author.tag, message.author.displayAvatarURL())

timber fractal
#

Ok

weak parrot
#

stitch_shrug That's all I can see wrong from the screenshot. Would you mind sending me the full file so I can check it myself?

zenith terrace
#

dont have to be tag either can be whatever else there is

earnest phoenix
unique nimbus
#

you took that from github

earnest phoenix
#

no

#

-_-

#

i took that class VoiceState()
from GitHub

unique nimbus
#

hm

#

okay yea its not the same

#

from what I was looking at

earnest phoenix
#

hmm

crimson vapor
slender thistle
#

Can someone send a screenshot of that file

weak parrot
#

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

earnest phoenix
#

only class

crimson vapor
#

oof

pale vessel
#

OOF

weak parrot
pale vessel
#

pastebin closebruh

weak parrot
#

Yes

earnest phoenix
#

@weak parrot help me please

pale vessel
#

@crimson vapor . support when

#

xd

crimson vapor
#

wdym

weak parrot
zenith terrace
#

hastebin > pastebin

earnest phoenix
#

@weak parrot class problem solved now new problem came

pale vessel
#

never mind

#

different keys should just work

crimson vapor
#

wait for what?

pale vessel
#

for nesting

crimson vapor
#

am confused

#

oh

weak parrot
#

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

earnest phoenix
#

F

#

Sorry

pale vessel
#

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

crimson vapor
#

o

#

how should I do that?

pale vessel
#

Split periods

#

and loop through them and create the property if not exist

#

I also have another suggestion

#

Make the method names simple

crimson vapor
#

sure what should I rename

pale vessel
#

get(), set()

crimson vapor
#

oh you're right lol

#

much better

drifting wedge
#

how can i get vars i set during a func with python?

#

return?

#

like i want to return multiple things

crimson vapor
#

hmmm

#

can you return more than one thing without using an object?

drifting wedge
#

wdym object?

crimson vapor
#

does python not have objects like js

#

idk tbh not a py dev

tired panther
drifting wedge
#

it does

tired panther
#

yes they have objects

drifting wedge
#

like guild object etc

crimson vapor
#

ok

crimson vapor
#

@pale vessel could you help me make a function to turn all of the x.y into x: { y: }

pale vessel
#

I'm trying right now for the past 5 minutes

tired panther
#

xD

crimson vapor
#

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

drifting wedge
#

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

slender thistle
#

@drifting wedge you could use tuples, dictionaries, lists

#

I personally use tuples but make sure to document what I return

pale vessel
crimson vapor
#

nice

pale vessel
#

Still have stuff to fix

#

Can I make a pr if I'm done?

crimson vapor
#

UMMMMMMMM

#

yea y not

pale vessel
#

bruh

slender thistle
#

Ah js right

crimson vapor
#

wdym

slender thistle
crimson vapor
#

LOL

#

that would have sucked

drifting wedge
#

etc

#

dict func()?

#

=

slender thistle
#
def func():
    return 1, 2

one, two = func()
print(one, two)
knotty obsidian
#

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();
  }
}
crimson vapor
#

that doesn't look like it should work

drifting wedge
#

shivaco is legit the python god lmao

#

how long have u been doing python shiv?

slender thistle
#

If it doesn't involve asyncio, threading, or anything of that sort

drifting wedge
#

im good with asyncio.sleep

#

thats about it

slender thistle
#

About 3 years now but I haven't done much other than Discord bots and Flask/Sanic

#

same KEKW

drifting wedge
#

flask gang!

#

lmao for my dashboard

#

i have 5 lines of js

slender thistle
drifting wedge
#

js is poopy

#

python is best lmao

#

alr gotta go pretend to code!

#

cya!

#

ty

slender thistle
#

Cya have fun

crimson vapor
#

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

drifting wedge
#

we arent supposed to have lang wars but whatever

crimson vapor
#

nah

drifting wedge
#

imo I feel python is superior, because it's syntax is easier to understand

#

and it's modules can go really far

pale vessel
#

do you still want to do collections

crimson vapor
#

kinda

#

but nesting > collections

#

tbh I will be changing the code a bit so a collection is a class

crimson vapor
#

no one here atm knows much java I think

#

status on pr flaze?

knotty obsidian
#

f

pale vessel
crimson vapor
#

how

earnest phoenix
#

Whats the easiest way to to encode a request? in python?

pale vessel
#

because your code + I have to use 2 space indent and single quotes

#

Pain

crimson vapor
#

just change to 4 then

pale vessel
#

after this

crimson vapor
#

and ctrl F at the end for the quotes

pale vessel
#

why do you like 2 spaces

#

it looks unclean imo

crimson vapor
#

I prefer it

#

am strange tho

feral aspen
#

Hello! ๐Ÿ‘‹

crimson vapor
#

mongodb?

feral aspen
#

Yes.

drifting wedge
#

wdym filter?

#

u wanna use a key

#

i would give u some pseudo code but idk wat lang?

feral aspen
#

Like I want to find a specific userID, for example.

drifting wedge
#

the mongodb website doesnt work well for this

crimson vapor
#

no filter is a function on mongodb

#

and the mongodb website is fine

drifting wedge
#

not for me @crimson vapor

crimson vapor
#

{ userID: <ID> }

#

maybe

#

I havn't read docs for a while

sudden geyser
feral aspen
#

Oh waitt, I wrote it wrong. It now works.

crimson vapor
#

its perfect

feral aspen
crimson vapor
#

idk how you can't like js

#

easy to understand

feral aspen
#

Python is more organized.

#

And more bigger community.

earnest phoenix
#

JS or PY, go for the one that suits you the best

sudden geyser
#

You need to try other languages to understand JS' face-front shortcomings

earnest phoenix
crimson vapor
feral aspen
#

๐Ÿ˜‚

earnest phoenix
#

No need for a lang war really, program in peace

feral aspen
earnest phoenix
#

Poggers

sudden geyser
earnest phoenix
feral aspen
earnest phoenix
#

Every language has it's own limitations

#

As an example

#

JS doesn't support really big integers
PY is single threaded

crimson vapor
#

voltrex

sudden geyser
#

JS is as well

feral aspen
#

๐Ÿคทโ€โ™‚๏ธ

crimson vapor
#

im creating a new object with new Class, inside another class, how can I access the first class from the second class, js ofc

sudden geyser
#

Python has its good and bad too. Look no further than GIL - global interpreter lock.

#

responsible for Python's slowness

earnest phoenix
crimson vapor
#

umm

sudden geyser
#

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.

crimson vapor
#
  this._moment = new Moment();
}```
#

how do I access Bruh in Moment

sudden geyser
#

You'd want to put that in the constructor

#

and pass this probably

crimson vapor
#

ofc

#

oh

#

ty

pale vessel
crimson vapor
#

huh

pale vessel
crimson vapor
#

bruh

#

ty

#

thats hot

pale vessel
crimson vapor
#

nice

pale vessel
#

so far it's okay

crimson vapor
#

nice

#

can I see code?

crimson vapor
#

and set

pale vessel
#

and i just realized

#

i can't use ?.

#

Since it won't work below node 14

crimson vapor
#

oh

#

fuck

pale vessel
#

but that's the gist

#

I can fix that ig

crimson vapor
#

rip

hard anchor
#

Hi, I have had problems creating an embed, someone can give me their embed code, it can be discord.js or discord.py

pale vessel
#

You use two libs at the same time? amandathink

crimson vapor
#

flaze how much do you have left to do?

frigid schooner
hard anchor
#

thanks

pale vessel
#

okay i'll just keep it

crimson vapor
#

tbh delete it since its useless

weary socket
#

Have someone every programmed a MusicBot for Discord?

pale vessel
#

yeah it's gone after I use it

crimson vapor
#

yep

weary socket
#

MILLON which language?

crimson vapor
#

js

weary socket
#

can you help me in Java? I am not understanding LavaPlayer lol

pale vessel
#

million what in the living fuck did you do

crimson vapor
#

wdym

pale vessel
#

did you change the spacing back

quartz kindle
#

you guys are still doing the json db thing? lmao

pale vessel
#

yes

crimson vapor
#

yes

#

jason.db

pale vessel
#

oh fuck me

crimson vapor
#

its at the bottom right

#

make sure its at 4

#

Spaces: 4

weary socket
quartz kindle
#

nope

pale vessel
weary socket
#

damn

quartz kindle
#

never used them

crimson vapor
quartz kindle
#

javba sounds cool tho

#

:^)

crimson vapor
#

javba is cool

pale vessel
#

bro I use npp

weary socket
crimson vapor
#

OH

#

nvm then

#

I didn't know

#

Tim you still here?

pale vessel
#

@crimson vapor Done

#

don't make fun of my code

crimson vapor
#

nice

#

why would I?

drifting wedge
#

like commandname(ctx)

#

u want like ^

#

not commandname (ctx)

carmine summit
#

hey uh

#

im stuck

drifting wedge
#

waddup?

frigid schooner
#

While true, it still works.

#

Also thanks, didn't see that space there ๐Ÿ‘

quartz kindle
crimson vapor
#

well I figured out my problem

#

made myself a circular

#

tried to write to file

carmine summit
#

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
pale vessel
#

the typings was correct though

crimson vapor
#

alright ill change it

pale vessel
#

i forgot to change that one

crimson vapor
#

I am moving all the has get set functions to the collection class

carmine summit
#

is the bug on the checkDied function or the generateGui function?

crimson vapor
#

so DB.collection('collectionName').get('yes.no') // returns no.yes

carmine summit
#

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?

crimson vapor
#

if that is js could you change "```" to "```js"

#

nice

quartz kindle
carmine summit
#

uh.

#

let me just scream very very load as i havent figured this out for 2 hours

#

excuse me

#

ok.

#

Thanks

earnest phoenix
#

Tim literally spots every error in less than 15 seconds, he's speedrunning error checks

crimson vapor
#

Tim 100% should get his own role

earnest phoenix
#

๐Ÿ—ฟ Or i may say, speedrunning knowledge

crimson vapor
hard anchor
#

How can I create meme embeds?

pale vessel
#

All for that node 14 and below support

crimson vapor
#

yea ik

pale vessel
#

yes

#

you like that?

earnest phoenix
#

What are you making flaz

crimson vapor
#

it looks kinda strange

pale vessel
#

json db

crimson vapor
#

jason.db

#

on npm

pale vessel
carmine summit
#

alright

#

changed it, tested it

earnest phoenix
#

Hmm

carmine summit
#

fkin works

crimson vapor
#

oof

#

didn't remove value

pale vessel
#

LOL

#

yes I copy pasted

crimson vapor
#

same

pale vessel
#

it said "save" on your get method too

crimson vapor
#

IK

drifting wedge
#

flap wat bot u make?

crimson vapor
#

I copy paste too

pale vessel
#

pog

hard anchor
#

What do I do for my bot to send memes embeds?

sick fable
#
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

crimson vapor
#

that should work

pale vessel
#

yes

crimson vapor
#

you should also use ``` not `

pale vessel
#

very wise of you to remove the token

crimson vapor
#

for code blocks

#

fuck

#

oh wait

#

ik what I did

#

why

#

sets cursor

#

returns data

pale vessel
#

cursor is just data

#

but with the properties referenced

crimson vapor
#

fuck

#

u smart actually

pale vessel
#

No

crimson vapor
#

oh

#

I like

tardy hornet
#

how can i make that the bot will DM me the top 10 servers with most users in them?

crimson vapor
#

well

#

what lang

pale vessel
#

million

#

check if value is !== undefined

#

since if you put 0 it won't set

tardy hornet
#

languages are js, python and all of them right?

crimson vapor
#

no

#

there are hundreds

tardy hornet
#

so languages are discord.js and all of them?

pale vessel
#

there and on if (value)

earnest phoenix
#

is this a good way to make an app in js:

delete myself
crimson vapor
#

delete humans["code913"]

#

myself is undefined

earnest phoenix
crimson vapor
#

oh

#

py

earnest phoenix
#
self
pale vessel
#

myself is None

crimson vapor
#

ok flaze

#

im about to make changes

pale vessel
#

oh

#

okay

crimson vapor
#

wait what

pale vessel
#

what if i put 0 as value

crimson vapor
#

oh

pale vessel
#

this too

crimson vapor
#

should I change cursor[property] == undefined?

pale vessel
#

idk

#

ig not

#

change == to ===

crimson vapor
#

alr

#

should I do that for all == undefined?

pale vessel
#

yea

#

0 would be true

#

sometimes people want to set balance as 0

crimson vapor
#

ty

pale vessel
#

then it might not save it

crimson vapor
#

tbh*

#

what if they decide to put null

pale vessel
#

that's fine

crimson vapor
#

null === undefined?

pale vessel
#

no

#

null is good

umbral zealot
#

no but null == undefined though

crimson vapor
#

oh

#

ok

umbral zealot
#

they're 2 different values ๐Ÿ˜‰

crimson vapor
#

so x === undefined but y !== undefined right

pale vessel
#

yes

#

ah yes

#

Save
get

#

lmao the params

umbral zealot
#

You can, actually, do x == undefined or y != undefined and it'll take both null and undefined btw

crimson vapor
#

what about 0?

umbral zealot
#

that's a different value

pale vessel
#

we want to allow null

umbral zealot
#

if you want to take all falsey value, just do if(x) or if(!y)

#

that's 0, null, undefined, false

pale vessel
#

This is a JSON db by the way LOL

crimson vapor
#

ye

umbral zealot
#

What? why? Thonk

pale vessel
#

why not

#

bored maybe

umbral zealot
#

If you're not doing atomic reads and writes, don't make a json db wrapper, you're not helping anyone with that shit

pale vessel
#

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

umbral zealot
#

I'd use nedb for god's sake it already exists.

crimson vapor
#

not like anyone would use the db

#

just making it for fun

pale vessel
#

yeah

umbral zealot
#

Yeah I love building boats with holes in them for fun, not like anyone would ever sail them.

pale vessel
#

I did it cause I was bored

crimson vapor
#

hmmm

#

maybe if I ever rewrite ill use that

#

or if im even more bored

umbral zealot
#

Just, y'know, please do'nt publish this on NPM.

#

keep it private.

crimson vapor
#

or

pale vessel
#

too late evie

crimson vapor
#

I could publish it

umbral zealot
crimson vapor
#

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

pale vessel
#

tbh you can make the same thing but with mongodb

crimson vapor
#

wdym

umbral zealot
#

What do you mean by "real db" though

pale vessel
crimson vapor
#

one that isnt json

umbral zealot
#

do you mean like you don't want to setup a database server?

crimson vapor
#

like setting it up to work with the new project

umbral zealot
crimson vapor
#

shhhhh

umbral zealot
#

"I have a small project and don't want to setup a database" is precisely what enmap was made for.

#

just saying.

earnest phoenix
#

lurkin'

umbral zealot
#

Your reason should be "I want to practice" and nothing else, no need to justify it by trying to find excuses ๐Ÿ˜‰

pale vessel
#

true

#

not false at all tbh

crimson vapor
#

nah the real reason was I thought it was funny

pale vessel
#

even the name is a meme

crimson vapor
#

yep

umbral zealot
#

What's funny is that Enmap started out as an idea of "What if I took discord.js collections and made them persistent"

crimson vapor
#

ive never even used enmap lol

pale vessel
#

same

umbral zealot
#

It's basically like discord.js collections but with more features and an sqlite file to store the data.

#

ยฏ_(ใƒ„)_/ยฏ

crimson vapor
#

evie whats the @returns keyword in the comments before a function used for

#

well returns

#

but

#

how do you use it correctly

umbral zealot
#

It tells jsdocs what returns from the function

pale vessel
#

oh, it uses sqlite for persistent?

#

that's so cool

earnest phoenix
#

what's sqlite
sql but @sudden geyser ?

quartz kindle
#

lmao

crimson vapor
#

Tim

long marsh
#

Haha, I knew Tim would see that ๐Ÿ˜„

crimson vapor
#

hi

umbral zealot
#

it's @return {type} description

crimson vapor
#

oh you guys were all watching evie destroy me

#

thanks

long marsh
#

๐Ÿ˜„

umbral zealot
#

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.
    */
quartz kindle
#

technically you are already destroying yourself since yesterday

pale vessel
#

LOL

umbral zealot
#

Yeah "I'm making a json db" is basically a glorified way of saying you're an idiot tbh.

crimson vapor
#

yeah but no one was calling me out

earnest phoenix
#

also evie why are you using jsdoc on gitbook

umbral zealot
#

I convert it to markdown

long marsh
#

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.

quartz kindle
#

how would you jsdoc a return value that is both an array and an object?

umbral zealot
#

Literally I have a conversion script.

long marsh
#

Unknowledgeable, if you will.

#

Ignant'

crimson vapor
#

I see idiot as more of a phrase

#

but yeah it is kinda ignorant if you use the real definition

umbral zealot
#

You can't be making a db while being ignorant of it deficiencies. lol.

#

people will tell you

umbral zealot
quartz kindle
#

this

#
a = [1,2,3,4]
a.b = 10
a.c = "something"
return a
crimson vapor
#

json db go brrrrrr

umbral zealot
#

uhm

crimson vapor
#

Array

#

array object

umbral zealot
#

@return {ifuckedup} Some shit you won't want to use ? lol

long marsh
#

lol

earnest phoenix
#

every data type in javascript extends Object so umm

quartz kindle
#

i need it to be that way lmao

umbral zealot
#

The real answer is "don't do that"

long marsh
quartz kindle
#

because the return value is coming from a C lib

#

and the C lib returns multiple things at once

umbral zealot
#

Or, in other words, use a class instead. probably.

long marsh
#

Return an object with its respective instantiated properties so that you have a clear representation of what you're returning.

earnest phoenix
long marsh
#

Just my 2 cents, of course.

quartz kindle
#

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

earnest phoenix
#

oh

quartz kindle
#

and extra return values for error messages and function status

long marsh
#

Parse the array of doubles from the C lib, and create an object / map to return.

earnest phoenix
#

i thought you were talking about the programming language C

earnest phoenix
long marsh
#

Heh

earnest phoenix
quartz kindle
#

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

long marsh
#

Sounds like an object ๐Ÿค”

quartz kindle
#

arrays are objects anyway

long marsh
#

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.

quartz kindle
#

probably

#

who asked them to make functions like that tho

earnest phoenix
#

everything is an Object in js
Object is an Object too

quartz kindle
#

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

long marsh
#

Is that a reputable C library?

earnest phoenix
#

tim forgot to put the code syntax lmao

quartz kindle
#

yes its an official library thats been in development since the 90s

obsidian cairn
#

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/?

earnest phoenix
#

@obsidian cairn wdym uploaded

obsidian cairn
quartz kindle
#

i guess i should just do this then ```js
return {
value: array,
status: number,
error: string
}

earnest phoenix
#

reload your profile page

quartz kindle
#

but it feels weird having to access another property

long marsh
#

Agreed, Tim

obsidian cairn
#

did it but it still says the same

quartz kindle
#

because "officially" the function returns an array

earnest phoenix
#

also you need to get your bot approved before it can interact with the top.gg API

long marsh
#

Like said, do whatever you think is best ๐Ÿ˜„

earnest phoenix
#

and since you're whitename you probably have no approved bot

obsidian cairn
#

how do i get my bot approved?

young flame
#

wait

earnest phoenix
#

wait for a bot reviewer to check it

obsidian cairn
#

how much time does that take?

earnest phoenix
#

it takes around a week right now
(don't be angry we're faster than discord verification)

umbral zealot
#

A week or more for approval

obsidian cairn
#

ok

#

wait to read them

quartz kindle
#

its down to a week?

#

whoa

crimson vapor
#

bruh

long marsh
#

Best case, is a week.

crimson vapor
#

I had to wait so much longer than a week

quartz kindle
#

last time i heard it was 5 weeks lmao

crimson vapor
#

Tim you should rate my code now

long marsh
#

Mine got approved in a bout a week and a day.

#

But it was over the thanksgiving holiday.

crimson vapor
earnest phoenix
#

mine got approved in 6 days

pale vessel
#

nice

#

is that the new format?

earnest phoenix
#

hi
i made a serverinfo command but in some servers it can't get owner tag

#

y

crimson vapor
#

thats the file im testing to on

pale vessel
#

you should make it .jason

obsidian cairn
#

can u send me the link of you bot? @earnest phoenix

crimson vapor
#

it is

pale vessel
#

By default?

crimson vapor
#

no

obsidian cairn
#

on DM pls @earnest phoenix

crimson vapor
#

default is specified by user

pale vessel
#

oh never mind you can - yeah

crimson vapor
#

I should

#

rename .json to .jason

earnest phoenix
#

ok

crimson vapor
#

because realistically the extention shouldnt matter right

earnest phoenix
#

@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

zinc condor
earnest phoenix
#

can someone help lol

obsidian cairn
#

send me your server pls

crimson vapor
earnest phoenix
#

bruh

long marsh
earnest phoenix
#

discord fucks my status everytime

zinc condor
earnest phoenix
zinc condor
#

check that repo's root directory

pale vessel
#

Where is console.table()

long marsh
#

Interesting. For embedded applications, a more minimalist language would have sufficed

zinc condor
#

not there yet

pale vessel
crimson vapor
#

console.table > kitchen.table

zinc condor
#

ASakashrug 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)

long marsh
zinc condor
#

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)

sick fable
#

.Jason kek

crimson vapor
#

yes

#

.jason

sick fable
#

Lmao

zinc condor
# long marsh Yeah, I use AWS Lambda at my job. We leverage GO, and it's incredibly fast - bot...

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

long marsh
long marsh
zinc condor
#

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

long marsh
#

What are you using the workers for?

zinc condor
#

anything, im kinda making a platform for them

#

open source for the most part

long marsh
#

Not sure I entirely understand ๐Ÿค”

zinc condor
#

i am making an OSS alternative to Cloudflare workers

#

without cold-start times

earnest phoenix
#

does Message#reply use the new inline replies in discord now

#

No

zinc condor
#

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

long marsh
# zinc condor without cold-start times

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 ๐Ÿ˜„

earnest phoenix
#

That method is only implemented on discord.js v13 @earnest phoenix

#

Which isn't out yet

zinc condor
#

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

long marsh
#

But, I'm assuming the worker would need to 'shutdown' at some point unless you consistently hit it - right?

zinc condor
#

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

earnest phoenix
#

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#");
long marsh
#

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 ๐Ÿ˜‰

opaque seal
#

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?

crimson vapor
#

do you have a 404 on the vue page or conflicing routes?

opaque seal
#

What do you mean?

#

I'm trying to fetch apis from another server so it's totally another thing from the website

zinc condor
#

Thats my philosophy there, hoping i can get it to be efficient running once for each execution

#

thats the definition of a serverless function

#

ASakashrug different state for each request

opaque seal
#

?

zinc condor
#

talking to someone before

pale vessel
#

Yes

#

I do that to my functions

#

mostly for caching

earnest phoenix
#

@pale vessel so basically importing code in node is kinda like read file then eval(exports)

#

what does Discord.Structures do?

pale vessel
#

most objects you get in d.js has structures

#

like guild, channel, role, etc

#

you can extend them

earnest phoenix
#

wat does that mean

#

oh

#

so basically add extra features?

sterile lantern
#

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

quartz kindle
#

makeid should never generate the same code twice

#

no need to compare

sterile lantern
#

o

#

ok

quartz kindle
#

as long as your makeid function is done correctly

#

show your makeid

sterile lantern
#
 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

gentle lynx
#

(node:2424) UnhandledPromiseRejectionWarning: Missing permissions: I not have permissions to Manage Messages in this channel to delete reactions.

#

what does this error mean lol

quartz kindle
#

thats not the best way to generate a unique code

sterile lantern
#

o

#

y?

gentle lynx
#
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

quartz kindle
#

to generate a unique code, you need a random component, which you already have, and also a date component

sterile lantern
#

@gentle lynx u need to give it perms

#

to manage msgs

#

a date component?

gentle lynx
#

for what though

quartz kindle
#

so that even if by any chance you get two equal codes, if they are both generated 1 millisecond apart they are still unique

gentle lynx
#

embeds i guess?

sterile lantern
#

manage msg + embeds

gentle lynx
#

why the manage message? i dont get it

sterile lantern
#

(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

quartz kindle
#

you can simply add result += Date.now().toString(36).toUpperCase() after the for loop

gentle lynx
#

yes. but how is the bot requiring the manage msg perms, its not removing a message

sterile lantern
#

perhaps a different command?

#

oh

#

its removing a reaction

#

it cant remove a reaction

#

of someone else's

#

without having that perm

gentle lynx
#

it's not removing a reaction tho

sterile lantern
#

uhh

#

then im not too sure

earnest phoenix
#

@gentle lynx you know you can just do number.toLocaleString() instead of functions.commas

#

iirc

sterile lantern
#

well yes it is

#
client.awaitingMessage.delete(message.author.id);```
#

its deleteing an awaitingMessage

#

deleting*

gentle lynx
#

thats a set in the code

crimson vapor
#

ok im back

gentle lynx
#
client.awaitingMessage = new Set();
sterile lantern
#

uhh

crimson vapor
#

what?

#

why

sterile lantern
#

its still supposed to delete a msg in discord right??

gentle lynx
#

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

earnest phoenix
#

client.awaitingMessage is a Set not a message object

sterile lantern
#

perhaps that erorr

#

is

earnest phoenix
#

Set#delete removes a key from the Set

sterile lantern
#

triggered from a different

#

command

#

yea

gentle lynx
#

hmm

sterile lantern
#

do you have any other cmsd

#

cmds*

#

that delete reactions?

gentle lynx
#

no

sterile lantern
#

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

crimson vapor
#

well can you set code as an object and add pcode: true?

#
code: {
  `${pcode}`: true
}```
#

db.get('code')

summer torrent
#

do code.${pcode} instead of _

crimson vapor
#

im not sure but maybe you can do code. instead of code_ and code will be an object

#

ye

sterile lantern
#

what does code.${pcode} do?

#

also, i can do that for a DB
?

#
code: {
  `${pcode}`: true
}```
#

this

summer torrent
#

it makes your data object

sterile lantern
#

so db.get('code') would work?

summer torrent
#

it will return all pcodes you have

sterile lantern
#

aight

earnest phoenix
#

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

sterile lantern
#
  let codes = db.fetch(`code.${pcode}`)```
earnest phoenix
#

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

sterile lantern
#

template string?

#

db should be able to fetch that

#

though

quartz kindle
#

no

sterile lantern
#

oh wait

#

pcode

#

oh

#

bruh

quartz kindle
#

they meant save as code.${pcode}

#

then fetch as code

hollow sedge
earnest phoenix
#

why not just use let

hollow sedge
#

yeah ik that part is pretty bad

#

but i was referring to the function

sterile lantern
#

how come something returns as object object

hollow sedge
#

to create an object

earnest phoenix
#

also that class name

sterile lantern
#

o i have to string it

#

nvm

#

lmao

earnest phoenix
#

heavy w3schools ripoff by putting my in every variable name

hollow sedge
#

lol

sterile lantern
#

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

earnest phoenix
#

bro

#

learn js

#

please

sterile lantern
#

ah i got it

#
JSON.stringify(codes)```
#

ez

#

ok it works now

#

so my money is set like money_id

earnest phoenix
#

no

sterile lantern
#

in order to make a leaderboard

earnest phoenix
#

that's not how it works

sterile lantern
#

what? the stringify?

#

or the money

hollow sedge
earnest phoenix
#

it's not

hollow sedge
#

ok good

faint prism
#

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

hollow sedge
#

it does though ๐Ÿ˜ข

quartz kindle
#

the this inside that function will point to the global scope

#

so you are basically doing global.x = x

crimson vapor
quartz kindle
#

or window.x = x in a browser

hollow sedge
#

yeah but it changes each time you call the function

crimson vapor
#

so something like .set(key: string or number, data: any)

quartz kindle
hollow sedge
#

yeah, so it does work

#

albeit in a very terrible way

crimson vapor
#

I mean how do I make it look that way

quartz kindle
#

key: string | number

crimson vapor
#

ty

quartz kindle
hollow sedge
#

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

crimson vapor
#

because you aren't learning oop yet?

quartz kindle
#

hes teaching pre-ES6 js?

hollow sedge
#

yeah lol

crimson vapor
#

oh

#

why tho

hollow sedge
#

he uses vars everywhere too

quartz kindle
#

rip

#

fire him and hire me

crimson vapor
#

Tim how would you suggest I go about trying to corrupt my json file?

hollow sedge
#

lol

crimson vapor
#

imagine

#

Tim as your teacher

hollow sedge
#

epic

crimson vapor
#

very

quartz kindle
crimson vapor
#

o

#

smart

hollow sedge
#

wait

#

why though

crimson vapor
#

trying to corrupt a file

hollow sedge
#

ok lol

crimson vapor
#

how can I do that with writeFileSync()?

quartz kindle
#

idk if you can do it from within the process

#

but if you ctrl+C it while its writing, it will work

crimson vapor
#

hmm

#

maybe

#

first ig I should ask if it is even possible to crash if I save to another file then rename it

sterile lantern
#

how come the other user is undefined?

crimson vapor
#

do you use .cache.get()?

sterile lantern
#

yes

umbral zealot
#

I'm guessing you're not fetching them and/or they're not cached ยฏ_(ใƒ„)_/ยฏ

sterile lantern
#
  let user = client.users.cache.get(tl[i].ID.split("_")[1]);```
#

o

crimson vapor
#

^

#

use fetch

#

client.users.fetch(<id>) iirc?

earnest phoenix
#

fetch gets IDs

#

oh

sterile lantern
#

ah well

#

its also getting all of the DB

#

which is annoying

fallow lichen
#

is there a way to easily split a line into multiple defined strings argument?

solemn latch
#

might be easier to just do the standard <@id>

sterile lantern
#
var tl = await db.all(`money_`, { sort: ".data" });```
solemn latch
#

since your just using tags anyway

sterile lantern
#

yea

solemn latch
#

let discord handle it

sterile lantern
#

well honestly

#

it gets everything in the db

#

then starts listing it

#

in the lb

crimson vapor
#

whats the difference between db.all('money_', { sort: <sort>}) and (await db.all('money') ).sort(<sort>)

solemn latch
#

ah global variable, dont let erwin see that ;p

crimson vapor
#

lol

#

global.client = new Discord.Client()

#

I guess you could say the bot would be everywhere

earnest phoenix
#

hey guys

#

just a question

#

im too lazy to use google

#

so

crimson vapor
#

fair

earnest phoenix
#

may i have the quick.db documentaire

crimson vapor
#

not fair

solemn latch
#

you would have had it by the time you typed that

earnest phoenix
#

false

crimson vapor
#

fast

earnest phoenix
#

k

#

ty

#

ez shortcut

solemn latch
quartz kindle
#

that sounded like "quick.db documentary"

#

10/10 would watch

cinder patio
earnest phoenix
#

still it also have documentaire shortcut

#

2 shortcuts

crimson vapor
#

imagine a documentary on a database

#

so boring

#

quick db is SQL?

earnest phoenix
#

actually useful for a person who doesnt know quickdb well

quartz kindle
#

quick.db uses sqlite

crimson vapor
#

oh

#

good

earnest phoenix
#

sqlite3

#

I've had errors on that

crimson vapor
#

Tim please rate my json db

earnest phoenix
#

but fixed it

#

Youโ€™ve had errors on it?

#

Like what

#

no I've already fixed it

#

but

#

like

quartz kindle
earnest phoenix
#

better sqlite3 install script error

quartz kindle
#

a killer db

earnest phoenix
#

idk

sterile lantern
#

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

earnest phoenix
#

Thats an issue with you not sqlite3

sterile lantern
#

it also adds y_ before the user id?

earnest phoenix
#

is there any way to make a command that makes the bot leave the current guild?

sterile lantern
faint prism
#

Yeah

quartz kindle
#

sure

sterile lantern
#

this is what it returns

earnest phoenix
#

@earnest phoenix <guild>.leave() i believe

#

Oh thx

sterile lantern
#

ah wait i sliced it nvm

#

also, this doesnt send as one message

#

for some odd reason

crimson vapor
sterile lantern
#

aaaa i finally have an lb ;D

quartz kindle
#

lmao

sterile lantern
#

any1 know how to make it send all in one msg

#

instead of it sending different msgs

crimson vapor
#

what is it sending as and what is your code?

#

like pictures

sterile lantern
#
 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

quartz kindle
#

dont .send() inside the loop

sterile lantern
#

ohh

#

alright

faint prism
#

lol

crimson vapor
#

I would add tthat to a string

sterile lantern
#

how exactly do i make it go from top to bottom

#

like for example

#
  1. 500
  2. 40
  3. 10
crimson vapor
#

sort by decending I think

faint prism
#

that might be unexpected behavior if you sort

crimson vapor
#

im not quite sure which is a and which is b in a sort function

faint prism
#

1
10
2
20
3
30
I think sorting ascending does this if I'm not mistaken

#

So descending wouldn't be what you expect either

quartz kindle
#

if you sort by string yes

#

you need to sort by number

crimson vapor
#

do Number(value)

#

or parseInt(value) up to you