#development

1 messages · Page 2028 of 1

quartz kindle
#

depends on how the program is coded, which libraries are used, how the library was coded, but on average golang programs use less ram and less cpu than node programs

tidal nymph
#

oh cool, I guess I should consider pick it up as well

#

ty for enlightening me

#

💖

wheat mesa
#

Just pick up asm and never have a worry about performance ever again!

quartz kindle
#

good luck

tidal nymph
simple stump
#

How would I execute multiple tasks at the same time, then return the data once the tasks are finished? For example, if I have this async function:

async function doSomeTask() {
  return new Promise(async(resolve, reject) => {
    String data = "";
    // await and do something
    resolve(data);
  });
}

How can I execute 3 of doSomeTask(), then when the task is finished return all of the data variables?
Ex.

let data1 = await doSomeTask();
let data2 = await doSomeTask();
let data3 = await doSomeTask();
let finalData = data1 + data2 + data3;

I just don't want to have to await, rather have all the functions execute at once and then return all the data once they have all finished.

wheat mesa
#

Promise.all()?

#

Might be relevant to what you’re doing

simple stump
#

Oh. Thanks I'll look at that

tidal nymph
#

you can await a Promise.all()

simple stump
#

👍

tulip cradle
#

How to refresh users count in cmds

quartz kindle
#

wdym?

tulip cradle
#

value is not changing when bot is running

boreal iron
#

Does your bot have the priviledged member intent?

tulip cradle
#

Yup

boreal iron
#

Without that it's just an approximately number

#

Well then guild.memberCount should be accurate

tulip cradle
#

let or const issue?

boreal iron
#

Which value are you talking about?

#

The guild member count should update once a member joins or leaves a guild

boreal iron
#

But you need to loop through all guilds to get the current property value

tulip cradle
#
let ucount = 0;
      client.guilds.cache.forEach((guild) => {
        ucount += guild.memberCount;
      });




.addField(`Users`, `${ucount}`, true) ```
split hazel
#

disagreed. use whats most performant and optimised

#

sorry my dark os dev side is showing

quartz kindle
boreal iron
#

Well instead of looping through all guilds at any time I would create a global var and add or subtract the guild member to it in the guild join and leave event

tulip cradle
quartz kindle
#

do you also have the GUILDS intent?

tulip cradle
#

Value is not refreshing when bot is running

tulip cradle
quartz kindle
#

does client.on("guildMemberAdd") show anything?

tulip cradle
quartz kindle
#

no, not command

#

im talking about the guildMemberAdd event

#
client.on("guildMemberAdd", member => {
  console.log(`new member added: ${member.displayName}`)
})
tulip cradle
#

I have

quartz kindle
#

add that to your code and see if it logs anything

#

so confirm if your bot is detecting members or not

quartz kindle
#

so first you need to check if the detection is working

#

and btw, show the full command code

tulip cradle
#

Its works

quartz kindle
#

show the full command

tulip cradle
#

When my bot is running, then if I add a bot to a server, then the values ​​are not added to that value until I restart the bot.

#

Sorry for mistakes

quartz kindle
#

again, show code

#

full code

celest gate
boreal iron
#

Tim trying hard

celest gate
#

@tulip cradle player handle ki file du

boreal iron
#

edit isn't a function, means playembed is not what you think it is

#

log it in your console and see

celest gate
wheat mesa
# celest gate

<MessageEmbed>.edit() is not a thing, try reading the documentation

earnest phoenix
#

lmfao

tulip cradle
wheat mesa
#

Discord.js

celest gate
quartz kindle
#

lmao

tulip cradle
#

Fake

spark flint
tulip cradle
boreal iron
#

but complaining about non accurate numbers

junior loom
#

How do i shard my bot on multiple hosts? Cause how im doing it rn the bot responds 2 times...

craggy pine
#

Clusters i think is what your referring too

feral aspen
quartz kindle
#

how many shards do you have in total? or how many guilds

feral aspen
#

Hey, Tim, do you recall this question I asked you? You also gave me an answer...

earnest phoenix
feral aspen
#

This was your answer.

#

This was my logs so far.. so what's the best ideal solution?

[SHARDS]: Launched shard 0
Error [SHARDING_IN_PROCESS]: Shards are still being spawned.
[SHARDS]: Launched shard 1
Error [SHARDING_READY_TIMEOUT]: Shard 1's Client took too long to become ready.
Node.js v17.4.0
#

I've tried this, but I kind-of got lost in the end, and the Shards are still being spawned error still kept appearing.

feral aspen
#

Damn, although, I have only used this 9 lines of code on my shard.js file since I started sharding.

require('dotenv').config();
const { ShardingManager } = require('discord.js');
const manager = new ShardingManager('./src/index.js', { token: process.env.TOKEN, totalShards: 'auto' });

manager.on('shardCreate', shard => {
    console.log(`[SHARDS]: Launched shard ${shard.id}`)
});

manager.spawn({ delay: 10000, timeout: 60000 });
quartz kindle
#

what exactly are you running that is causing the error?

#

are you using broadcastEval in shard 0?

feral aspen
#

I replaced 'auto' with 2 for testing purposes, and shards are still being spawned error comes up.

feral aspen
# quartz kindle are you using broadcastEval in shard 0?

You see, my client#ready event immediately fires since shard.js runs index.js and the index file runs the event file which the event file runs all the events in the event folder including the ready.js file which is the ready event that has the broadcastEval, yes.

#

shard.js --> index.js --> event.js --> ready.js (which has BroadCast Eval)

#

What I'm thinking is put some sort of sleep() function or promise that waits till all shards are ready, but although, I do not know how to calculate the total amount of time for all shards to get ready.

quartz kindle
#

you can do something like this

#
// manager
manager.on("shardCreate", shard => {
  shard.on("ready", () => {
    if(manager.shards.every(x => x.ready)) {
      manager.broadcast("allReady");
    }
  });
});

// index.js
process.on("message", message => {
  if(message === "allReady") {
    // all shards are ready
  }
})
feral aspen
#

//manager, the code of the sharding manager, correct?

quartz kindle
#

yes

feral aspen
#

Alright, momento while I apply that.

#

Do I keep the console.log?

junior loom
lyric mountain
#

it'd be inside ready event

#

ah nvm

feral aspen
lyric mountain
#

I mean, that's up to u, "Lauched shard" just means it started, not that it is ready

#

that's why I said nvm

#

at the end of the day that's up to u, it's logging after all

feral aspen
#

Where should I put it, though, inside the ready event or outside of it.

lyric mountain
#

you'll be the one reading the log

#

you choose where to put

junior loom
quartz kindle
#

for example ```js
new Client({
shards: [0, 1],
shardCount: 4
})

