#development

1 messages ยท Page 2006 of 1

spark flint
#

Well what members are there to mention

#

Use a user selector

bright hornet
#
data: new SlashCommandBuilder()
    .setName('whois')
    .setDescription('To see members information')
    .addUserOption(option => 
        option
        .setName('user')
        .setDescription("Enter who would like you to know their information")
        .setRequired(true)
    ),
    async execute(interaction, client) {
        

        await interaction.channel.send({embeds: [embed]})
    },``` just like this right
spark flint
#

Yeah

bright hornet
#

hmm

#

how do i show their idendity or

#

call them

#

to an embed

spark flint
#

You mean get the user object?

bright hornet
#

yap

spark flint
#

2 secs

upbeat sleet
#

how to i check a people voted or not ?

bright hornet
upbeat sleet
spark flint
#

interaction.options.getUser('user')

upbeat sleet
spark flint
bright hornet
spark flint
bright hornet
spark flint
#

You need to await it too

spark flint
bright hornet
#

ohh

spark flint
#

Then you can do user.username

#

Etc

upbeat sleet
#

Hm.....

earnest phoenix
bright hornet
#
var member = interaction.options.getUser('user)```
spark flint
#

Anyways

#

That should work

bright hornet
#

ok ill try this shit

upbeat sleet
#
await lib.topgg.get.user.voted.or.not?({
user : toast
});

quite nice XD

spark flint
#

Alrighty

bright hornet
#

why slash is way more diff to command handler

#

like damn

lyric mountain
bright hornet
upbeat sleet
lyric mountain
bright hornet
#

oh

lyric mountain
#

If u want the full list of reasons give it a search

bright hornet
#

const then

lyric mountain
#

Let

#

Const is constant

bright hornet
#

llet

#

let

craggy pine
#

let = you can reassign it
const = it stays as it is

bright hornet
#

oh

#

thanks for info

lyric mountain
#

dw, I see people using var here all the time

craggy pine
#
const thing = "hi"
thing = "bye"
//error

let thing = "hi"
thing = "bye"
console.log(thing)
//"bye"
lyric mountain
#

most come from very old tutorials that still used var

craggy pine
#

It is rather surprising that var was used as much. Was let / const not a thing

#

lol

lyric mountain
#

let is a quite new thing

craggy pine
#

Oh interesting

lyric mountain
#

and a privilege devs that support IE can't afford to have

#

luckily for them, IE support is bound to die this year

earnest phoenix
#

In the old versions of JavaScript, only the var keyword existed to declare variables, and the strict equality operators (===/!==) didn't even exist

bright hornet
#
interaction.member.roles.cache.size``` this is how can i get their roles right
quartz kindle
#

another difference is that let/const is block scoped, while var is function scoped```js
var x = 10;
if(something) {
var x = 20;
}
console.log(x) // 20

let y = 10;
if(something) {
let y = 20;
}
console.log(y) // 10

craggy pine
#

That's "size"

#

as in. You'll get the total # of roles they have (if that code is even correct I never messed with slash commands yet)

bright hornet
#

damn

craggy pine
#
.addField(`Roles [${guildUser.roles.cache.map(r => r).length}]`, guildUser.roles.cache.map(r => r).join(" "), false)
#

how I atleast display roles in an embed

lyric mountain
#

that's the reason ye?

bright hornet
#
const member = interaction.options.getUser('user')

const member = message.mentions.members.first()``` how this is so diff
craggy pine
#

Different stuff entirely

quartz kindle
#

i guess it was a very early attempt at supporting some kind of static analysis

lyric mountain
#

like ```js
function aFunction() {
var a, b;

a = 10;
b = 5;

console.log(a * b);
}

quartz kindle
#

yeah

#

considering js copied much of its syntax from c langs

bright hornet
#

understandable^

lyric mountain
#

I suffer that pain everyday with delphi

#

sucks not being able to declare a var anywhere other than the head of a function/class

quartz kindle
#

delphi requires all vars to be declared beforehand at the top?

lyric mountain
#

ye

craggy pine
#

yikes

earnest phoenix
bright hornet
#

6 years?

lyric mountain
#

iirc they added support for in-code variable declaration on newer updates

#

but we wont be updating delphi in the foreseeable future

earnest phoenix
lyric mountain
#

why? look at how much it costs to update

#

yes, you also have to pay for bug fixes

#

yes, the IDE crashes and freezes all the time for absolutely no reason (like pressing ctrl + space)

earnest phoenix
#

Do people even use Delphi anymore

lyric mountain
#

sad brazil reality

#

oh, and did I mention that you dont get database components unless you purchase the second package (there are 3 packages)?

#

because who would need databases anyway /s

earnest phoenix
#

Sounds like EA to me

feral aspen
#

Is there a link I can check out Discord.JS V14?

lyric mountain
#

isn't it still nightly?

earnest phoenix
feral aspen
#

Pardon?

earnest phoenix
#

Those are the changes, if you want to use the v14 early, you just install the development version by running

$ npm i discord.js@dev
feral aspen
#

Would you do that?

lyric mountain
#

using nigthly branches is risky

feral aspen
#

I'm afraid I don't understand what nightly means.

lyric mountain
#

everything could change from one commit to another

#

well, how could I explain?

#

basically an in-dev version

feral aspen
#

Ohh. Makes sense.

lyric mountain
#

still-hot bread

earnest phoenix
#

I don't recommend using the development/beta/alpha/nightly branches since they ship the newest code without any consideration or security checkups and breakage checks

lyric mountain
#

also they almost always lack any meaningful documentation

earnest phoenix
#

And they're meant for testing, not production ready projects

feral aspen
#

This part annoys me.

#

It's supposed to be an array of objects.

