#development

1 messages · Page 1533 of 1

quartz kindle
#

what do you actually want help with?

#

if anything

earnest phoenix
#

Well Superbrain8 is gonna write my bot for me soon so I'm good for now

quartz kindle
#

x doubt

lusty quest
#

i have to write a bot?

earnest phoenix
#

Yes

lusty quest
#

where did i agreed to it?

earnest phoenix
lusty quest
#

i just said i want to know what you have in mind?

mellow kelp
earnest phoenix
#

right here

umbral zealot
#

Even if you did you can still say "no" 😂

lusty quest
#

since there is still no answer i havent agreed in any way

earnest phoenix
#

I want to write an AI bot

#

well sorry

cinder patio
#

you don't have to explain yourself, just block them and move on

earnest phoenix
#

I want you to write an AI bot for me

lusty quest
#

will be quite expensive for you

earnest phoenix
#

What?

#

This is for free of course

quartz kindle
#

charge extra for being annoying

umbral zealot
#

Oh yeah the "Karen charge"

lusty quest
#

lol

earnest phoenix
#

I want you to write a Voice AI Bot that you can talk to in a voice channel

lusty quest
#

150$/hour or nothing

earnest phoenix
#

and it will feel like you're talking to a human

quartz kindle
#

jarvis bot

earnest phoenix
#

It's been a dream project for me

mellow kelp
#

For you

earnest phoenix
#

Yes

cinder patio
#

This isn't a channel for asking people to write you a bot. Go to fiverr or something

earnest phoenix
#

I'll give you $5 to shut up

lusty quest
#

grabs Dialogflow API and throws into a bot, then collect money

mellow kelp
#

Stonks

quartz kindle
#

$5 to shut up? deal

tight plinth
#

[insert ads for a bot making company]

earnest phoenix
#

You just gave me a great idea Lumap

#

It'd be good to put ads in the bot

#

so I can make money off of it

#

moyaigod Ads

lusty quest
#

lol how to get your bot removed within a day 101

earnest phoenix
#

ok forget the ads then

#

so

#

do u think u can do it @lusty quest

lusty quest
#

if you throw ads into a bot People will kick the bot relatively fast

earnest phoenix
#

yeah ok

lusty quest
earnest phoenix
#

ur right

#

how long do u think it will take

lusty quest
#

40-80 Hours

earnest phoenix
#

Are you even a Certified Developer? like @quartz kindle ?

#

Until minecraft 2 releases

lusty quest
#

did i have the role?

earnest phoenix
#

ok

#

well

#

get to work

lusty quest
#

you agree to the price?

earnest phoenix
#

yes but im not gonna pay to u slack off on top.gg guild

lusty quest
#

if yes i have to contact my lawyer to make a work contract

earnest phoenix
#

ok

#

DM me

sage bobcat
#

One message removed from a suspended account.

lusty quest
#

lol

humble gyro
#

wtf

lusty quest
#

still thinking its a joke

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

moyaigod Why do i smell scam here

buoyant aspen
#

How can I edit a webhook using the discord.js WebHookClient? (Can't seem to find the docs on it)

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

oh I see

#

so you were just wasting my time

dusky sundial
#

This guy isn't being serious right?

lusty quest
umbral zealot
#

Just a troll, ignore him.

humble gyro
earnest phoenix
solemn latch
#

5 head indeed

earnest phoenix
#

let me know if u wanna play

sage bobcat
#

One message removed from a suspended account.

dusky sundial
#

Seems like some random dude looking for attention Lmao

earnest phoenix
#

I'd prefer if we went to DMs to avoid all these people

#

moyaigod This guy is speedrunning to get fully spoon-fed by other devs, telling others to make a "Voice Chat AI bot"

cinder patio
lusty quest
#

told you a price and you agreed, if you want to negotiate more i will refuse

earnest phoenix
#

You're not getting $5 because you've failed to shutup @cinder patio

dusky sundial
#

It's apparently his dream project to have someone else create an AI bot for him

humble gyro
#

can ya'll like not

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
earnest phoenix
#

maybe 1 day u will realize that

mellow kelp
#

You expecting it for free KEKW ?

earnest phoenix
#

no

humble gyro
#

Take it to DMs

earnest phoenix
#

im gonna pay the guy

#

after we work a contract with his lawyer

#

as he wishes

#

🗿 Inb4 mute

mellow kelp
earnest phoenix
sacred aurora
#
async function getWiki(query){
  var link = await google((query + ' wikipedia'), ['wikipedia.org/wiki']);
  if(!link.length) link = await duckduckgo((query + ' wikipedia'), ['wikipedia.org/wiki']);;
  if(!link.length) return null;
  var url = link[0];
  const html = await axios.get(url);
  const $ = cheerio.load(html.data.replace(/b>/g, 'b>**').replace(/<i.*?>|<\/i>/g, (elem) => elem + '*'));

  var text = $('.mw-parser-output p:not(.mw-empty-elt)').first().text();
  if(text.includes('Coordinates')) text = $('.mw-parser-output p:not(.mw-empty-elt)').eq(1).text();
  text = text.replace(/( \(\*listen\)|\[([a-z]|[0-9])*?\])/g, '').trim();
  var thumb = $('.infobox img').first().attr('src');
  var title = $('.firstHeading').text();  
  var footer = $('#footer-info-lastmod').text().trim().slice(14);
  if(thumb) thumb = 'https:' + thumb;
  if(!thumb) thumb = null;
  return {url, title, thumb, text, footer};
}

did i do it to much?

#

it takes 5 sec to get the article

earnest phoenix
#

@lusty quest enable ur dms

#

What in the god's name

earnest phoenix
#

if I'm being honest

#

You don't even know what that is KEKW

sacred aurora
#

oof

earnest phoenix
sacred aurora
earnest phoenix
#

I can read Python

#

That's not python

earnest phoenix
#

Proud of you

sacred aurora
#

hmmm

earnest phoenix
#

So are you trying to return the wiki of a single query?

sacred aurora
#

but it takes 5 sec bruh

#

yeah

earnest phoenix
#

yes thats weird

sacred aurora
#

how can i make it faster

earnest phoenix
#

have u tried placing a breakpoint

#

and seeing what is taking so long

sacred aurora
#

hmm should i do that for all the thing

earnest phoenix
#

I'd say just for the getWIki method?

#

It should be pretty obvious which line is taking so long

#

You could also do it like a real man and print to console every line LOL

#

Either way will work I'm sure

lusty quest
#

your webscraper is what is so slow

solemn latch
#

Does Wikipedia not have an api

dusky sundial
#

^^ it does

umbral zealot
earnest phoenix
umbral zealot
#

Using cheerios is inherently slow

sacred aurora
#

yeah i've been using the api before

#

and it is fast

earnest phoenix
#

Then why'd you stop?

quartz kindle
#

try using cheetos instead

#

or doritos

sacred aurora
#

hmmmm

quartz kindle
#

should give you better results

umbral zealot
#

I prefer corn flakes and fruit loops. thumbs_up

earnest phoenix
#

LULW Good one

quartz kindle
#

or at least a better flavour

earnest phoenix
#

Very funny guys

quartz kindle
#

:^)