#

that would tell the client to run shards 0 and 1 on this process

#

out of 4 total shards

#

so you're free to run shards 2 and 3 anywhere else

junior loom
#

ok thank you!

feral aspen
#

Well, it's spawning one shard only. :/ Hold on while I share my code.

quartz kindle
#

how many guilds do you have?

feral aspen
#

For my testing bot, 9.

lyric mountain
#

it's around 1 shard per 1500 servers (on auto)

feral aspen
quartz kindle
#

yeah you cant use "auto" if you dont have at least 1500 servers

#

otherwise it will only spawn 1 shard

feral aspen
#

Yup, but for now, I put a 2 value, and before you told me to test out the code you sent me, it would spawn 2 with errors, although, with the code you gave me, it's spawning only 1.

quartz kindle
#

weird

#

did you remove the broadcastEval code?

feral aspen
quartz kindle
#

its spawning one tho right?

feral aspen
#

I set the totalShards to 2, although, it's spawning one, only.

quartz kindle
#

to index.js

#

also

#

change the code i gave you to this

#
manager.on("shardCreate", shard => {
  shard.on("ready", () => {
    if(manager.shards.size === manager.totalShards && manager.shards.every(x => x.ready)) {
      manager.broadcast("allReady");
    }
  });
});
feral aspen
gloomy vessel
#

anyone else getting this

#

or is it just me

lyric mountain
#

Where's that happening?

vapid hinge
#

yes

gloomy vessel
#

command js

lyric mountain
#

...no, like, the line

gloomy vessel
#

it's where its setting the perms

#

oh wait

lyric mountain
#

are u trying to set permissions?

#

cuz discord broke v1

gloomy vessel
#
await g.commands.permissions.set({ fullPermissions })
lyric mountain
#

ye, wont work

gloomy vessel
#

How do I get around it then

lyric mountain
#

you don't, you wait

#

discord broke their api, you need to wait for them to fix

gloomy vessel
#

ahhh shit alright ty

#

truly unfortunate

lament rock
lyric mountain
#

ehhhh dat sucks

sharp saddle
#

wtf

#

"business"

warm summit
#

Business?

sharp saddle
#

google suggestions

warm summit
#

Oh sorry

sharp saddle
#

that gboard thing you know?

warm summit
#

If im assuming correctly your send process isn't registering

#

@quartz kindle can u help this man?

sharp saddle
#

Tim must know me in real life and doesn't even know KEKW

#

ok, just joking, if you can help me :D

sharp saddle
sharp saddle
#

that also looks weird...

quartz kindle
#

where is process.send?

warm summit
sharp saddle
#

I don't find this shit at all

quartz kindle
#

show full error then

warm summit
#

so either you have it or something is requesting it

sharp saddle
#

ok

