#development

1 messages · Page 1961 of 1

proven lantern
#

what's the reason that the integer standard doesn't require an overflow error or something to be thrown when 2 large positive number are added together that overflow?

#

integers are scary

#

they are like y2k

#

im glad javascript doesn't have those

sudden geyser
#

depends what you mean by integer standard

#

some languages do throw or warn

proven lantern
#

interesting

lyric mountain
#

Most do nowadays

#

Guess why?

#

Yep, y2k

proven lantern
#

lol

sudden geyser
#

issue is that would be a breaking change

#

I think what's wrong with Java is it tries to be a high-level language but mixes systems programming with it

#

So a lot of what other programming languages abstract away for you creeps into Java

lyric mountain
#

I find java to be one of the perfect examples of middle level language

#

Has both sides into it

#

Can be abstract as hell OR touch JNI

#

although with jni you'd partially enter into c++

proven lantern
#

yeah, it not a good idea to try to be both a systems language and an application language.

boreal iron
#

How does anything cute, like my sweet win end up in a big weird shit, like Java in this case?

#

You’re all crazy!

#

And where tf is Tim and his even crazier opinion?

#

_to anything _

earnest phoenix
#

No you're the crazy one

boreal iron
#

Yeah being normal between so many crazy dudes actually makes me crazy, too, there’s no other explanation for this

earnest phoenix
#

there is nothing that is normal

wheat mesa
#

Normal is relative

boreal iron
#

That’s actually not true

#

Normal is usually what most of the people think of is normal

earnest phoenix
#

Well then nothing is normal

boreal iron
#

As there’s no actual definition for it

earnest phoenix
#

Its hard to gauge what is normal if its put into that definition

boreal iron
#

It is not, people just try to transform hit how they like
An example:

#

Most people on earth are not gay, that means we feel like this is the normal condition

People who are gay know they are a minority - in other words they are not normal

Now normal describes a condition in this example basically a relation of a minority and majority

Now people say something being not normal is bad because it’s different, they associate it to something completely different than the original meaning

#

We always need to find a position as a measuring point
In this a simple majority is what we call normal, that’s our subjective position

#

In reality it doesn’t actually matter which one is the case but humans always need to break down things

#

I’m too tired to go on at this point but just the beginning of what would be important to say about this facts

#

Which means as how we explain things, the nature, physics etc. something normal - common is always the thing with the largest quantity - which mostly occurs and anything else is not normal - just being different to the rest - we also call it an exception

#

Which means it’s actually not relative

earnest phoenix
#

I thought you were too tired

boreal iron
#

That’s was the short version

#

Which ends up in normal actually being defined strictly but very different regarding on where to use it

#

Should change my job to do philosophy

earnest phoenix
#

You seem to do better in it

shell crest
#

Can someone help me with my code?

#

I get an odd error

#
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name 'gameOver' is not defined
#

I know this means gameOver is not defined

#

but it is clearly defined in the code multiple times...

#

Please ping me if you know how to help me

#

Also, I have just converted the code into cogs instead of client.command

#

It was working perfectly before though...

earnest phoenix
#

See I don't know python but I am curious, are you allowed to keep doing global gameOver

shell crest
#

I'm not entirely sure

#

I believe it's just there so it can be used again and again within the code

earnest phoenix
#

Mmm, but if you keep defining a global variable isn't that just going to mess stuff up?

#

Or is that not what global does ti seems like that is what it does

shell crest
#

I guess so

earnest phoenix
#

Also you already have gameOver defined in the class scope so cant you just use that?

shell crest
#

Thats more of if gameOver

lament rock
#

You should never create global variables in any language since you could accidentally overwrite a built in or a constant someone else has defined. Unlikely in some cases, but still something to consider. Global is also a strange context, so you should only use local context variables

earnest phoenix
#

What is the point of defining gameOver with a value if you are going to overwrite that and give it no value

lament rock
#

If you need a variable in other files, you should be assigning it to something like a shared required module that acts as a passthrough

shell crest
#

What can I do instead then?

earnest phoenix
#

Assuming scopes work how i think they do in python you have gameOver = false then in your methods you do global gameOver giving it no value so it doesn't know what the value actually is (I assume this is correct can someone correct me if im wrong)

shell crest
#

It will just give me an error for gameOver isn't defined

#

Alright, I will try that. Thank you!

earnest phoenix
#

Ayo dont take what i said to be factual

#

I dont know python I was more asking a question

lament rock
#

the logic checks out.

earnest phoenix
shell crest
#

Now that I deleted the global variables, its giving me a "referenced before assingment" error

earnest phoenix
#

hmm

shell crest
#

Is this some kind of cog error?

#

Like I said before

#

It worked perfectly on client.command

#

I'm very confused

lament rock
#

did you assign it a value before accessing it

woeful monolith
# shell crest

You need to keep global gamOver before gameOver = True

shell crest
earnest phoenix
#

Yea but apparently you define it before gameOver = True

shell crest
#

Yes

earnest phoenix
#

python seems weird

shell crest
#

And then it just never finds that variable again...

earnest phoenix
#

I think he means like

class Fun(commands.Cog):
  def __init__(self, client):
    self.client = client

  global gameOver
  #Tic Tac Toe Command
  player1 = ""
  player2 = ""
  turn = ""
  gameOver = True

not entirely sure tho so dont quote me mmLol

shell crest
#

There are still errors

woeful monolith
shell crest
#

aaaaaaaa

#

That works again!

#

But,

#

It gives me the endGame function instead

woeful monolith
#

You should try gameOver = False at start.

shell crest
#

Nope

#

Same thing still happens...

woeful monolith
neat ingot
#

figured this might help some folks:

const some_variable = "supyo";
const some_object = { [some_variable]: 5};
console.log( some_object );
// => {supyo: 5}```
dense gulch
#

Mmm

marble juniper
#

oh wait no im stupid thats why

earnest phoenix
#

I dont see the point

marble juniper
#

nah I get it

#

the value of some_variable acts as the key in the object

#

its simple actually

earnest phoenix
#

Well yea ik how it works

#

but it seems pointless to make a variable for the key

marble juniper
#

it just fucks with ur brain

earnest phoenix
#
const some_obj = { supyo: 5 }
console.log(some_obj)

ez

#

Only way I can see it being useful if you are going to use the key name for something else.

neat ingot
#

its incredibly useful in cases where you have no idea what the keey will be

#

or, for example, mapping the index of an array to an object property

#
const some_array = ["supyo"];
const some_object = { [some_array[0]]: 5};
console.log( some_object );
// => {supyo: 5}```
earnest phoenix
#

That is when it'd be useful yes.

neat ingot
#

tbf, i didnt present it as life altering. only potentially useful 😂

shell crest
#

Can you send me it?

woeful monolith
# shell crest

Everything same. Just include global gameOver before gameOver = True