real rose
bright hornet
#
const user = interaction.options.getUser('user')
        
        const embed = new MessageEmbed()
        .setTitle(`Informations`)
        .addField(`Member:`, `${user.username}`, true)
        .addField(`Roles:`, `${interaction.user.roles.cache.size}`, true)
        .addField(`Role Names:`, `${interaction.user.roles.cache.map(r => r).join(" ")}`, false)
        .addField(`Joined At:`, `${moment(user.joinedAt).format('ddd, MMM Do, YYYY, h:mm a')}`, true)
        .addField(`Created At:`, `${moment(user.joinedAt).format('ddd, MMM Do, YYYY, h:mm a')}`, true)
        .setColor('RANDOM')
        .setTimestamp()

        await interaction.channel.send({embeds: [embed]})``` so after doing this, if i ping someone, it shows the role to me not in the member that i pinged
feral aspen
lyric mountain
#

.map(r => r) why

neat ingot
craggy pine
#

he def tried my code out KEKW

feral aspen
bright hornet
bright hornet
#

need to see the codes with this slash command

feral aspen
earnest phoenix
feral aspen
#

You're getting the roles of the user who performed the interaction.

craggy pine
neat ingot
feral aspen
neat ingot
#

it does tho...

feral aspen
#

I don't see an array?

neat ingot
feral aspen
bright hornet
#

if i dont add the interaction gonna get the eroror

neat ingot
#

i think so, says stable on the site ๐Ÿ˜„

bright hornet
#

eroror

earnest phoenix
# bright hornet ohhh

Since you're getting role info and all that, you should use getMember() instead, it returns the guild member instance of the user, which you can also access the user's details from the <GuildMember>.user property

feral aspen
lyric mountain
#

oh js has varargs

neat ingot
#

when did that drop? lol

feral aspen
lyric mountain
#

basically an open array

earnest phoenix
lyric mountain
#

you don't need to declare explicitly an array, you just write whatever would go inside it

#

the fucntion itself can grab the values as an array normally

bright hornet
#

since interaction only define who use the command

feral aspen
#

Why not pass in an array to the argument and discord.js use the array instead of grabbing the values and putting them into an array?

bright hornet
#

how about for the members :

lyric mountain
#
function aFunction(...args) {
  for (a of args) {
    console.log(a)
  }
}

aFunction(1, "a", {}, 10)
aFunction(2, "b")
aFunction(3)
#

I use it all the time on java, didn't know it was a thing in js too

feral aspen
#

Yup, that's possible.

neat ingot
#

๐Ÿ‘€ really? i thought that was super common lol

feral aspen
#

The rest parameter, I believe it's called.

lyric mountain
#

we call it varargs in java

feral aspen
neat ingot
#

you also dont need to declare '...args' and can access the arguments property within a function, buts its not quite the same an the array you get from using ...args

earnest phoenix
# bright hornet can u give some example?

An example

// Get the guild member instance of the user.
const member = interaction.options.getMember('user');

// Username.
console.log(member.user.username);
// Roles.
console.log(member.roles.cache);
// User flags
console.log(member.user.flags);
quartz kindle
#

yes, all functions have a hidden arguments variable available in its scope

feral aspen
#

You don't need to us it unless for some certain reasons.

#

Not sure when, though, and at what cases?

quartz kindle
#

one case is checking how many params were given to the function

#

a(1,2,3,4,5,6) { console.log(arguments.length) }

feral aspen
#

Well args.length?

feral aspen
lyric mountain
#

varargs don't require to be alone

#

function aFunction(param1, param2, ...args)

feral aspen
#

Indeed.

earnest phoenix
#

If you want to check the amount of arguments passed to the rest parameter, although that's not recommended if you don't want to actually use rest parameters, so that's when the arguments internal scope slot comes into play

feral aspen
quartz kindle
#

there are a few use cases on the mdn page

neat ingot
feral aspen
neat ingot
#

^ another use case

bright hornet
#

ohhhh

quartz kindle
#

for example ```js
function myConcat(separator) {
let args = Array.prototype.slice.call(arguments, 1);
return args.join(separator);
}
myConcat('. ', 'sage', 'basil', 'oregano', 'pepper', 'parsley');

neat ingot
#

but thats different from the actual functions arugments i guess ๐Ÿ˜„

bright hornet
#

.getMember and .getUser for slash commands

neat ingot
#

more just a destructuring example

quartz kindle
#

but yes, pretty much everything you can do with arguments, you can also do with the spread operator

earnest phoenix
#

Rest parameters can modify the length of the function while the arguments internal scope slot doesn't, which was a fatal case in older browsers but I'm sure that was patched by someone in the team

lyric mountain
#

things get funny when u want to pass an actual array as a param