earnest phoenix
#

I cannot stop laughing

#

🗿 Ok

#

Thanks

quartz kindle
limpid gyro
#

Can anyone tell how can we make economy bot

earnest phoenix
#

By using a database

quartz kindle
#

with a database and some math

earnest phoenix
#

You need to learn how to make a basic bot first, Mr. SneakyCat

#

Which I highly doubt you know how to do

earnest phoenix
#

Perhaps some documentation

#

Or wait

quartz kindle
#

do you have any coding experience? ever tried making a bot before?

solemn latch
#

Anyone got any opinions on okta?

earnest phoenix
#

You probably need to learn how to program first

#

Which I highly doubt you know how to do

#

I've come to the realization that a lot of the people who ask for help here

#

They don't know how to code and want to make something way beyond their capabilities

umbral zealot
#

Yeah especially those that demand other people make the bot for them, those are the worst types of noobs Kek

limpid gyro
#

Which documentation I am new

dusky sundial
#

Learn a programming language first

earnest phoenix
quartz kindle
earnest phoenix
# limpid gyro Which documentation I am new
umbral zealot
limpid gyro
#

Ok Ty all

earnest phoenix
earnest phoenix
#

Read the convo before talking

limpid gyro
#

Ok

earnest phoenix
#

"Those that demand other people make the bot for them" you?

#

It's not demanding if I pay them

solemn latch
#

Can we keep non dev help conversations out of this channel 🤔

earnest phoenix
#

It's conversation about help developing my bot

#

Can you explain how you came to the wild conclusion that that's not dev help related

solemn latch
#

This channel is not for hiring developers

earnest phoenix
#

I'm not hiring anyone

#

They will help me with my bot

#

and I, completely unrelated to the bot help, will give them money

fair axle
sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

earnest phoenix
#

This might be crazy but maybe

fair axle
#

I already did

earnest phoenix
#

Just maybe

#

There's a slight possibility

fair axle
#

say it

earnest phoenix
#

That it could not find any Visual Studio insallation to use

sage bobcat
#

One message removed from a suspended account.

cerulean ingot
sage bobcat
#

One message removed from a suspended account.

fair axle
#

I have both Visual Studio and Visual Studio Code

#

the last versions both of them

sage bobcat
#

One message removed from a suspended account.

fair axle
#

I tried to reinstall vs code

#

and I updated Visual Studio

earnest phoenix
fair axle
earnest phoenix
#

ok

cerulean ingot
#

i dont think its a good idea to show the ips

sage bobcat
#

One message removed from a suspended account.

cerulean ingot
#

its the ip for my vps

fair axle
#

yes

earnest phoenix
cerulean ingot
#

oh lol

#

alright

sage bobcat
#

One message removed from a suspended account.

fair axle
#

what is it exactly

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

earnest phoenix
fair axle
#

How can I do it?

cerulean ingot
scenic kelp
#

@earnest phoenix I'm going to remind you once again to please keep the channel on topic and to be nice to people

earnest phoenix
#

My deepest apologies Mr. Pasta it won't happen again

rocky hearth
#

Is <Set>.has() is faster than <Array>.includes()?

quartz kindle
#

yes

dusky sundial
#

Most likely

rocky hearth
#

Oooh! How much?

solemn latch
#

Probably depends on the size

earnest phoenix
#

It depends on the size

#

Call the method too many times and see the difference

dusky sundial
#

Think of it like this, to find an element in an array you have to loop through the entire array where as sets include addresses to each element in memory.

earnest phoenix
#

Such as 99k times

rocky hearth
#

Considering both have same amount of elements.

quartz kindle
#

not sure about the specific implementation of Set, but im pretty sure Set .has() is o(1)

#

array.includes is o(n)

dusky sundial
#

Worst case scenario for an array is that you have to loop every single element to find the one you're looking for

wicked pivot
#

Good evening someone would already use the pkg module could help me?

rocky hearth
fair axle
solemn latch
earnest phoenix
#

BIG O NOTATION

dusky sundial
earnest phoenix
#

<Set>.has() is just a little faster

rocky hearth
#

🤔 that's not too much though.

solemn latch
grizzled raven
#

and since it's o(1), that speed will not change iirc

quartz kindle
#

there is a huge difference between array and set

#

the position of the item in the index matters

earnest phoenix
#

Wait, am i tripping or <Array>.includes() is actually faster

quartz kindle
earnest phoenix
#

Array - 25 chars
Set - 26 chars

dusky sundial
#

Arrays are faster to loop through because of the way they're placed in memory

quartz kindle
#

items in sets are hashed and indexed. every item has a uniform access time

#

arrays are stored in indexes, and any operation besides direct index access requires a full scan

earnest phoenix
#

any operation?

#

ok

dusky sundial
#

I think it's a bit faster to add elements onto a set than an array too right?

earnest phoenix
#

to add new elements to an array u need to create a new array and copy its contents

dusky sundial
#