woeful monolith
shell crest
#

I get another error now

#

checkWinner is not defined

earnest phoenix
#

What

#

🤔

#

Your question makes no sense

#

Okay cool

#

You can't change the color of an image with css

#

Uh what

#

I've never heard of such a thing

#

I only know that you could possibly use filters

modest maple
#

i mean it just set's the element's background color

#

and because it's transparent, the background color will show

earnest phoenix
#

Mmm true

#

I thought it was actually changing the pictures color im too tired for this

#

Not put it behind the p tag?

#

I wish I could actually help but unfortunately it is almost 2am so im tired

#

goodnight guys!

#

Unrelated really

#

but I thought it was cool so I shared

feral aspen
#
bot.shard.fetchClientValues('guilds.cache.size').then(total => {
    console.log(total.reduce((accumulator, currentValue) => {
        accumulator + currentValue
    }, 0))
}) // Undefined
#

How does this return undefined???

earnest phoenix
obtuse timber
#
const express = require('express')
const Topgg = require('@top-gg/sdk')

const app = express() // Your express app

const webhook = new Topgg.Webhook('Here comes my token') // add your Top.gg webhook authorization (not bot token)

app.post('/dblwebhook', webhook.listener(vote => {
  // vote is your vote object
  console.log(vote.user) // 221221226561929217
})) // attach the middleware

app.listen(1333)

it is not posting anything

boreal iron
#

Make sure port 1333 (TCP) is accessible from the 'net

split hazel
#

I hope you hit someones car while driving and helping in development and insurance refuses to pay the bill

feral aspen
#
console.log(bot.guilds.cache.map(guild => guild.name)); // Normal
bot.shard.broadcastEval(client => client.guilds.cache.map(guild => guild.name)).then(results => console.log(...results)); // Via Sharding

Did I do the via sharding correct? .. or is there a simpler way?

split hazel
#

Doesn't broadcast eval take in a string?

feral aspen
#

Although, do you think the way I did to get all the guild names, via sharding, is correct or is there a shorter way?

split hazel
#

last time I used it it did take in a string

split hazel
feral aspen
#

You sure there isn't a shorter code.

feral aspen
split hazel
#

you can use this which will grab a prop and return it from the client

#

you pass something like guilds.cache.size as the string

#

if you wanted to get amount of guilds in a shard

#

but actually that's only for simple values

#

so yeah that's the best way to do it

feral aspen
#

Yes. ^

split hazel
#

if you want it to be shorter wrap it in a function

feral aspen
#

Although, I want to console log all of the guilds' names for all shards.

split hazel
#

the simplest way would probably be to do it via broadcast eval

feral aspen
#

As an example, like this, in normal bots. console.log(bot.guilds.cache.map(guild => guild.name));

feral aspen
split hazel
#

you can do it like that too but it's slower since it has to transfer the data to the shard requesting it

#

fastest way would be to make the shard log them itself otherwise that's fine

feral aspen
#

I also realised another problem, this is returning the correct data since it's in one shard. I'm scared double shards returns the wrong array output.

#

Double shards like those outputs. const array = [["Server A", "Server B", "Server C"], ["Server D", "Server E"]];

split hazel
# feral aspen How, so? What do you mean.

your way it goes:

  • shard requests data from all shards
  • shards send the result back to the shard requesting it
  • waits for all shards to send back the data
  • console log the data
#

you can skip the sending back part and just make the shard itself log it

#

but if its just a one time thing it doesn't matter

feral aspen
#

Although, isn't this what I did?

split hazel
#

nope

#

doesn't matter though just an optimisation tip

feral aspen
#

Quick question, requests data from all shards is via which discord.js method, the .broadcastEval()?

feral aspen
# split hazel what do you mean?

The following code returns an array of array so I had to use the spread operator to spread the array, although, if it returned two arrays, my spread operator is useless.

bot.shard.broadcastEval(client => client.guilds.cache.map(guild => guild.name))
boreal iron
#

don't you need to fetch the values fist via. client.shard.fetchClientValues(...) ?

#

Then processing with the results

feral aspen
split hazel
#

since when did that method exist

boreal iron
#

Nobody said you should fetch the cache.size

quartz kindle
feral aspen
#

Holy, that worked. That's one issue solved.

feral aspen
feral aspen
wheat mesa
#

seems fitting

quartz kindle
#

lmao

quartz kindle
feral aspen
quartz kindle
#

easy

boreal iron
#

Ignore Speedy... he only speaks "OS language"

quartz kindle
#
bot.shard.broadcastEval(client => console.log(client.guilds.cache.map(guild => guild.name)));
feral aspen
#

Wtf.

split hazel
#

though you might want to return 1 unless just returning the log is fine

#

or 0:)

quartz kindle
#

the only difference is that it will log X arrays of names, where X is the number of shards, instead of 1 array of all names

#

but they will all be logged the same way

split hazel
#

except you dont have to wait for all shards to finish returning the data

#

and the heap remains happy

quartz kindle
#

but of course, that only works if logging them is your actual goal

feral aspen
quartz kindle
#

if you want to do something else with the data, then its different

quartz kindle
feral aspen
#

That's with one shard, right?

quartz kindle
#

with 2

feral aspen
#

What? Basically the same as the long code with .flat() method?

quartz kindle
#

no

#

transfering the data with broadcastEval and then only logging it at the end, will always make 1 array

#

unless you want to log an array of arrays

#

basically, speedy's method makes each individual shard log its own guilds

feral aspen
#

Nope, just trying to return the exact output as bot.guilds.cache.map(x => x.name);

wheat mesa
quartz kindle
#

while your previous method makes each individual shard send its own guilds, then assemble then all together, then log only the final result

wheat mesa
#

can anything even go on to the stack in js since it's interpreted

feral aspen
split hazel
quartz kindle
feral aspen
#

Now, with two shards, it will yet return one array with both shard's guild names merged into one array, right?

feral aspen
#

How about your method?

quartz kindle
#

with speedy's method, you are not returning anything

#

you are telling the shards themselves to do the logging

#

so each shard will log once

#

they will not be merged

#

they will be logged separately

feral aspen
#

Oh, I see, makes sense.

#

Meaning my method can be helpful when it comes to merging, but when it comes to quick logging a shard's own guilds, speedy's way.

split hazel
#

so very fast unlike heap 🤮

quartz kindle
#

nice

#

xD

#

well yeah, but stack is very limited

#

pretty much only works if you know what you'll use it for at compile time

agile ember
#

Hi

feral aspen
#

Sweet.

split hazel
#

you could theoretically make a lot of space for objects that might change in value to something larger or smaller in the stack so you dont have to request space in the heap

#

but it does get fiddly

quartz kindle
#

for short lived data yes, like a cache

split hazel
#

since the stack is mostly for short data

wheat mesa
#

we'll see about that when I put my statically allocated 2 billion length array on the stack