#
TypeError: process.send is not a function
    at /***/*****/*******/node_modules/discord.js/src/sharding/ShardClientUtil.js:85:17
    at new Promise (<anonymous>)```
#

@quartz kindle

quartz kindle
#

thats all?

warm summit
#

ive had shorter errors before

austere surge
#

"you did something wrong you idiot"

quartz kindle
#

looking into your code, you seem to be running a client inside the manager

#

and trying to use broadcasteval from the manager itself

sharp saddle
#

hmm

quartz kindle
#

which obviously doesnt work

sharp saddle
#

ok

warm summit
#

lol im messing with ya

quartz kindle
#

basically, delete this

sharp saddle
#

done

warm summit
#

does it work now

earnest phoenix
#

Hello if i remove top.gg-autopost from my bot codes is it still work after that?

boreal iron
#

It won’t post the server count automatically anymore

earnest phoenix
boreal iron
#

I doesn’t magically post the server count

earnest phoenix
#

Then how is it possible

boreal iron
#

If you don’t post it manually or have the autoposter included somewhere (again) it won’t update anymore

earnest phoenix
boreal iron
#

Well I don’t know your code

earnest phoenix
boreal iron
#

Check if you have included the package anywhere else again

earnest phoenix
#

Provide on npm example

earnest phoenix
wheat mesa
#

what

#

you're asking him questions...

#

??

earnest phoenix
#

Just remove codes from index.js

wheat mesa
#

again, that's very vague

earnest phoenix
wheat mesa
#

I did

boreal iron
wheat mesa
#

It still doesn't make sense

earnest phoenix
wheat mesa
#

in fact it makes even less sense

#

reading it without reading the messages above it makes it sound like fake is asking you for help

#

and not vice versa

#

??

earnest phoenix
boreal iron
#

Facts please, auto posting the server count only works with the package

earnest phoenix
#

Like i use auto Post package for statics of bot i remove it from bot now still sending right information to page

boreal iron
#

If you removed it correctly and restarted the app it can’t post anything anymore since it doesn’t get loaded

earnest phoenix
#

Hmm

boreal iron
#

Make sure there’s no second instance running with the package still loaded in

earnest phoenix
#

Now it not sending message but still website update after bot server increase

boreal iron
#

The website uses a cache

earnest phoenix
#

Ya maybe

boreal iron
#

A change you will see in about an hour can already be hours old

earnest phoenix
#

Maybe website cache bot user data

#

Like total server etc

boreal iron
#

Wait an hour or more, it shouldn’t update after that anymore

earnest phoenix
#

Okay

boreal iron
#

As I said if the library isn’t loaded in anymore it doesn’t happen automatically

boreal iron
#

Alright

valid sierra
#

oh nvm ig

heavy wren
#

my bot not registering all the commands, just 1 (i have 20 commands) and i waited 3 hours and counting

lament rock
#

You might not be using the bulk override commands endpoint

cinder patio
#

why?

still storm
#

Btw, im for hire if anyone need

#

Redis is cache database. Use it only to speedup mongodb. You cant store it forever

woeful pike
#

you most likely don't even need redis

still storm
woeful pike
#

I'm just saying at a smaller scale the complexity isn't justified just for caching

still storm
woeful pike
#

people underestimate how much load databases can take before they start to slow down

still storm
#

Hope i can get some client soon. Need to get some money

still storm
#

And it is faster

woeful pike
#

did you need it to work faster?

#

you cache user levels and configs but now you have to deal with things like cache invalidation

#

nothing is free

woeful pike
#

what happens when a user changes their settings? You gotta clear their redis key

pale vessel
#

doesn't that defeat the point of using redis

woeful pike
#

so you basically have 2 databases you keep in sync lol

#

that's the complexity I'm talking about

#

and for what? 50ms speed increase?

still storm
still storm
#

I fetch data from redis

#

If it isn't there then fetch from mongodb and put into redis

celest gate
pallid zinc
# celest gate

It means the module you were looking for was not found

celest gate
pallid zinc
celest gate
#

node index.js

#

it's showing this error

spark flint
pallid zinc
#

Send the ss of the folder(where it shows the files)

pallid zinc
spark flint
#

^^

lyric mountain
#

I wonder why people clone bots and struggle to solve errors when making one from scratch is easier and faster

spark flint
#

lol

lyric mountain
#

And worse, they expect somebody else to fix it

weak grove
#

When I use the command, the command does not work and gives a voting condition.
should not use the command without voting how do I do

dry imp
earnest phoenix
sharp saddle
#

any experts help here?
The content doesn't appear next to the sidebar for some reason, but underneath the sidebar

quartz kindle
# weak grove

return inside .then() does not affect the rest of the code

royal herald
#
 {
    label: 'Util',
    submenu: [{ role: 'reload' }, { role: 'toggleDevTools' }, { role: 'zoomIn'}, { role: 'zoomOut'},{role:'zoom0'}]
  },

how do i reset the zoom? its not zoom0 or something

quartz kindle
#

context?

royal herald
#

on electron

quartz kindle
#

resetZoom

royal herald
#

its not

earnest phoenix
#

Can Discord bots access the disable/enable command thing that discord released a few days ago?

quartz kindle
# royal herald its not

thats the only mention of zoomIn and zoomOut i found in the entire electron docs

Cmd+/-/0 zoom shortcuts are controlled by the 'zoomIn', 'zoomOut', and 'resetZoom' MenuItem roles in the application Menu.

pallid zinc
quartz kindle
#

role string (optional) - Can be undo, redo, cut, copy, paste, pasteAndMatchStyle, delete, selectAll, reload, forceReload, toggleDevTools, resetZoom, zoomIn, zoomOut, toggleSpellChecker, togglefullscreen, window, minimize, close, help, about, services, hide, hideOthers, unhide, quit, 'showSubstitutions',

earnest phoenix
royal herald
quartz kindle
#

zoomer

earnest phoenix
opaque acorn
#

what system do u recommend me to host my bot

quartz kindle
earnest phoenix
opaque acorn
#

os

quartz kindle
#

i only used ubuntu and debian, and i liked debian more

compact pier
#

linux

#

well nobody use WIndows server

#

:D

earnest phoenix
#

In general it doesn't matter, but Linux is more preferred for hosting things like a web-server or a Discord bot or anything similar, and if you're planning to host it on a VPS, Windows servers are way more expensive than Linux servers

opaque acorn
#

so any linux dist

earnest phoenix
#

Yes

compact pier
#

Ubuntu Server

quartz kindle
#

except arch linux unless you know what you're doing

compact pier
#

is like the most popular

opaque acorn
#

ok

#

thx

compact pier
#

so only cmd shows up

#

:/

quartz kindle
#

rip

compact pier
#

yeah, I had to buy a windows cd from amazon

#

so i can boot back to windows

#

no sec lap :<

boreal iron
#

Instead of downloading the iso?

compact pier
#

no computer

boreal iron
#

And mounting it to a usb drive

compact pier
#

no broswer

#

and I can't setup the wifi driver

boreal iron
compact pier
#

my 60 Euros

#

:<

earnest phoenix
compact pier
#

rip my 60 euro

#

again

quartz kindle
#

fun fact, arch linux is governed by a democracy with a new leader elected every 2 years

compact pier
#

wtf

quartz kindle
boreal iron
#

60 for a windows cd

#

My gosh

#

Probably 59,99 profit for Amazon freerealestate

split hazel
#

either pirate or buy a cheap key on ebay for like £3

boreal iron
#

My gosh speedy

#

Read the text above

split hazel
#

dont pirate nfts tho

compact pier
# quartz kindle

where there aren't a "shared power" and "full power", like the candidate need to get more then 45% for a "full power" and less is "shared power" with the sec guy

quartz kindle
compact pier
#

because like that, the people won't be listened to him

#

100%-ly

split hazel
#

bruh

#

go to a library or something and burn the iso

compact pier
#

BRO

boreal iron
compact pier
#

why i didn't think about it

split hazel
#

please summarise

quartz kindle
#

30min on internet cafe with decent internet

boreal iron
#

Speed dumpy dumb

split hazel
#

i dont want to read a whole convo

spark flint
wheat mesa
#

I've been running off my windows 10 ISO for almost 4 years now

split hazel
#

if its about nfts im all ears

wheat mesa
#

never had any problems

quartz kindle
#

i have old ass isos on my external disk idk why

wheat mesa
#

completely free :^)

quartz kindle
#

including windows xp isos

split hazel
#

why cant bro use a library computer

compact pier
#

yeah now I have like 3 usb for 3 diffrent os

boreal iron
#

It’s actually difficult to install XP on newer hardware

compact pier
#

for every case

wheat mesa
split hazel
#

cant relate

#

ive downloaded whole games before lol

boreal iron
compact pier
#

:D

earnest phoenix
boreal iron
#

No day without Voltrex’s threats to attack the western world

earnest phoenix
#

No day without FakE spreading FakE news

boreal iron
#

Fake news

earnest phoenix
#

Don't expose yourself!

opaque acorn
#

Xd

boreal iron
#

Or I reveal your location to the fbi

earnest phoenix
royal herald
#

like on Tray

boreal iron
#

Im not at Home freerealestate

#

Feel free

earnest phoenix
#

Well there are some in your car as well

boreal iron
#

The insurance will pay a fair amount of money

royal herald
#

@earnest phoenix qt do u know electron

earnest phoenix
#

Sure, what's the problem?

royal herald
#

can i make a click string on ApplicationMenu

#

like onClick or something

#

for help etc

tulip cradle
earnest phoenix
royal herald
#

is it ok to relase v6 tommarow?

earnest phoenix
#

Sure

royal herald
#

click Function (optional) -

#

yup

#

there it is

#

can i make it on the role thing

#

like;
@earnest phoenix

#

yup,it did! woo

feral aspen
#

Is it a bad thing for someone to learn about brute force attacking with Hydra?

quartz kindle
#

learning is never a bad thing

#

attacking something or someone with it who doesnt want it is bad

feral aspen
#

Having to deal errors with something like these. shruganimated

#

Anyways, it's fine, I'm happy I got to learn about Hydra, for now.

quartz kindle
#

i got my neighbours wifi password once

feral aspen
quartz kindle
#

using hashcat for the brute force

#

took 2 days

feral aspen
#

Well, at least that is your first challenge, I suppose. 😂

#

Did you do it locally or from a virtual machine or a VPS?

quartz kindle
#

i bought a usb wifi antenna and run it on a linux vm

feral aspen
#

LOL, that strategy. 😂

boreal iron
quartz kindle
#

i dont remember what i used to captue the wpa handshake

feral aspen
#

I used wsl so I could run it on my terminal and that would take me to the look-alike kali-linux terminal, then I used xrdp to create a machine on my local computer via the Remote Desktop app.

#

Basically installed xrdp via the look-alike kali-linux terminal.

opaque acorn
#

ubuntu 22.04 is worth

#

??

earnest phoenix
feral aspen
#

OOP, hold on, forgot to put 2.

#

Yup, back to the Shards are still being spawned error and the ready event didn't work.

quartz kindle
#

did you remove the broadcasteval?

spark flint
#

NGL I’d recommend discord-hybrid-Sharding

feral aspen
quartz kindle
#

then it works

feral aspen
#

So.. here's what I think should be our solution..

#

We need to wait for the shards to launch before our ready event fires.

#

How can I achieve that?

quartz kindle
#

you just need to put your broadcasteval in the allReady event

#

and remove it from the ready event

proven lantern
#

is it still considered the decorator pattern if you dont modify the input object, but make a copy of the input object and modify that?

feral aspen
#

In the ready event of shard?

quartz kindle
feral aspen
#

God, there.

feral aspen
# quartz kindle

Do you think adding a promise to this process and putting it before the forEach()s would work?

quartz kindle
#

forEach doesnt work with promises

feral aspen
#

No, the message event for the process, I would put it in line 6, supposedly, instead of 12.

#

And make a promise for it for it to finish.

quartz kindle
#

why?

feral aspen
#

I would wait for the shards to launch then run the event handler which has the ready event.

quartz kindle
#

then your bot will not work at all until all shards are ready

quaint rampart
#

anyone know if there is a way to turn this:

[
  { name: 'Laptop', value: 'laptop' },
  { name: 'Lottery Ticket', value: 'lotteryTicket' },
  { name: 'Diamond Ring', value: 'diamondRing' },
  { name: 'Pentecostal Coin', value: 'pentecostalCoin' }
]

to this:

{ name: 'Laptop', value: 'laptop' },
{ name: 'Lottery Ticket', value: 'lotteryTicket' },
{ name: 'Diamond Ring', value: 'diamondRing' },
{ name: 'Pentecostal Coin', value: 'pentecostalCoin' }
``` (javascript)
feral aspen
quartz kindle
quartz kindle
proven lantern
#
const x = [
  { name: 'Laptop', value: 'laptop' },
  { name: 'Lottery Ticket', value: 'lotteryTicket' },
  { name: 'Diamond Ring', value: 'diamondRing' },
  { name: 'Pentecostal Coin', value: 'pentecostalCoin' }
];
...x
#

