#development

1 messages · Page 219 of 1

pearl trail
#

hoe about arch

quartz kindle
#

hoe about it indeed

sharp geyser
#

we always hoein for linux

past field
#

so you're saying

#

(217 - 100)/2 = x coordinate? what is "squareX" ?

#

the numbers are 100px

lyric mountain
#

AND it comes in like 7 flavors

lyric mountain
#

As in, the size of the X character ur printing

past field
#

idk what that means lol side_eye

lyric mountain
#

It means find out how many pixels X takes

#

Literally the size of it

past field
#

the entire fox?

#

box*

lyric mountain
#

X

past field
#

cause the font size im using is 100px

lyric mountain
#

Font size is irrelevant

#

Find out the dimensions of the character

#

As in, vertical and horizontal pixels

#

Search online if you don't know how

#

Don't think you get it

#

You need the pixel size of

#

>>>> X <<<<

#

The letter X, the thing ur using to mark the squares

past field
#

OH.

lyric mountain
#

The letter after W and before Y

past field
#

well i changed that to use an image as adab

#

so it looks like this now

lyric mountain
#

What is adab

past field
lyric mountain
#

Ok, then find the dimensions of it

#

Width and height

#

The rest is very straightforward

past field
#
ctx.drawImage(dabImage, x - 67, y - 61, 134, 122);
#

which is this right?

lyric mountain
#

No

#

I don't want the code

#

I want the image dimensions

past field
#

sorry i've never done this before lol so im learning

#

ah ok i get you now

lyric mountain
#

Open the file in any image viewer

sharp geyser
#

What is the width & height of the image in pixels

#

e.g 256x256

past field
#

1640x1640

lyric mountain
#

What image are u look at?

#

The entire bingo or the small markers?

past field
#

small markers

lyric mountain
#

They're 1640x1640?

past field
sharp geyser
#

thats fucking massive

lyric mountain
#

Holy hell put that in an image editor and downscale it to like 128x128

#

You'll kill your memory by dealing with images that large in such high amount

#

Resize it to what'd be the size you'll actually use

#

So you don't need to resize it during runtime

past field
sharp geyser
#

this is 128x128

past field
#

but that makes sense!

past field
lyric mountain
#

Using a pre-resized image is much better than doing it for every single slot

past field
lyric mountain
#

Now draw the image without resizing

#

The horizontal coordinate will be leftPadding + (slotWidth / 2 - markerWidth / 2) * (currentIndex + 1) + gap * currentIndex

#

LeftPadding is the red are at the left size

#

SlotWidth is the white squares' width

#

MarkerWidth is the width of the marker chip ur using to mark slots

#

Gap is the tiny red gap between slots

#

And currentIndex is your current iterator value

#

If ur using one

#

Otherwise 0 for first slot, 4 for the fifith slot

#

Same formula for vertical coordinate, just replace widths with heights

sharp geyser
past field
#

shiiieetttt side_eye

lyric mountain
#

Literally just replace values in the formula

sharp geyser
#

Questionable server

past field
sharp geyser
#

mhm

past field
#

ok let me do this piece by piece

lyric mountain
past field
#

so if i’m looking at this

sharp geyser
#

I hate how offcentered that is

past field
#

the red space on the left from the side of the photo to the first row B is the LeftPadding

lyric mountain
#

Yes

past field
lyric mountain
#

The count of red pixels

#

Till the first white pixel

past field
#

what image editor do you use to get the pixels? i’m using pixlr but idk if it’ll show me pixel counts

#

or if it does idk how to display it

#

can i just pay one of you to find the coords side_eye

lyric mountain
#

Anything will do

#

Are u at pc?

past field
#

yes

lyric mountain
#

Open paint

past field
#

i'll need to resize the bingo board as well honestly

#

its 1428x2000

lyric mountain
#

Yeah that's unnecessarily big

sharp geyser
#

discord likely wont even display that will it

lyric mountain
#

It will

past field
#

it will

sharp geyser
#

Whats discord's max size

#

cause I remember there being a limit before its not embeddable

past field
lyric mountain
#

My tcg arena is like almost 3k width

sharp geyser
#

Wtf

lyric mountain
#

Cuz I need to show the cards at real size

#

Else people can't read em

#

Each card is 225px wide

past field
#

i have paint open

lyric mountain
#

Zoom in, a lot

#

Put the mouse where red and white meet

past field
#

ok

lyric mountain
#

Look bottom left of the screen, there'll be ur mouse coordinates

sharp geyser
#

when the fuck was thread channels added to discord

lyric mountain
#

First value is ur padding

#

Lmao, a year or so ago

sharp geyser
#

ok

#

just curious

#

cause I was just reading an article from 5 years ago talking about threads

#

💀

lyric mountain
#

Just see how old top 10 fish thread is

#

They created it when it was released

past field
#

leftpadding 147

lyric mountain
#

Put that in the formula

past field
#

leftPadding + (slotWidth / 2 - markerWidth / 2) * (currentIndex + 1) + gap * currentIndex

lyric mountain
#

For the other values it's a bit harder to get with paint

past field
#

so 147 + (218 / 2 - markerWidth / 2) * (currentIndex + 1) + gap * currentIndex

lyric mountain
#

Yes

past field
#

slot width is the width of the boxes?

lyric mountain
#

Yes

sharp geyser
#

now to get the width dont you need to start at one end of the box, then do the other and subtract the two values to get the actual width?

#

or is there an easier way