^^

quartz kindle
#

no

grizzled raven
#

no?

earnest phoenix
#

You don't

quartz kindle
#

array is faster to add items

#

but

#

only if adding at the end

#

not at the beginning

#

or at an arbitrary position

earnest phoenix
#

uh yes

quartz kindle
#

i actually benchmarked this when making my FTSet lib

grizzled raven
#

like where there's a gap in the array?

quartz kindle
dusky sundial
#

Push is O(1) yeah?

grizzled raven
#

no

#

wait

quartz kindle
#

yes push is o(1)

grizzled raven
#

yeah

quartz kindle
#

unshift is not

dusky sundial
#

Ah, I see

quartz kindle
#

unshift is something like o(log n) or something

grizzled raven
#

math™️

earnest phoenix
#

Bro, quik mafs

quartz kindle
#

adding items to sets is like adding items to an object, there is no concept of index position, they are stored as hash keys under the hood

#

with arrays the position matters

earnest phoenix
#

Whats this o(n) stuff

#

Big o notation

#

Time complexity

quartz kindle
#

O(1) = operation takes 1 amount of time
O(n) = operation takes N amount of time depending on N number of items

grizzled raven
#
const timeTaken = 0, a = Array(100000).concat("##########")
for (const i of a) {
  a.includes("##########")
}
console.log(`Time taken: ${timeTaken}ms`) // Time taken: 0ms
``` easy faster js now
quartz kindle
#

Lol

grizzled raven
#

performance.now() is obviously the reason why it's showing high numbers

solemn latch
#

O(log n) isn't bad is it? Obviously not o(1) good but not the worst.

fringe pendant
#

as close as you can get pretty much

quartz kindle
#

then i meant the wrong thing

#

lul

#

i meant exp

#

or n²

#

not sure which

#

array.unshift() gets STUPID slow

#

as the amount of items increases

earnest phoenix
#

It's not bad unless it's O(n!)

quartz kindle
#

Lol

#

unexpected factorial

fringe pendant
#

unshift is O(n) isn't it

quartz kindle
#

btw

#

never use for...of with Sets

earnest phoenix
#

Why not

grizzled raven
#

coming from tim

quartz kindle
#

from experience

grizzled raven
#

lmaoo

quartz kindle
#

the way it ramps up is just stupid

grizzled raven
#

wdym

rocky hearth
#

but I use for...of with everything 😅

fringe pendant
#

I'm reading linear online

#

for unshift

quartz kindle
earnest phoenix
#

Wtf

solemn latch
#

Do you have these numbers posted somewhere tim

quartz kindle
#

idk either

grizzled raven
quartz kindle
#

they are in my FTSet lib

#

on github

solemn latch
#

Pog

rocky hearth
#

LOL not like that

earnest phoenix
#

The moment when forEach() is faster for once, impossible

#

🗿

grizzled raven
#

i've actually extended the number prototype just so i can do that LOL

#

it's so fun

quartz kindle
#

prototype pollution lmao

#

not a bad idea tbh

grizzled raven
rocky hearth
#

how to do that?

earnest phoenix
quartz kindle
#

implement the iterator protocol on the number prototype

grizzled raven
#

for (const i of Infinity); is the new while (true)

quartz kindle
#

omg

rocky hearth
#

is it ok to do like that?

grizzled raven
#

yeah 100% cpu is fine

quartz kindle
#

i mean

#

why use that

#

when you can

#

for(;;)

grizzled raven
crimson vapor
#

what the fuck

#

you can do that?

grizzled raven
#

leave me alone i want to be different

quartz kindle
#

in fact, for(;;) is the recommended way to do infinite loops, according to ESLint

earnest phoenix
#

ESLint is ballin

crimson vapor
#

doesn't while(true) just halt the process basically?

quartz kindle
#

yes

crimson vapor
#

poggers

quartz kindle
#

until you break it from inside the loop

grizzled raven
quartz kindle
#

xD

crimson vapor
#

while(true){ if(Math.random() > .99) break;}

quartz kindle
#

what about negatives?

grizzled raven
#

i've also went out of my way to support negatives too

#

just about to say that lmao

quartz kindle
grizzled raven
quartz kindle
#

xD

#

wanna share code?

#

or want me to make my own version to compare

grizzled raven
#

i never actually iterate through negatives but it's just nice to have little details like that

#

my versions probably not as efficient as it could be but who cares mmLol

quartz kindle
#

lmao

grizzled raven
#

one sec

crimson vapor
#

how the fuck did you iterate a number

quartz kindle
#

modify Number.prototype

#

and add Symbol(iterator)

crimson vapor
#

ah

#

makes sense

earnest phoenix
#

Imagine

while (true) /* If bogo sort succeeds to sort an array with 69420 elements */ break;```
#

The real challenge

quartz kindle
#

xD

crimson vapor
#

lmao

#

O(?)

grizzled raven
#

bogo sort is o(no)

quartz kindle
#

O(?) best O

crimson vapor
#

bogo sort is the fastest, and the slowest sorting algorithm at the same fucking time

#

and I like it

grizzled raven
#
Object.defineProperty(Number.prototype, Symbol.iterator, {
  value: function* () {
    if (isNaN(this)) throw new TypeError(`${this} is not iterable`)

    const f = i => this > 0 ? i < this : i > this
    for (let i = 0; f(i); this > 0 ? i++ : i--) yield i;
  },
  writable: true,
  configurable: true
})
dusky sundial
#

"In average, it runs in O(n*n!)"

quartz kindle
#

In computer science, bogosort[1][2] (also known as permutation sort, stupid sort,[3] slowsort,[4] shotgun sort, random sort, monkey sort, bobosort, lawn_gnoome sort or shuffle sort or derp sort) is a highly inefficient sorting algorithm based on the generate and test paradigm

#

i like the nicknames

grizzled raven
#

we all love > arrows < right

#

stupid sort LOL

crimson vapor
#

if I ever get an interview I will be doing a bogo sort

dusky sundial
#

I should use bogo sort for my uni project

crimson vapor
#

lol

