#development

1 messages · Page 2026 of 1

fluid garden
#

The problem that idk how to get that url

#

This is my problem

lyric mountain
fluid garden
#

I made much file but after 1 day it getting not working

#

And now iam stucked here

#

Idk what happened

#

What happening

wheat mesa
#

You didn’t give a valid token when calling client.login()

#

The error is fairly self explanatory

fluid garden
#

But i did

#

Not working in qnytoken

#

Idk why

#

I also made another bot

#

And didnt worked

wheat mesa
#

I’m going to tell you that you did not give it a valid token otherwise it would be working

fluid garden
#

Ok

wheat mesa
#

The error tells you what’s wrong, regenerate your token and try again with that token

fluid garden
#

Ok

#

Still same eroor

wheat mesa
#

Can you show what you’re doing in the code? (With hiding your token obviously)

fluid garden
#

This token is reste dont worry

wheat mesa
#

Ok but where is the client.login() call located

#

The json is meaningless if it’s not loaded correctly

fluid garden
#

Sec

#

How to find it?

pine nova
#

index.js?

fluid garden
#

Ok

earnest phoenix
pine nova
#

💀

fluid garden
#

Then?

wheat mesa
#

Did you make this bot?

earnest phoenix
#

i think his not

pine nova
#

yea

fluid garden
#

It is for my friend he dont know how to host i tried like i hosted mine

#

But dodnt work

#

Me py

pine nova
#

oh

#

💀

wheat mesa
#

Again, his setup might not be like yours

fluid garden
#

Where to search in index?

wheat mesa
#

You have to look for the call to client.login()

fluid garden
#

K

#

Oh my token is in config

#

Not env

pine nova
#

💀

fluid garden
#

What should i use?

pine nova
#

import the json file

wheat mesa
#

Or add a secret

#

Either one

fluid garden
#

I cant paste the client?

pine nova
#

const config = require('./config.json') at the top
client.login(config.token)

wheat mesa
pine nova
#

mhm

wheat mesa
#

I’d recommend using replit’s secrets feature

#

That puts the variables into the env

#

And it should work after that

fluid garden
#

Where to put client? Now in config file?

pine nova
#

no

fluid garden
#

Where

pine nova
#

u dont need to put client anywhere

#

💀

wheat mesa
#

What? Just keep the code as it was, and use secrets

fluid garden
#

I puted in client.login what u said

wheat mesa
#

On the left side of the website there should be a “secrets” tab

fluid garden
#

For me

#

Ya

wheat mesa
#

Change it back to what it was

fluid garden
#

Ok sec

wheat mesa
#

And then go to the secrets tab, make the key token and make the value your token

fluid garden
#

Ok and in the config file?

wheat mesa
#

The config file is irrelevant for the token after that

fluid garden
#

Oh ok

#

Not loading all

#

Why

#

It was loading fast vefore shiw the errors

wheat mesa
#

Replit is slow, but I don’t know why it’s loading slowly. I do not have the code

fluid garden
#

Can u help me?

wheat mesa
#

I think you should learn some js before that :p

sick agate
fluid garden
fluid garden
sick agate
#

oh sure

wheat mesa
#

It’s very difficult to help someone with something that could be a complex problem if they’re essentially asking you for a step by step by step explanation

fluid garden
#

Whoo can help me?

#

From link

wheat mesa
#

We don’t spoonfeed code here if that’s what you’re expecting :p

fluid garden
#

Just see code u cant edit

pine nova
#

💀

fluid garden
#

?

#

Tf no error found

wheat mesa
#

Personally I’m not going to look over your friends entire project to try to fix the code he wrote. You need to ask specific questions. Ambiguous questions will receive ambiguous answers

fluid garden
#

Iam not reiciving

pine nova
#

just help the man bruh 😔

fluid garden
#

Wrror

#

Iam not getting erros

pine nova
fluid garden
#

Idk

pine nova
#

what?

fluid garden
#

Not logging

pine nova
#

logging what?

fluid garden
fluid garden
pine nova
#

prolly slow

fluid garden
#

Oh worked it was replit problem

#

Tysm all ♡

#

U made my day cz me and my friend each one ckded a bot to grow a community

#

How can i get the project link for uptime robot? Last time i did errors started

#

Oh i got it

#

Uptime robot good for replit 24/7 ?

tidal nymph
#

I keep getting DiscordAPIError: Missing Permissions when I tried to send a message even though I checked these permissions

 [
    Permissions.FLAGS.VIEW_CHANNEL,
    Permissions.FLAGS.SEND_MESSAGES,
    Permissions.FLAGS.READ_MESSAGE_HISTORY,
    Permissions.FLAGS.USE_EXTERNAL_EMOJIS,
    Permissions.FLAGS.EMBED_LINKS,
]

Which permissions that im missing to prevent getting that error again

fluid garden
#

Oh

#

Review your codes

#

And ehen invite bot give all perms

tidal nymph
lyric mountain
#

did u account for channel overrides?

tidal nymph
lyric mountain
#

ye

fluid garden
#

Now my bot will still alive?

tidal nymph
#

I did

fluid garden
tidal nymph
#

literally showed u the code block like 1hr ago

fluid garden
#

?

lyric mountain
#

if anything, go adding one perm at a time to see when it stops erroring

fluid garden
#

Give the bot all permissions then test permissions 1 by 1

#

Like remove a permission if didnt show error back it

#

When u reach the permission that without it

#

Bot send error

#

Add it as requirement

tidal nymph
#

hmm, okay I guess I have to go the hard way

fluid garden
#

Ya

tidal nymph
#

quite dumb that discord doesn't show which perm it needs

lyric mountain
#

do the other way around

fluid garden
#

No other way

lyric mountain
#

add perms one by one, it's a shorter path

fluid garden
#

Ya

lyric mountain
#

maybe it's d.js that's not showing

tidal nymph
#

weirdchamp, library diff

#

💀

fluid garden
#