lyric mountain
#

To get with paint, move the whole image to the left till the slot touches the border

sharp geyser
#

or that

lyric mountain
#

Then repeat the mouse thing

sharp geyser
#

man I was bout to have bro do some math

lyric mountain
#

With gimp or smth it'd be easier lul, trying to use vanilla tools

#

But Microsoft doesn't help with not updating paint since Windows 98

sharp geyser
#

Why update it if it does its job - some tech at microsoft

lyric mountain
#

It STILL doesn't have a proper selection box

past field
#

218x205 is the first box wxh

lyric mountain
#

And no transparency

sharp geyser
#

Bah who needs those

sharp geyser
lyric mountain
past field
#

no they are all the same

sharp geyser
#

oh ok

#

bout to say

lyric mountain
#

They're slightly squished

#

Not perfect squares

sharp geyser
#

i'd honestly resize them to be 218x218

#

but thats just me

past field
#

so 147 + (218 / 2 - 128 / 2) * (currentIndex + 1) + gap * currentIndex

#

marker width? as in the chip it's dabbing with?

#

aaron resized it to 128 so that would be 128 correct?

sharp geyser
#

yea

#

128

past field
#

so 147 + (218 / 2 - 128 / 2) * (currentIndex + 1) + gap * currentIndex

sharp geyser
#

yep

#

and now all thats left is to find the gap width

past field
#

what is current index?

sharp geyser
#

if you are looping you'd have one

#

else just use the index of the square as if its an array

#

e.g first square 0, second 1, third 2, so on so forth

past field
#

and what is gap width?

lyric mountain
#

The tiny red distance between each slot

past field
#

ah ok

#

hm

#

ok i’m seeing it

#

still just a tad bit confused on the currentIndex tho

sharp geyser
#

right

#

so currentIndex is just the current square you are working on

#

e.g say you wanted to place a chip in square 1

#

the currentIndex would be 0

#

now if you were looping over all squares, currentIndex would be the index of that current interation

#

e.g

for (let i = 0; i < 10; i++) {
  let currentIndex = i;
}
past field
#
  • the gap value
lyric mountain
#

Yes

past field
#

or this is math i’m doing?

sharp geyser
#

thats the math the code will be doing

#

to figure out the X/Y of where to place the marker in the square

past field
#

ahhh ok i see now

lyric mountain
#

You can pre-calculate it if you want, but keeping it as a formula is fine too

sharp geyser
#

pre-calculation is a little weird though

past field
#

will this same logic work with the generation of the numbers as well?

lyric mountain
#

It'll be easier to remember what it's doing

sharp geyser
#

You'd have to do that for every square I think

lyric mountain
#

I meant pre calculate the other values

sharp geyser
#

doing so in code as a formula allows you to just calculate it based off the current square

sharp geyser
lyric mountain
#

Like the divisions

sharp geyser
#

yuh

lyric mountain
#

Anyway, you can use it for the numbers too ofc, but they'll be centered too

#

Do note tho, text is usually bottom-aligned

sharp geyser
#

147 + (109 - 64) * (currentIndex + 1) + gap * currentIndex

lyric mountain
#

So for vertical you'll sum instead of subtract

sharp geyser
#

even further
192 * (currentIndex + 1) + gap * currentIndex /j

past field
#

shit wait

sharp geyser
#

sorry ima stop im probably adding to confusion

past field
#

let me dissect this

lyric mountain
#

As padding is constant

sharp geyser
#

ah right

#

dah doi

#

my bad

lyric mountain
past field
#

so

#

errmm

lyric mountain
#

The formula is your x coordinate

#

Now repeat it again for y coordinate

past field
#

what would be different to find the y

lyric mountain
#

Instead of widths you'll use heights

past field
#

ah

lyric mountain
#

And padding is the top margin

sharp geyser
#

https://pastes.dev/peyHjbkyRE for some reason in between calling HandleNumber it is consuming the first number in the expression 2 + 2 so it is tripping up because it is reading the + and ignoring it causing an index out of range error

#

I've tried debugging, but I don't see what is causing it to consume the first number before tokenizing it

sharp geyser
#

Solved the issue ironically using chatgpt

sharp geyser
#

Unless defining an AST is part of lexing I can't remember, if so then its not completely done

frosty gale
# pearl trail hoe about arch

arch linux has the consensus that you should put in the most effort possible to achieve one thing which i do not agree with

#

i think an operating system should just work out the box and features should be extremely easy to set/configure

#

dont have too much time to fiddle with my os for hours to fix one small thing lol

#

i tried endeavouros yesterday and KDE themes are absolutely broken on it and are a pain to install

#

im putting in a second attempt today to install the theme i want

#

and yes themes do matter to me a lot dont judge me

#

girl just wants her os to look good

lyric mountain
#

definitely not me who spent 2 days configuring plasma to get it exactly how I wanted

wheat mesa
#

So yeah you’ve completed Lexing pretty much

lyric mountain
#

lexing is annoying to get right, especially with recursive structure

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

real rose
#

i had to do that for palworld

sage bobcat
#

One message removed from a suspended account.

real rose
#

i had to use a program made specifically for doing what i needed with it

#

because same as you, i couldnt open it at all

#

google just says to use python to process it 💀

lyric mountain
real rose
#

can it? Dont think it could open my 15gb level.json file 😭

lyric mountain
#

you can also use terminal if u know the line ur looking for

real rose
#

i cant remember now if i tried it, but i imagine i did