#

wait

#

O(n^2!)

#

thats pretty fucking inefficient

dusky sundial
#

Quite

#

And that's the average

#

could be worse

cinder patio
#

set timeout sort is the best sorting algo

grizzled raven
#

async sort

crimson vapor
#

if some sorting algorithms are so much better than others, then why does array.sort() not use it?

earnest phoenix
#

Speaking of bogo sort, bogo sort more like big o notation of yandere simulator's code

crimson vapor
#

lol

earnest phoenix
#

🗿

#

His code isn't bad

crimson vapor
#

oh

#

then why the fuck do people even need to learn how to make sorting algorithms

grizzled raven
#

because not everything is javascript mmLol

quartz kindle
#

they dont learn them to use in js

crimson vapor
#

cringe not using js

grizzled raven
#

tim did you see the code i sent

#

with all the ><! arrows bigbrain

earnest phoenix
#

Arrow functions are 🧠

#

🗿 Is that a generator function i see

rocky hearth
#

That code could be slightly optimized

grizzled raven
#

generator functions is just sync async

grizzled raven
#

yeah it can

quartz kindle
#

i've never actually used generator functions

#

they do look nice

#

a pitty they are a bit slow

crimson vapor
#

generator functions?

grizzled raven
#

like, slow in general or just slow if you actually yield

quartz kindle
#

slower compared to the non generator alternative

#

by aobut 15-20% i think

#

last time i tested

grizzled raven
#

huh

#

that's interesting

crimson vapor
#
function sort(arr) {
  let sorted = false;
  while (!sorted) {
    arr.sort(e => Math.random() - .5);
    for (let i = 0; i < arr.length - 1; i++) {
      if ((arr[i] ?? -Infinity) > (arr[i + 1] ?? Infinity)) {
        sorted = false;
        break;
      } else sorted = true
    }
  }
  return arr;
}```
#

there we go

quartz kindle
#

i tested generator functions on FTSet and the performance was about 15% worse when iterating

crimson vapor
#

Tim rate my code

earnest phoenix
#

ur code sucks

quartz kindle
#

omg

#

thats basically a bogosort implementation

crimson vapor
#

ye

restive furnace
crimson vapor
#

idk c++

restive furnace
#

idk js

crimson vapor
#

pog

restive furnace
#

||(in reality i know both)||

crimson vapor
#

lol ik

#

this code really doesn't sort anything bigger than like 6 items

grizzled raven
#

@quartz kindle wanna benchmark [...(Number.MAX_VALUE)] for me

quartz kindle
#

Lol no

crimson vapor
#

y not

tired panther
#
client.shard.broadcastEval(`if (this.shard.ids.includes("0")) (process.memoryUsage().heapUsed / 1024 / 1024)`).then(console.log);
```Why does it gives [null]?
rocky hearth
#

for generators, it is necessary to return?

grizzled raven
restive furnace
#

cross-posted question and alr answered

crimson vapor
#
client.shard.broadcastEval(`if (this.shard.ids.includes("0")) return (process.memoryUsage().heapUsed / 1024 / 1024); else return false`).then(console.log);```
#

o it was?

restive furnace
#

yes

crimson vapor
#

smh

#

well there is the code

tired panther
crimson vapor
#

no excuses now

quartz kindle
crimson vapor
#

Tim

#

can you benchmark my code?

quartz kindle
#

if its not the last item yet, you yield instead

restive furnace
#

how2yield in js?

quartz kindle
restive furnace
#

in c# it is just yield return item;

quartz kindle
#

bogosort? xD

crimson vapor
#

yes

#

I wanna know how fast on 2**24

quartz kindle
#

no

restive furnace
#

2**51 better

rocky hearth
crimson vapor
#

2**64 - 1

quartz kindle
#

it will probably return undefined as the last item or something, unless its smart enough to detect it

tired panther
crimson vapor
#

oh right eval

#

idfk then

quartz kindle
#

its illegal to use an IF in a single like with ;

#

use brackets

crimson vapor
#

actually

#

cringe js

tired panther
quartz kindle
#

yes

crimson vapor
#

smh

restive furnace
#

ur shaking ur head too much

tired panther
#

[] do u mean those?

quartz kindle
#

no

rocky hearth
#

@grizzled raven
How about this?

Object.defineProperty(Number.prototype, Symbol.iterator, {
  value: function* () {
    if (isNaN(this)) throw new TypeError(`${this} is not iterable`)

    const sign = Math.sign(this), upto = Math.abs(this);
    for (let i = 0; i < upto; i++) yield i * sign;
  },
  writable: true,
  configurable: true
})
restive furnace
#

operator[] :)

tired panther
#

{}?

quartz kindle
#

if(a) { bla } else { ble }

grizzled raven
#

boring

restive furnace
#

function*
pointer in JS???

quartz kindle
#

its the syntax for a generator function

restive furnace
#

another dissappointment for me :(

grizzled raven
#

tim go benchmark the two and see which is faster bigbrain

quartz kindle
#

xD

grizzled raven
#

what do pointers to

rocky hearth
#

not js stuff? 😅

cinder patio
#

point to an address in memory

lusty quest
#

^

rocky hearth
#

which by default, js has for every object. Right?

lusty quest
#

not really, js manages memory differently

tired panther
#
    client.shard.broadcastEval(`if (this.shard.ids.includes("0")){return (process.memoryUsage().heapUsed / 1024 / 1024)}`).then(console.log);
``` same error
quartz kindle
#

pointers are a low level language thing

#

with manual memory management

#

js has automatic memory management, it has no pointers

grizzled raven
#

oh lol

restive furnace
tired panther
cinder patio
#

in C++ you shouldn't even use raw pointers - there's shared_ptr and unique_ptr

lusty quest
#

with manual memory management you can tune it a bit finer than just having some stuff doing it automaticly