maybe the spread operator is what you are looking for?

#

...

quaint rampart
quartz kindle
#

do what ben said

quaint rampart
sharp geyser
#

yo tim do you still work on tiny-discord or is it mostly contributors?

quartz kindle
#
function test(a,b,c,d) {
  console.log(a,b,c,d)
}

test([1,2,3,4]) // [1,2,3,4] undefined undefined undefined
test(...[1,2,3,4]) // 1 2 3 4
quartz kindle
sharp geyser
#

ah ok

quaint rampart
#

ah that worked

#

thanks tim and ben

#

yall taught me something new today :D

feral aspen
sharp geyser
#

ima be honest I didn't even know you could use the spread operator like that

feral aspen
#

Two different purposes.

#

One that spreads the arguments and one that rest (merges) the arguments.

digital swan
#

(new to ts) getting this error on collection.find(), cant seem to fix it or find anything clear enough to help

feral aspen
feral aspen
feral aspen
#

Soo... allReady hasn't been logged, unfortunately.

quartz kindle
feral aspen
#

Where do I put that, after which line in the index.js?

quartz kindle
#

anywhere after bot =

feral aspen
#

God, does it log this much?

#
[SHARDS]: Launched shard 1
[WS => Shard 0] [HeartbeatTimer] Sending a heartbeat.
[WS => Shard 0] Heartbeat acknowledged, latency of 335ms.
C:\Users\HamoodiHajjiri\Desktop\Rewrite\node_modules\discord.js\src\sharding\Shard.js:166
        reject(new Error('SHARDING_READY_TIMEOUT', this.id));
               ^