split hazel
#

i will store massive objects in the stack and then wont release it no one can stop me

quartz kindle
#

xD

split hazel
#

actually one of my functions in my os does that

#

it leaves a huge string buffer in the stack (will change that)

feral aspen
#

How can I get the current shard ID?
Let's say bot.shard.broadcastEval(client => console.log(client.guilds.cache.map(guild => guild.name))); but something like Shard ID # {}

split hazel
#

pretty sure its just client.shard.id

feral aspen
quartz kindle
#

i believe

split hazel
#

i swear they've changed 90% of this shit

#

last time i used sharding it was straight forward

quartz kindle
#

or is it client.shard.ids[0]

#

both should work

feral aspen
quartz kindle
#

it wont do it only for the first

feral aspen
#

How about the others?

#
Shard 0 [];
Shard 1 [];
Shard 2 [];
quartz kindle
#

exactly like i said

feral aspen
#

Supposedly, the [] is the output of bot.shard.broadcastEval(client => console.log(client.guilds.cache.map(guild => guild.name)));

feral aspen
quartz kindle
#

the first one of each client

#

each client only has its own shard

feral aspen
#

OHHH.

quartz kindle
#

so the first is always the correct one

feral aspen
#

client.shard.ids[0] inside the arrow function??

quartz kindle
#

yes

feral aspen
#

My bad, sorry about that.

quartz kindle
split hazel
#

uh

#

for normal usage

#

well actually technically it is short lived data

quartz kindle
#

make a troll function that memory leaks on purpose

split hazel
#

why do i want to troll myself

quartz kindle
#

:^)

split hazel
#

c++ already screams at me when i reference pointers inside of the stack

#

and take them outside of the function, though its just a warning not an error

feral aspen
#

When I restart the bot, it sends this error. Error [SHARDING_READY_DIED]: Shard 0's process exited before its Client became ready..

quartz kindle
#

then you have an error in the shard

quartz kindle
feral aspen
#

An error?

module.exports = async bot => {
    bot.shard.broadcastEval(client => console.log("Shard ID", client.shard.ids[0], client.guilds.cache.map(guild => guild.name)));

    bot.shard.fetchClientValues('guilds.cache.size').then(total => console.log(total.reduce((a, b) => a + b, 0)));
};
#

That's my entire codebase, though?

split hazel
#

i never use references i always use pointers

#

unless i want a terrible performance program

#

unless i actually want to copy something of course:)

quartz kindle
#

yeah but stuff like memory ownership makes it not always possible

#

i've had this problem working with node's napi

#

i didnt find a way to take ownership of the buffer content of a js object

#

without copying the data to a new object on the heap

split hazel
#

though reading and writing memory in a linear buffer is really fast anyways

fast trench
#

why would the 2nd deny line be making it so the newRole.id can't see the channel? ```js
const discchannel = await reaction.message.guild.channels.create(${user.username}, {
parent: parentCat[0][0].disctubecat,
permissionOverwrites: [
{ deny: VIEW_CHANNEL, id: reaction.message.guild.id },
{ allow: SEND_MESSAGES, id: member.id },
{ allow: VIEW_CHANNEL, id: member.id },
{ allow: VIEW_CHANNEL, id: newRole.id },
{ deny: SEND_MESSAGES, id: newRole.id }
]
});

split hazel
#

i've copied millions of ints and it usually does it under a few milliseconds

quartz kindle
#

yeah but when working with heaps, it causes unnecessary memory fragmentation

split hazel
#

how does windows/linux deal with memory fragmentation

quartz kindle
#

depends on the allocator

split hazel
#

thats what i find confusing

#

shouldnt the os be constantly moving things around in the background to ensure maximum amount of heap can be allocated

#

unless im misunderstanding something

#

such as paging

quartz kindle
#

i dont fully understand the intrinsics of it either

#

but the allocator is responsible for dealing with alignment and efficiency of the program's own virtual memory

#

other than that, the os just gives it chunks of memory as needed

split hazel
#

does it do it in pages

quartz kindle
#

likely yes

split hazel
#

a page is 4kb i believe

#

because that would make sense

quartz kindle
#

allocators usually use multiple different page sizes

split hazel
#

each program gets a page it can use and if it runs out of space it can grab more pages

quartz kindle
#

depending on the amount being allocated

split hazel
#

though i still dont get how it detects memory access violations

#

unless i dont understand something a page cant be less than 4kb

#

and you can only apply privileges to pages

quartz kindle
split hazel
#

dont know exactly

#

behind the scenes a page is 4kb

#

thats the hardware definition for it

#

at least for a 32 bit system

quartz kindle
#

but it can be bigger

split hazel
#

can it?

#

interesting

#

i still need to ask people that know way more about this stuff

#

i dont understand the paging concept entirely

quartz kindle
#

i dont exactly know the relationship between architectural allocation and software allocators like mimalloc, jemalloc, tcmalloc etc

#

i know that jemalloc for example uses multiple different page sizes and pool sizes depending the amount requested

#

and somehing they call "arenas"

split hazel
#

so like what is a page exactly

#

does a program take ownership of one

quartz kindle
#

likely yes

split hazel
#

so if you were to allocate two different buffers would they possibly end up on the same page

quartz kindle
#

if the page is big enough i guess

split hazel
#

that makes a lot more sense

#

but what i dont understand is if a program owns a whole page how do seg faults happen even if you access just a byte before or after the requested and returned size

quartz kindle
#

inside the same page?

split hazel
#

since pages arent the size of the requested buffer you should have permission to access the bytes inside of it

#

yes

quartz kindle
#

the allocator likely has some kind of book keeping for individual chunks inside the page

feral aspen
#
console.log(`${bot.shard.fetchClientValues('guilds.cache.size').then(total => total.reduce((a, b) => a + b, 0))}`)

This is returning [object Promise].

sudden geyser
#

.then returns a promise

quartz kindle
#

speaking of which, one of the dumbest things i've ever seen on npm is an "object pre-allocator" for js lmao

sudden geyser
#

but the value inside that .then won't be a promise, so you should use one to log the value

split hazel
#

as far as i know internally the only way the os knows if a memory location has been accessed without having permission to is when an interrupt happens when accessing a page that is not marked as currently in memory or has a higher privilege level than the code page running it

sudden geyser
#

aka .then(console.log)

split hazel
#

and during a switch of a task the os marks the pages the process owns as present in memory which allows the process to run without segfaults

#

i'll ask sometime soon on the os forum i'll also let you know about it

quartz kindle
#

👍

feral aspen
#

Tim, quick question. Can I store the value of this in a variable?

bot.shard.fetchClientValues('guilds.cache.size').then(total => console.log(total.reduce((a, b) => a + b, 0)))

I want to use it in console.log().

quartz kindle
#

yes

feral aspen
quartz kindle
#