bright hornet
#
const member = interaction.options.getMember('user')``` in here, i should focus on ```js
.getMember('user')``` whatever in the `option .setName('')`?
earnest phoenix
#

It should be the same name as the user option's name, it just gets the guild member instance of that user instead of just returning the user

bright hornet
#

why this happened?

lyric mountain
#

you didn't ack

bright hornet
#

ha?

earnest phoenix
#

You only have 3 seconds to respond to an interaction before it expires, if you need to respond after 3 seconds, you need to defer the response

neat ingot
#

a 2 minute delay in command reply?

#

for real? ๐Ÿ˜„

earnest phoenix
#

YandereDev Simulator

bright hornet
#

interaction.deferReply()?

earnest phoenix
#

Yeah

lyric mountain
#

you should focus on why it took 2 min tho

bright hornet
#

where should i put it? on interactionCreate event? or in the command.js?

earnest phoenix
#

Either their bot host is pretty shitty or they're sorting a ton of shit in that command or something

bright hornet
spark flint
#

Id recommend Discord time stamps for join and create dates

neat ingot
bright hornet
#

oh i see

bright hornet
neat ingot
#

dunno what to tell you there KEKW

#

as long as you defer once, and edit reply after that you should be fine

bright hornet
#

aaaaaaaa

#

seems like this .joinedAt and .createdAt got idk

boreal iron
#

Aye use timestamps freerealestate
Canโ€™t be easier to read tho 1647831025

livid lichen
#

Found the error, it was the Start Activities perm.

neat ingot
#

I like that rgb background ๐Ÿ™‚

livid lichen
#

I love ShareX ๐Ÿ˜Ž

livid arrow
#

can anyone tell me approximately what specifications I may need to host a bot with over 200 servers (5k members on average) which will run the bot smoothly without any lags. Also Note: I'll be using flask. Thanks In advance

wheat mesa
#

We donโ€™t know what your bot does

#

Or what it caches

livid lichen
#

^

livid arrow
wheat mesa
#

Again, that doesnโ€™t provide too much detail on what specs youโ€™ll need

#

What does your bot cache? Do you run in memory databases? Do you do any intensive calculations? Etc

neat ingot
#

i mean, as long as you have around 2gb ram and not running a potato, your bot should be fine for that number of guilds unless your doing obscene things with your cache

wheat mesa
#

Itโ€™s difficult for someone to estimate specs without looking at your specific implementation

livid arrow
livid lichen
livid arrow
quartz kindle
#

start with 1gb ram 1 core and continue from there

livid lichen
#

If you're using a database known to be resource intensive, that could also need more ram.

wheat mesa
#

Thereโ€™s always the handy testing method

quartz kindle
#

like mongoliadb

livid lichen
#

I use mongoDB and redis. Both are not that resource heavy.

livid arrow
quartz kindle
#

well mongoliadb uses a certain % of your system's max ram by default

#

so it can be more resource intensive than others, depending on the configuration

livid arrow
#

hmm understood, Thanks topggThumbsUp is there any good hosts that is cheap and accepts crypto :))

wheat mesa
#

I donโ€™t think thereโ€™s many hosts out there that accept crypto

#

Never heard of one that does, but I donโ€™t know many hosts

livid arrow
#

umm I saw some but can you tell me what's the cheapest price I can have?

#

so that I can compare

wheat mesa
#

Iโ€™m not sure about the cheapest hosts, especially for accepting crypto, but generally speaking you get what you pay for

#

most hosts that claim to be cheap also use less powerful hardware

livid arrow
#

Mainly I need a python hosting. I'll need to use flask and connect my domain to use the Oauth callbacks.

#

so, will also need a good bandwidth for the site

#

topggFacepalm I have a shared hosting but it has gcc disabled. so, not being able to use it for hosting the bot primarily

wheat mesa
#

gcc is required for python? Interesting

livid arrow
#

and other modules which requires that

wheat mesa
#

I suppose node-gyp is a similar way, makes sense

sweet python
#

Like when someone votes your bot it shows up in a channel

wheat mesa
#

There is a nodejs top.gg api wrapper

sweet python
#

Could I get a link to it

livid arrow
#

dunnu if it's allowed to share links, so yeah, search manually ๐Ÿ™†โ€โ™‚๏ธ

dry imp
#

you're allowed

#

if someone asks for it, you are allowed to give them the link

quartz kindle
neat ingot
#

contabo vps is super cheap:

quartz kindle
#

if you dont mind slow disks, yes contabo is unbeatable, nothing else comes even close

neat ingot
#

they offer nvme now which is nice ๐Ÿ™‚

#

i think i only have ssd, and never had any issue with read/write speeds

quartz kindle
#

last time i saw someone benchmark it, they were still slow

neat ingot
#

could be yea, i remember checking the hardware when i first signed up and it was a little older than i'd have liked

quartz kindle
#

its usually not a problem since most programs wont be doing lots of reading and writing from disk

neat ingot
#

easy to reduce writes as well if you cache temporarily... but i wont start that again lol

#

I was getting flamed the other day cause i cache my active db items for a minute before saving ๐Ÿ˜„

quartz kindle
#

im running a full text search based on grep lol

neat ingot
#

like, regexp?

#

oh, grep is a command line utility? i've never used it before ๐Ÿ˜„

quartz kindle
#

ye, its used to find lines in a text file

neat ingot
#

this is for parsing your astronomy datasets? ๐Ÿ˜„

livid arrow
quartz kindle
#

sort of yes lel

#

i have a huge list of keywords and names that can be searched for, but i didnt find any tokenizer that was good enough

#

grep still gives me the best matches

neat ingot
quartz kindle
#

i did use it a first, but since its inside the program, its also blocking and limited to 1 thread

#

grep can be multithreaded if searching through multiple files

neat ingot
#

ahhh ok ok, so your outsourcing it ๐Ÿ˜„

quartz kindle
#

and its non blocking to the progam

#

ftset is faster to search in a single file

#

but grep is faster for multiple files

neat ingot
#

how many files are there?

quartz kindle
#

about 8 or 9

neat ingot
#

ahh ok, so how much faster is it to use 'native' grepping?

quartz kindle
#

well, with ftset i was getting anywhere from 10ms to 50ms per query

#

with grep im getting an average of 10-20ms

#

im caching all queries tho, so they will only actually grep once

#

after its cached is < 1ms

neat ingot
#

is that heavy on the rams?

quartz kindle
#

we'll see, is not running in prod yet

#

im using lmdb for cache

neat ingot
#

the movie website? CharDerp

quartz kindle
#

lmao

#

LMDB

neat ingot
#

ahh ok, so a lightweight key->value storage

quartz kindle
#

ye

livid arrow
neat ingot
#

I wonder how my cache system compares to others

quartz kindle
#

lmdb is kinda like redis but embedded like sqlite

neat ingot
#

ohhh, so its a recoverable cache too? like, in between boots?

quartz kindle
#

ye it has persistence

neat ingot
#

nice! thats a thing i did not bother with as I'm mostly cacheing mongodb objects ๐Ÿ˜„

neat ingot
#

my brains hit a complete dead end for what to do to improve this more ๐Ÿ˜ญ

livid arrow
#

thanks again ๐Ÿ˜„

quartz kindle
vast cedar
#

Does someone know why Structures.extend return undefined on v13 ?

quartz kindle
neat ingot
#

and tooltips

quartz kindle
#

nice

vast cedar
neat ingot
#

I was going to stop writing it and just use the Discord RPC Maker app someone linked when I first showed it, but eh, theres no fun in that ๐Ÿ˜„

#

I also needed to poll an api for json data for like, players and server counts

quartz kindle
vast cedar
#

Okay thanks :)

sweet python
#

dope

ripe heron
#

i get this error:

#
ModuleNotFoundError: No module named 'discord.ext.commands.bot'```
I just ran import topgg
dry imp
#

welp

#

that is topggpy?

bright thorn
#

How much player we can connect from lavalink for my bot?

#

any idea

bright hornet
#

how do i get the random data in here? seems doing this js .then((res) => { const embed = new MessageEmbed() .setTitle(res.data[0].name) .setImage(res.data[0].image.url) .addField(`Weight:`, `${res.data[0].weight.imperial}`, true) .addField(`Height:`, `${res.data[0].height.imperial}`, true) .addField(`Bred for:`, `${res.data[0].bred_for}`, true) .addField(`Breed Group`, `${res.data[0].breed_group}`, true) .addField(`Life Span:`, `${res.data[0].life_span}`, true) .addField(`Origin:`, `${res.data[0].origin}`, true) .setColor('RANDOM') .setTimestamp() message.channel.send({embeds: [embed]}) }) only focus on the first data

#

nvm

#

fixed

heavy marsh
#

In d.js v13 is there a way to get the number of voice channels the client is playing on

bright hornet
#

how can i make this emoji?

slender thistle
ripe heron
bright flame
#

okay so i want my bot to have time when the message is sent by the user in any channel in epoch format, for python

#

how can i do this?

neat ingot
#

^ that, but no spaces

#

oh, that ones slightly different actually, my bad ๐Ÿ˜ฆ

dry imp
ripe heron
#

yes but I fixed it

dry imp
ripe heron
dry imp
#

owh okay, i guess the problem occur because topggpy needs d.py 1.7.3 dependancy that may cause error for people who uses pycord since they use the same import name, thats why for pycord you must install it using --no-deps

near stratus
dry imp
rocky dagger
#

im trying to run nodemon but i just geet this error here how can i fix it? nodemon : File C:\AppData\Roaming\npm\nodemon.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Pol icies at https:/go.microsoft.com/fwlink/?LinkID=135170.

near stratus
rocky dagger
#

thanks

civic scroll
#

you can randomize the indexies

analog tinsel
#

how i can add my website as bot description? i forgot website that converts