Error [SHARDING_READY_TIMEOUT]: Shard 1's Client took too long to become ready.
    at Timeout.onTimeout (C:\Users\HamoodiHajjiri\Desktop\Rewrite\node_modules\discord.js\src\sharding\Shard.js:166:16)
    at listOnTimeout (node:internal/timers:564:17)
    at process.processTimers (node:internal/timers:507:7) {
  [Symbol(code)]: 'SHARDING_READY_TIMEOUT'
}

Node.js v18.0.0
digital swan
feral aspen
proven lantern
digital swan
proven lantern
#

oh, nice. you need to pass a comparator function for that to work

#

hmmm

sharp geyser
#

instead of doing an if statement just do the comparing in the function

#

<Member>.find(member => member.blah === "something")

digital swan
#

its multiple if statements tho

feral aspen
#

You're using typescript?

digital swan
#

yea

proven lantern
#

typescript is being difficult

feral aspen
#

Have you specified the value that you want to return from the method?

digital swan
#

ye

feral aspen
#

Where did you do so?

digital swan
sharp geyser
#

<Member>.find(member => (member.blah === "something") || (member.something === "something"))

sharp geyser
#

you can use logical AND and OR in them

proven lantern
feral aspen
quartz kindle
# digital swan

pretty sure its
(member: GuildMember)
not
(member): GuildMember

sharp geyser
sharp geyser
#

I haven't used ts in a while tho so don't quote me

#

:^)

digital swan
feral aspen
#

Did you try?

sharp geyser
#

Are you sure members is a collection?

digital swan
#

yes

sharp geyser
#

Well try what I suggested

digital swan
#

thank u

#

yeah i just did

proven lantern
quartz kindle
#

@sharp geyser@digital swan

sharp geyser
quartz kindle
#

the type is for the parameter, not for the entire list of params

digital swan
#

the function wouldve returned a guildmember anyway

#

it works now tho so problem over

sharp geyser
#

I was thinking about this

let {member, user}: { member: GuildMember, user: User } = data
vague heart
#

How do I delete my bot from top.gg? I have 2 old ones that aren't online anymoer

quartz kindle
vague heart
#

on the website?

sharp geyser
#

yes

vague heart
#

ive been looking for a way to delete and i cant find one

#

heres my profile, dont know where to go from here

#

i've looked in "edit", there's no delete button anywhere

quartz kindle
vague heart
#

wow i am an idiot

spark flint
#

lol

sharp saddle
sharp geyser
#

So I am messing with react and electron together and I am noticing it isn't displaying my stuff when I implement react-router-dom with it

#
import ReactDOM from "react-dom";
import {BrowserRouter, Route, Routes} from "react-router-dom";
import {Home} from "./routes/Home/Home";
import { GlobalStyle } from './styles/GlobalStyle'

const rootElement = document.getElementById("root")
ReactDOM.render(
    <BrowserRouter>
        <GlobalStyle />
        <Routes>
            <Route path={'/'} element={<Home />} />
        </Routes>
    </BrowserRouter>,
    rootElement);
#

I assumed this would work as I see no reason it wouldn't render what is on the Home page

sharp saddle
#

I recommend that you build it first and then you start the app

pallid zinc
#

Im learning electron too
Which frontend framework is best for electron? Or things like ejs works better?

sharp saddle
#

Never tried EJS with electron

sharp geyser
sharp saddle
#

Try inspect element

sharp geyser
#

just shows a div with id root

sharp saddle
#

see if there is an error

sharp geyser
#

no errors

sharp saddle
#

Have you searched the internet about it?

sharp geyser
#

yea

sharp saddle
#

Did you find any relevant results?

sharp geyser
#

yea using hash router worked

sharp saddle
#

Did it really work?

sharp geyser
#

yea

#

the content shows up now

#

ty

#

I didnt even know HashRouter was a thing

sharp saddle
#

Np :D

lament rock
sharp geyser
#

ima be honest I used google to figure out how to get electron to work with react

#

and I found a boilerplate that uses electron, react and webpack

pallid zinc
#

Electron with react is kinda hard to work with and ig they has a limited community

#

If i try to search something

#

It shows me 4-5 years old ans

#

Which 40% of time dont work

wheat mesa
#

I feel like electron is one of those frameworks that is overly difficult/painful to start with, but if you know what you’re doing it’s a godsend

sharp geyser
pallid zinc
wheat mesa
sharp geyser
quartz kindle
#

if you think electron is too weird, try nwjs, its pretty much the same thing but simpler

sharp saddle
crystal wigeon
#

is something wrong with top gg sdk?

#

when someone votes its calling the webhook multiple times

#

im sending a 200 success status tho

#

res.sendStatus(200)

stiff dust
#

Guys i want to create an interval to change my server banner how much should I set for the interval to dont spam the API?

pallid zinc
#

If you change the banner in a loop
They will ban you ig no matter the interval time

#

I have seen people try to making rainbow roles, they set it up properly but discord still banned it

crystal wigeon
#

is there something wrong with djs??

#

my bot suddenly went down and now the node process wont even start?

#

the shards arent starting'

bright thorn
#

Anyone using erela.js ?

crystal wigeon
#

ya me

bright thorn
#

How can we change youtube

#

to soundcloud

#

as search platform

crystal wigeon
#

i think you can specify a platform

#

check their docs

#

i kinda forgot, but i used lavalink with erelajs to control the streaming platform

#

you need soundcloud key as well

bright thorn
#

how?

crystal wigeon
#

check docs

#