await

feral aspen
#
console.log(`Bot is now online serving ${await bot.shard.fetchClientValues('guilds.cache.size').then(total => console.log(total.reduce((a, b) => a + b, 0)))} servers.`);
#

Do I have to do this for all?

quartz kindle
#

if its a promise, you have to await it

feral aspen
#

[object Promise]

quartz kindle
#

although that code above wont work

feral aspen
#

WAIT

#

Yup, figured out why.

#

Although, I remember in the past, when you told me that you cannot use await with .then() or are there cases you can?

quartz kindle
#

you can

#

just that await will wait for all thens

feral aspen
#

Ohh.

quartz kindle
#

meaning await a.then().then().then().then(() => 10) will return 10

feral aspen
#

Oh, sweet!

#

If we removed the await in the above code? It will error promise, right?

crimson vapor
#

Promise<10>

feral aspen
#

Since the group of .then()s didn't complete?

crimson vapor
#

Actually I don’t know

quartz kindle
#

they will always complete

crimson vapor
#

i think I’m wrong

quartz kindle
#

just wont return the value you want

feral aspen
#

Oh, basically, it will complete although you didn't wait for it to return the value.

split hazel
#

wait i think i know how it works in depth but not sure

feral aspen
#

Makes sense.

split hazel
#

so the library (std) request 4kb pages from the os or how many it thinks it needs and then the allocation library under it decides and organises where the allocated blocks go inside it

quartz kindle
#

basically, a promise will create a separate branch of code that will execute stuff in a different space

#

if you dont await it, that branch of code will never merge again with the previous branch

#

so all kinds of values and processing that happens inside there, will stay inside there

feral aspen
#

Aha, I see.

quartz kindle
#
|
|
| -> something.then(() => {
|  // new branch of code
|  |
|  |
|  |
|  v // cannot merge again
| })
|
|
|
v
#

with await:

#
|
|
| -> await something.then(() => {
  |
  |
  |
  v
<-})
|
|
|
v
feral aspen
#

OHH, that gave a much clearer image.

#

I appreciate it, this actually just answered a bunch of other questions I had in mind for about a few days.

quartz kindle
#

👍

feral aspen
#

Quick question..

#

What did you mean by cannot merge again?

quartz kindle
#

if its not awaited, the original branch does not wait for it

#

so when the new branch completes, the original branch already finished long time ago

#

so there is no way to return to it

feral aspen
#

That's why it returned [object Promise] since it completed and it didn't return the value I wanted since it finished a long time ago.

quartz kindle
#
console.log(1)
something.then(() => {
  console.log(2)
})
console.log(3)

// result:
// 1
// 3
// 2
feral aspen
#

.. and then if you add the await before the .then() method then it will return from 1 incrementing, makes sense!

quartz kindle
#

yes, if you await it, the 2 will log before the 3

feral aspen
#

Yup.

#

Quick question in sharding, I have this code bot.users.cache.get(args[0]);, and I want to know how I can convert it via sharding, although, what method should I be using?

#

.fetchClientValues() or .broadcastEval()?

quartz kindle
#

doesnt matter, fetchClientValues and broadcastEval both do the same thing, just broadcastEval is more powerful and can do more things while fetchClientValues can only do simple things. but in this case both should be able to do it.
however this is not strictly a sharding problem, its a caching problem as well, and you cannot retrieve complex data via ipc

#

meaning that you will be limited to send a simple form of a user as an object

#

another option is to fetch it from the api instead

feral aspen
#

ipc meaning?

quartz kindle
#

ipc = inter process communication, which is how shards are connected to each other

feral aspen
#

Is this a problem with all bots using sharding, which is .cache?

quartz kindle
#

all bots using the ShardingManager yes

feral aspen
#

Didn't we just use .cache to just map all the guild names or are those just simple things?

split hazel
#

that said my heap allocator allocates blocks on the os level which means there is no paging or protection

#

gonna rewrite that

quartz kindle
#

you cannot send a full Guild object

#

it will either error or lose some data in the way

feral aspen
quartz kindle
#

as in, return the entire object instead of a part of it

#

broadcastEval((client) => client.guilds.cache.first())

#

or fetchClientValues("client.guilds.cache.first()")

feral aspen
#

That will return the first guild?

quartz kindle
#

the first guild in the cache in that shard, yes

feral aspen
#

Oh, as an example, you're returning the first guild?

quartz kindle
#

yes

feral aspen
#

Now, if I cannot use .cache.get(), then that's fine, although, how can I fetch it from the api, instead, using .broadcastEval()?

quartz kindle
#

you dont need bradcastEval to fetch from the api

#

just client.users.fetch()

feral aspen
#

That's it? That's cool!

#

Anything else I should be aware of when it comes to sharding?

bronze socket
#

how can i make this command only used by members having permission manage server

sudden geyser
#

I'd recommend abstracting this into an option for the command rather than performing the check in your execute function.

uneven scaffold
earnest phoenix
#

ello, i have a little problem

#

i have 2 files and one loads faster than another

#

i cant explain :d nvm

#

or can i..

weird thing is that help is required faster than handler

#

even tho handler is called first

wheat mesa
#

is that a problem..?

#

can you show some code

#

it's difficult to tell what you're doing by just speculating

earnest phoenix
#

sec

#

this command (help.js) calls for handler.js

#

but, variable from handler is initialized after help already called it

#

so it returns just {}

#

handler just reads a directory

#

i know that readdirSync is the issue but idk how to handle it

#

maybe this makes it clearer

without timeout its just {}
with timeout its ok

quartz kindle
#

i dont get it, is the console.log inside the timeout showing before the console.log outside?

#

or what is going on?

#

you mean the fs.readdirSync is not being called before?

earnest phoenix
#

help.js needs a variable from handler.commands (in handler.js)

help.js gets a variable but its empty because it calls it faster than handler.commands can finish reading

quartz kindle
#

you will need to show more code

earnest phoenix
#

it simply pushes into commands

#

i need to go trough exports.commands

#

but not before its finished

quartz kindle
#

like, which files are being loaded, starting from your index.js or whatever is your main file

#

would need to see the entire load order

earnest phoenix
#

simple timeout fixes the issue

#

but its not a good solution ( i think)

quartz kindle
#

which simply means the load order is wrong, or you have some kind of asynchronous code in the loading process

earnest phoenix
#

thats how they are loaded

#

then help calls handler

#

can i make help wait for handler to finish loading files?

cosmic forum
earnest phoenix
#