lyric mountain
real rose
#

damn

#

i was likely impatient then

lyric mountain
#

also intellij

#

since it doesn't load the whole file at once

real rose
#

i didnt try intellij, but i tried webstorm and pycharm from jetbrains

lyric mountain
#

terminal will be the fastest option tho, just grep the content you want

lyric mountain
real rose
#

ooh

#

didnt know about that

#

good to know though

#

ty

past field
#

147 + (218 / 2 - 128 / 2) * (currentIndex + 1) + 13 * currentIndex

#

@lyric mountain right? for x coordinate

lyric mountain
#

ur still at that

#

yes

frosty gale
past field
past field
#

still did it wrong

#

it did this

sharp geyser
#

💀

past field
#

the tears in my eyes rn

sage bobcat
sharp geyser
#

sure

#

if you have git installed

#

just use the git-bash terminal

lyric mountain
#

do note they're neatly packed in a square

#

so the sizes you used simply dont match the real image size

sharp geyser
#

he also told them all to go to one index did he not

lyric mountain
#

oh also

#

the vertical padding is wrong

sharp geyser
#

Also me personally, I would not be generating the numbers on the board on the fly (just as a side note)

lyric mountain
#

you used the same values from horizontal apparently

sharp geyser
#

Just generate 1000 predefined boards /j

lyric mountain
past field
#

kinda scared to show my code now

sharp geyser
#

just do it

#

quicker you do

#

quicker we can help

past field
#

most of it is AI SideEye SideEyeRight

sharp geyser
#

most of what new devs do is use AI

#

so its not surprising for us anymore

past field
sharp geyser
#

We don't advise it

#

but it's whatever

#

where are you using the formula

lyric mountain
#

dont do this

#

it'll prevent u from deploying the bot to a server

#

use relative paths

#

if Da-High-Roller-Bot-main is the name of your project's root, then the path is simply ./hrbingoboard.png

sharp geyser
#

Bro I swear to fucking god, and all things holy

past field
#

ok

sharp geyser
#

if Automod blocks me one more fucking time

#

i give up

#

😔

lyric mountain
#

but well, code regardless, you just need to fix your units

#

the formula is correct, as the numbers assembled into a square

past field
lyric mountain
#

do it for everything

#

all paths must be relative to your project's root

#

nothing absolute

sage bobcat
#

One message removed from a suspended account.

sharp geyser
#

does that count

past field
lyric mountain
#

no

past field
lyric mountain
#

open the image in any image viewer

#

it'll tell you the sizes

sharp geyser
sharp geyser
#

A single pixel

past field
#

i got $2m waiting for you

sharp geyser
#

fixing to make bank

past field
#

this image is 1500x2000

#

i need to resize this

#

what's a good size? like 300x420?

sharp geyser
#

what

#

the board image?

past field
#

yes

sharp geyser
#

why would you resize it

past field
#

isn't 1500x2000 really big?

sharp geyser
#

That is a 300x420 image

neon leaf
#

too low res tbh

past field
#

ok so keep it at 1500x2000

#

yeah really low res

#

true

past field
#

OH.

#

I think i see what i did wrong.

real rose
#

BINGOO

past field
#

I THINK

sharp geyser
past field
#

leftpadding 728px

real rose
#

so real for that

past field
#

nvm i confused myself

surreal sage
#

This GitHub Sponsors profile is waiting to be reviewed by GitHub.

#

its been over a week bruh 😭

neon leaf
#

well

#

dont get too excited

#

there is a 3 month period where you cant payout

#

after you got reviewed

surreal sage
#

thats fine

neon leaf
#

I think i got reviewed in like 6 hours tho lol

surreal sage
#

dudeee

past field
#

WAIT.

#

I GET IT NOW.

#

YES.

#

well, almost

#

so close

#

ok so i almost have the numbers centered

#

@sharp geyser @lyric mountain

#

thank you!!! i figured it out from here, i get it now

#

but the dab markers are a bit off

real rose
#

looking good

#

id imagine the markers are the same concept as number placement

#

you'll need to match the resolution to overlay your image to scale

#

(idk how to best phrase that)

lyric mountain
#

The numbers are off too

#

Appears to be wrong slot sizes

past field
lyric mountain
#

Don't guess, the numbers are there already

#

All you need to do is read them

past field
#
const coordinates = Array.from({ length: 25 }, (_, index) => {
        const rowIndex = Math.floor(index / 5);
        const colIndex = index % 5;
        const x = 200 + (218 / 2 - 128 / 2) * (colIndex + 1) + 180 * colIndex;
        const y = 700 + (218 / 2 - 128 / 2) * (rowIndex + 1) + 180 * rowIndex;
        return [x, y];
    });
#

this is what i have at the moment

#

for number placement

lyric mountain
#

Yes, the formula is correct, but some value u passed to it is wrong

#

Double check padding, gap and slot sizes

past field
#

i guess i’m struggling to know which numbers to use

sharp geyser
#

WxH

#

1428 is the width, 2000 is the height

quartz kindle
#

ew why is it crooked

past field
#

but what number do i use to put in the formula?

sharp geyser
sharp geyser
quartz kindle
#

im not crooked, im cooked

sharp geyser
#

X is horiztonal, Y is vertical

#

Width is horizontal, Height is vertical

quartz kindle
#

uh, isnt it the opposite?

past field
#

leftPadding + (slotWidth / 2 - markerWidth / 2) * (currentIndex + 1) + gap * currentIndex