i kinda forgot

crystal wigeon
#

the shard process is not running at all, it just stops

#

no logs

#

no errors

crystal wigeon
#

so umm

#

im getting a Rate limit issue

#

for some reason

#

when i try to start my bot

#

pls help

rustic nova
quartz kindle
# crystal wigeon

if you get that on all shards that means youve been temp banned, wait an hour or so and try again

crystal wigeon
#

Yeah gotcha figured it out, implemented a queue to send dms. hope it works tho

quartz kindle
#

if you dont get it on all shards, that means youre trying to connect multiple shards at the same time

#

also, if youre manually making a request to /gateway/bot you might also wanna log the headers

#

could give you more information

sly solar
#

what is the problem

covert ingot
#

req.body is undefined

#

u got ur middleware set up @sly solar ?

rustic nova
#

req.body wont work, you'd need to get the form first from the request

#

boldly would assume req.form because thats how its done on python iirc

spark flint
#
rich copper
#

Oh

covert ingot
#

req.body is the correct way

neat ingot
#

either req.body, or req.params, depending on if its a get or post request. and either way, a middlware needs to be setup

#
const body_parser = require('body-parser');
const express = require('express');
const app = express();

// To support json and url encoded bodies
app.use(body_parser.json());
app.use(body_parser.urlencoded({extended: true})); 
#

^ to setup middleware for parsing the properties for req.body and req.params

#

eyyy thats pretty neat!

spark flint
#

very

feral aspen
#

Is it just me or is the guildScheduledEventCreate event not working?

#

None of the console logs logs. ;-;

fluid garden
#

What is bulk 0verwrite

celest gate
ember sequoia
ember sequoia
crystal wigeon
#

you need node version < 18

bright thorn
celest gate
#

nvm

#

my friend fixed it

spark flint
#

i want to use req.hostname but i'm using nxing reverse proxy

#

whats the best solution to fix this

split hazel
#

step 1 acknowledge there is a skill issue at hand

spark flint
#

i fixed it now

fluid garden
#

Hi guys please can anyone suggest me a coding website pls

spark flint
#

for what

#

wdym "coding website"

fluid garden
#

Bot

#

To code my bot

spark flint
#

to make a bot with?

fluid garden
#

Ye

spark flint
#

You on mobile or something

fluid garden
#

Pc

#

Laptop

spark flint
#

just download vs code and code there

fluid garden
#

It is not free hosting

spark flint
#

no hosting is really free

fluid garden
#

I need website like replit

celest gate
#
C:\Users\creative infotech\Desktop\Uchiha\node_modules\discord.js\src\client\Client.js:206
    if (!token || typeof token !== 'string') throw new Error('TOKEN_INVALID');
                                                   ^

Error [TOKEN_INVALID]: An invalid token was provided.
    at Client.login (C:\Users\creative infotech\Desktop\Uchiha\node_modules\discord.js\src\client\Client.js:206:52)       
    at Object.<anonymous> (C:\Users\creative infotech\Desktop\Uchiha\index.js:290:5)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47 {
  [Symbol(code)]: 'TOKEN_INVALID'
}```
spark flint
#

your discord token is invalid

celest gate
spark flint
#

well you didn't

#

or it would work KEK

celest gate
fluid garden
#

I need to ask something if i didnt maked like slash commands i can change prefix to / and it will show like /command?

rustic nova
#

just responding to a message starting with / will not actually make slash commands

#

Several other people tried that already

fluid garden
#

Oh

spark flint
#
<h1 class="text-white text-xl md:text-2xl"><button class="rounded-full p-3 bg-gray-300"></button> Offline</h1>```
#

how to make same height

royal portal
#

move the text down a bit

spark flint
#

how

royal portal
spark flint
#

how angery

#

like what did you do

#

also

#

oh my fucking

#

god

#

ignore me pls

neat ingot
#

~have been 😗

spark flint
neat ingot
#

you really dont know how to move an element around?

spark flint
#

idk how to make them line up

royal portal
spark flint
royal portal
spark flint
neat ingot
royal portal
#

bun make your own framework

#

where you can just align-this-pls

spark flint
#

smart

royal portal
earnest phoenix
warm summit
#

its not hard. If its HTML and CSS its no hard at all...

spark flint
#

bro you use a template OMG

warm summit
#

your point

spark flint
#

if html and css isn't hard, why are you using a template

warm summit
#

sorry for using one tempo3rary while i make my own

#

people can be in a rush to get shit up aka I was

#

so I bought a template and posted it while im making my own

#

oh and next for referance w3school helps alot with that stuff.

#

or just google it

bright thorn
#
    const track = player.get("trackforautoplayfunction");
    const url = `https://www.youtube.com/watch?v=${track.identifier}&list=RD${track.identifier}`;
    let res = await player.search(url, client);

I switched in soundcloud so the autoplay will stop as it is in youtube
so in soundcloud what should i do

spark flint
#

tyty

green kestrel
#

anyone mind testing something for me please

#

visit https://dl.dpp.dev and see what happens? you should get a tarball download via github

craggy pine
#

Accurate

warm summit
#

it would in therory download whatever virus to your pc

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

warm summit
#

so why couldnt he test it himself if its a library?

sage bobcat
#

One message removed from a suspended account.

green kestrel
#

i have tested it myself

craggy pine
#

I'd also be surprised if he planted a virus in that URL due to being also former staff of this discord

spark flint
#

no need to jump to conclusions lmao

green kestrel
#

but i get intermittent redirects to another site on my server

warm summit
#

well sorry last time someone wanted me to "test" something it was a virus and I had to wipe everything

green kestrel
#

the apache vhosts are playing up

sage bobcat
warm summit
#

its called people are not trustworthy

green kestrel
sage bobcat
#

One message removed from a suspended account.

craggy pine
#

I was also staff if you remember.

green kestrel
#

but i have too much to lose by trying to infect anyone with any virus lol

sage bobcat
#

One message removed from a suspended account.

warm summit
#