Is this correct? ```js
message.channel.send("...").then(msg => {
msg.delete({ 5000 })
});

earnest phoenix
#

in v13 u need to delete it urself using timeout

boreal iron
#

Keep in mind to catch the errors if you aren't already doing that

earnest phoenix
#

ok

boreal iron
#

Imagine your message gets deleted before the 5s are over

earnest phoenix
#

@rustic nova

#

finally! free nitro

#

lmao

rustic nova
#

fuc is that name tho

boreal iron
#

And yes, move on using timeouts to prevent to edit you code later on again

earnest phoenix
#

Not how that works

#

I don't use this like months

#

How was it

#

It doesn't have a time prop anymore

boreal iron
#

And yes, move on using timeouts to prevent to edit you code later on again

earnest phoenix
#

in v12

#

Then it's timeout: time

boreal iron
#

What prevents you from using a timeout?

earnest phoenix
#

If he's using v12 and the option is there why make your own timeout

wheat mesa
#

didn't we have this discussion before

boreal iron
#

...then((message) => { setTimeout(() => { message.delete(); }, 5000); });

wheat mesa
#

wait no that was about deleting a message after a timeout

earnest phoenix
#

Fake if the option exists why do it yourself

pale vessel
#

You really love your brackets

boreal iron
#

bc I don't give a fuck about the option

boreal iron
earnest phoenix
#

That's cool ig then

boreal iron
#

You didn't ask for something looking less aggressive, flazepe

#

So.. that's what you get

pale vessel
#
.then((message) =>
    {
        setTimeout(
            () =>
            {
                message.delete();
            },
            5000
        );
    }
);```
earnest phoenix
#

No

boreal iron
#

My gosh... eww

pale vessel
#

That's literally his coding style

boreal iron
#

lol no

#

Who's fucking using line breaks on anything not being in brackets?

timber fractal
#

can i use a dns record on my domain name to redirect any urls on cc.luckiecrab.nl to crazyclown.luckiecrab.nl
for example if someone enters https://cc.luckiecrab.nl/thing/idk it will redirect to https://crazyclown.luckiecrab.nl/thing/idk

boreal iron
#

You must be crazy...

boreal iron
#

timeout cough

sudden geyser
#

c# crave

earnest phoenix
#

visual studio syndrome

boreal iron
#
.then((message) =>
{
  setTimeout(() =>
  {
    message.delete();
    ...
  }, 5000); 
});
#

there you go

#

While I wouldn't use brackets for the timeout, but who knows what else he would do inside

split hazel
#

you are the crazy one here 😠

boreal iron
#

shut up OS dev

#

calling me crazy

quartz kindle
#

does it show only {} ?

earnest phoenix
#

i fixed it

quartz kindle
#

👍

earnest phoenix
#

oh its tim

#

hi tim

quartz kindle
#

hai

earnest phoenix
#

if that makes sense

split hazel
#

step 1 of getting usb to work

quartz kindle
#

oooo

split hazel
#

barely anything is standardised so you have to look for the tables left by hardware manually by probing for signatures

abstract quarry
#

Quick question, (ping me), how can I get a text that is written on a website, like get the texts ID or element and stuff and if I can get the text, can I see what the text is?

quartz kindle
#

how exactly does i/o communication work from a c/c++ standpoint? does std have classes and functions to create connections with that? or is it by accessing some particular area in memory in a read/write fashion?

#

how exactly do you write C code to access some hardware part of the board?

split hazel
#

you mean IO as in accessing memory or actual physical IO

#

as in data busses to hardware

quartz kindle
#

ye

split hazel
#

which

quartz kindle
#

idk any, like if you want to read data from the bios

#

how would you request this data from C?

split hazel
#

in this case there is actually a standardised part of the RAM in the first 1mb which contains data left by the BIOS for the operating system to interpret so there is no IO going on

#

but if I do need to do IO i wrote a wrapper function in pure assembly which allows me to send and receive bytes/words from data busses

#

i'll show you

quartz kindle
#

cant C access these data busses by itself?

split hazel
#

kind of

#

i wrote it in inline assembly

#

ignore the weird inlining i just wanted piece of mind

#

though IO is quite old only down to the metal hardware are connected to it

quartz kindle
#

you can integrate asm code inside C like that?

split hazel
#

such as the GPU, keyboard emulation by the BIOS etc

split hazel
quartz kindle
#

nop

split hazel
#

and thats c++:)

quartz kindle
#

nice

split hazel
#

but pretty much c

quartz kindle
#

so thats like eval(asm)

split hazel
#

its not really eval but you could say so

cinder patio
#

It depends on the compiler

split hazel
#

on compile time the compiler inserts the ASM inside of it into the actual code

#

its a bit more complicated than that so optimisations can still take place properly

boreal iron
#

the more you explain to Tim the earlier he starts making Tim OS

proven lantern
#

Terry already made the best OS

boreal iron
#

Enlighten me

split hazel
#

like this

#

the decompiler did a bad job here but you get the picture

proven lantern
quartz kindle
split hazel
#

now i think you'll be interested in how you can access graphics memory

#

well not exactly graphics memory but the memory which maps actual data onto pixels on the screen

#

you can actually map certain areas of memory for use in for example graphics memory so whatever you read/write in that area of memory is actually processed on where it is mapped to

#

though reading is extremely slow from these mapped addresses so you often do whats called a "double buffer" where you write to two locations and you read from the location thats physically in ram

quartz kindle
#

thats too low level for me

#

im just a js dude

#

:^)

split hazel
#

it is the most fun part of computer science

#

the low level stuff

boreal iron
split hazel
#

shut up fake

#

i know you're typing up your hilarious response right now

boreal iron
#

lmao

#

I don't

spark flint
#

how can i get a date in DD/MM/YYYY format from a mongodb id

boreal iron
#

what

#

you mean from a timestamp?

spark flint
#

yeah

boreal iron
#

my gosh

spark flint
#

entry._id.getTimestamp()

earnest phoenix
#

you can format the timestamp with any date formatting lib

#

like dayjs

#

assuming that is what you mean

earnest phoenix
cosmic forum
#

It's my first time making and publishing an API, and I've just started on the "homepage"/"documentation" of it, however I'm not so sure what I need to add or include in it.

For reference, here is the link to the current homepage/documentation: https://ffa.aakhilv.me

If anyone would like to give me some tips or pointers in how I should format it and what I should include, I'd really appreciate it.

quartz kindle
cosmic forum
#

hm, how should I deliver the images then?

spark flint
#

Image url

quartz kindle
#

if the images are generated on the spot, like via canvas or something, then you already have the endpoints for the image format, just send the raw image as an octet-stream

#

it would be the same as if the user downloaded the image via direct link

#

if the images are pregenerated and stored in a folder, give them the image url

cosmic forum
#

hmm okay thanks

quartz kindle
#

i think you dont need the json url at all, just have all the other urls

#

and have each url deliver the raw data

cosmic forum
#

Yeah, I was deciding whether to remove it or not

quartz kindle
#

like text/plain for the text endpoint, and image/png or similar to the image endpoints

cosmic forum
#

but I was thinking that some people would like all the data under one endpoint

quartz kindle
#