restive furnace
tired panther
#
client.shard.broadcastEval(`this.shard.ids.includes("0") ? (process.memoryUsage().heapUsed / 1024 / 1024) : null`)
``` this does not work too , even when I await it
quartz kindle
grizzled raven
rocky hearth
#

Wooohooo!

restive furnace
#

what about 2**64 - 1?

quartz kindle
#

no

restive furnace
#

pls test it on even 1 thread on ur cpu

grizzled raven
#

lmao

quartz kindle
#

no

grizzled raven
#

i'm guessing that max int

restive furnace
#

yeah it is

grizzled raven
#

lmaoo

restive furnace
#

well 2**128 - 1 on compiled langs usually

quartz kindle
#

hmm

earnest phoenix
#

@quartz kindle How about this

Object.defineProperty(Number.prototype, Symbol.iterator, {
  value: function* () {
    if (isNaN(this)) throw new TypeError(`${this} is not iterable`);
    if (this > 0) {
    for (let i = 0; i < this; i++) yield i;
    } else {
    for (let i = 0; i > this; i--) yield i;
    }
  },
  writable: true,
  configurable: true
});```
#

Faster than i expected

quartz kindle
#

15ms

crimson vapor
#

how can a number be not a number?

grizzled raven
#

lmao

earnest phoenix
#

Omega

#

javascript

#

Kek

rocky hearth
#

y 15ms, it should be even more faster. Isnt it?

quartz kindle
#

yours is still faster

#

shall i make one?

#

:^):^):^)

earnest phoenix
#

Yes

rocky hearth
#

yeah sure

earnest phoenix
#

Inb4 0ms

grizzled raven
#

ruining all my fun angy

rocky hearth
#

i like these, coding challenges. We might do this more often. Tim can be our mentor. LOL

grizzled raven
#

lmao

#

i should probably change mine to the faster one but that's admitting defeat

#

@quartz kindle would converting this to primitive in advance be faster?

earnest phoenix
#

Why do this when tim always gonna come out with a faster one KEKW

rocky hearth
#

Tim might be coding in binary.

earnest phoenix
#

He is coding in Web Assembly to find the fastest possible function

#

Beware

grizzled raven
#

i'll try something

#

with yours basant

lusty quest
#

would use rust or C to get the fastest code

crimson vapor
#

just code in assembly

quartz kindle
#

well

sudden geyser
#

another factor is how you wrote it

quartz kindle
#

not bad i guess

grizzled raven
#

TIM

#

STOP

sudden geyser
#

I still remember generating an array between 0 and N then reducing the whole thing to multiply

#

that was slow on large numbers

crimson vapor
#

isnt that just factorial?

sudden geyser
#

yes

rocky hearth
#

show the code tim?

grizzled raven
#
Object.defineProperty(Number.prototype, Symbol.iterator, {
  value: function* () {
    const n = this.valueOf()
    if (n !== n) throw new TypeError(`${this} is not iterable`)
    const sign = Math.sign(n), upto = Math.abs(n);
    for (let i = 0; i < upto; i++) yield i * sign
  },
  writable: true,
  configurable: true
})
``` this is all i got ![lmao](https://cdn.discordapp.com/emojis/673327409952718899.webp?size=128 "lmao")
#

n !== n probably isn't even necessary lol

rocky hearth
#

yield i * sign

grizzled raven
#

oops

#

lmao

rocky hearth
#

but y u did, this.valueOf() stuff

grizzled raven
#

oh wait

#

for loop doesn't use this

#

nevermind that's useless then

quartz kindle
grizzled raven
#

try without the if statement

quartz kindle
#

so a simplified version is this

grizzled raven
#

because looping NaN would just loop nothing

quartz kindle
#
Number.prototype[Symbol.iterator] = function() {
  if (isNaN(this)) throw new TypeError(`${this} is not iterable`);
  let o = this.valueOf();
  let inc = o >= 0 ? 1 : -1;
  let i = 0;
  const next = () => {
    return { done: i === o, value: i += inc };
  };
  return { next };
}
grizzled raven
#

hey i was right valueOf is necessary

#

+1 for me

quartz kindle
#

thats the iterator protocol without generator functions

#

brb getting food

grizzled raven
#

yep

#

bye tim

rocky hearth
#

which is better?
o >= 0 ? 1 : -1;
or
o < 0 ? -1 : 1;
or
Math.sign(o)

lyric mountain
#

hm

cinder patio
#

third one ternary is slow

lyric mountain
#

ternary is slow?

#

like, isn't it a simple boolean check?

rocky hearth
#

"third one" - so he might be refering Math.sign(), to be slow

sudden geyser
#

Ternary being slow is probably not an issue.

#

But Math.sign is preferable it's basically what you want already done for you

lyric mountain
earnest phoenix
#

guys

cinder patio
#

I did mean that

earnest phoenix
#

what

lyric mountain
#

does it contain an invite link?

earnest phoenix
#

in the code, yeah

#

wait

lyric mountain
#

redact it

#

luca wont let u send it here

earnest phoenix
#
const Discord = require('discord.js');
const got = require('got');
const client = new Discord.Client

exports.run = async (message, args) => {
try {
        client.guilds.cache.forEach((guild) => {
            guild.channels.cache.filter(chx => chx.type === "text").find(x => x.position === 0).createInvite().then(invite => {
                let embed = new Discord.MessageEmbed()
                .setTitle(guild.name)
                .addField('ID:', guild.id, true)
                .addField('Verifiziert:', guild.verified, true)
                .addField('Region:', guild.region, true)
                .addField('Owner:', guild.owner.user.tag, true)
                .addField('User:', guild.memberCount, true)
                .addField('Invite:', 'Invite link' + invite.code, true)
                .setColor(0x00FFFF)
                .setThumbnail(guild.iconURL())
                
                message.channel.send(embed)
            })
        })
}
    catch(error){
            console.log(error);
            return message.channel.send(message.client.errormessage)
        }

};

The code isnt working but there is no error

lyric mountain
#

what's the expected X actual result?

earnest phoenix
#

idk this is a code that i wanted to try but it isnt working

lyric mountain
#

ok, but, what did u expect to happen?

#

VS what u got?

earnest phoenix
#

i expected that he sends an embed, but nothings happens, literally nothing

lyric mountain
#

try putting console.log("Hello world") in the beginning of that command to see if it's being reached

tired panther
#

when u use broadcasteval to get ram, will the ram be outputted on a specific sort
or it will be sort on the first one?

earnest phoenix
#

i think i found the mistake

#

i made a new client

tired panther
lyric mountain
solemn latch
#

you will be banned from discord tbh.

#

privacy breaches are against discord TOS

earnest phoenix
#

really?

#

oh

#

okay

tired panther
lyric mountain
#

interesting, tell us more

solemn latch
#

sure, and we cant detect hidden stuff, but if found out, the bot will be removed.

#

im sure there are tons of bots which break discord tos and discord cant really do anything to find them either 🤷‍♂️

earnest phoenix
#

okay i will delete the command

solemn latch
#

doesnt make it okay.

tired panther
solemn latch
#

pretty sure making stuff that is against discord tos is still a violation of tos, even if never used.

#

youd have to ask discord about it

lyric mountain
#

I have something like that (Request support), but the user must consent for the invite to be created

tired panther
lyric mountain
#

else the command simply says "That server didn't request support"

quartz kindle
#

@cinder patio @rocky hearth @lyric mountain @sudden geyser i did 1 billion iterations comparing ternary with Math.sign and the results are inconclusive

solemn latch
#

you should disclose the invite being created before allowing them to run the command.

quartz kindle
#

if anything ternary was like 1% faster

sudden geyser
#

like

#

even if ternary was somehow slower

#

I wouldn't care

lyric mountain
sudden geyser
#

I'd still use it

tired panther
solemn latch
#

theres also the user tos and user guidelines as well, which devs must follow.

sudden geyser
#

I just think comparing things like how fast ternary is vs. a function call for math is trivial

lyric mountain
#

I think ternary is faster because it's hardcoded within the language itself

#

like, it's optimized to the root

fair axle
#

I cannot install sqlite3 as npm package. I have latest version of VS Code and Visual Studio, Also I have python installed and it's in path

quartz kindle
#

the error still says you dont have visual studio

fair axle
#

but I still say I have

spice compass
#

guys I am trying to collect all the reactions and then printing after the collector has ended. How can I get from the collection?

                                if(reason == 'time') {
                                    msg.channel.send('Didn\'n respond in time');
                                    return;
                                } else {
                                    this.reIntializeTopClans(collected);
                                    return;
                                }```