Btw hiw to be sure that my bot will still online using uptime robot

lyric mountain
#

just wait

#

see if it goes offline about 10 minutes or so

fluid garden
#

Oh ok

tidal nymph
#

@lyric mountain sorry for ping but after I checked, it only needed VIEW_CHANNEL,SEND_MESSAGES,EMBED_LINKS

#

I also checked the channel that giving the error, it does give the bot those permissions as well

lyric mountain
#

did u try with every perm?

sharp saddle
#

is it possible to fix a flexbox under the screen?

tidal nymph
sharp saddle
#

like this navbar

lyric mountain
#

position: fixed; bottom: 0px

sharp saddle
tidal nymph
#

I was adding 1 by 1

#

and the bot only needs those perms to send msg

lyric mountain
sharp saddle
#

result:

#

it breaks the navbar

lyric mountain
#

fixed works like absolute, it ignores wherever it is

#

if anything put it inside a div

tidal nymph
#

yea, double checked the result is still the same

#

💀 why this is so weird

#

so what do I do now?

earnest phoenix
eternal osprey
#
count[id] = {
       opt1: [],
       opt2: [],
       opt3: [],
       opt4: [],
       opt5: [],
       opt6: [],
       opt7: []
      }``` Lets suppose the opt variables all hold a number from 1-4. How would i get the number that's the most occuring?
proven lantern
# eternal osprey ```js count[id] = { opt1: [], opt2: [], opt3: [], op...
const ones = [...count[0].opt1, ...count[0].opt2].reduce((acc, n) => n === 1 ? acc + 1 : acc, 0);

const twos = [...count[0].opt1, ...count[0].opt2].reduce((acc, n) => n === 2 ? acc + 1 : acc, 0);

const threes = [...count[0].opt1, ...count[0].opt2].reduce((acc, n) => n === 3 ? acc + 1 : acc, 0);

const fours = [...count[0].opt1, ...count[0].opt2].reduce((acc, n) => n === 4 ? acc + 1 : acc, 0);

lyric mountain
#

what in tarnation

#

doesn't js have any kind of bag?

eternal osprey
#

wouldn't this basically just categorize the numbers?

#

I am just trying to get the number that is most occuring in all opt variables

proven lantern
#
const most = Math.max(ones,twos,threes,fours)```
#
if(most === ones){}else if(most === twos)```
proven lantern
eternal osprey
#

ah i see! Let me try!

proven lantern
#

[...count[0].opt1, ...count[0].opt2]

#

this part will need to include all the opts

#

and just do that once and save it to a variable

proven lantern
lyric mountain
proven lantern
#

tricky

lyric mountain
#

and it always keep track of the amount under a certain key

lyric mountain
#

but it's made exactly for cases where u want a count of each group

proven lantern
#

i guess one could use that same type of logic with js

#
{
  "ones": []
  "twos": []
}```
#

populating that would be annoying

quartz kindle
split hazel
#

@earnest phoenix do you happen to know how to solve this

#

for some reason on node 18 from a package that uses superagent every request gets logged in console and completely floods it

#

dont know if its a node issue

#

oh i think its just an unhandled rejection very badly presented

quartz kindle
#

apparently the new fetch in node 18 is pretty bad

#

also missing a lot of features

#

and its seriously screwing over a lot of browser-compatible libs that use native fetch detection

split hazel
#

rip

lyric mountain
#

it's like ```java
var bag = new HashBag<Integer>(Integer::compareTo);
bag.add(1);
bag.add(1);
bag.add(1);
bag.add(2);
bag.add(2);
bag.add(3);
bag.add(3);
bag.add(3);

bag.getCount(1); // returns 3

proven lantern
#

nice, that is fancy

proven lantern
#

whoops

split hazel
#

tfw you decide to use the old way of making classes instead of the new way

proven lantern
#

fixed

#

lol

woeful pike
#

smh at least use prototypes correctly if you're gonna do that

proven lantern
#

it's wonderful

split hazel
#

using the new keyword on functions looks really strange

#

welcome to javascript

proven lantern
#

class shouldn't be in the language

#

and new

split hazel
#

suppose its more verbose

#

you are making a "new" instance of the class

#

aka calling the constructor

proven lantern
#

you dont need classes to do oop

#

just need objects

#

class free oop

split hazel
#

you're the type of guy to use structs to make a class in c++

woeful pike
#

youre dunking on class syntax but you just did methods wrong

#

so clearly the syntactic sugar is helpful

proven lantern
#

pure functions > methods

#

i never write classes

split hazel
#

anyways random message but i often see when people move from js to c++ or any other similar language they use new instead of just making the class by "calling" it which will actually allocate a new object on the heap leading to leaks

woeful pike
#

okay if you're gonna do function syntax pls learn what prototypes are

proven lantern
woeful pike
#

it's not an arrow problem

#

your example here creates a new copy of those 2 methods for every object. Class methods are not copied across different instances, only fields

proven lantern
#

how does this make you feel?

function HashBag() {
    return function HashBag() {
        this.add = function (thing) {
            this[thing] = this[thing] ? this[thing] + 1 : 1;
        }
        this.getCount = function (thing) {
            return this[thing];
        }
    }
}

const bag = new new HashBag()();
bag.add(1);
bag.add(1);
bag.add(1);
bag.add(2);
bag.add(2);
bag.add(3);
bag.add(3);
bag.add(3);

bag.getCount(1);
woeful pike
#

if you wanna do it correctly you gotta use HashBag.prototype.add = function(){...}

split hazel
#

💀

woeful pike
#

and it sounds like you didn't know that so I don't get why you'd rip on class syntax

proven lantern
#
function HashBag() {
    const map = {};
    const add = function (thing) {
        map[thing] = map[thing] ? map[thing] + 1 : 1;
    };
    const getCount = function (thing) {
        return map[thing];
    };

    return Object.freeze({
        add,getCount
    })
}

const bag = new HashBag();
bag.add(1);
bag.add(1);
bag.add(1);
bag.add(2);
bag.add(2);
bag.add(3);
bag.add(3);
bag.add(3);

bag.getCount(1);

#

even better than prototypes

#

i know about prototypes

#

saves a tiny bit of memory

quartz kindle
#

lmao

split hazel
#

lmao

#

that's the spirit my man

wheat mesa
#

That just looks like a very annoying and inconvenient way to write classes for no reason

woeful pike
#

create a closure for every method pog

split hazel
#

this guy is the equivalent of me in c++

wheat mesa
#

Classes are there for your convenience, you are not better off not using syntactic sugar because it saves a tiny bit of performance

woeful pike
#

I mean you might as well just remove the new in this case

#

since that's just a factory function

wheat mesa
#

If you cared about that tiny bit of performance, you’d be using a language geared towards performance

woeful pike
#

I do prefer factory functions over classes tho because no this

quartz kindle
#
class HashBag {
  constructor() {
    this.data = {};
  }
  add(thing) {
    if(!this.data[thing]) { this.data[thing] = 0; }
    return this.data[thing]++;
  }
  getCount(thing) {
    return this.data[thing];
  }
}
``` here, is this what you guys wanted to see?
wheat mesa
#

I don’t see what the point of making something more unreadable is though tbh

proven lantern
#

i hate this

#

it's a code smell

split hazel
#

I think you should scrap the function class overall and just make each of the class elements without the parent class, saves a bit of memory and performance

wheat mesa
#

Because 15 bytes of memory overhead really matters when you’re using a runtime that already takes 40+mb of memory to even run mmLol

split hazel
#

that's what you'd do in c anyways since there's no classes

proven lantern
split hazel
quartz kindle
split hazel
#

I don't even care unless it's a large difference

#

in c++ tho I stick to c apis

#

std::cout? streams are slow af and take up memory im sticking to printf

#

std::vector? allocates space on heap + is a literal class so overhead 101 im sticking to allocating c arrays on stack

#

just don't pass them to another function because for some reason stack overflow occurs

wheat mesa
#

depends on your use case

#

the standard lib is meant to make life more convenient by not having to do things manually like you would in c

split hazel
#

yeah though I see a lot of things are overcomplicated I would say

wheat mesa
#

C++ just feels like standard lib overload sometimes though, I agree

split hazel
#

and it all costs performance and since I don't need the features they offer I stick to c apis

quartz kindle
#

this better for you guys?

wheat mesa
#

does it make my shift key not sticky after the coffee I spilled on it?

proven lantern
#

only add and getCount should be public

wheat mesa
#

put a # on it

quartz kindle
#

who cares

wheat mesa
#

or use typescript

proven lantern
#

makes it cleaner for the user

#

force them to use the getters and setters

wheat mesa
#

ok then use java...?

proven lantern
#

kotlin isn't too bad. does that count as j**a?

wheat mesa
#

no but that's a jvm lang so kinda close

proven lantern
#

that's good enough for me

split hazel
#

web assembly is basically bytecode 💀

quartz kindle
#

@proven lantern

lament rock
#

private fields in typescript can be destroyed just by accessing object[property] with a string just types as string and not as const

#

only real way

wheat mesa
#

but at that point you're intentionally accessing them

#

when you know you shouldn't be

proven lantern
lament rock
#

Does intent matter to people who want to fuck with internals

quartz kindle
#

:^)

hidden gorge
#

is there a reason that might be causing this?

wheat mesa
#

outdated route?

#

Are you using an old version of djs?

hidden gorge
wheat mesa
#

Or probably a user that doesn't exist

quartz kindle
#

you have an uncaught promise

wheat mesa
#

Something like that

lament rock
#

That stack trace tells us nothing because they don't modify the stack

quartz kindle
#

you need to properly catch the promise to obtain a proper stack trace

wheat mesa
#

I saw 404 and my mind went to non-existent route... Agh

proven lantern
#

it could also be an await call that isn't in a try/catch

quartz kindle
#

@proven lanternthere you go

proven lantern
#

not too bad, but this is used.

quartz kindle
#

why are you so against this?

#

i mean, what other alternative there is?

#

some hacky closure?

proven lantern
#

i never use it. i just do map/reduce type stuff for everything

quartz kindle
#

wot

#

i mean

proven lantern
#

i'm not making a lib though

quartz kindle
#

if you want something that is reusable, but at the same time independent from its own copies

#

you need some kind of this

#

how would you create multiple instances of HashBag each with its own counts?

quartz kindle
#

thats not what im saying

proven lantern
#

i'd solve the problem a different way

quartz kindle
#

sure you can programatically solve everything you want, but what if you dont want to necessarily solve X, but to create a structure to use for X

proven lantern
#

then i'd create classes

quartz kindle
#

yeah

#

but you said you dont like them

proven lantern
#

well i'd make my type of class

quartz kindle
#

lel

lyric mountain
lyric mountain
#

and you've re-created a hashbag

#

(well, not really a hashbag but anyway)

quartz kindle
#

techincally

#

it is one if you use Map as the container

lyric mountain
#

I mean, the HashBag is list-like, but it's grouped by hash I guess

#

it has everything a list has

quartz kindle
#

im pretty sure Map uses a hash table so it kinda is grouped by hashes

#

ex dee

proven lantern
#

I think the name HashBag was inspired by Weezer

#

nothing to do with maps

#

or hashmaps

lyric mountain
#

oh it's a actually a java collection naming convention

#

HashSet, HashMap, HashBag, etc

#

there are also Tree___ and Array___

quartz kindle
#

it does have to do with hashes and maps, since hashing is a requirement to check for equality and incrementing counts

#

and map for storing the count values

proven lantern
#

i choose to believe the weezer thing

proven lantern
lyric mountain
#

which is like, 99% use-cases for java collections

feral aspen
#

When it comes to collectors like these, should I be filtering the user or should I also be filtering the message, too? I'm talking in pFilter.

#

It tried to read int.message.id === p.id but that threw the error of TypeError: Cannot read properties of undefined (reading 'id') in the first int.message.id.

#

I've tried debugging for a while, can't seem to figure out which line I should stop at since I'm trying to figure why .id is on an undefined value??

proven lantern
#

try removing int and just use message

#
const pFilter = message => message.id === p.id && ...
feral aspen
proven lantern
feral aspen
#

Fair, the above user doesn't check if message id is same or not.

earnest phoenix
#

Is there any bots that can verify my rocket league account

proven lantern
#

yep, but there isn't that nesting

earnest phoenix
#

What does nesting mean

proven lantern
#

an object inside an object

#

like nesting dolls

earnest phoenix
#

So when you say there isn’t that object inside a object taht means

proven lantern
#

int.message.id vs message.id

#

each dot is nesting

earnest phoenix
#

Uh I don’t know if taht has to do with what I was saying about a bot

earnest phoenix
proven lantern
earnest phoenix
#

Oh

#

So is there a bot ues or no

#

Yes

feral aspen
wheat mesa
earnest phoenix
wheat mesa
#

Read the channel topics, #general is probably the place to ask, but just remember that if people don’t answer your question, asking it over and over again might annoy them so use it sparingly :p

earnest phoenix
#

The channel is dead

wheat mesa
#

Well, it’s one of the few appropriate places to ask about that

#

¯_(ツ)_/¯

#

Nobody is entitled to answer your question immediately, you might just have to sit patiently for a bit

#

Or ask around some rocket league servers too

proven lantern
#

¯_(ツ)_/¯ ™️

earnest phoenix
#

Oh ok

earnest phoenix
proven lantern
#

that's mine now

earnest phoenix
#

Huh

wheat mesa
proven lantern
#

i added a ™️

#

it's mine now

boreal iron
#

¯_(ツ)_/¯

earnest phoenix
proven lantern
#

Tim i know i said your code made my eyes burn, but could you look at my code and see why it might be caching the server count?

quartz kindle
proven lantern
#

it's magic

#

dang

#

aws ec2 magic

quartz kindle
#

btw how do you know its being cached? how are you checking that the value is incorrect?

lyric mountain
#

I fear no man

#

But this

#

It scares me

proven lantern
quartz kindle
#

are you kicking/inviting it from guilds to test that?

lyric mountain
#

May I ask why do u have 7 try-catches?

proven lantern
feral aspen
#

Hey, KuuHaKu. wave_pepe

#

Why have we defined two classes?

proven lantern
#

this is my latest server log

#

that's when i run locally

lyric mountain
quartz kindle
#

btw, how is this not spamming your console?

lyric mountain
#

To have such properties you need to make a class

proven lantern
lyric mountain
#

U could remove the superclass, but then you'd need to conform with new Type(id)

proven lantern
#

at 12am UTC

#

it only runs once every 4 hours

woeful pike
#

I know nobody cares but I just used prolog to solve a riddle 😃

-The first number is even
-The second number is half of the first one
-the third number is double the first
-the sum of all three are equal to 14

#

this is actually so fun

proven lantern
lyric mountain
#

Xet

quartz kindle
#

you run the function on all shards, and you expect it to fail on all of them except the last one, but even the failed ones still create an interval, so you have one interval running for each shard anyway, which should be executing the update function multiple times

feral aspen
lyric mountain
#

I had to consult the doctor, sadly xet was diagnosed with nerd

woeful pike
lyric mountain
feral aspen
#

Is it possible to put empty constructors?

lyric mountain
#

Ah, then js doesn't allow inner classes

woeful pike
#

you can do Type = class { ... } and that should work

#

but it's an incredibly stupid idea

feral aspen
lyric mountain
#

Context: he wants to be able to do something akin to From.type(id).channel

woeful pike
#

just don't export the class from the file and it's pretty much private

proven lantern
lyric mountain
#

Bonus points if u manage to remove the From part

feral aspen
#

To be honest, I'm doing the above but replacing the final value of GUILD_CHANNEL to like This is a guild channel.

quartz kindle
#

the shard you get from manager.on("spawn")

quartz kindle
#

can you show some examples?

feral aspen
#

Tim.

quartz kindle
lyric mountain
#

I believe it's a jack-of-all-trades util function

feral aspen
quartz kindle
#

because type(id).channel doesnt make sense because you cant know what kind of data it is from an id alone

feral aspen
#

I would know since I would be putting the value of id.

lyric mountain
#

What I suggested is either throwing on wrong usage or returning null

feral aspen
#

I'll be the one putting it (in the code, not in the user interaction).

quartz kindle
#

thats why i asked for examples

#

of you using this code

feral aspen
#

On how the result should be?

#

Moment.

quartz kindle
#

how you would use this class/function in an actual piece of code

feral aspen
#

The original values of channel.type is all capitalised and I don't think users would want to even spend time trying to understand what it means.

#

It's why I want to convert them to understandable english.

quartz kindle
#

so all you want is change the text for channel type?

#

nothing else?

feral aspen
#

Indeed.

quartz kindle
#

just use an object

feral aspen
#

I mean, probably, in other cases can be a message,.

feral aspen
#

I'll need to use this object across multiple files, so...

quartz kindle
#
const types = {
  GUILD_TEXT: "This is a text channel",
  GUILD_VOICE: "This is a voice channel"
};

types[channel.type]
#

yes

feral aspen
quartz kindle
#

sure

feral aspen
#

It would be export const types or is that for functions?

quartz kindle
#

yeah, if you're using ts

feral aspen
#

Unfortunately, not.

#

I'm using Javascript, at this case.

quartz kindle
#

then its just module.exports = { ... }

feral aspen
quartz kindle
#

yes

feral aspen
#

Sweet.

quartz kindle
#

then you can do const types = require("./types.js")

feral aspen
#

I'll be adding nested objects (I think that's what it is called).

#

... like types.channel or types.message, etc.

quartz kindle
#

yeah you can do that

feral aspen
#

Fair enough. 👍

quartz kindle
#

then use it as types.channel[channel.type]

feral aspen
proven lantern
#

i am failing. is this the right idea?

#

i made some changes, but still broken

quartz kindle
proven lantern
#

ah, i was passing the shard over

#

whoops

quartz kindle
# proven lantern

if you want to delay until everything is ready, you can do something like this ```js

manager.once("ready", async () => {
do stuff
});

manager.on("shardCreate", shard => {
shard.on("ready", () => {
if(manager.shards.every(x => x.ready)) {
manager.emit("ready");
}
});
});

proven lantern
#

it seemed to work when the manager was passed in

#

i think the spawn method wait until all shards are ready before returning

raw nest
#

How can I convert times like "30min" or "20d" into seconds? Is there a function or something?

quartz kindle
quartz kindle
raw nest
#

okay thank you^^

quartz kindle
#

for example this one

raw nest
feral aspen
#

Is there a simple way to simplify this?

const capitalise = (value) => {
    let each = value.split(" ");
        
    let final = []
    for (let e of each) final.push(e.charAt(0).toUpperCase() + e.slice(1));

    return final.join(" ")
};

console.log(capitalise('hifi wefwfe'));
#

Capitalising the first letter of each word.

wheat mesa
#

Like Title Case?

#

this is what I have for mine: ```ts
export function toTitleCase(value: string): string {
return value
.replace(/_/g, ' ')
.split(' ')
.map(word => {
return word.charAt(0).toUpperCase() + word.substr(1).toLowerCase();
})
.join(' ');
}

lyric mountain
#

value.replace(/\\s[a-z]/g, v -> v.toUpperCase())

raw nest
#

I'm building an NPM package and want to use prisma for an sqlite database. Now if I publish it and install it on a separate server it first needs to initalize etc. Can I make this automatically? Like when the user installs the npm package it auto initializes etc.?

proven lantern
wheat mesa
#

?

#

The idea is that the value is split by spaces, but underscores are handled as spaces with the .replace call

proven lantern
#
    .replace(/_/g, ' ')
    .split(' ')```
wheat mesa
#

so that you could pass something like i_love_js and i love js and they would both be converted to I Love Js

lyric mountain
#

Really?

#

value.replace(/ [a-z]/g, v -> v.toUpperCase()) then

proven lantern
#
.split(/[_\s]/g)```
wheat mesa
#

too much of an unreadable mess to use that much regex

#

I'd prefer to keep regex out as much as possible

lyric mountain
#

Mine barely has size

#

And it'd be faster than splitting and joining the string on a loop

wheat mesa
#

you sure? regex is hella slow

lyric mountain
#

Only when you do big regexes or use it on trivial tasks

#

String is immutable, so every single operation you do is creating a new string

#

And for those who dealt with low level languages, strings are hell behind the curtains

wheat mesa
#

regex is hell behind the curtains and in front of the curtains mmLol

lyric mountain
#

Nah, they're fine when u understand how to read it

wheat mesa
#

personally I hate regex, I use that function sparingly and only when performance does not matter

#

I don't like having to look at a regex for 10 mins to figure out what it does, nor do I want to spend the time to learn to read it just to figure out what a simple task does

lyric mountain
#

That's why u comment regexes

#

And really, unless ur doing data validation, regex doesn't get too big

#

Repeating yes, but each segment is small

#

For that code I wrote, / [a-z]/g is just "any lowercase letter after space"

bright hornet
raw nest
#

Is there a way that an NPM package has a persistent data source which I can automatically install/configure? So the user doens't have to do anything?

lyric mountain
#

Better-sqlite-3 maybe?

#

When u instantiate it, if the file doesn't exist it'll create one

raw nest
#

Well I already have an SQLite DB in my package which gets automaticall initialized. But when I update the package it resets it

#

even if the file exists*

lyric mountain
#

It shouldn't, what lib is it?

raw nest
#

I use Prisma, so prisma generate and prisma migrate to load the schema

lyric mountain
#

That's essentially a flaw if you lose the whole db when updating the lib

raw nest
#

Yes I know that's why I try to fix it xD

lyric mountain
#

Why don't u go with better-sqlite?

#

Like, it's quite simple with not much fancy features, but so is sqlite

#

Configuration and usage are pretty simple

raw nest
#

I agree but I wanted to take a look into Prisma and get started with it.

lyric mountain
#

I wouldn't trust a lib that drops my db without notice

raw nest
#

Maybe I can configure something in Prisma that doesn't overwrite it.

lyric mountain
#

Welp, gtg now, gn

raw nest
#

bye

bright hornet
#

https://sourceb.in/n7QkouxiSv how can i transfer my current wallet amount to a member? i tried so far like js data.wallet += message.author.id[data.wallet] didnt work xd

raw nest
#

Does the Discord OAuth refresh_token expire?

pale vessel
#

if they revoke access in settings

raw nest
#

okay

split hazel
#

oh so prisma isn't a standalone database it uses mysql under the hood

#

why tho

#

at this point just use sequelize or something honestly

raw nest
#

prisma is an ORM. the same principle as typeORM or sequelize...

#

None of'em has/is a DB

split hazel
#

don't know what any of that means

lament rock
#

orm means object relational mapper which just a fancy way of saying that you'll interact with your relational database in an object oriented manner similar to how the language operates

#

orms may also provide a way to get typings out of your database

#

I made my own, but realistically it's just a simple sql query builder and provides typings. I guess I could also say that it includes a buffer feature because postgres is cool which allows me to de-duplicate prepared statement values and batch insert queries together

raw nest
#

Can I use an SQLite DB in my NPM package?

split hazel
#

ah

split hazel
#

what for may i ask

#

i wouldnt want a random package making a database inside of itself for no good reason

rustic nova
#

node-ipc moment

#

I do want a random file on my desktop

spark flint
#

am tempted just to setup node-ipc

split hazel
#

whats all the hype about node ipc

spark flint
#

not hype

split hazel
#

is it the obfuscated malware

spark flint
#

its the fact that it puts a random file on your desktop

#

and wipes ur pc if you're in Russia or some other country

#

i think

split hazel
#

belarus

spark flint
#

thats it

split hazel
#

if that isnt ignorance i dont know what is 💀

spark flint
#

lol

#

the guy who made the package got doxxed

#

and swatted

split hazel
#

good

#

better have

spark flint
#

lol

split hazel
#

punishing people that have nothing to do with the war is terrible

#

i doubt any government agency is using node ipc

#

also destroyed his career over something that helped nothing

spark flint
#

yeah

#

there was a government agency who used it tho

split hazel
#

💀

#

if i was using oss packages in a critical sector i'd stick to a version that works

stiff lynx
#

Is it possible to get the number of members in discord.js from the server invitation?

split hazel
#

yeah i think discordjs has a method for that

#

one sec

spark flint
split hazel
#

do note thats a cached and inaccurate version (mostly accurate though)

stiff lynx
split hazel
#

then you can get the count with <invite>.memberCount

stiff lynx
#

tysm ❤️‍🔥

split hazel
#

they have a point but like its their fault

#

they shouldve stuck to a specific version and only updated when its necessary

spark flint
#

they updated because it was necesary

#

50x the traffic

split hazel
#

FINE THEN I'LL MENTION THE FACT THEY SHOULDVE STORED DATA ON ANOTHER SERVER

spark flint
#

updated the production server, npm i node-ipc would have gotten the latest version sus

#

i mean

split hazel
#

my backup point

spark flint
#

they mention they usually back up

#

and if the traffic/communication increased by 50x then they wouldn't have backed it up yet

#

as the war started on 27th or some shit, and this all happened between 1st-10th

white anvil
#

it’s pretty agreed upon that that’s fake anyway

#

if there was actually data loss of that calibre it would for sure have been picked up by the news

rustic nova
#

which basically killed off any trust towards node-ipc, aswell as any other open source projects made by that particular user

split hazel
#

yeah hes done for

#

his only hope is to start with a new account

rustic nova
#

yeah

split hazel
#

and to change his details 💀

spark flint
#

peope don't trust node-ipc

#

oh hes already gone too far

#

his entire family was doxxed on doxbin

rustic nova
#

yeah kinda expected, though kinda dont want this conversation to go towards that direction KEKW

split hazel
#

@quartz kindle need some advice - so im adopting the technique you mentioned (storing dynamic data in another file with the main record having a seek pointer to it) but i dont know if i should hash all dynamic data that gets written, or at least leave a blank space for it and not remove the space

  • its easier to query the data
  • leaves space for a possible hash without having to relocate the record if the user decides to enable hashing for that data length
  • it takes up an extra 4/8 bytes depending on architecture
#

i mean kinda stupid because its better to leave the space there

#

much easier to query and better performance because you dont have to calculate lengths (whether to include hash or not)

split hazel
spark flint
#

lol

split hazel
#

oh yeah found it 💀

#

thats deep

#

they went in

#

i assume they got some of the data from a data breach

spark flint
#

yeah

tulip terrace
#

Hewo, so i am facing this issue while pushing my code to heroku, i get this error.

The error says no module named glfw was found.
But this package is mentioned in the requirements.txt file so it should install like other modules.

Any Idea?

quartz kindle
#

most dbs do that

#

there is always some fixed length header containing various things

#

like data size, prev pointer and next pointer if using separate chaining, sometimes also a copy of the key if its a key-value store, sometimes a backpointer to the table row

quartz kindle
#

look for it in the heroku build packs, or check if there is a way to build it

split hazel
#

im going to store the hash and size of the string in the main data file so if the hash & length matches it will seek to the other file

tulip cradle
#

anyone know how to catch these properties

quartz kindle
#

you mean how to count them?

tulip cradle
#

yes

quartz kindle
#

for each guild check the size of guild.channels.cache and guild.emojis.cache

#

then add it all together

lyric mountain
#

do note tho that it'll be an approximation, not the actual value

#

but close enough for whatever reason u need it for that

quartz kindle
#

the value will be correct if using djs with default settings

lyric mountain
#

djs caches all channels and emotes?

quartz kindle
#

yes

lyric mountain
#

geez

#

so d.js literally can't be used for big enough bots

quartz kindle
#

not with default settings

split hazel
#

have experience - will work you just need to have a big enough budget for ram:)

quartz kindle
#

yeah

#

about 50gb ram for 150k guilds

boreal iron
#

oof

sage bobcat
#

One message removed from a suspended account.

split hazel
#

yeah and iaras paying an arm and a leg for hosting

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

split hazel
#

honestly such a waste considering you can make some tweaks and lower that significantly

#

without having to switch libraries alltogether

#

bro thats like a data science rig

#

or video editing

#

probably also has a shit ton of clusters because node can become unpredictable with high enough memory usage

boreal iron
#

I mean at that size a dedi makes sense of course... and 256gb of RAM aren't that expensive

#

at least over here

stiff lynx
#

there is a way to find the invite of a server inside a long text in discord.js?

#

I mean, in a partnership message

earnest phoenix
stiff lynx
earnest phoenix
#

You can use the <String>.match() method to match against the regex and get the invite

stiff lynx
#

tysm

boreal iron
earnest phoenix
boreal iron
#

You better don't ask

#

Guess that will take the entire day

#

the hdd should actually manage to get around 100mb/s

#

weird tho, might be my network

#

idk

quartz kindle
#

:^)

stiff lynx
#

school projects

quartz kindle
#

that starts with "s"

boreal iron
lyric mountain
#

"school" projects

quartz kindle
#

ah yes, "school" projects

#

:^)

stiff lynx
#

lmao

earnest phoenix
boreal iron
#

homework wtf

quartz kindle
#

xD

boreal iron
#

School is like 20y ago

earnest phoenix
#

What

#

FakE how old are you

boreal iron
#

fucking old

stiff lynx
#

NaN

boreal iron
#

also don't blame me, Tim's a few days older, he's the grandpa here

earnest phoenix
#

Found footage of FakE

boreal iron
stiff lynx
boreal iron
#

I'm still concerned why the fucking speed is so low

#

I feel like it's an issue with the unmanaged switch

#

probably not prioritizing the traffic correctly

lyric mountain
boreal iron
#

just because you're too lazy to scroll up

lyric mountain
#

26 MB/s is slow?

#

that's more than 200 Gb/s

boreal iron
#

Of course it is if 5times the speed can be expected

#

Tf you’re on drugs again?

lyric mountain
#

what kind of isp plan are u using? 1 Tb/s?

boreal iron
#

I’m talking about internal traffic my gosh

stiff lynx
#

my pov: 🍿 💻

lyric mountain
#

do ur cables even support those speeds?

boreal iron
#

Wtf now… my usb device doesn’t get detected anymore

#

What the heck is going on

stiff lynx
#

those "panda pictures" have to stay there

boreal iron
#

No no that’s still running

#

Guess for the next 12h or more

#

I don’t trust those windows time calculations

earnest phoenix
#

FakE be purging some things before getting exposed on Twitter

boreal iron
#

lol imagine being on twitter

earnest phoenix
earnest phoenix
#

Let the chaos unravel

earnest phoenix
boreal iron
#

Nope I’m not

#

Literally got no time for that bullshit

earnest phoenix
#

But you got time to drive for 9 hours?

boreal iron
#

yeah just for fun of course

#

To get rid of the damn Diesel

earnest phoenix
#

Oh wow, damn

pine nova
#

dem

boreal iron
#

Yeah don’t you know, some years ago it was cool to drive an expensive car, now it’s to refill your entire gas tank at a gas station

earnest phoenix
#

I know, but I've forgotten to fill your car with some atomic bombs hahaha

#

And to refill the chaos

boreal iron
#

no day without Voltrex's terroristic threats

#

lol

boreal iron
#

eu

earnest phoenix
boreal iron
#

true

stiff lynx
#

here in Italy Diesel is like 1.70 euro's

#

not that expensive 🤣

boreal iron
#

FINALLY

spark flint
boreal iron
spark flint
#

i made postgres run on port 6969 (i did 6969:5432 when starting the docker container)

boreal iron
#

it's detecting the usb device over the PCIE card

#

took so long, my gosh

#

now the question remains how to pass it through to the VM

#

guess there aren't any proxmox experts here? hmm

#

ffs

#

I would need to reboot the device which currently is moving the 511GB of data

#

great

#

nvm

#

I'm stupid

sick agate
#

sorry

#

ghostpinged fake

tulip terrace
spark flint
#

Postgres is running on port 6969

boreal iron
spark flint
#

Yee

#

Yes

boreal iron
#

hmm

spark flint
#

i'm doing insertMany with mongodb nodejs

#

how can i prevent duplicates

split hazel
#

thats up to you

spark flint
#

i sorted it now

#

i thought { ordered:false } would have done it

#

but nope

#

anyways i just checked if it already existed

lament rock
#

pug is so nice

cinder patio
#

mmm no

split hazel
#

was waiting for someone to tell him

lament rock
#

???

turbid canyon
#

Anyone know of a bot that will strip a users role if they move, delete or make a role/channel?

lament rock
#

can you elaborate

turbid canyon
#

So

#

I wanna give someone manage roles so they can use a bot to give roles

#

But I want it so if they delete, move a role/channel or delete a role/ channel it removes all their roles

#

And pings me

split hazel
#

@turbid canyon very specific i doubt theres a bot that does that even if there is it will probably shut down very soon like most of them

#

maybe try using a bot that allows you to "program" features

#

i think carl bot has that (not sure if it has events though)

lament rock
#

or make your own bot that does that

cinder patio
#

god next.js images are such a pain in the ass

#

I want to import an image without specifying it's height and width

#

the fact that next.js can't just fall back to a regular img if height / width is not specified is annoying as fuck

#

And there's no other sane way to serve static images

#

so your server can be ran on vercel

split hazel
#

@quartz kindle speedydb officially has findall support

#

tho its just a copy paste of findone with a few things changed

#

might need to make things more modular

#

dont think repeating myself will go down too well considering its a project

boreal iron
#

\o/

quartz kindle
#

are you copying prisma syntax tho?

#

lmao

simple stump
#

[^\w:/.-]

split hazel
#

theres not much you can do with an object honestly

#

so it might look similar to a lot of json based databases/drivers

#

for conditions im thinking something like

{
  where: {
    one: { lt: 5, gt: 2 }
  }
}
#

pretty standard

#

string based special queries might come later or might just not add them at all

quartz kindle
#

ew mongo syntax

lyric mountain
#

at some point ur just writing sql but with json

quartz kindle
#

i'd rather have something like js one: ["< 5", "> 2"] or ```js
one: "< 5 AND > 2"

lyric mountain
#

BETWEEN 2 AND 5

quartz kindle
#

yeah

#

or at least use more descriptive keys

#

like one: { lowerthan: 5, greaterthan: 2 }

lyric mountain
#

and inverted

split hazel
lyric mountain
#

greater, lower

split hazel
quartz kindle
#

yeah you're not wrong

proven lantern
#

is this guy right?

split hazel
#

oh fuck

#

right after an email that my github account may have been involved in a breach

boreal iron
#

imagine spending money to google

split hazel
#

always set budget kids otherwise you won't know until its too late

boreal iron
proven lantern
#

use uuid() for your passwords

boreal iron
#

base64, totally save

lyric mountain
#

encode an uuid in base64 and sha256 it

#

:v

proven lantern
#

then memorize it

split hazel
#

i think its because google cloud again updated their fucking tos which means my free tier is no longer free tier

boreal iron
#

hehe

lyric mountain
#

they do a little trolling

split hazel
#

gonna see if i can get it credited

boreal iron
#

nothing is for free, sir

proven lantern
#

time is free

#

at least after the big bang

#

and until heat death

lyric mountain
#

nope, u spend energy to have time

boreal iron
#

huge mass = no time

#

so, no it's not free

#

(endless time would also be ok)

cinder patio
#

I'm excited to learn what happens after death

boreal iron
#

you will be reborn as cat

proven lantern
#

probably very similar to before life

cinder patio
#

yeah well we don't know before life

proven lantern
#

you were a cat

cinder patio
#

oh

boreal iron
split hazel
#

such a mind boggling concept

#

how was nothing created from nothing

lyric mountain
boreal iron
#

you're swimming around in a big sp*rm pool

#

that's the before

proven lantern
cinder patio
#

end of scope reached, memory freed 😩

lyric mountain
#

they forgor to free the british queen

#

she's a memory leak

split hazel
#

she really is 💀

cinder patio
#

She was created with the new keyword

split hazel
#

should've been attached a smart pointer

boreal iron
#

born and invented apple

#

the fruit

rocky dagger
#

how do you edit a message using a messageID?

proven lantern
rocky dagger
#

what

cinder patio
#

fetch the message and edit it?

rocky dagger
#

and how do i do that?

cinder patio
#

you gotta give us more information.........

proven lantern
rocky dagger
cinder patio
#

... what language are you using? what library?

rocky dagger
#

djs

#

got it

stiff lynx
#

We're writing to let you know that the names of the organizations your GitHub account is a member of, if any, were likely viewed as part of an attack campaign against GitHub customers. Unless you have received a separate notification from GitHub indicating otherwise, we do NOT have evidence to suggest that the attacker used your account to view other private information, such as repository names or content.

#

LETS'S GOO

split hazel
#

yeah everyone got that that has a linked heroku or travis ci

#

as a precaution

cinder patio
#

I'm so confused

viral spade
#

discord.js question: Are all channels and roles of a guild cached by default?

cinder patio
#

a domain I got for free thanks to my github student pack is always sending me to the github's 404 page saying "There isn't a GitHub Pages site here." but I'm not using discord pages at all 🤔

quartz kindle
split hazel
warm summit
#

I am a failure lol

split hazel
#

nice

#

sorry sad psychology joke

warm summit
#

ikr

#

its ok lmao

proven lantern
#

Tim it's still caching™️

boreal iron
#

wtf ur using the topgg package

proven lantern
#

idk why

#

but it's there until discord ends message intent

#

wait

boreal iron
#

shame on u sir

warm summit
#

im confused @boreal iron

proven lantern
#

i use axios for the rest

warm summit
#

is that bad he is using it?

proven lantern
boreal iron
#

saw it already, too late to censor

proven lantern
#

im not advertising!

boreal iron
#

shameless ads, ban now!

warm summit
#

hes not advertising...

#

Ive been watching this channel

proven lantern
#

i use this command to start my bot sh pm2 --name NAME_HERE start npm -- start --watch --exp-backoff-restart-delay= 100 --time

boreal iron
#

also... why tf do I see djs-light

#

I thought you dont wanna deal with a gateway connection anymore?!

proven lantern
#

once message intent goes away

#

i want to respond to !help for now

#

and tell them to use slash commands

boreal iron
#

you just wanna sniff and log any message

#

I got u sir

proven lantern
#

if i use discord.js i'd need at least 1MB of ram

proven lantern
#

by default

boreal iron
#

its crazy how easy u can sell personal data freerealestate

quartz kindle
#

at least 1mb? more like at least 100mb

#

ex dee

proven lantern
#

i mean GB

rustic nova
#

@proven lantern honestly wouldn't care if the URL contains a competitor

#

just fyi

boreal iron
#

no

#

ban him

#

now

#

ads

rustic nova
#

-b

gilded plankBOT
#

downvote You need to provide a member to ban

rustic nova
#

Done

warm summit
#

👀

proven lantern
#

noooo!

warm summit
#

Seems sus

boreal iron
#

I wanna speak the manager, now!

warm summit
#

😂

#

BOI Hope IS the MANAGER

proven lantern
#

this is the discord.js-light code that adds the guild. does client.guilds._add add it to the cache?

#

the same thing is used for ready, so it should work the same. idk

thorn spruce
#

Hey guy's, someone know how i can send data to my second nodejs app?

lyric mountain
quartz kindle
#

._add respects the client's caching settings

thorn spruce
#

they are on the same server,

lyric mountain
#

still

thorn spruce
#

no easier way so? sueur

quartz kindle
lyric mountain
#

easier than websockets?

boreal iron
#

._add respects the client's caching settings

imagine respecting an user's choice wtf

thorn spruce
#

i never use websockets i'll look

proven lantern
#

i have the guild set to infinity

lyric mountain
#

do note, tho, that you'll only be able to transfer simple data

#

like string, numbers, bytes, etc

#

no objects or fancy stuff

#

unless u serialize them (like by json stringify)

thorn spruce
#

ah

quartz kindle
#

look into ipc libraries

#

ipc stands for inter-process communication

#

most of them use unix domain websockets and tcp sockets as a fallback

#

those are 1 level lower than websocket, so they are faster

lyric mountain
#

like node-ipc topggBurbur

quartz kindle
#

yup, the infamous node-ipc ex dee

#

i made an ipc library myself, feel free to check it out

thorn spruce
#

i see it look funny

#

i'll look that before making something

#

so, for ipc libraries you can send any type of data?

quartz kindle
#

data will always need to be serialized

thorn spruce
#

because i have to send something like that

let s =  {
  author:userid,
  mmr:1000,
  message:r // message event from djs collector 
}
quartz kindle
#

your message object will need to be serialized into a plain object, without references, classes, methods, functions, etc

proven lantern
#

maybe i could move the server count logic from the persistent ec2 instance to a lambda that is triggered every 4 hours by a step function.

#

then it cant cache it

quartz kindle