sharp geyser
#

you'd use width when calculating the X values, and height when calculating the Y values

sharp geyser
#

X goes left to right, Y goes up and down

quartz kindle
#

left to right = horizontal

past field
#

x is horizontal

sharp geyser
#

oh wait

#

FUCK

#

😭

#

AHEM

past field
#

i know what you meant lol

sharp geyser
#

Anyway

#

point stands

#

Width = X, Height = Y

#

so use width to calcualte X and Height to calculate Y

quartz kindle
#

lmfao

sharp geyser
#

oh tim

#

I made a lexer!

#

Step 1 to making my own programming langage (granted I used crafting interpreters to do it)

#

but still I think I understand teh code 99%

quartz kindle
#

nice

sharp geyser
#

extra 1% is mainly just confusion on how the fuck Peek works

#

😭

past field
#

shit

quartz kindle
#

theres something iffy about that formula

past field
#

idk what part is off

sharp geyser
#

cuz peek is literally

private char Peek()
{
  if(IsAtEnd) return '\0';

  return Source[current] // How is this the next character, is it not the one currently being lexed?
}
past field
#

right now i have

#
const coordinates = Array.from({ length: 25 }, (_, index) => {
        const rowIndex = Math.floor(index / 5);
        const colIndex = index % 5;
        const x = 200 + (225 / 2 - 128 / 2) * (colIndex + 1) + 170 * colIndex;
        const y = 700 + (225 / 2 - 128 / 2) * (rowIndex + 1) + 170 * rowIndex;
        return [x, y];
    });
#

and it looks like

#

but idk what part is off

quartz kindle
#

where was the marker supposed to be?

past field
#

the marker is suppose to be directly ontop of the free space and ontop of the numbers

quartz kindle
#

the formula doesnt look right

past field
#

this is the updated code

sharp geyser
#

342 lines dang

past field
#

yeah it's wild

#

i'm sure parts of it can be optimized though

quartz kindle
past field
#

tim been tying for a min, im scared af now

#

oh there it is

quartz kindle
#

change padding slot and marker to width for x and height for y

quartz kindle
#

padding = distance from image border to the white squares

#

slot = size of the white square

#

marker = size of the marker

#

gap = size of the small red line between white squares

#

for x, take the width of all the above
for y, take the height of all the above

past field
#