vast cedar
#

About Me ? If yes it's on the developer portal

earnest phoenix
simple stump
#

How do I get the duration of an mp3 file? Iโ€™ve tried reading the metadata, used different libraries (mp3-duration, music-metadata, etc.) but they all return different values than the actual duration. I essentially download an mp3 file using node-fetch or axios and store it locally, then read the file and stream it using Discordโ€™s @discordjs/voice. Iโ€™m attempting to get the duration of the file and display the total time of what is being played, but when trying to get such duration it always returns the wrong output.

wheat mesa
#

Donโ€™t quote me on this because Iโ€™m not sure entirely, but the buffer length is probably directly related with how long the song is

quartz kindle
#

ffmpeg can do that

#

also, where are you downloading the mp3 from?

#

audio files can be of bad quality and contain garbage data

wheat mesa
#

Yeah, I just looked at the code for some duration packages, and they use ffmpeg internally

feral aspen
earnest phoenix
wheat mesa
scarlet rune
scarlet rune
wheat mesa
#

Are you sure that line 40 doesnโ€™t have spaces instead of a tab? I donโ€™t use python, not so sure

feral aspen
#

That looks like spaces to me.

wheat mesa
#

โ€œPython is a good beginner languageโ€

#

Errors when you misindent your code

earnest phoenix
scarlet rune
wheat mesa
#

Iโ€™m going to trust the python interpreter on this one

#

And say that youโ€™re doing SOMETHING wrong

woeful pike
#

did you make sure to enable indents for ur bot bro

feral aspen
#

What? Cat_Bruh

last tapir
#

its all because of that damn phone of urs

ancient nova
#

guys I'm trying to do a function that outputs 2 results

#

for example

#

return 1,"hello"

#

and if I do

#

thatFunction[0] it would return 1
and if I did [1] it would return "hello"

#

would that be possible to do?

feral aspen
#

Uhh, sure.

#
const values = [1, "hello"];
console.log(values[0]); // 1
console.log(values[1]); // "hello"
ancient nova
#

I figured an array would do it

feral aspen
#

Indeed, that would work.

ancient nova
#

is there a way to do it without an array though?

neat ingot
feral aspen
#

Can you eat an apple without eating it?

neat ingot
#

your just returning an object, or an array, and then using that data

feral aspen
ancient nova
#

let me test

neat ingot
ancient nova
#

huh that actually works

neat ingot
#

yup, but you should do the function call and store the value before referencing its properties, eg:

const mything = athing();
mything.a```
feral aspen
#
const athing = () => ({ a: 1, b: 2 });

athing().a
athing().b

const otherthing = () => [1, 2];

otherthing()[0]
otherthing()[1]
#

This is better. ES6 Moment

ancient nova
#

to extract the values you'd usually have to do

#

function().then((0, 1) => {
return 0,1;
} no?

#

cause if I do them separately and call the function two times

#

otherthing()[0]
otherthing()[1]

#

like so it will give two different results

feral aspen
neat ingot
ancient nova
#

my thing isn't a constant function

feral aspen
wheat mesa
neat ingot
#

hey, you wanted to 'es6-ify' it ๐Ÿ˜„

wheat mesa
#

Thatโ€™s the easiest way

ancient nova
ancient nova
wheat mesa
#

I was unaware, but even then you donโ€™t want to fall into .then callbacks

#

Iโ€™m confused

#

I thought you wanted multiple values

ancient nova
#

okay let me explain what I'm doing so you guys can understand

#

basically I have a function

wheat mesa
#

If you want to return more than one value in a function you generally want to use objects for that

neat ingot
#

everything is javascript is an object. it doesnt matter if you return a value, a string, an object, an array, its all only relevant to how you handle those returned values.

#

if you want to return an object, do it, then handle that object

wheat mesa
#

Letโ€™s try to not be confusing about semantics right now :p

quartz kindle
#

how about doing it the C way? ```js
function something(return1, return2) {
return1.value = 10;
return2.value = 20;
}

const return1 = { value: null }
const return2 = { value: null }
something(return1, return2);
console.log(return1.value) // 10
console.log(return2.value) // 20

ancient nova
#
const certainFunction = function (something, something2) {
//do stuff with something and something 2
return {result:something, result2:something2};
//return them
}

and then somewhere else in the code I call the certainFunction
certainFunction(input, input1);
I want to be able to call that function and get both of the outputs out of it, by your guys example I figured it would be like so
const {result, result2} = certainFunction(input, input1);
and I want them both because I want to use them in a switch case like so:

switch (result) {
case "modified-something-here":
//rest of the code
conssole.log(result2);
break;

@wheat mesa @neat ingot

#

apologies for taking so long

ancient nova
neat ingot
#

omg im dying lol

ancient nova
#

so would my example above work correctly?

quartz kindle
#

depends on a few things

#

is something and something2 a primitive? like number, string, etc? or are they objects/arrays?

ancient nova
#

both are strings

quartz kindle
#

ok, so they will not be accidentally modified by your function

ancient nova
#

however the something is classified and second is an object that a string is later passed onto

earnest phoenix
quartz kindle
#

lmao

wheat mesa
#

The good ol mutable object reference method

ancient nova
#

I haven't tested it yet let me see if that works

quartz kindle
ancient nova
neat ingot
#

if they are unmodified, why do you need to send them to the function to begin with?

ancient nova
quartz kindle
#

well, the originals are not modified

#

it will return new copies of them

earnest phoenix
#

They are just not explicitly done so tim

#

He made a comment saying to do something with something and something2

ancient nova
#

TypeError: Cannot destructure property 'result' of function()

#

hmm

neat ingot
#

did you await your function? its async right?

#

else its trying to destructure a promise

ancient nova
earnest phoenix
#

I don't think await here would even matter it'd just return something anyway just probably not what they want

feral aspen
#

What's the benefit from that?

neat ingot
#

explicit behaviour ๐Ÿ˜„

quartz kindle
earnest phoenix
quartz kindle
#

but since in js you cant have references to primitives, you have to put them inside an object

ancient nova
#

Failed: FATAL ERROR HAD OCCURED
Reason: TypeError: Cannot destructure property 'result' of '(intermediate value)' as it is undefined.

#

that's a problem

feral aspen
quartz kindle
#

i've worked with an old C lib from the 90s that returns 3 different values, one as the actual return value, and two in referenced args

feral aspen
quartz kindle
#

the same lib also has functions that you need to pass an array to, and the function will add all the results inside the array you gave it

#

instead of returning an array with the values

ancient nova
feral aspen
#

You're talking about C from the 90s?

quartz kindle
#

ye

feral aspen
#

How's that possible, where is the final value stored?

quartz kindle
#

in the array

#

like this

#
const result = [];
something(result);
console.log(result)
neat ingot
# ancient nova I'll try fixing that myself then
async function athing(input1, input2) {
    return {
        result1: `${input1}-success`,
        result2: `${input2}-success`,
    }
}
const {result1, result2} = await athing('test', 'result');
console.log(result1, result2);

as long as your doing something like this, there should be no issue.

quartz kindle
#

the actual return value of the function is a flag indicating if the function was successful or failed

#

so it works like this

feral aspen
feral aspen
quartz kindle
#
const result = [];
const status = something(result);
if(status === 1) {
  console.log(result)
} else {
  throw error
}
neat ingot
#

libs like that are a pain imo

quartz kindle
#

it often also has an output error string in a separate arg

#

like this

feral aspen
quartz kindle
#
const result = [];
const error = "";
const status = something(input, result, error);
if(status === 1) {
  console.log(result)
} else {
  throw error
}
#

ofc that doesnt work in js

#

but thats pretty standard in many C libs

feral aspen
#

input?

#

What's the value of that?

#

Is it like arguments?

quartz kindle
#

like whatever the function actually uses as an arg

feral aspen
#

Oh, fair enough.

quartz kindle
#

let me show the actual c code

feral aspen
#

Go ahead.

quartz kindle
ancient nova
quartz kindle
#

xx is an array of length 6

#

serr is an error string

hushed patrol
#

i have this in djs

const options = message.guild.channels.cache.map((channel) => ({ label: channel.name, value: channel.id }));โ€Š```
 but idk how to make a select element in html and forEach select option it's label is the channel name and value is the channel id(im trying to make a discord bot dashboard and need help assigning the options of a channel select dropdown to the contents of a variable)
quartz kindle
#

if flag returns ok, its safe use use xx, otherwise the error will be written in serr

feral aspen
#

Goodness. Cat_Bruh

quartz kindle
#

info is the input vars

neat ingot
ancient nova
quartz kindle
hushed patrol
feral aspen
#

What's the difference between int32, int64, double, integer and maybe there are else.

quartz kindle
#

i even showed you the ejs code

hushed patrol
neat ingot
hushed patrol
#

leme see

#

ah

quartz kindle
ancient nova
hushed patrol
#

this ig

ancient nova
#

Cannot destructure property 'result' of '(intermediate value)' as it is undefined.

neat ingot
ancient nova
#

that's really weird

#

I'm 100% it's defined

quartz kindle
ancient nova
#

it's exactly as you typed it above

quartz kindle
#

int32 is the same as int
int64 is the same as long long int
uint32 is the same as unsigned int

quartz kindle
feral aspen
#

Ohh.. thanks!

neat ingot
#

I love how folks always hoarde their code like its golddust ๐Ÿ˜„

simple stump
#

I'm sorta confused as to why I can't access the duration object. I have this JSON object:

{
  format: {
    randomStuffIdk: "asdfasdfasfasdf",
    duration: 34.207800453514736
  },
  otherThings: {
    asdfasdfasdfasdfd: "asdfasdfasdf"
  }
}

But for some reason, I can't access format.duration as it returns undefined.

let meta = await mm.parseFile(`./handlers/voice/music/${title}`);
let metadata = util.inspect(meta, { showHidden: false, depth: null }); // Returns the JSON object above
console.log(metadata);
console.log(metadata.format); // Undefined

let duration = metadata.format.duration;
console.log(duration); // Undefined
ancient nova
# quartz kindle you will need to show some of your actual code
const function(_input){
//code
if (result == 200) {
return {
result: "success",
input: _input;
};
}
if (result == 200) {
return "error";
}
return {
result: "failure",
input: _input;
};
}

and am calling that using
const statusResult = function(input);
statusResult.result and .input
I also tried doing the await
const {result,input} = await function(input);
but that also didn't work @quartz kindle

#

I shortened it as much as I could

neat ingot
neat ingot
#

this is not an object containing the properties you are trying to destructure

ancient nova
#

so even if that part doesn't execute it has to have the correct syntax?

neat ingot
#

you also have ; instead of , in your return objects

#

i didnt notice there was a duplicate if statement for that status lol

ancient nova
#

the ; is only to finish the statement

simple stump
ancient nova
#

is that a problem?

quartz kindle
#

well, thats what happens when you dont want to show your actual code, we end up fixing the problems with the example code you show instead of the actual problems with your actual code

simple stump
#

I didn't write the JSON, it's just what is returned..

neat ingot
#

function functionname(_input){
    //code
    if (result == 200) {
        return {
            result: "success",
            input: _input,
        };
    }
    return {
        result: "failure",
        input: _input,
    };
}```
#

const function is not valid syntax

earnest phoenix
quartz kindle
simple stump
earnest phoenix
#

Use JSON.parse() instead

ancient nova
#

I feel like I should've stated that before

#

could that be the issue? 0_0

quartz kindle
#

no

neat ingot
#

ok, well, please, when sharing code your 'having issues with', please show the actual code, not some half whipped up filled with errors example.

#

sorry to be blunt ๐Ÿ˜˜

quartz kindle
#

why not just put it in pastebin or something

#

pretty sure there are pastebin variants out there that support password protection and auto-deletion after 5min and shit like that

#

if you're that worried about your code

neat ingot
#

i worry about my code sometimes... then i remember i plagarized every line from some tutorial somewhere, and that makes me feel better as a human ๐Ÿ™‚

ancient nova
#

nah it's not that

#

let me post it all

#

hold on I just gotta short it to message limit

quartz kindle
#

just paste bin it

#

@_@

ancient nova
#

it's fineeeeee

#

gimme a sec

neat ingot
#

any other vital options an app might need?

ancient nova
#
const getWorkingWebStatus = function (website) {
    req(website, (error, res, body) => {

        if (res.statusCode == 200) {
            return {
                result: "success",
                input: `${website}`
            }
        }
        if (res.statusCode == 429) {
            return {
                result: "error",
                input: `${website}`
            }
        }
        return {
            result: "failure",
            input: `${website}`
        }
    });
};


const statusResult = await getWorkingWebStatus("http://google.com/");

switch (statusResult.result) {
    case "success":
        console.log(`${statusResult.input} is WORKING!`);
        break;
    case "error":
        console.log(`ERROR occurred!`);
        break;
    case "failure":
        console.log(`${statusResult.input} is NOT WORKING!`);
        break;
}
``` @quartz kindle
lyric mountain
#

tim suggesting pastebin tsk tsk

quartz kindle
#

well thats the problem

ancient nova
#

basically every bunch of code that matters is here

quartz kindle
#

your function returns undefined

ancient nova
#

HWAT?

quartz kindle
#

you return inside the req callback

neat ingot
#

^ this

#

you are not returning anything, and performing a request

earnest phoenix
#

Use a promise to resolve the said value

lyric mountain
#

also I'd check for status family not for exact statuses

ancient nova
#

that's an issue? I'm not returning anything related to res output?

quartz kindle
#

your function is basically doing this:

earnest phoenix
#
new Promise((resolve) => {
  req(..., (...) => {
    ...

    resolve(...);
  });
});
ancient nova
quartz kindle
#
const getWorkingWebStatus = function (website) {
    req(website, (error, res, body) => {}) // initiate a requst and return undefined
}
#

all your function does is initiate a request

#

it does not wait for it

#

it immediately returns

ancient nova
#

oh...

earnest phoenix
#

You're requesting a value from a callback, if you want it, you must use a promise to resolve the value

lyric mountain
#

res.toString().startsWith("4")

#

something like that

ancient nova
#

I'm confused, then what am I exactly supposed to do? take the callback out of the promise?

quartz kindle
#

you need to "promisify the callback"

#

like voltrex showed

neat ingot
#
const getWorkingWebStatus = function (website) {
    return new Promise((resolve) => {
        req(website, (error, res, body) => {
            if (res.statusCode == 200) {
                resolve({
                    result: "success",
                    input: `${website}`
                })
            }
            if (res.statusCode == 429) {
                resolve({
                    result: "error",
                    input: `${website}`
                })
            }
            resolve({
                result: "failure",
                input: `${website}`
            })
        });
    });
};

not to spoon feed. but that is what your function could look like

earnest phoenix
#

You can either return the promise and resolve the value from the callback, or additionally promisify it for later use by using the util.promisify() method

quartz kindle
#
function something() {
  return new Promise(resolve => {
    doSomethingWIthCallBack(callback => {
      resolve(callback)
    })
  })
}
ancient nova
#

so having async doesn't matter?

#

I still have to resolve it?

quartz kindle
#

when you return a Promise, your function automaticaly becomes an async function that returns whatever the promise resovles

neat ingot
#

i think you are misunderstanding which parts of your code are async and which arent

quartz kindle
#

callbacks are not promises

#

callbacks existed way before promises did

quartz kindle
#

they are the old style of asynchronous coding

ancient nova
#

let me try figure this out

quartz kindle
#

promises came to improve it, but if whatever you're using doesnt use promises yet, you need to turn it into a promise yourself

neat ingot
# ancient nova let me try figure this out
// create a non async function that returns a promise (and should be awaited)
const getWorkingWebStatus = function (website) { 
    // returns a promise that can be awaited
    return new Promise((resolve) => { 
        // perform a non async function call with some callback
        req(website, /*the callback >*/ (error, res, body) => { 
            resolve({ // resolve the promise we returned with an object
                result: "failure",
                input: `${website}`
            });
        });
    });
};
#

hope that helps somewhat ๐Ÿ™‚

ancient nova
#

I think I might actually have fixed it

#

running the code has no errors let me try to test the function out

#

it worked

#

amazing

#

thanks @quartz kindle @neat ingot @earnest phoenixand @lyric mountain lol

last tapir
#
const events = [
    {
        id: 'message',
        events: [
            {
                name: 'Message Delete',
                id: 'messageDelete',
            },
            /*{
                name: 'Message Delete Bulk',
                id: 'messageDeleteBulk',
            },*/
            {
                name: 'Message Update',
                id: 'messageUpdate',
            }
        ]
    },
    {
        id: 'role',
        events: [
            {
                name: 'Role Create',
                id: 'roleCreate'
            },
            {
                name: 'Role Delete',
                id: 'roleDelete'
            },
            {
                name: 'Role Update',
                id: 'roleUpdate'
            }
        ]
    },
];

How can I count the number of events?

quartz kindle
last tapir
#

yes

quartz kindle
#

events.reduce((a, b) => a + b.events.length, 0)

last tapir
#

i made a for in loop first

#

or that, ooo

neat ingot
feral aspen
#

.reduce() is really handy at times, I keep forgetting what it does and remembering the day after.

neat ingot
#

oh tim beat me lmao

feral aspen
#

I need to keep understanding it now that I am handling sharding.

ancient nova
#

is there a way to make a temporary variable that will be removed once function is over? I know I can do that in c# pretty easily

earnest phoenix
#

If you've already set those to the client, which I assume you've already done so, you can just do <Client>.listenerCount(), if you haven't, then you can reduce it by using <Array>.reduce(), which was already shown

quartz kindle
ancient nova
#

cause I'm running to performance issues declaring a new variable with looping

feral aspen
#

When I have this code:

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

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

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

The error is Error [SHARDING_IN_PROCESS]: Shards are still being spawned..
Some people told me, don't broadvast eval or fetch client values before all shards get ready. Although, I have the ready event immediately firing up, what can I do at this case?

quartz kindle
#
function something() {
  let object;
  // do something
  object = "string";
}

console.log(object) // undefined
ancient nova
neat ingot
#

dont use the var keyword, its obsolete and has quirks. use const for constant vairables or let for variables that can change

feral aspen
quartz kindle
#

anything declared inside a function only exists inside that function and its respective subfunctions and subscopes

ancient nova
wheat mesa
#

var is bad

ancient nova
#

I use it both with const and practically never use let

neat ingot
#

lol, fair. i ; every language i use because of habbit

wheat mesa
#

Unless you know the baggage that comes along with it, you should probably not be using var

neat ingot
#

still, should try for the sake of modern code ๐Ÿ˜„

wheat mesa
#

let is block scoped, var is function scoped

ancient nova
#

since JS doesn't need the ";" I sometimes forget to add it while writing in C and I can't figure out the why my code isn't running sometimes lol

cinder patio
neat ingot
#

arent var declerations also hoisted ?

quartz kindle
wheat mesa
ancient nova
#

var amount = 5;
for (let i = _amount; i--;) {
const variable = something;
return variable;
}
take this as an example of what I'm doing

quartz kindle
#

the only thing you could do is pass a timer calculated from the number of shards multiplied by the timeout between shards

ancient nova
#

it just hurts to look at how I'm declaring a new variable each loop

wheat mesa
#

You should probably show the actual code of what youโ€™re doing instead of showing vague examples

neat ingot
#

yea, but im sure the var variables are hoisted to the top of the scope and can be accessed (with no value) before definition ~ iirc, could be wrong

feral aspen
#

Is there no promise to first check that shards all finish launching first then continue to fire up the ready event?

cinder patio
#

That would run the loop only once. Variables have little to no cost so don't think that they're making your code slow

neat ingot
#
(()=> {
    console.log(testvar)
    var testvar = 1;
    console.log(testvar)
})();
wheat mesa
quartz kindle
ancient nova
#

also one last question before I go, what it's the best efficient way to check if the loop has stopped?
I've been using if (i === 0) and sometimes it doesn't work or get's called before loop is actually done

cinder patio
#
for (...) {
   ...
}
console.log("Loop has stopped :D");
wheat mesa
#

That

neat ingot
#
for (let index = 0; /* condition > */ index < array.length; index++) {
    const element = array[index];
    
}```
all loop types have a build in condition for if they should run
wheat mesa
#

But I donโ€™t think thatโ€™s what you meant unless Iโ€™m wrong

quartz kindle
#

can you show from where do you want to check that?

quartz kindle
#

calculate the total delay for all shards

#

2 shards * 10000ms delay each

#

give it to the shardArgs so yuo can access it from the children

#

then use that as a timer before using broadcastEval

#

but that is not an ideal solution

#

the last shard will wait the full time for all shards, instead of waiting just its own time

ancient nova
#

but that may be just cause my code is really unoptimized

feral aspen
quartz kindle
#

its better to just catch the error and retry later

feral aspen
#

Catch the error, where?

ancient nova
#

I fixed the above with a asynchronous delay of like 3000 ms

quartz kindle
#

broadcastEval

ancient nova
#

but now that it's being resolved automatically it's fixed

quartz kindle
#

once you are, there should be no race conditions

#

anyway i g2g

ancient nova
#

see ya later

#

thanks for the help again

feral aspen
#

Thanks for your time, Tim. wave_pepe

neat ingot
#

I asked earlier but it got immediately buried lol
Any vital options I could add to my app

wheat mesa
#

Canโ€™t think of any. What framework did you use for that? React native? Electron?

neat ingot
#

electron with bootstrap and custom styling

wheat mesa
#

Nice

#

Looks great

neat ingot
#

thankies love

hushed patrol
#

@quartz kindle ty the code u gave worked tysmmm

mild zodiac
lyric mountain
mild zodiac
#

but what does the app do, is it some kind of dashboard for the bot?

#

Discord RPC doesn't sound like a dashboard...

craggy pine
#

No it's quite literally the message you see in the picture

#

RPC probably Rich Presence Creator?

spark flint
#

like what i have rn too

neat ingot
#

the app communicates with discord on my pc to set my 'currently playing' information on my user profile. it also polls an api for information on players and servers, but that api is offline atm ๐Ÿ˜›

lyric mountain
mild zodiac
#

yeah sorry I'm dumb lol

spark flint
#

mines from VisualStudio, they made an app to allow you set it to whatever you want basically

ancient nova
#

can you not use the request NPM to ping an IP by itself?

lyric mountain
#

just use node-fetch

ancient nova
#

@lyric mountain can node-fetch do it though?

lyric mountain
#

well, yes

#

any kind of http request is a ping

ancient nova
#

just a plain IP

lyric mountain
#

without the port it's implicit to be either 80 or 443

#

but that's address not request

civic scroll
#

technically anything you send to an IP endpoint can be treated as a request

ancient nova
quartz kindle
#

in order to ping an address, that address must be able to respond somehow, so it needs to be running some kind of server on some port

civic scroll
#

yeah that

ancient nova
lyric mountain
civic scroll
ancient nova
#

cause before I had a invalid URI error while trying to ping an IP

civic scroll
#

in order to ping, both side send messages

lyric mountain
#

maybe u passed an invalid ip

civic scroll
#

you can't ping if endpoint doesn't respond

ancient nova
#

1.1.1.1 is valid

#

just don't know it's port

civic scroll
#

address and port matters

civic scroll
quartz kindle
#

port is 80 for http, 443 for https

lyric mountain
ancient nova
civic scroll
quartz kindle
#

if you write http:// it will automatically set port 80 for you

ancient nova
#

it didn't, it seems

lyric mountain
quartz kindle
#

if you write https:// it will automatically set port 443 for you

ancient nova
#

I kept getting invalid URI errors

civic scroll
#

you host on the same machine right

ancient nova
#

which is a host as well

lyric mountain
#

1.1.1.1 isn't a "host" per se

#

it's literally cloudflare

ancient nova
#

yep, but it is hosting

civic scroll
#

not a hosting one

ancient nova
#

testing for hosting returns data so it is a host

civic scroll
#

๐Ÿ’€

lyric mountain
#

you see, not everything that lay eggs is a chicken

ancient nova
#

okay, just give me a different IP address I'll see if it fixes the error

civic scroll
#

also another possibility is that, the host refuses connectio

ancient nova
civic scroll
#

tim why you use odd node version

quartz kindle
#

its runkit

civic scroll
#

i demand node 16

quartz kindle
#

node 17 is nice

civic scroll
#

also request

#

use http

#

:^)