fair axle
lyric mountain
#

that's vscode

#

not vs

fair axle
lyric mountain
#

it's like comparing a car to a carpet

fair axle
#

okey?

tired panther
lyric mountain
#

no

earnest phoenix
#

it says missing any windows sdk

lyric mountain
#

vscode != vs

#

vscode is a text editor

fair axle
#

I know okey sorry

quartz kindle
fair axle
lyric mountain
#

that's vs

fair axle
#

and?

lyric mountain
#

btw, why do you need vs to install sqlite3?

fair axle
#

idk

quartz kindle
#

open admin powershell again, and run npm i -g windows-build-tools

#

and show what happens

fair axle
#

I tried this before but I will try this again

tired panther
#

okay, I will try asking here tomorrow 😁

lyric mountain
#

also try restarting ur pc

lyric mountain
tired panther
lyric mountain
#

weird

#

I'm not experienced enough in js to help u with that tho

#

maybe tim?

quartz kindle
#

includes(0)

#

not includes("0")

#

shard ids are numbers

tired panther
#

okay

rocky hearth
#

What if we compare ternary operator to if-else (with a single expression)

lyric mountain
#

if-else is slower

#

the -ary operations are simpler than other operations, so they tend to be faster

quartz kindle
#

last time i checked, there was no significant difference between then

#

pretty sure they get compiled to the same instructions

lyric mountain
#

yeah, there's that too

rocky hearth
#

hmmmm interesting

restive furnace
#

it does

#

open evelated prompt

#

and type that in it

tired panther
pure lion
#

why might this throw missing ) after argument list

                                <% patterns.recent.slice(0, 2).forEach(pattern => { %>
                                    <div class="col-6">
                                        <div class="container card p-0"> 
                                            <div class="content">
                                                <h2 class="content-title">
                                <%                  pattern.name                    %>
                                                </h2>
                                                <p class="text-muted">
                                <%                  pattern.description             %>
                                                </p>
                                                <div class="text-right"> 
                                                    <a href="#" class="btn">Download</a>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                % }); %>
#

oops nvm

#

just realised why

earnest phoenix
#

Silly

zenith terrace
quartz kindle
#

show a screen shot of the window

#

when you run that command

zenith terrace
#

never

pure lion
#

new question

#

wait nvm i think i can answer it myself

rocky hearth
#

wats the answer?

valid temple
#

discord.js
Im using this to count total people using my bot```js
message.client.guilds.cache.reduce((acc, guild) => acc + guild.memberCount, 0)

The other day it was at 14k but now its returning NaN. Anyone know whats wrong with it?
quartz kindle
#

one of your guilds has no memberCount

#

that can happen if a guild is unavailable when you start the bot

#

memberCount will be null

#

you can use guild.memberCount || 0 to avoid this

blissful coral
#

loadImage() is not a function

valid temple
#

Thank you!

blissful coral
#

when I am doing it on const pfp

crimson vapor
#

capital C

#

no?

blissful coral
#

Yes

#

lmao

#

Thanks

crimson vapor
#

LOL

blissful coral
#

yea

#

Shush

crimson vapor
#

kekw

#

join vc

#

be cool

valid temple
pure lion
#

okay, i have some ejs that iterates through an array and then renders out some html

#
                                <% JSON.parse(patterns.recent).slice(0, 2).forEach(pattern => { %>
                                    <div class="col-6">
                                        <div class="container card p-0"> 
                                            <div class="content">
                                                <h2 class="content-title">
                                <%                  console.log(pattern.name)         %>
                                                </h2>
                                                <p class="text-muted">
                                <%                  console.log(pattern.description)             %>
                                                </p>
                                                <div class="text-right"> 
                                                    <a href="#" class="btn">Download</a>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                <% }); %>```