if you want to give them the text plus the image, you can put the text in the response headers

#

under a custom header

cosmic forum
#

Hm, I'll look into that

quartz kindle
#

if they really want all image variants at once, one way would be to use multipart/formdata

#

it would basically do the same thing as you're doing with json

#

but use 30% less data

earnest phoenix
#

should commands like "say" be mod locked?

quartz kindle
#

and many other ways you could get in trouble

earnest phoenix
dense finch
#

i dont know how to add commands to my bot. Can someone tell me ? If yes chat me please!

lament rock
#

There should be a bunch of tutorials online regarding your specific language choice. Of course, everyone's bot is different and as such, how to add commands is different

quartz kindle
split hazel
#

@quartz kindle threading support for speedyos??!!

#

yes or no

boreal iron
split hazel
#

ugh its you

#

im just joking

boreal iron
#

Like to see you, too

split hazel
#

i do need to implement it anyways because im planning to use a library which will take advantage of these os features

#

right now you can only spawn processes and thats about it

quartz kindle
#

gonna write a scheduler?

split hazel
#

i already have one lol

#

i wrote it ages ago after much struggle

#

actually now you reminded me

#

i need to optimise it

quartz kindle
#

xD

split hazel
#

right now you know i kind of wrote it quickly

#

for code that runs thousands of times a second it needs as much optimisation as it can

#

and there is no proper cpu scheduling algorithm yet

#

just first come first serve

#

mutex locks too i guess

#

though i dont know how mutex locks work

#

are they implemented on an os level

quartz kindle
#

pretty sure mutex is implemented by the programs themselves

modest maple
#

mmm depends

#

you normally have to use the OS in some way

#

because the OS is the only one who knows which thread has current ownership of the lock

#

there are locks that work off of atomics that are done off the program level but err, they're much more complicated

modest maple
split hazel
#

mutex are an optional feature for thread safety

#

well will be

#

my plan would be to make them program sided

modest maple
#

EYES sure... But err, you yourself need to maintain some way of synchronisation regardless just as a fyi

split hazel
#

mutex lock:
if mutex queue is not empty, sleep until it is empty
once empty, add thread to queue
continue processing
mutex unlock:
remove mutex lock from queue

#

something like that would work

#

but then could race conditions happen with the mutex itself

#

lmao

#

were talking about a single core os so probably not

modest maple
#

well your check to see if a lock is currently in use should be atomic

split hazel
#

unless a task switch occurs right after a safety check

modest maple
#

so it should be safe from a data race

split hazel
#

atomic?

modest maple
split hazel
#

so basically a cooler mutex lock

modest maple
#

no

#

because an Atomic doesn't block

split hazel
#

oh wait is that an actual instruction

modest maple
#

it also cannot protect / shield values generally like a mutex can

split hazel
#

so are mutex locks basically a while sleeping loop

modest maple
#

also although this is talking most about rust and databases, john does a good section about synchronisation and how you ensure no race conditions happen https://youtu.be/s19G6n0UjsM?t=1511

This is a guest lecture I gave at Two Sigma in November 2018 where I discussed the experience of using Rust for building larger, high-performance systems. In it, I cover what makes Rust an attractive option for such projects; Noria, the high-performance research database prototype I've built using Rust; an interesting concurrent data-structure ...

▶ Play video
modest maple
split hazel
#

so they just yield control back to the scheduler

#

nice

modest maple
#

Mutex world broadly:

Is mutex locked?

  • No: -> acquire lock
    -> Yes -> Yeild control / park thread until notified

#

its quite rare that things are on a sleeping loop other than the things driving the original state machines

earnest phoenix
#

any idea why its undefined? it seems to work fine in other parts of the code

split hazel
#

i seee

#

i should add parking support for threads too

#

on the os level

modest maple
#

you kinda gotta

#

otherwise you have no real control over cpu usage

split hazel
#

though yielding control to the scheduler right after a context switch isnt all that expensive

#

but i get it

#

will add that to the list

#

also further would prevent race conditions

#

since a thread actually has to physically unsuspend another thread

#

might just rewrite my scheduler tbh

#

i do have system calls as well

#

thanks for the knowledge@modest maple very helpful

#

will probably write a mind map of how i will implement it and then ask y'all for opinions

quartz kindle
#

also you dont need the first Object.keys either

#
const command = handler.commands[args[0]];
if(command) {
  // do something
}
earnest phoenix
#

but i need keys to check if args[0] matches any

quartz kindle
#

the code above implicitly does that

#

unless you have a key whose value is null or undefined on purpose

#

or 0 or ""

#

or NaN

earnest phoenix
#

it worked :DD

#

thanks a lot

quartz kindle
#

👍

split hazel
#

im supposed to be revising for a business and computer science mock exam yet im here doing this stupid shit

#

college btw + looking for a new part time job

#

@quartz kindle imagine after adding threads i add async support to c++

#

cant live without javascript await syntax

quartz kindle
#

hahah

#

good luck

#

async should be easier to implement than threading

#

its just timers and loops

split hazel
#

true but i think its a little different with c++

#

i need some threads under the hood

#

if i want to be able to use await keywords that is

quartz kindle
#

try creating an event loop in c++

#

and reinvent node

split hazel
#

lmao

#

threads arent even all about performance

#

its all single core right now

#

might make it multicore though

#

complicated

earnest phoenix
#

nodec++

#

node.cpp

split hazel
#

cursed

earnest phoenix
#

C++ nodejs like runetime

split hazel
#

so all processes have a main thread

#

sounds good

earnest phoenix
#

Just make nodejs but for c++ ez

split hazel
#

you can if you really want to

#

but why

earnest phoenix
#

There is no reason why

#

Do it to do it

#

Might look good on a portfolio ngl

radiant kraken
#

no it doesn't

earnest phoenix
#

It does if I say it does

split hazel
#

burh

earnest phoenix
radiant kraken
#

it'll make you look dumber

earnest phoenix
#

Isn't that the point of portfolios?

radiant kraken
#

LMAO

split hazel
#

you get sued by nodejs

#

insert mr incredible meme

earnest phoenix
#

is node a trademarked name?

split hazel
#

dont know but i know among us is

earnest phoenix
#

Apparently nodejs is trademarked

#

according to their website at least

#

unless I read it wrong

#

cant be bothered to re-read it

split hazel
#

nice

#

by the way does anyone have an idea for an os process event system

#

so processes can setup a listener to another process/resource and that process can dispatch events

#

problem is how would events run/be called in the destination process

wheat mesa
#

queue every single event and handle one event every 3 seconds

#

Most responsive OS in existence right there

split hazel
#

pf

#

but i also dont want that event to interrupt the execution path of the process

modest maple
#

Would recommend look at how systems like the tokio executor work

#

Because that's essentially how os schedulers work with threads

split hazel
#

i got a good grip on the thread situation

#