quartz kindle
#

thats what he said he was using

#

or she

#

or they

civic scroll
#

or [object Object]

quartz kindle
#

best gender

civic scroll
#

ngl

quartz kindle
#

"hi, are you male or female?"
"im a js object"

civic scroll
#

also any good image renderer that uses svg

quartz kindle
#

what platform?

civic scroll
#

wanna do programmatically

ancient nova
#

well it worked weirdly enough

civic scroll
#

js is best

#

but canvas sucked

ancient nova
#

I'll try with http now

quartz kindle
#

you dont need anything to make svg

civic scroll
#

no

lyric mountain
ancient nova
#
let amount = 10;
var intervalAmount = setInterval(() => {
amount -= 1;
if (amount === 0) clearInterval(intervalAmount);
}, 250);
``` can anyone tell me why this doesn't work?
quartz kindle
#

you can generate svg by concatenating strings

civic scroll
#

feBlendMatrix

#

is what i'm looking for

ancient nova
#

supposed to be a counter and stop once it reaches zero but it goes infinitely for some reason

civic scroll
#

for drop shadows on a transparent surface

lyric mountain
ancient nova
quartz kindle
#

then you're doing something wrong

cinder patio
#

== / === doesn't matter

civic scroll
#

runtime issue

ancient nova
lyric mountain
#

either >= or <=

#

or </>

civic scroll
#

or ==, if type is certain

lyric mountain
#

nonono

cinder patio
#

When working with integers u'll never get a floating point

lyric mountain
#

you see, cosmic rays are a real thing in programming

quartz kindle
#

^ thats true

civic scroll
#

yes

lyric mountain
#

plus iirc the compiler does some under-the-hood optimizations when using </<=/>=/> for loops

civic scroll
#

also like

#

tim

#

btw

#

any platform, as long as executable

#

and takes svg definition as argument

ancient nova
quartz kindle
lyric mountain
#

it'll never run

#

u need to use >= 0

cinder patio
#

< 1

quartz kindle
#

< 2

ancient nova
#

lmao which one

quartz kindle
#

=<=>>=<.<0.1

civic scroll
#

or .webp in this case

lyric mountain
#

= 0 if u want to include 0, else use > 0

ancient nova
cinder patio
#

< 1

lyric mountain
#

oh wait nvm, it's an inverse check

quartz kindle
ancient nova
civic scroll
#

that will be serverside code

#

i can use child-process

lyric mountain
#

โ˜•

quartz kindle
#

and canvas didnt work?

civic scroll
#

sucked

#

doesn't render boxshadows properly

#

for transparent surfaces

quartz kindle
#

did you try sharp?

civic scroll
#

ye

#

the shadow got through the surface instead

ancient nova
quartz kindle
#

well, try random npm modules i guess

lyric mountain
#

that's the idea

civic scroll
quartz kindle
#

me me

civic scroll
#

doesn't have to be a node module

#

an executable works

quartz kindle
#

try inkscape

#

or imagemagick

civic scroll
#

cli compatible?

quartz kindle
#

ye

#

they are linux cli programs

civic scroll
#

because ima run that with 1227 consecutive images

lyric mountain
#

imagemagick +1

#

heavily optimized for cli usage

civic scroll
#

thank

#

also is there any event in browser to tell if javascript code is already fetched and ready to execute

lyric mountain
#

isn't fetch a promise?

#

u could either await it or use .then

cinder patio
civic scroll
#

i mean "when do browser APIs are available"

cinder patio
#

Depends on which API

ancient nova
#

why does async delay not work in setIntervals?

cinder patio
#

document should be used in an window.onload event, or in a script which has the defer attribute

civic scroll
#

on serverside render config i tried but ended up with localStorage is not defined
when the code is rendered on servers , browser APIs are not available

civic scroll
cinder patio
#

yeah localStorage is a browser-only API and you're trying to use it server-side. Check if it exists beforehand

#

check if you're running on the server

#
if (typeof window !== "undefined") {
  // ... running on the client
} else {
  // running on the server
}
ancient nova
civic scroll
#

that is a microtask iirc

ancient nova
#

the problem is that it doesn't wanna work for some reason it doesn't work inside setInterval parentheses

cinder patio
#

give code

#

we can't imagine ur broken code

ancient nova
civic scroll
cinder patio
#

localStorage will never be available on the server

ancient nova
cinder patio
#

more code

ancient nova
#

it doesn't work event though the entire function is an async function

civic scroll
ancient nova
#

just put it into a constant function as alwayas

#

IT WORKS btw don't say it doesn't

cinder patio
#

Then why are you here

#

just show the code

civic scroll
#

you also have synchronus wait

ancient nova
#

for some reason it says that my function isn't async when it is whenever I try to exec it from setInterval

ancient nova
civic scroll
#

pain

ancient nova
#

I've shown you the one that causes the errors

cinder patio
#

That code doesn't give enough context at all

#

We can only guess

civic scroll
ancient nova
#

it's got too much stuff in it to fit into one screenshot

civic scroll
#

answer

civic scroll
#

then it should work

cinder patio
#

What do you mean by "doesn't work" then?

#

what does it do

civic scroll
#

then issue is _speed being too small for the await to work at all

cinder patio
#

Adding 100 ms won't make much of a difference anyways

#

at least for u to notice

ancient nova
#
rl.question(`question`), async (_something, _amount) => {
    //more code
    var interval = setInterval(() => { // here is the interval
        _amount -= 1;
        if (_amount <= 0) {
            clearInterval(interval); 
            await delay(_speed + 100); //this causes the error but it shouln't
            return recursiveAsyncReadLine();
        }
    }, _something);
});
``` this is basically the entire function
#