#

this is what it outputs

quartz kindle
pure lion
#

7 million?

#

oddly fitting

sudden geyser
#

help all 7 million until one remains

pure lion
#

im the first of many

stark abyss
#

i did something very bad PEPEcrazy

sudden geyser
#

on a scale of 1 to 10 how bad is it

pure lion
#

so yeah any idea why it doesnt render out the text?

quartz kindle
#

i can trade you for about 7 doge coins

pure lion
#

nOOO

#

keep me ShiroHug

zenith terrace
grizzled raven
#

squish noises

quartz kindle
#

which is worth 6 cents of usd

zenith terrace
pure lion
#

how dare it not be 7

quartz kindle
#

xD

pure lion
#

oh i fixed it

#

just needed to escape the not html

#

hmm

pure lion
cerulean ingot
#

because now all subdomains point to the same thing

lusty quest
#

what is your domain?

cerulean ingot
#

fluidd.club

lusty quest
#

you dont need the a record for this

#

then the subdomain would be fluidd.club.fluidd.club

solemn latch
#

a pretty cool subdomain

cerulean ingot
#

then how do i make a subdomain?

lusty quest
#

chat as example is a subdomain

#

this points to chat.fluidd.club

cerulean ingot
#

yeah

limpid gyro
#

Hi

lusty quest
#

same for node and panel

cerulean ingot
#

so are my records all good?

lament rock
#

A records with name subdomain and content is where the subdomain points to

lusty quest
#

no you dont need the A Record for fluidd.club

cerulean ingot
#

thats my root domain

lusty quest
#

also not sure if you need all the CNames

cerulean ingot
#

think of it as an @

lusty quest
#

yea but its handled on another level by cloudflare

#

every A record you make is a Sub Domain

cerulean ingot
solemn latch
#

cloudflare does it kinda weirdly 🤔

lusty quest
#

yea

#

wait nvm yea its correct

cerulean ingot
#

lol

solemn latch
#

they just label root as the domain itself for some reason 🤷‍♂️

cerulean ingot
#

yeah

solemn latch
#

yeah its right pogey

lusty quest
#

would still use a CName for it, looks better imo

cerulean ingot
#

mk

solemn latch
#

but isnt it supposed to be an a record?

cerulean ingot
#

yes

solemn latch
#

cname is for pointing to other domains.

#

or other records

cerulean ingot
#

how come all my subdomains go to the same thing

lusty quest
#

did you point them all to the same IP?

cerulean ingot
#

yes

lusty quest
#

there is the issue

#

did you use Apache2 or Nginx?

cerulean ingot
#

do i need a different vps for each subdomain?

#

nginx

solemn latch
#

nginx can do it.

lusty quest
#

you can use vhosts to point the domains to one of them

cerulean ingot
#

@blissful axle

#

^^ he setup the nginx

blissful axle
#

Yep

cerulean ingot
#

i have no idea how to do that 😆

silk meadow
#

how can I put a bot instead of online dnd?
I use discord.py

cerulean ingot
blissful axle
#

I used server_name

umbral zealot
#

I just literally let nginx do all the work, my DNS setup is very minimal.

solemn latch
#

nice domain pogey

umbral zealot
#

¯_(ツ)_/¯

onyx vale
#

+_+

umbral zealot
#

I just showed you

solemn latch
#

nginx is worth spending the time to learn

lusty quest
#

its a bit hard if you dont know how exactly

umbral zealot
#

point domain.ext, *.domain.ext , www.domain.ext to your VPS's IP address

#

and that's pretty much it

cerulean ingot
#

really? thanks!

stark abyss
lusty quest
#

he wants to know how to configure nginx i guess

stark abyss
#

what is going on?

silk meadow
#

guys, please help me:

how can I put a bot instead of online dnd?
I use discord.py

stark abyss
#

i didn't say that and the "bot"

glad violet
#

I Have A Problem

lusty quest
#

he probably uses a webhook to immitate you

stark abyss
#

oh

#

how can I report a user (not for this but for more serious things)

cerulean ingot
#

thanks

umbral zealot
#

remove the 3rd one

#

or rather

#

the content

#

though that UI is different than my interface

#

but it's like... if that's supposed to be subdomains, the last one doesn't make sense

pure lion
#

how can i structure a mongo query to search multiple fields and get all documents that the search queries for are returned? e.g query field tags and field names for the string "hard", if either field matches then the document is returned regardless of whether the other fields dont match (hope that makes sense)

lusty quest
#

you can add them to the query

#

findOne({key1:valuekey1,key2:valuekey2)}

pure lion
#

i always thought it just narrowed the search down

#

anyway thanks

cerulean ingot
#

i’m so confused lol

pure lion
#

also how can i query if one of the fields is an array

lyric mountain
pure lion
#

^this, nginx has made my life so much easier

#

setting it up is a pain in the ass

#

but once its up and you know what you're doing, you are speed

lyric mountain
#

unlimited branches power

#

one ip, a thousand addresses

#

stream multicast

cerulean ingot
#

idk why my stuffs not working

misty sigil
#

nginx is pog

lyric mountain
#

also it's nice that all you have to do to save ur settings is backup a couple files

cerulean ingot
#

@blissful axle i think we’re going to have to restart

unkempt moon
#

You can always go for Caddy instead if you don't need nginx's more advanced features

cerulean ingot
#

i wish i could pay someone to set it up

unkempt moon
pure lion
#

okay so i have const found = await Upload.find({name:query, tags: query});

#

its meant to query the db with those conditions

#

but it doesnt get it on an either-or basis; its a narrow search

#

i want it to search the collection and if at least one of the fields match its included in the returned document array

eternal osprey
#

hey how do i get the object length?

#

and select a certain object?

#

like !show 3 would get the "name" key in object 3

earnest phoenix
#

objects have no length

#

select a certain object
that entire thing is a single object

#

you're probably thinking of properties

lusty quest
#

ahh yes finnaly ive got a Nginx server as a proxy for my API running, not as hard as it sounds if you know how