so instead of x = 200 + (225 / 2 - 128 / 2) * (colIndex + 1) + 170 * colIndex I would use ```x = 200 + (225 * (index + 1)) + (170 * index) + (225/2 - 128/2)111

quartz kindle
#

theres no way gap is 170

#

also, i made a mistake, should be just index, not index+1

past field
#

i drew a line between the gap and paints is showing "11 x 1px"

quartz kindle
past field
#

x = 200 + (225 * (index)) + (11 * index) + (225/2 - 128/2)

quartz kindle
#

why the 111 at the end lul

past field
#

y = 700 + (225 * (index)) + (11 * index) + (225/2 - 128/2)

past field
past field
quartz kindle
#

whatever you measured here

past field
#

ok

lyric mountain
#

oh wait nvm

#

yeah I miswrote the formula lmao, forgot the centering should only be applied on the first pass

#

tho u can reduce that to padding + (slot / 2 - marker / 2) + (slot + gap) * index

past field
#

errmmm

#

so i replace this

#
const coordinates = Array.from({ length: 25 }, (_, index) => {
        const rowIndex = Math.floor(index / 5);
        const colIndex = index % 5;
        const x = 200 + (225 / 2 - 128 / 2) * (colIndex + 1) + 170 * colIndex;
        const y = 700 + (225 / 2 - 128 / 2) * (rowIndex + 1) + 170 * rowIndex;
        return [x, y];
    });
#

with

#
const coordinates = Array.from({ length: 25 }, (_, index) => {
        const rowIndex = Math.floor(index / 5);
        const colIndex = index % 5;
        const x = 200 + (225 * colIndex) + (11 * colIndex) + (225/2 - 128/2);
        const y = 700 + (225 * rowIndex) + (11 * rowIndex) + (225/2 - 128/2);
        return [x, y];
    });
#

nvm that's not right

lyric mountain
#

ur using index for both axes

#

u need to use row/col indexes

past field
#

OHHHH

past field
lyric mountain
#

no

#

"index" show refer to the appropriate index

#

not the iterator

past field
#

idk what that means

lyric mountain
#

you have rowIndex and colIndex

#

use them

#

you'll never use the iterator for anything but calculate those two

past field
#

ok i got you

#

ok i updated the formula

#

just need to redo the numbers

sharp geyser
#

I have a feeling part of this is due to the squares not being perfect squares

#

they are squished height wise

lyric mountain
#

yes, you cant use the same value for height if it isn't equal to width

#

aside from that, the numbers appear to be centered by the first digit

#

you need to calculate the total width, not just the first digit

past field
#

shit

#

is that harder

lyric mountain
#

...

#

@quartz kindle I dont remember how to get string metrics from canvas, your take

quartz kindle
past field
#

generating the numbers and dab? yes

#

and canva is where i made the board

#
const { createCanvas, loadImage, registerFont } = require('canvas');
quartz kindle
#

much easier to make the white squares with code, it guarantees the measurements are always exact

#

thats what i would do

past field
#

canvas can do that too?

#

holy shit

quartz kindle
#

canvas can do everything

past field
#

wtf

quartz kindle
#

people make games on canvas

proud plover
quartz kindle
#

the entire board can be done with pure canvas

#

which would also be much faster because it wouldnt need to load any images

proud plover
#

ppl make chess board, connect four and more

past field
#

wtf

#

hold on

quartz kindle
#

my bot generates astrological charts with pure canvas

past field
#

so i dont even need a png of the board

quartz kindle
#

nope

past field
#

so you're telling me

past field
# past field

canvas alone can make a bingo board similar to this?

quartz kindle
#

yes

#

easily

past field
#

stop playing

surreal sage
#

wizardy

sharp geyser
surreal sage
#

is it like

#

find the cute people near u

#

with the icon being genders

#

or what

rigid maple
#

How to import json file in esm

lyric mountain
#

require("...")

rigid maple
sharp geyser
#

import/from

quartz kindle
#

according to the proposal (currently stage 3), it should be like this

import json from "./foo.json" with { type: "json" };
import("foo.json", { with: { type: "json" } });
#

but idk if that was implemented yet

sharp geyser
#

import contents from 'some.json'

#

Do you really need to do that whole with types: json thing

#

thats honestly such an ugly flaw

rigid maple
past field
#

so idont need a png at all?

#

purely canvas?

sharp geyser
quartz kindle
sharp geyser
#

try it

rigid maple
#

no they didn't work either

quartz kindle
#

chrome 91 added this:

import json from "./test.json" assert { type: "json" };
console.log(json.hello);
#

idk if it works on node

quartz kindle
rigid maple
#

yes

#

still keeps giving the same error

quartz kindle
#

according to this, node should support it

surreal sage
#

what was the problem with brave browser

quartz kindle
surreal sage
#

i remember seeing stuff about like

#

bad shit

#

something

#

idk

#

controversy

past field
#

tim

#

help

sharp geyser
lyric mountain
#

as you'll be using pure code, no visual guides

quartz kindle
#

otherwise most complains are just "its another chromium fork, use firefox"

#

im using brave rn

sharp geyser
#

same

lyric mountain
#

I'd love to use firefox, but I cant get behind their shortcuts

#

they aren't even changeable

quartz kindle
#

every single time i tried firefox it was noticeably slower and clunkier

frosty gale
#

so they would get the commission for use of the link

#

and of course that crypto stuff but theyve listened to the feedback and let you disable and hide those elements

#

so i'd say its a pretty solid browser that i use personally

quartz kindle
#

brave was the only browser that never gave me issues on youtube lmao

#

every other one i tried, with ublock and all, always broke youtube at some point

quartz kindle
#

you want to try making it without images?

#

create a canvas, just like you did, then instead of loadimage, do a fillRect to add the red background, then use fillText to draw the texts for high rollers, bingo, etc

#

then on your loop for the numbers, add a fillRect to draw the white squares

frosty gale
#

i think they use the same blocklists are ublock origin too

#

fanboy or whatever its called

quartz kindle
#

ye but afaik they way they block them is different

#

their blocking engine works on a lower level than extensions

distant sand
#

Hey! is it possible to transfer team ownership? if the account has been disabled/deleted? (top.gg team ownership)

frosty gale
#

yeah it is a bit better

#

and theyre not subject to the whole "manifest v3" update which would limit adblocker network interception ability

#

oh what a coincidence

#

google say theyre doing it for better privacy but somehow their enterprise customers arent affected by the manifest v3 restrictions on adblockers?

past field
#

HOLY SHIT

quartz kindle
#

they are literally doing anything they can to make ad blocking a paid feature

past field
#

this shits hard

quartz kindle
past field
#

lol another question

#

different game

#

i have my bot in 2 different servers

#

how can i register the command for it to work in both with no issues?

frosty gale
#

thats why they arent so pushy with things like that on their enterprise products

#

windows enterprise lets you completely disable telemetry for example while normal windows you need to do hacks to do it

quartz kindle
#

im gonna install windows 11 ltsc next time i reformat

quartz kindle
#

or better yet, unique per channel

frosty gale
#

i'll do anything to get away from the consumer windows

#

microsoft manages to make windows worse and worse

#

its seriously making me consider going back to linux

quartz kindle
#

windows 11 ltsc took a long time to arrive

past field
#

hm

#

so here's the code for it

quartz kindle
# past field https://pastes.dev/YWBL2bzLQJ
- let game = {
-    players: new Set(),
-    round: 0,
-    inProgress: false,
-    timer: null,
-    numButtons: 3,
-    timeWindow: 7000,
-    survivalButtonIndex: 0,
-    extraLifeButtonIndex: -1,
-    playerLives: new Map()
-};

+ const games = new Map();
sharp geyser
#

a map is just an object

spark flint
#

object with a fancy name and harder to access info

past field
#

so just add + const games = new Map ();

sharp geyser
#

he is saying remove the game object

#

and make it a map instead

quartz kindle
#
-if (game.inProgress) {
-    await interaction.channel.send('A game is already in progress.');
-    return;
-}

+ const game = games.get(interaction.channel.id);
+ if(game && game.inProgress) {
+    await interaction.channel.send('A game is already in progress.');
+    return;
+ }
sharp geyser
#

you'd index it based off some unique id

#

like either a channel id

#

or if you want to allow multiple games in a channel a game id you generate

past field
#

so this will allow both servers to run games simultaneously with no issues or errors?

sharp geyser
#

yes

quartz kindle
#

servers and different channels too

#

you still need to add code to create the game object

past field
quartz kindle
past field
#

OH

#

ok i get it now

quartz kindle
#

ie

if(!game) {
  games.set(interaction.channel.id, {
    players: new Set(),
    round: 0,
    inProgress: false,
    timer: null,
    numButtons: 3,
    timeWindow: 7000,
    survivalButtonIndex: 0,
    extraLifeButtonIndex: -1,
    playerLives: new Map()
  });
}
past field
#

separate states for each server

quartz kindle
#

exactly

sharp geyser
#

TS my beloved

#

would love to set the type of the map

quartz kindle
sharp geyser
#

no

neon leaf
sharp geyser
#

😭

neon leaf
#

im calling my lawyer

sharp geyser
#

I was called?

quartz kindle
#
const games = new Map<*,*>();
sharp geyser
#

Alright thats it buddy

#

youre going to the slammer

quartz kindle
#
const games = new Map() as Map<*,*>;
sharp geyser
#

tim

#

your experienced role should be revoked

#

thats not something an experienced person would ever write

quartz kindle
#

*,*
w

neon leaf
#
const game = new Map<string, {
    players: Set<string>
    round: number
    inProgress: boolean
    timer: number | null
    numButtons: number
    timeWindow: number
    survivalButtonIndex: number
    extraLifeButtonIndex: number
    playerLives: Map<idk, idk>
}>()
sharp geyser
#

or idk

#

use interfaces????

neon leaf
#

y

sharp geyser
#

Might need it later who knows

neon leaf
#

interfaces suck

#

types ftw

sharp geyser
#

you suck

past field
#

um

#

ok so hold on

neon leaf
# sharp geyser Might need it later who knows
const game = new Map<string, {
    players: Set<string>
    round: number
    inProgress: boolean
    timer: number | null
    numButtons: number
    timeWindow: number
    survivalButtonIndex: number
    extraLifeButtonIndex: number
    playerLives: Map<idk, idk>
}>()

type GameMap = typeof game
export type MapValue = GameMap extends Map<string, infer V> ? V : never
sharp geyser
#

WHat in the absolute fuck did you just show me

neon leaf
#

inferring the value from the map

sharp geyser
#

no

neon leaf
#

yes

sharp geyser
#

no

neon leaf
#

yes

sharp geyser
#

no

neon leaf
#

prove

sharp geyser
#

well ik what it does

#

but no

neon leaf
#

ok

sharp geyser
#

There is never a need to do that

#

😭

past field
#

ok so

#

looking at this

neon leaf
past field
#

remove lines 4-14

sharp geyser
#

I use actual good code tho

#

I program in rust

#

💪 🚀 moyai_chad

neon leaf
past field
#

and add ```js
const games = new Map();