rest doesn't affect it whatsoever

lyric mountain
#

var

ancient nova
#

whoops

#

wait

cinder patio
#

what error

ancient nova
#

that the function is not async

woeful pike
#

protip a _ prefix means intentionally unused variable outside of classes so this is probably going to end up confusing you

lyric mountain
#

shouldn't it be _speed * 100 btw?

ancient nova
cinder patio
#

You need to put async in the callback to setInterval

#

async () =>

ancient nova
#

I figured

#

var interval= async => setInterval(() => {

cinder patio
#

no

ancient nova
#

updated it to that whilst trying to figure out

cinder patio
#

setInterval(async () => {

ancient nova
#

that did not work either

#

I've done that the first time I got this error

cinder patio
#

then u did something else wrong

ancient nova
#

req("http://" + _ip, async function (error) {

#

should I convert it to an arrow function?

cinder patio
#

Most of the time it doesn't matter if it's an arrow function or a function defined with the function keyword so that's not your issue

ancient nova
#

could be though you never know

#

and at this point I feel braindead so it doesn't hurt to try

cinder patio
#

async (error) =>

#

go ahead and waste more CPU cycles

ancient nova
#

the delay didn't even work

#

no error though so that's progress

#

I won't make you help me anymore so I'll just figure it out myself

cinder patio
#

you're definitely not doing something right if that removed ur error

ancient nova
#

yeah, but I got no clue what ๐Ÿ˜ซ

#

could it maybe be an IP validation function?

#

it uses REGEX, and only is used once in the if statement

#

okay I finally fixed it lmaoooooooooooooooooooooo

quartz kindle
#

congrats

ancient nova
#

aaaaand now I got a different error ... I just can't

boreal iron
#

I won't make you help me anymore so I'll just figure it out myself

#

lmao

ancient nova
#

๐Ÿคญ

dry imp
#

imagine getting error when programming

ancient nova
#

and you don't?

#

are you human?

dry imp
#

CashKronii i dont

ancient nova
#

cap

dry imp
#

work pefrectly in 1 try

ancient nova
#

massive cap

dry imp
#

sorry if you cant relate

ancient nova
#

stop the cap

split hazel
#

what is an average r/w speed for a hdd

ancient nova
#

for a SSD prolly like couple GB

craggy pine
#

550 MB/s for a ssd

ancient nova
#

I don't get why the god damn thing logs AFTER THE ERRORS

earnest phoenix
#

can I make kind of a setTimeout that runs every x time infinitely? And I want to start the timeout every time the bot starts if it dies or I update it

#

this sounds me of ```js
client.setTimeout/Interval

split hazel
earnest phoenix
#

how to meter that

earnest phoenix
split hazel
boreal iron
#

Wtf is this review?

wheat mesa
earnest phoenix
#

will check cronjob

dry imp
boreal iron
#

Are those two IDs are actually bot IDs?

earnest phoenix
boreal iron
#

Thank you but i do understand English as well

#

Canโ€™t create a test invite on mobile meh

#

I wonder if both IDs are actually bot IDs

earnest phoenix
#

wait i'll make invite

boreal iron
#

Ah ty

#

Send them privately please

earnest phoenix
#

ok

#

oof I have to copy the ids

earnest phoenix
boreal iron
#

Hmm one actually is a bot