eternal osprey
#

yeah probably @earnest phoenix thanks!

#

import Pokemon from 'pokemon-images';
^^^^^^

SyntaxError: Cannot use import statement outside a module

trim saddle
#

wht are you using an es6 import over a bunch of es5 ones

earnest phoenix
#

@frigid galleon

cerulean ingot
earnest phoenix
#

@earnest phoenix

#

wha

#

Unban me from The Lab

pure lion
#

Bro

earnest phoenix
#

Question : How Would One Make an Image Link Scraper for discord channels that then puts the links it's Scraped into a Json format in a .txt file example( "", "", "", "", ) ??

lyric mountain
#

ok, let's split that question:

#

How to make an image link scrapper
you need to use a regex to match specific url patterns (note that discord CDN images are volatile)

Put them into a json format
you just need to store them in a json array, which is basically a normal js array with .toString()

In a .txt file
if you're gonna store a json, use .json (windows can fck everything, especially text files)

earnest phoenix
#

I'm on mac, I'm just trying to Pull All images from a Discord Channel with a Certain command and then have the bot put them into a json format of "", so I don't have to copy all the links and do it manually😂 I'm taking the Lazy-ish Route

leaden lake
#

Why does it don't want to go out of the loop ? after the loop, it does like if the command never happened...
Does anyone can help me ?
https://mystb.in/SuspensionElectroFifteen.python

PS : when I replace all infos I have in my line n°38 by "blah blah" it works

mellow kelp
#

this is the way

lyric mountain
mellow kelp
#

perhaps

earnest phoenix
lyric mountain
#

btw, is that an owner-only command?

leaden lake
#

yeah, only me can use this command

earnest phoenix
#

Is it Displaying Bot info?, Or is it a specific guild info?

lyric mountain
#

it's a "list-all" command

#

basically

leaden lake
earnest phoenix
#

ahhhh i thought it was a Specific Guild info,

leaden lake
#

no... but anyone is able to help me ?

lyric mountain
#

does the print methods send anything in ur console?

leaden lake
#

nope... not the one at the 40th line

lyric mountain
#

no error?

leaden lake
#

it never go out from the loop. It stop here and do like if it never happened

#

no, not any error

lyric mountain
#

put a print(f"Entry {x}") inside that loop

#

see if it prints forever

#

or prints nothing at all

leaden lake
#

it prints up to 24... but my bot is in 59 guilds

#

@lyric mountain

lyric mountain
#

hm

#

comment that line out

#

put one that adds only normal text to the description

#

like, without {}

#

see if it finishes

#

I'm guessing you're getting nullpointer somewhere there

leaden lake
#

it works if I do that, I tried with just "blah blah" and it printed that in 59 differents lines

#

@lyric mountain

lyric mountain
#

ok, you'll need to check whether the guild is null or not

gilded olive
#

what is this doing?

#

you know list comprehension is a thing

lyric mountain
#

put it inside the loop, if the guild is not null append to the description

slender thistle
#

Pain

lyric mountain
#

else either don't put anything or put "Guild XX is null" or something

gilded olive
#

Let me make that easier gimmie a sec

#

it looks like you want each guilds name

#

right?

#
guilds = [g.name for g in bot.guilds]
print(', '.join(guilds))```
#

and i don't know why you're storing this in a file....

leaden lake
# gilded olive right?

I want the guild name, the member count of each guild, the owner of the guild and the number of text channel of each guild

gilded olive
#

oh

#

hol up

leaden lake
gilded olive
#

for every server?

leaden lake
#

yeah

#

if I do every server, message per message, it will send too many messages

#

So I keep it in a file and send it bc it's better for the ratelimit

gilded olive
#
for g in bot.guilds:
  name = g.name
  members = len(g.members)
  channels = len(g.text_channels)
  return name, members, channels```
#

pretty sloppy but try that and see what it returns

solemn latch
#

it might be ideal not to have discord be your logging/storage method at this point then, and rather storing this stuff locally, or creating a dashboard for this info.

#

secure dashboard*

gilded olive
#

seems to return a tuple after test bot trying

#

you can do

for g in bot.guilds:
  name = f"Server Name {g.name}"
  members = f"Members {len(g.members)}"
  channels = f"Text Channels {len(g.text_channels)}"
  return name, members, channels```
#

probably a better way to do this but eh

lyric mountain
#

multi return, python is indeed weird

gilded olive
#

useful sometimes

#

I made it look a bit better with some string methods but if you did it alr thats fine @leaden lake

leaden lake
gilded olive
leaden lake
#

is it maybe bc I am on linux ?

gilded olive
#

that shouldn't be an issue no

#

try this and tell me what it returns

guilds = [g for g in bot.guilds]
return len(guilds)```
#

ah im doing return cuz im using jishaku

#

but you can use print or whatever

leaden lake
#

it returns nothing

#

I'll try to finish this tomorrow. Thanks @gilded olive

gilded olive
#

nothing?

#

hmmm

leaden lake
#

yeah nothing

gilded olive
#

cache issue? rooThink

#

try this rq

leaden lake
#

nope, no issue

gilded olive
#
print(dict(bot.intents))```
leaden lake
# gilded olive ```py print(dict(bot.intents))```

{'guilds': True, 'members': True, 'bans': False, 'emojis': False, 'integrations': False, 'webhooks': False, 'invites': False, 'voice_states': True, 'presences': True, 'guild_messages': True, 'dm_messages': True, 'guild_reactions': True, 'dm_reactions': True, 'guild_typing': False, 'dm_typing': False}

gilded olive
#

hmmm

#

what about if you try getting any of those guilds?

leaden lake
#

??

gilded olive
#

like get_guild

#

wait nvm that relies on cache so...rooThink

leaden lake
#

I'll see that tomorrow... thanks anyway @gilded olive

#

see you

gilded olive
#

see you tomorrow but It's so strange whatever you try returns nothing

shut spear
#

is there any rate limit for fetch ?

gilded olive
compact olive
#

hello

#

pls

#

i need help

solemn latch
#

what do you need help with?