neon leaf
#

*/ public extend<V extends Validator<any, any, any>, _Data extends [any, any] = V extends Validator<infer Data, infer Context> ? [Data, Context] : [{}, {}]>(validator: V): Validator<Data & _Data[0], Context & _Data[1], Middlewares> {

sharp geyser
#

yea I closed that immediately

past field
#

could i not just add const games = new Map(); ontop of the game object?

#
const games = new Map();

let game = {
    players: new Set(),
    round: 0,
    inProgress: false,
    timer: null,
    numButtons: 3,
    timeWindow: 7000,
    survivalButtonIndex: 0,
    extraLifeButtonIndex: -1,
    playerLives: new Map()
};
#

like this?

sharp geyser
#

no

#

you can ofc make it into a variable

#

but there is no need

past field
#
const game = new Map<string, {
    players: Set<string>
    round: number
    inProgress: boolean
    timer: number | null
    numButtons: number
    timeWindow: number
    survivalButtonIndex: number
    extraLifeButtonIndex: number
    playerLives: Map<idk, idk>
}>()

type GameMap = typeof game
export type MapValue = GameMap extends Map<string, infer V> ? V : never
sharp geyser
#

no

#

thats ts stuff

#

ignore that

#

we were rambling on

past field
#

oh lol

sharp geyser
#

this is the important thing to note

#

look at that

past field
#

so remove 4-14

#

and put that there?

#
if(!game) {
  games.set(interaction.channel.id, {
    players: new Set(),
    round: 0,
    inProgress: false,
    timer: null,
    numButtons: 3,
    timeWindow: 7000,
    survivalButtonIndex: 0,
    extraLifeButtonIndex: -1,
    playerLives: new Map()
  });
}
sharp geyser
#

you'd set the game state whenever a game is started

#

idealy you'd store the games map somewhere you can access anywhere

#

like on the client

past field
#

im gonna cry

sharp geyser
#

client.games since djs attatches the client to literally everything

past field
#

i have $2m more dollars for you to fix it up for me lol

sharp geyser
#

interaction.client.games.set() is how you'd call it then

#

it's simple

#

wherever you instantiate the client e.g const client = new Client() or const client = new Discord.Client() whatever

#

just put client.games = new Map() under it

#

then inside your game command, when its called set the game state

past field
#

okay so

#

remove game object

#

makeit amap

surreal sage
#

a friend is learning javascript

#

and i saw this

neon leaf
pale vessel
frosty gale
# surreal sage

tell him to maybe consider choosing another course of study

surreal sage
#

luckily he has me (a self acclaimed professional) to fix his errors

surreal sage
#

(typescript) how can I set the type of a dictionary and then also make a type of the values like a "string1" | "string2"

#

this is what I want

#

but

#

replacing as const with as const satisfies Record<number, string> does the same thing

sharp geyser
#

Im confused on what you really want to do

surreal sage
#

ok so i have this large object as record<number, string>

sharp geyser
#

yuh

surreal sage
#

i want to create a type where the values are like the enum

sharp geyser
#

yuh

surreal sage
#

but I don't know how to do that

sharp geyser
#

so a union type using predefines trings

surreal sage
surreal sage
#

im not too familiar with the typescript terms

sharp geyser
#

right

#

so you can make it readonly by using Object.freeze and give it a type of whatever you want

#
const dictionary: Type = Object.freeze({})
#

This will make it read only not allowing you to modify it

#

and also setting the type and able to index it how you want

#

assuming the key you are giving is the right type for that Record<number, string>

#

I assume this is what you were looking for?

surreal sage
#

yes :3

#

is there a way to do it without Object.freeze

#

like Readonly<something>

#

or will that screw up the value type

sharp geyser
#

you can sure

#

iirc all it does tho is call Object.freeze anyway

#

but if you want the ts code to look nicer then go for it

surreal sage
#

ya but how

sharp geyser
#
const dictionary: Readonly<Record<number, string>> = {};
surreal sage
#

i dont know the type though

lament rock
#

Types have no effect on the runtime at all

#

You must call Object.freeze

surreal sage
#

ya okay

surreal sage
surreal sage
sharp geyser
lament rock
#

When something is a type ReadonlyArray, TS will tell you its readonly but you can tell it to stfu

sharp geyser
#

I see

lament rock
sharp geyser
#

That's kind of wonky

#

whats the point of it then

lament rock
#

Compile time safety

sharp geyser
#

ig

#

at that point just use Object.freeze

lament rock
#

and I guess runtime as well

#

The whole point is that you can use Object.freeze at any point

#

not just at Object creation

sharp geyser
surreal sage
sharp geyser
#

What

#

You have a object

#

it can't be a string

#

you can do
Record<number, DictionaryValue>
if need be

surreal sage
#

I cant know DictionaryValue before it was made

sharp geyser
#

what are you talking about

#

then your only option is to use any if you dont know the type

surreal sage
#

nvm object.freeze works :3

neon leaf
#

imagine not pinging me for typescript help smh

surreal sage
#

ELIFECYCLE = exit code 1?

neon leaf
#

exit code 1 just means error

surreal sage
#

would this stop the CI yes/no

neon leaf
#

yes

surreal sage
#

oki ty

neon leaf
#

only exit code 0 is success

sharp geyser
#

What is your guys opinion on https://rythm.fm return?

The music app designed to be used together. Rythm makes it possible to share, discover and enjoy music with friends from all around the world.

#

Me personally its just spotify with extra steps

#

Not ot mention you can't use it by yourself as of rn, and you need premium to even listen with others anyway (free users can listen along to any premium user)

frosty gale
#

it is useless

#

they tried to reinvent music by removing features

#

thats not how it works

#

ah yes our unique selling point is the fact that you cant listen to music alone and have to listen to music with another person

sharp geyser
#

not to mention they appear to want to be standalone, but dont want to break ties with discord

#

Which honestly is what really would hold them back. I mean spotify is massive yes, but anyone will opt for a cheaper option over that.

#

Providing its quality is up to standards that is

frosty gale
#

music streaming is a really difficult market to break into

#

spotify is barely staying afloat and thats their only product

#

theyre probably already paying more than theyre earning from the publishers they are paying right now to allow them to host some music on their platform

sharp geyser
#

yup

#

Not to mention, daring to offer lower prices over more popular services like spotify is pretty ballsy

#

It's a shot in the dark hoping you actually hit your target

#

At most they will barely break even i'd say (if they are lucky)

frosty gale
#

its also possible discord is paying them a bit of money for being an activity

#

thats the only way i can think of them justifying launching this

proven lantern
#

We launched a new feature that allows anyone to add apps to their own account, and use them across all of their servers, DMs, and GDMs.
hmmm

quartz kindle
#

since you need to redeploy the commands and icba

proven lantern
#

we can't even use them until like the 18th i think

quartz kindle
#

there are already bots using it

#

so its definitly usable

proven lantern
#

mmkay

quartz kindle
#

unless its one of those slowly rolling things

#

but my bot does have that option in the dev panel

proven lantern
#

does it need to be a new bot or can it be added to an existing bot?

quartz kindle
#

existing bot

proven lantern
#

that's pretty cool

quartz kindle
proven lantern
#

is it the USER type?

#

no, not that

quartz kindle
#

no

#

the commands are the same

#

its just that if the person choses a user install, they can use the command anywhere

#

even if your bot is not there

#

ofc only they can see it

#

mandatory ephemeral or something idk

sharp geyser
#

yea no

#

anyone can do it

#

Its released fully

proven lantern
sharp geyser
#

Yea no, i've definitely been able to do it myself, as well as a number of other people

quartz kindle
#

maybe they are enabling it to show for all users

#

ie, not ephemeral anymore

proven lantern
#

so if someone installs the bot and then runs a command in a server will it send the guild_id just like a normal command?

#

i'm hoping people wont be able to record matches using the user installed bot on a server

quartz kindle
#

idk exactly, you need to test

#

but commands have these two fields now

proven lantern
#

mmmkay, i'll try to get it enabled to test it out

#

oh, i can just not enable user installs

quartz kindle
#

i mean, it should be disabled by default

#

mine was disabled, i just left it there

past field
#

anyone having issues with their bots?

quartz kindle
#

apparently

#

discord is having a discord moment

sharp geyser
#

Messages & Bots are experincing problems sending / connecting

quartz kindle
past field
#

ok thought it was just me

sharp geyser
#

I doubt that

#

It takes years to send a photo

past field
#

💀

sharp geyser
green kestrel
#

"we thought it best to slow down our API to encourage our developers to touch more grass in the meantime "

slender wagon
#

Have u guys made load balancers with different locations not using cloud services such as aws but just normal vps's?

#

If yes pls enlighten me :)