im just saying god damn

spark flint
warm summit
#

toxic people 😂

green kestrel
#

no you raise a legit point

#

"how can I trust you"

#

the others answered your question

#

🙂

warm summit
#

and how can I trust any one in here?

green kestrel
#

you'd have to start somewhere, as this place is probably going to list your bot

warm summit
#

what bot lol

#

im just here to chat mostly

green kestrel
#

why else would you be here 😄

spark flint
green kestrel
#

fair point

spark flint
#

maybe servers

#

its a pretty useless community to be in without being related to servers or bots lol

warm summit
#

i forgot you can add severs too

green kestrel
#

either way seems my server is being arse

warm summit
#

arse?

spark flint
#

its not really a "community" server here

warm summit
#

i can tell -_-

#

also shouldnt we take this to general?

harsh nova
spark flint
#

😔

#

ok i have a real development question now

#

how do i do that skeleton loading thing OMG

warm summit
#

lets hear it

#

oh lord im out

spark flint
#

I want to make my site use skeleton loading until I have the API response with my status

#

instead of just showing "Offline" until it loads

sage bobcat
#

One message removed from a suspended account.

compact pier
#

I don't really know how to export the clientproperly :/

#

because when I call the function, it just say that client is undefiened

#

someone help me T.T

compact pier
#

Solved Actually my Backend GraphQL is not on yet, so yeah.... sorry for wasting time

quartz kindle
sharp geyser
#

Anyone know how I can use react with electron? I have been trying a lot of boilerplates and other things and I can't get any stable instance to run without problems occurring later on

split hazel
#

@quartz kindle do you think its faster to write a little bit of data, move to another position then write/read again or do it in one massive chunk even if most of the other data is untouched or not needed

#

i was thinking its faster to do one big buffer because a) disk can take time to acquire again b) system call disk overhead c) if the disk is a hdd writing one long sequence of data requires no head movement and it can simply be written in a linear manner (ignoring fragmentation of course)

quartz kindle
proven lantern
#

does this wait for all promises?