but now i need a good grip on events

quartz kindle
#

or shared memory

split hazel
#

shared memory i dont want because you have to waste a lot of resources checking if an event happened

#

very inefficient

quartz kindle
#

arent unix domain sockets just a piece of shared memory in a ram disk?

split hazel
#

i have no idea lol

#

how do keyboard process events for windows work

#

that could be a good example

quartz kindle
#

didnt you say you'd have to query the device to receive data?

split hazel
#

i mean i do query it to receive data

#

but i know when to query due to hardware events

#

which raise an interrupt letting you know the keyboard/device has data available

quartz kindle
#

dont atomics have events?

split hazel
#

atomics?

quartz kindle
#

i have no idea how low level atomics work, but in js you can use atomics to wait for a byte in a buffer to change

split hazel
#

never heard of them lmao

quartz kindle
#

js has a SharedArrayBuffer thing, which is essentially shared memory for workers

#

and it has atomic functions to guarantee any operation on that memory is not interrupted by another worker

split hazel
#

it does seem very interesting but it relies on an event loop doesnt it

quartz kindle
#

so you can create locks and events with that

#

atomic locks are blocking

#

so they cant be used in the main thread

#

but inside workers, you set up an atomic wait on a specific byte in the shared array buffer

#

and that entire thread will be blocked until another thread changes that byte

split hazel
#

i think thats basically thread parking under the hood

quartz kindle
#

something like that i guess

split hazel
#

my thought on a possible solution is maybe upon a process attaching an event listener to a resource, the os creates a new thread with an execution path of the handler function and events that happen while an event is still being processed are simply queued - and while no event is available the os will simply park the core/suspend it forever

#

thread* not core

#

a special kind of thread which will be distinguishable via a flag

quartz kindle
#

yeah but for IPC for example, both processes would need to access a piece of shared memory and exchange data that way, im pretty sure thats how domain sockets work

#

although they have an entire protocol built around it

#

mmaps would be a lower level version of domain sockets

split hazel
#

but then ipcs would fall under the same problem wouldnt they

#

it would need to notify the destination that data is incoming

#

but then that would interrupt executing code

#

and i dont have an event loop yet lol

quartz kindle
#

yes, and the destination would need to either query the memory for changes, or use an atomic wait, if that exists in C++

split hazel
#

ah so an old style c# websocket implementation

#

but then i want that kind of thing as simple as possible

#

creating a new thread and applying mutex locks on it is a bit complicated for each event

split hazel
#

or i could use that idea and extend on it

#

creating a listener would create a new thread which is parked until the os unparks it which would be caused by a system call by the host process

quartz kindle
#

if you create an event loop, then everything should be easier, you could just query all sorts of I/O for changes once per loop

split hazel
#

the scheduler is sort of an event loop lol

quartz kindle
#

ye

split hazel
#

there is no good way of going about it without creating a new thread

#

thats fine tho

#

because i really want the main thread to be independent

#

and be able to run mid events

quartz kindle
#

node.js by itself already runs like 4-6 threads

#

for all sorts of I/O and events

split hazel
#

yeah i know

#

dont know what they do though

#

could only find uses for 2 threads

#

1 main thread 2 runs async tasks

#

or maybe multiple running async tasks

#

i want to test something

quartz kindle
#

it runs on libuv

#

libuv maintains a thread pool

#

which is called upon for IO operations

split hazel
#

what happens on linux when a thread is waiting for user input via cmd line but another thread logs something during that

#

just so i know how to handle it

#

because my cmd line system is purely based on system calls

#

theres a print system call and a get input system call

#

which blocks the thread until an input has been entered

#

well process in this case

quartz kindle
#

or something like that, i dont know how it works on low level

#

cmd/terminal should have some sort of signaling, and it receives signals from processes that subscribe to it

#

have you implemented a circular buffer?

split hazel
#

what is that

#

and i got an idea on handling that

quartz kindle
#

thats one of the ways to handle reading and writing to/from a memory location

split hazel
#

my idea is upon something being printed during input mode it will simply keep the input text at the bottom of the terminal until you press enter

#

right so i think i have pretty much everything i need

#

i'll do a start on the planning tomorrow when im free from class

split hazel
#

how do signals work

#

are signals on a separate thread

simple stump
#

When trying to fetch a channel, I get the error saying:

                channelThing.delete();
                                   ^

TypeError: channelThing.delete is not a function

Is it not possible to fetch a channel by name?

let channelThing = newState.guild.channels.fetch(name => name.name === memberID).catch(() => null);
if (!channelThing) {
  return;
} else {
  channelThing.delete();
}
quartz kindle
earnest phoenix
#

Also why are you catching it like that. I am sure you'd wanna respond to an error that occurs when fetching a channel cause that channel might not exist.

simple stump
earnest phoenix
#

Well tbh you could be left with wondering why something isnt working and it very well could be the channel doesn't exist so at least logging the error is logical then just not doing anything with it

quartz kindle
#

he is doing something with it

earnest phoenix
#

yea nothing

quartz kindle
#

he is checking if it exists

#

if it doesnt exist, dont do the thing

earnest phoenix
#

Yes but there could be errors that come from that

quartz kindle
#

highly unlikely in this situation

earnest phoenix
#

I mean yes but still

#

It doesn't seem like good practice to just shut an error up like that

quartz kindle
#

thats pretty much a standard way of "do something if exists, otherwise do nothing"

earnest phoenix
quartz kindle
#

its not shutting up the error

#

its using the error as a signal to not proceed

earnest phoenix
#

Mm oka ig

quartz kindle
#

the error in this specific case is irrelevant because no matter what kind of error you get, it will always be used the same way

quartz kindle
#

pretty much how streams are implemented under the hood

earnest phoenix
#

That looks confusing mmLol

quartz kindle
#

using a finite block of memory to process infinite amounts of data

split hazel
#

never knew that that's awesome

simple stump
# simple stump When trying to fetch a channel, I get the error saying: ``` chan...

Update to this. I logged the error:

DiscordAPIError: Invalid Form Body
channel_id: Value "name => name.name === memberID" is not snowflake.
    at RequestHandler.execute (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:298:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async RequestHandler.push (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:50:14)
    at async GuildChannelManager.fetch (/home/container/node_modules/discord.js/src/managers/GuildChannelManager.js:183:20) {
  method: 'get',
  path: '/channels/name => name.name === memberID',
  code: 50035,
  httpStatus: 400,
  requestData: { json: undefined, files: [] }
}

Current code:

let channelThinge2 = newState.guild.channels.fetch(name => name.name === player2).then((channelThing) => {
  if (!channelThing) {
    // sorta useless but i keep thsi here just cause lol
    return;
  }
  channelThing.delete();
}).catch((err) => console.error(err));
split hazel
#

and I asked some people if they know how signals work in processes

quartz kindle
#

you cant use .fetch() the same way you use .find()

simple stump
#

ah

quartz kindle
#

you cant fetch a channel by name

#

fetch can only be used with IDs

simple stump
#

ty

#

thats helpful

#

When trying to catch finding a cache'd channel, I still get an error which then crashes the bot. How would I use try catch correctly?

                let channelThing = message.guild.channels.cache.find((name) => name.name === player1);
                setTimeout(function () {
                  try {
                    if (!channelThing) {
                      return;
                    }
                    channelThing.delete();
                  } catch(err) {
                    console.error(err);
                  }
                }, 4000);
earnest phoenix
quartz kindle
simple stump
#

so would this

setTimeout(function () {
  try {
    let channelThing = message.guild.channels.cache.find((name) => name.name === player1);
    if (!channelThing) {
      return;
    }
    channelThing.delete();
  } catch(err) {
    console.error(err);
  }
}, 4000);

be correct?

quartz kindle
simple stump
#

ah

#

so then id need let channelThing = await message.guild.channels.cache.find((name) => name.name === player1);

quartz kindle
#

so one of these: ```js
try {
await channel.delete();
} catch(e) {

}
orjs
channel.delete().catch(...)

quaint wasp
#

how do I async a timeout..

#

i forgot

#

(in js)

#

ping in replies...

proven lantern
#

can components like buttons not be sent in DMs?

boreal iron
#

They can?!

proven lantern
#

i dont think so

#

the message goes through, but no buttons

#

sad times

#

oh wait

#

nm

boreal iron
#

You must be don’t something wrong

#

Interactions and components are global

#

*globally accessible

#

Send me an example component object, wanna test it out on mobile

proven lantern
#

sorry, i figured it out like one sec after i typed that

boreal iron
wheat mesa
quaint wasp
#

thanks

boreal iron
#

Thought he meant a timeout promise oldEyes

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

boreal iron
round cove
#

I'm having such a weird issue where emoji mentioning works fine when mentioning a ton of them in a single embed but when broken up into multiple embeds some of them don't resolve correctly and it's making zero sense.

#

Example.

#

One has a list of them all (Quite a lot) and they all load fine, but when loading 12 (lol) embeds some of them don't resolve.

boreal iron
#

It also doesn’t make sense that Discord consistently has trouble to fetch images - from any source - and to show it in Discord.
Even if your webserver logs a successful request.

round cove
#

Right lmao

#

Think this might be sorta related?

boreal iron
#

As the requests are successful and the emojis are known I would assume it’s an issue with the cache.

#

But who knows

round cove
#

My client? That wouldn't make sense for it to load in one embed and not the other.

boreal iron
#

Or generally the cdn having trouble to deploy the content on request - probably in time - as I also assume there’s a very short timeout if an image/emoji can’t be delivered by the cdn in time it will be removed

boreal iron
#

The cdn

round cove
#

Ah.

#

Hmmm

#

It always works when sending the single embed, so maybe it's able to get them all there?

boreal iron
#

Yee I got that and that also doesn’t make sense KEKW

round cove
#

Literally makes no sense.

#

Sigh

boreal iron
#

Yeah

#

Who knows what’s going on in the backend

round cove
#

It even fucks with the reaction portion too though

#

Like ?????????????

boreal iron
#

That’s we get when dealing with Discord and it’s API

#

Trouble, unexpected results and even more weird shit freerealestate

round cove
#

Oh I guess you can't react if you don't share servers.

#

I'm using prod data on my test bot to see fuller results and of course it shouldn't be able to react with emojis it doesn't have access too.

#

That makes sense.

#

But the image stuff is weird

#

I'd almost be convinced it's a non shared server thing if it DIDN'T work when listing in a single embed.

boreal iron
#

It can only use the emojis of the servers it’s in, right?

woeful monolith
round cove
boreal iron
round cove
#

God this makes me so scared to release this rewrite now lmao

boreal iron
#

lol

round cove
#

What if..

boreal iron
#

What can go wrong

round cove
#

I ran it on my prod bot

#

and tested

#

lmfao

#

Testing on prod time Xddddddddd

#

just for these two commands

#

that's all

boreal iron
#

Just note somewhere anything going wrong is the result of discord’s unexpected responses

round cove
#

Lmao

boreal iron
#

What does both even do?

round cove
#

Okay so on prod it's only missing a handfull

round cove
boreal iron
#

The commands you mentioned

round cove
#

Ah.

#

One list all react roles made in the server. The other is more detailed and shows the categories each react role is in.

#

This is the category one.

#

And this is just the all list.

boreal iron
#

Are you going for a react - role assignment bot?

round cove
#

Yeah it's been my main bot for a few years now

#

humbly small bot lmao

#

~1500 servers

boreal iron
#

Does that even get the privileged intent?

round cove
#

The current system is so god awful, I've spent the last few months rewritting it into something much more pretty and useful

#

It literally only needs reaction and member

#

and it has those

#

All messages it tracks are its own.

craggy pine
#

By chance, would someone know why I'm getting a RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values must be non-empty strings. error on my embed? I did a console.log on all of my values, and they are indeed not empty.

    const animeEmbed = client.extends.quickEmbed(anime.animeResult[0].title, anime.animeResult[0].synopsis)
      .setURL(anime.animeResult[0].url)
      .setImage(anime.animeResult[0].image_url)
      .addFields({name: `Episodes`, value: anime.animeResult[0].episodes, inline: true},
        {name: `Rating`, value: anime.animeResult[0].rated, inline: true},
        {name: `Score`, value: anime.animeResult[0].score + ` / 10`, inline: true},
        {name: `Anime Type`, value: anime.animeResult[0].type, inline: true},
        {name: `Start Date`, value: moment(anime.animeResult[0].start_date).format(`MM/DD/YYYY`), inline: true},
        {name: `End Date`, value: moment(anime.animeResult[0].end_date).format(`MM/DD/YYYY`), inline: true},
        {name: `Airing`, value: anime.animeResult[0].airing, inline: true})
      message.channel.send({
        embeds: [animeEmbed]
      })

My console.logs in order by field

13
R+
7.52 / 10
TV
07/24/2004
10/16/2004
false
round cove
#

My partnered server uses it for a god awful amount of roles.

#

because it's a comp sci uni server

#

and there are so many classes lol

boreal iron
#

Well I rewrote my whole bot to a perfectly (for me) OOP based structure I can work with for just a few guilds, now 114 as my target interest group is small but still did the work

craggy pine
#

I'll remove airing and see if it happends still sec.

round cove
#

Very proud

craggy pine
boreal iron
round cove
boreal iron
#

As it’s no string output for the value

round cove
#

Yeah that's what I thought.

craggy pine
#

Well as mentioned. I did indeed remove the airing and still recieved the issue

#

But I will try the string() thing

round cove
#

You could use template strings too.

craggy pine
#

btw