spark flint
#

i have a few different use cases

#
  1. multiple API nodes, running same software and uses nginx locally to proxy to different host IPs - requests are a tiny bit slower but its worth it for stability
  2. same as above but using CF dns level load balancing ($5 month), not slow as its dns level
slender wagon
spark flint
#

yes

slender wagon
#

So the db could still be a bottleneck?

spark flint
#

i used mongodb cloud for that cuz im lazy

#

yeah

slender wagon
#

I see

spark flint
#

i didn't notice speed issues tbh

#

lemme do some speed tests rq

slender wagon
#

Aws is so cool for letting u create private subnets or rules for the db

spark flint
#

yeah

#

you can do the same with a few providers

#

through load balancer

#

directly to node

#

direct to other node

#

it depends on the speed of the node

#

2nd node is a lower spec node

slender wagon
#

Oh nice

#

So when u are doing this on a single vps u can't really chose between locations right?

distant sand
#

Hey! is it possible to transfer team ownership? if the account has been disabled/deleted? (top.gg team ownership)

surreal sage
#

why are server racks so expensive

civic scroll
#

bare metal + setup scripts for maximum performance

surreal sage
#

startech is a joke

#

90 euros for a metal shelf

civic scroll
#

😔

#

virtualbox

surreal sage
#

whar