await Promise.all([[promise1],[promise2]])```
quartz kindle
#

i dont think Promise.all() looks inside subarrays

proven lantern
#

i must test!

#

it would be nice

#

this took one sec to log, not 5 😦

split hazel
#

rip?

proven lantern
#

yes

quartz kindle
proven lantern
#

they should just flatten it for us

quartz kindle
#

that could cause unintended scenarios

proven lantern
#

both could

quartz kindle
#

for example if you want to resolve a list of promises that resolve to arrays mixed with already resolved promises or normal arrays

proven lantern
#

it could throw an error when a nonpromise is passed to it

#

but i guess

earnest phoenix
proven lantern
#

it should be like concat()

#

i love concat

crimson dagger
#

so how do i use the 15 usd i get from the 1st 100 votes my bot gets

dry imp
#

auctions

earnest phoenix
# proven lantern

We don't flatten it in the Promise.all() method because of exactly what Tim said, it could extend it's depth to go deeper into the sub-arrays and start resolving encountered promises, leaving no room for short-circuiting, and could cause lots of unexpected behaviors, even with your idea of throwing an error when a non-promise is passed, because we would additionally have to check whether the value is a promise or not, leaving us with a performance regression

crimson dagger
proven lantern
#

if a user is passing a nested array of promises to Promise.all they are probably expecting those promises to resolve before going on

crimson dagger
#

so what is

#

$

#

and
@ $

earnest phoenix
quartz kindle
#

which team?

#

you'd need to take it to the js commitee

split hazel
#

💀

quartz kindle
#

tc39 i believe they are called

split hazel
#

yeah

quartz kindle
earnest phoenix
earnest phoenix
proven lantern
#

That's awesome btw

sharp saddle
#

do you know why webhooks of interactions give the error DiscordAPIError: Unknown Webhook?

#

wtf

quartz kindle
earnest phoenix
quartz kindle
#

n-no shyheartblush

earnest phoenix
quartz kindle
#

.<

sharp saddle
lament rock
#

Someone rewrite my discord.js bot to slash commands and using cacheless libraries for free please :)
So much pain
I am not actually offering

hollow spade
#

Opa

quartz kindle
#

someone write my api for me pls

#

i'd even pay for it (although i dont have much), the issue is shit's hard yo

boreal iron
#

Thought you’re already done

quartz kindle
boreal iron
#

Poor Tim

#

Could write it in PHP

quartz kindle
#

hell no

boreal iron
#

I see you don’t want any help

quartz kindle
#

xD

boreal iron
#

_rude boi _

sharp saddle
#

Wait wrong chat

lyric mountain
#

And here we observe two brazillians at their native habitat

earnest phoenix
#

lol

old sigil
#

How to make a delete all messages commands in py?

dry imp
#

purge

old sigil
#

How to code it?

hybrid cargo
#

We do not spoon feed. We only help with errors and stuffs in your code, and not write teach the whole coding itself. If you want to learn how to code, consider watching tutorials on YouTube and reading documentations of the language that you are coding in.

old sigil
#

K

fluid garden
#

How to clone a mongodb?

#

I have a mongo db that i must duplicate it

delicate shore
#

Hi

#

so I was wondering if there is a way

#

like I can tell my machine to do a certain task at a certain time (in NodeJS)

#

for example: I set a time of 28 days, and then add a .on event or something, then after 28 days, I get a response on that event with the required details

tidal nymph
#

I assume my bot is having mem leak with this metric 🤔 whats the best way to detect mem leak? I've tried installing some package but they were all outdated or somehow unable to install

#

or maybe because im using djs

quartz kindle
tidal nymph
quartz kindle
#

does it do music?

tidal nymph
#

nope

quartz kindle
#

well its a little bit excessive but still looks like normal djs to me

#

are you using v13?

tidal nymph
#

yea im using v13

quartz kindle
#

have you tried disabling the caches you dont need?

tidal nymph
#

oh I never heard of that

quartz kindle
#

its a new thing in v13, caches are now customizable (to a certain extent)

#

check the docs for client options

tidal nymph
#

ok i'll take a look into that

quartz kindle
#

you can disable message caching and user/member caching for example

#

those usually take a lot of space

tidal nymph
#

but does it mean when I have some commands related to role/finding message, its gonna be slower right?

quartz kindle
#

depends on what the command does

tidal nymph
#

or I wont get the access to cache at all for those disabled ones?

quartz kindle
#

messages contain member data, so you can still access the member object in a message

#

to find messages its a bit tricky, you wont be able to find past messsges by content

tidal nymph
#

ok let me check which caches my bot is using first

tidal nymph
quartz kindle
#

should be fine yes

#

try it out

quartz kindle
#

the server names?

#

you list them from your library's guild cache

#

which library are you using?

lyric mountain
#

just a heads-up, only you (or other devs) can see such info

#

unless those servers agree to be listed publicly

quartz kindle
#

still waiting for which library they are using

lyric mountain
#

something tells me it's dpy

quartz kindle
#

client.guilds gives you a List of guild objects

sage bobcat
#

One message removed from a suspended account.

split hazel
#

@quartz kindle the db has used too much of my attention its now my os's turn

#

I'm planning to refractor the scheduler since I'll be showing my os to someone my teacher invited to the school

#

I want to implement the SJF (shortest job first algorithm)

#

and you have been selected to be my guide

slender thistle
#

Guild objects means it's a list that contains information about each guild your bot is in. Names, member counts, and so on. So, yes.

quartz kindle
#

you probably know more about that than i do

#

in your code, you need to use client.guilds to get the list of guilds your bot is in, then decide what to do with it, for example map the list into a new list of guild names, and then print that list, or make a command that sends that list to a channel, idk you decide

split hazel
#

lol probably but I'll ask for some advice on how to implement the priority system

#

should probably explain the algorithm to you first

#

the shortest tasks get the highest priority and longer tasks get the least priority, so short tasks are first and long tasks are last

cinder patio
#

Are the tasks just "short" and "long" or does each task have a specific time

quartz kindle
#

how do you decide which tasks are short or long?

lyric mountain
#

if (task.length > 10) return "long";
else return "short";

split hazel
#

that's the part I'm not exactly sure on

#

I think it depends on all other tasks

#

the "short" and "long" tasks probably don't exist

quartz kindle
#

how about a priority system where the task itself can decide its own priority?

split hazel
#

I think it's just a priority queue where higher priority tasks get executed first

quartz kindle
#

because i dont see how the os can measure and assign the correct priority to each task

#

unless the os is running real time metrics

cinder patio
#

Have two arrays, one with short tasks and one with long tasks, first pull from short tasks until empty, then long tasks

#

Priority in the array is a different subject though

split hazel
#

you can use some hacks to determine how much time the thread has used

#

but putting that into longer or shorter is the harder part

quartz kindle
#

if you cant do something as simple as that, you might want to learn python first

split hazel
#

if I can't come up with something I'll just go with what Tim said lol

#

though there's probably a video on it

lyric mountain
split hazel
#

yeah that's what I thought

lyric mountain
#

first few times it'll be mostly unsorted, but after that it should start to order itself

split hazel
#

less than average = short task else long

quartz kindle
#

you'll also need to introduce a limit

split hazel
#

but then very short or long tasks can dilute the average

lyric mountain
#

use geo mean

quartz kindle
#

so you dont lock the cpu by flodding it with small tasks

#

for example for every 5 small tasks ran in a row, run one larger task

split hazel
#

I was gonna answer that question earlier

#

if you have too many short tasks it will starve the longer tasks so you often also implement a priority decay so longer tasks eventually gain higher priority

#

forgot to send lol

lyric mountain
#

use geo mean to prevent average biasing

split hazel
#

the longer the long tasks sit without cpu time the more priority they gain

#

never heard of geo means what is that?

lyric mountain
#

geometric mean, it's one of the averaging methods that's made for datasets with spikes

#

ah wait

#

not that yeah it's that

#

In mathematics, the geometric mean is a mean or average, which indicates the central tendency or typical value of a set of numbers by using the product of their values (as opposed to the arithmetic mean which uses their sum). The geometric mean is defined as the nth root of the product of n numbers, i.e., for a set of numbers x1, x2, ..., xn, th...

split hazel
#

actually diluting the average shouldn't be an issue

lyric mountain
split hazel
#

each time slice is capped at whatever the CPU timer is set to

#

I'm thinking to set it to 20ms

#

it's currently at 2ms no wonder my os is lagging on vms lmao

#

that was before I really know anything

lyric mountain
#

well, if u face issues with biased averages that's the way to solve it

#

it's not really hard to implement

split hazel
#

I'll play around with geo means

#

to master them first

lyric mountain
#

frost

split hazel
#

😡

lyric mountain
#

there's also the median, which literally picks the middle point

#

but it doesn't reflect the actual range

split hazel
#

yeah

#

I was only taught mean range and median

lyric mountain
#

no moda?

split hazel
#

nope

#

oh mode

#

yeah mode too

lyric mountain
#

ye that

#

geomean u usually learns on later years

#

the same year that u learn plotting data iirc

split hazel
#

yeah not in my curriculum when I did maths

#

science too

#

so like cube root of values a, b, c... ?

lyric mountain
#

basically

split hazel
#

can't find a website that explains it without the ramble

lyric mountain
#

ultimate wikipedia fail

quartz kindle
#

lmao

lyric mountain
#

the formula

#

PSA: big math symbols are just for-loops

#
y = x[0];
for (i = 1; i < n; i++) {
  y *= x[i];
}

y = y ^ (1/n);
#

in a nutshell

quartz kindle
#

code is so much easier to understand

lyric mountain
#

fuck I cant decide if it's inclusive or exclusive

quartz kindle
#

people should start writing formulas in code instead of math symbols, or at least offer the code version as an alternative

lyric mountain
#

I started understanding math after I saw someone say that phrase