eternal osprey
#

I am gathering many different web crawls, of like 1-2tb worth of warc files but this shit takes way too much

cloud relic
#

What you building it on @eternal osprey

warm imp
#

Is it good to have prefixes?

lyric mountain
#

if your bot is message-based, yes

eternal osprey
#

I swear i want to record my meetings so you can hear how i am yapping about numbers and predictions i don't even understand myself

#

😭

sharp geyser
#

hello ChittyKat

eternal osprey
#

"Yeah, so you see here that there's a trend in sales and the months. i guess, next month we will get more sales."

eternal osprey
sharp geyser
#

How goes it

eternal osprey
#

Me good

sharp geyser
#

noice noice

eternal osprey
#

wby?

sharp geyser
#

Oh yknow just torturing myself more

eternal osprey
sharp geyser
#

Making a programming language

eternal osprey
#

With what

eternal osprey
sharp geyser
#

just toy languages rn

eternal osprey
#

ah iss

sharp geyser
#

I have plans in the future to make an actual general purpose language

eternal osprey
#

damn that's awesome

#

how does it look rn

sharp geyser
#

then use that language to make an OS

eternal osprey
sharp geyser
#

LMAO

eternal osprey
#

What does it look like?

sharp geyser
#

The one right now is modeled after lox

#

Im going through that book as its the best resource I could find that balances theory with actual code application

#

It still lays theory on pretty thick in some parts and I myself am not one that learns by just reading val_WaaGone

eternal osprey
#

Hm i see. Yeah it seems like a decent book... what are you going to create your language in>

#

I also was interested in creating my own language but i never got the time to finish it

sharp geyser
#
> var x = (2 * 3) * 10 - 1 / 2;
VAR var 
IDENTIFIER x 
EQUAL = 
LEFT_PAREN ( 
NUMBER 2 2
STAR * 
NUMBER 3 3
RIGHT_PAREN ) 
STAR * 
NUMBER 10 10
MINUS - 
NUMBER 1 1
SLASH / 
NUMBER 2 2
SEMICOLON ; 
EOF  
#

This is the current state of my stuff

eternal osprey
#

cuz my bitch ass finally is not unemployed rn 🗣️

sharp geyser
#

I also have an AST generated but its not in use rn I am working on parsing the expressions from the actual lexer

eternal osprey
#

I took a semantics course once

sharp geyser
eternal osprey
#

why don't you create actual grammars?

#

In like xml structure

sharp geyser
#

Im working on that right now

#

That's part of generating an AST and parsing it

eternal osprey
#

VAR x = NUMBER y | POINTER z
or whatever

sharp geyser
#

I am just struggling to wrap my head around what exactly is a CFG

eternal osprey
#

Ah i see

#

cfg?

sharp geyser
#

Context-Free-Grammar

eternal osprey
#

ahhh

#

Lnaguages and automata

#

i love that course

sharp geyser
#

I have no course to teach me

#

I am self-teaching basically by reading books and looking at theory vids

civic scroll
sharp geyser
#

ok

#

no need to flex

#

😭

civic scroll
#

but i got stuck at AST generation

sharp geyser
#

oh

#

AST is where Im struggling

civic scroll
sharp geyser
#

cause of the grammar

civic scroll
#

🤝

sharp geyser
#

I basically skipped the theory on that for now just to keep moving along

#

I have the AST generated basically

#

and it works

#

I ust need to make use of it now and prase the expressions from the lexer

civic scroll
#

i wanted it to also support more complex syntax

sharp geyser
#

I have no plans for that rn

#

other than null adding escape characters in strings and hex, octal and binary numbers