#development

1 messages · Page 235 of 1

queen needle
#

I would have thought to use local storage

solemn latch
#

You have to get that right.
The worst feeling is watching peacock and it completely losing track

sharp geyser
#

local storage is too limiting

#

Imagine they were watching 100 videos, and they never finished any of em

#

Kind of exaggeration

#

but its better to store this somewhere else more mangable

solemn latch
#

That and not keeping it between browsers/devices

queen needle
#

I get what you're saying

queen needle
#

Yeah that's fair

sharp geyser
#

I plan on making a mobile app in the far future

queen needle
#

I still think websockets would be nice for that, just making it easier to save it

sharp geyser
#

not to mention people swap browsers like opera gives out cars sometimes

#

or they clear cache inadvertanly clearing local storage on websites too

queen needle
#

how would you store it? Like key value of Id to timestamp?

sharp geyser
#

Not sure yet

#

my first thought is index it based on video ID + user ID

#

then have a timestamp of where they were in the video and just send em there

queen needle
#

That makes sense

sharp geyser
#

I could hash the video ID and user ID together and store that so Im not querying based off two columns if I wanted

#

just to make it a bit faster

#

idk I will figure it out when I get to it

#

I first need this media player working

#

💀

queen needle
#

what isn't working?

sharp geyser
#

nothing yet

#

because I havent started

#

💀

#

I was about to eat dinner

eternal osprey
sharp geyser
#

hm?

eternal osprey
#

A client could send so much tcp syn segments to a server, which would then save ongoing and not acknowledged tcp connections in its buffer. It was a way to dos a server

#

Hence they came with tcp cookies, which is used to hash the details in a isn that the server creates and stores on the client instead. But as it’s just one singular isn, it’s very limited. So nowayadas browsers use the normal buffers but if they reach the max, they fall back to tcp cookies

#

Don’t mind my yap sometimes I just let my mind speak to my imaginary friends

#

It’s lonely sometimes

sharp geyser
#

All good man its very interesting stuff

#

right so how the fuck do I scale a video element

#

cause its not co-operating with me

#

😭

neon leaf
#

does anyone know a good 4u case thats not 10 trillion usd and max 35cm in depth

sharp geyser
#

4u case?

neon leaf
#

yes

sharp geyser
#

ah

#

server rack

#

Talk to sky about that one

#

Bro knows everything there is about servers

neon leaf
#

there are many skys sir

sharp geyser
#

@pine willow

#

He's likely not alive rn idk what time it is in berlin

neon leaf
#

same as me

#

12am lol

sharp geyser
#

Oh yea bro might be asleep

neon leaf
#

nah

sharp geyser
#

but he's the best one to talk to

#

He knows more about servers than I'd wager anyone else in this chat

neon leaf
#

ok I will order everything else for now then

sharp geyser
#

@solemn latch How does this look

#

I cannot for the life of me figure out how to size the video element, and make the video itself look normal

#

😔

#

oh wait

#

object-contain seems to have fixed it

frosty gale
surreal sage
#

"struggles to find a good font"

roboto

sharp geyser
#

I just hope it doesn't look this weird with actual content streamed from my cdn

#

because all that empty space in the player looks terrible

#

YOOOO

#

I GOT HLS STREAMS WORKING :D

neon flicker
#

How to detect once a GuildMember updates their guild nickname?

sharp geyser
#

member update events

neon flicker
#

Thanks

surreal sage
#

online hls player did work

sharp geyser
#

I made my own using hls.js

#
<script lang="ts">
    import {page} from '$app/stores'
    import Hls from 'hls.js'
    import { onMount } from 'svelte';

    onMount(() => {
        const video = document.getElementById('video') as HTMLMediaElement;
        const source = $page.data.video.url

        if(Hls.isSupported()) {
            const hls = new Hls();
            hls.loadSource(source);
            hls.attachMedia(video);
        } else if (video.canPlayType('application/vnd.apple.mpegurl')) {
            video.src = source
        }
    })

</script>

<div>
    <h1>hello</h1>
    <div class="w-full">
        <video id="video" class="w-full h-[30rem] object-contain" controls></video>
    </div>
</div>
#

simple as this

frosty gale
#

inventing something thats already existed under another name is such an apple thing

#

i think thats basically what hls is

quartz kindle
#

i have no idea what im doing (send help)

frosty gale
#

and i dont wanna know what youre doing

neon flicker
#

Is there a bot that allows us to copy emoji ID's?

#

I can't use the backslash method as I don't have nitro

sharp geyser
#

I mean without the emote you wont be able to

#

You would have to be able to send the emote

#

or you can copy the emoji url

neon flicker
#

Aw nope, I'm trying to add emojis into my bot

sharp geyser
#

What im saying is

#

you can download the emote to your server via that link

#

Download the emote, save it to your server

neon flicker
#

It still doesn't allow me to copy the ID of it

sharp geyser
#

Well

#

You would have to know the emote you want

#

and have to get the link

neon flicker
#

Aw I found a bot which provides us the ID's of the emojis

frosty gale
#

bro couldve done it himself

proven lantern
#

i almost used all my github action minutes getting a Hello World zig lambda deployed

neon flicker
solemn latch
#

can you not just right click and copy the id?

neon flicker
#

God so there's an option for it 🤦‍♀️

surreal sage
#

the debugging is real

neon flicker
#
await DB.set(`${interaction.guild.id}.blacklist.${userId.toString()}`,dataStructure)

RangeError: Invalid string length
It's quick.db if it's an important information

surreal sage
neon flicker
#

What exactly is the limit tho?

#

Apparently, I don't think it's way too long. Hold on

#
{
  reason: 'No reason was provided.',
  date: 1720309497817,
  moderatorId: '735807653594398742'
}

This is dataStructure

surreal sage
#

im not sure

#

its a weird error and i dont rlly know how to fix it either

neon flicker
#

Well, it works to execute the following:

await DB.set(`blacklist.${userId.toString()}`,dataStructure)

But not the following:

await DB.set(`${interaction.guild.id}.blacklist.${userId.toString()}`,dataStructure)

surreal sage
#

dude

#
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/g/glibc/libc-dev-bin_2.35-0ubuntu3.4_amd64.deb  404  Not Found ```
#

what is this

#

cant even install c

#

forgot to update mb

quartz kindle
#

can you check your sqlite file and open it with an sqlite viewer? i have an idea about what the issue is (tldr quick.db is bad)

tawny lava
#

(ik it's not)

sharp geyser
#

lol

#

I got a working media player tho

#

albiet a basic one

#

but its cool

#

Now that I know i have the capabilities to do it myself I am

#

Time to work on the backend some more :D

sharp geyser
#

@lyric mountain I know this isn't postgres related but I have a db question

#

How should I keep track of creators, videos and subscribers?

#

My original idea was to make a table called creators, and videos, then have a relation between users -> creators -> videos

#

then have subscribers table be a relation of users -> subscribers -> creators

frosty gale
#

ez

#

subscribers table which contains user id/reference, creator reference/id and whatever else you want

#

then when fetching creator you can join that table to see if the user is subscribed to them

#

and do a count to see how many subscribers a creator has

#

all of this should of course be cached as much as possible especially the subscriber counts

sharp geyser
#

I am using surrealdb

#

So it has handy features to get this data performantly

#

Its just surrealdb is similar to your average sql database, but it varies a bit

#

It has support for your traditional linking of tables, but also graph relations

frosty gale
sharp geyser
#

So I can have

  1. User table
  2. Creator Table with a link to User table
  3. Subscribers table with a graph relation as User and Creator (user (node) -> subscribers (edge) -> creator (node))
sharp geyser
#

@gloomy marsh ?

#

Why ghost ping

gloomy marsh
#

didnt mean to reply to you

sharp geyser
#

right well dont just delete it, just say so

#

ghost pinging is not nice

gloomy marsh
#

this guy 💀

gloomy marsh
sharp geyser
#

There was no question

#

It was a statement

gloomy marsh
#

ah ok

warm carbon
#

does a bot need manage threads to assign the thread perms on a role

sharp geyser
#

yes

gloomy marsh
#

yes

warm carbon
#

ah that explains it

sharp geyser
#

A bot needs the permission it wants to grant/revoke others

warm carbon
#

ah ok

#

i was wondering why my bot needed that but i figured out a bit later, just wanted to confirm

sharp geyser
#

👍

warm carbon
#

wat

sharp geyser
#

I was just saying ok

wintry river
#

Sometimes i'm getting this error in my response from top.gg api back when trying to post changes

sharp geyser
#

502 is a cloudflare error

deft wolf
#

Classic Bad Gateway error

sharp geyser
#

Just ignore 502 errors

wintry river
#

oh okay

sharp geyser
#

Nothing else you can do

wintry river
#

so it's a "deny" error, should i retry to post?

sharp geyser
#

no

#

its not a deny error

#

502 means that the gateway is closed/bad e.g you cannot give or receive any connections from top.gg

wintry river
#

ok

#

ty

sharp geyser
#

All you can do is ignore 502 errors and hope it gets resolved

wintry river
#

any other error statuscodes i should "ignore"

wintry river
sharp geyser
#

Anything other than a 4xx or a 500

#

typically 500's aren't errors you can fix either, but if you can gracefully handle them by just logging them. It might be useful information to report

eternal osprey
#

hey, i have an emojiReactAdd event.
THat even is partial so it does not work on older messages.
If my client reconnects (which it does after a long time), does it still work on the messages from before the reconnect, but after the bot was online for the first time?

gloomy marsh
#

unless those messages are fetched and cached again.

eternal osprey
#

Is there a way to stop reconnects?

gloomy marsh
#

yes

eternal osprey
#

Owhh how

gloomy marsh
eternal osprey
#

Js

gloomy marsh
#

Setting ws.reconnect to false

#

well i mean

#

you can stop it from auto reconnecting but

#

sorry i got confused with ur question

#

you mean like stop it from doing the reconnecting shit completely?

pine willow
eternal osprey
#

Yeah

pine willow
#

ping ponged?

gloomy marsh
#

issues on discord's end

#

itll happen

eternal osprey
gloomy marsh
#

yes

eternal osprey
#

I see, using that we can also allow older messages to be cached ain’t it?

gloomy marsh
#

yeah if you use the reaction.fetch

neon flicker
#

Well, apparently

DB.set(`${interaction.guild.id}.logschannel`, channel.id)

Is fine, but it doesn't work when there's a third dot such as

DB.set(`${interaction.guild.id}.blacklists.${interaction.user.id}`,dataStructure)
#

Ah it's not related to the third dot, it's due to the length of the entry string

#

I found it though

#

I'm not sure why this occurs

#

Yes, now I'm pretty much sure that it's due to the third dot

sharp geyser
#

💀

#

I am too tired to try and help you diagnose that

#

I am barely pulling through my own project

neon flicker
#

Uh what do you mean?

#

Sorry if I'm asking way too many questions but I'm back to JS development after long so I'm not sure what I'm doing wrong

sharp geyser
#

No no no

#

I was simply saying I am too tired its 8am almost

#

I want to help, but any information I give you might be wrong due to my sleep depriveness

sharp geyser
#

log dataStructure

neon flicker
#

Oh sorry lol, I've read it as "I'm too tired of" instead of "tired to"

neon flicker
sharp geyser
#

Are you 100% certain this is happening at that specific line

neon flicker
#

Yes, the error code prints out that line

sharp geyser
#

I have no idea how set works, but my only guess is, it can't identify that location

#

Probably better to wait till someone who knows better sqlite 3 better to help though

neon flicker
#

Yep

gloomy marsh
neon flicker
#

RangeError: Invalid string length

gloomy marsh
#

yes

neon flicker
#

Is there a way to solve it?

gloomy marsh
#

break the data into smaller parts or shorten the key

neon flicker
gloomy marsh
#

then its the key length

neon flicker
#

Well, there doesn't seem to be any way to shorten it

#

I changed blacklist to b, it still does not work

gloomy marsh
#

have u tried storing the data as a json string before saving it

#

your making my brain work too hard at 8 am

#

i also only read half of the things you sent

#

😭

gloomy marsh
neon flicker
#

How would I do that tho?

#

JSON.stringify?

gloomy marsh
#

yes

#

then youd need to retrieve and parse the data

#

JSON.parse

neon flicker
#

I'll let you know soonly

quartz kindle
#

quick.db works the same way as json files

#

it only has 1 table to contain everything

#

and it only handles the first key

neon flicker
#

Then it's useless for me for now

quartz kindle
#

which means whenever you set or get anything at all, only the first key is an actual table row, the rest of it is inside a json file embedded in the row

neon flicker
#

Or either I will have to store them as arrays

quartz kindle
#

for example

#

if your key is blacklists.guildid.etc

#

everytime you do anything to that, the db has to fetch blacklists, json parse the entire blacklists, set the data, then stringify the entire blacklists again, and set it back in the row

#

so you can see how that can quickly ramp up to gigantic json files

gloomy marsh
#

ah

neon flicker
#

What am I really supposed to do in this case?

quartz kindle
#

if you want to keep using quick.db, you need to change the structure of your db in order to create smaller rows

surreal sage
#

what thefuck

neon flicker
#

Is there a useful alternative for quick.db?

quartz kindle
#

you can always use better-sqlite3 directly

#

you have more control over it that way

#

but essentially, you need to keep in mind that only the first key matters, everything else will be treated as the same file

#

so you need to keep the first key small

neon flicker
#

Like firstkey.secondkey.thirdkey and the first key is firstkey in this case, right?

quartz kindle
#

yes

#

also

sharp geyser
#

Oh it’s quick db

#

That’s still a fucking thing?

quartz kindle
#

if you remove the dot, it will force quickdb to create a separate row for it, and not put everything inside the existing value of the virst key

neon flicker
#

Yes, somehow

quartz kindle
#

for example

sharp geyser
#

quickdb uses dot prop to traverse the objects no?

quartz kindle
#

if your key is a.b.c, quick db will save it as a => { b: { c: ... } }

#

if your key is a-b-c, quickdb will save it as a-b-c => { ... }

#

so you can fix your issue by not using dots

#

the only disatvantage is you lose the ability to "fetch all children", like you cant use a to get everything inside it anymore

sharp geyser
#

Tim why don’t you make a more performant json database

quartz kindle
#

lmao

neon flicker
#

Or maybe a.b-c would be an option as well

sharp geyser
#

Another option : mongodb

quartz kindle
#

yes, as long as you dont let the actual json value get too big, you should be fine

neon flicker
#

I never understood mongodb, tho the last time I used it was like 2 years ago

quartz kindle
#

mongodb bad

#

:^)

sharp geyser
#

Good enough for their use case

#

Unless you want them using Postgres

#

💀

neon flicker
#

I think I will give it uh, another try

quartz kindle
#

quickdb is fine

#

as long as you respect how it works internally

sharp geyser
#

Tim

quartz kindle
#

which is not very obvious

sharp geyser
#

I never thought I’d see the day where you promote bad practices/j

quartz kindle
#

a-b.c

#

otherwise a will still contain everything

sharp geyser
#

But then doesn’t a-b contain everything either way

neon flicker
#

But then it would look like guildid-logchannel => {c: {}}, and I can't really delete all the guildid-... values

sharp geyser
#

You can

neon flicker
#

*At once

sharp geyser
#

Ima be real json dbs suck but if it’s small scale it’s fine

quartz kindle
#

quickdb has the ability to create separate tables

#
     const db = new QuickDB();
     await db.init();
     const table = await db.table("test");
     await table.set("test", "Hello World");
     console.log(await table.get("test"));
neon flicker
#

Seperate tables for each guild?

sharp geyser
#

Wait doesn’t quick.db use SQLite not json what was the one that used json

quartz kindle
#

sqlite itself is table based, if you dont use tables then you are not taking full advantage of sqlite

sharp geyser
#

Enmap I think

quartz kindle
#

then on each table, the id is the main key

#

guildid on guilds table, userid on blacklists table, etc

#

the main key should be as unique as possible, so you have more keys and less stuff inside each key

sharp geyser
#

Is enmap still relevant btw

quartz kindle
#

so always use discord ids as the main key for each relevant table

quartz kindle
#

and having problems of course :^)

sharp geyser
#

Well yes

#

It’s json

#

And I don’t think it’s maintained anymore

surreal sage
quartz kindle
#

it is maintainet still

sharp geyser
#

wtf

neon flicker
#

So it would be something like:

const DB = new QuickDB()
const Guilds = await DB.table("guildsettings")
const Logchannel = Guilds.get(`guildid.logchannel`)
sharp geyser
#

What are they updating? Variable names?

#

Like there’s not much to a json db

neon flicker
#

Thank you

sharp geyser
#

Does JS have hash maps

#

I don’t remember

quartz kindle
#

Map basically is one

#

objects kinda are one as well

sharp geyser
#

Oh really?

quartz kindle
#

and arrays too

#

lmao

surreal sage
#

[[],[],[]]

sharp geyser
#

Tim

#

If an object is a hashmap

pearl trail
#

Cook

#

aww late

sharp geyser
#

EVERYTHING in js is a hashmap

quartz kindle
#

yes

sharp geyser
#

That’s cursed

#

1 a number? Nah buckaroo it’s just a hash map

quartz kindle
#

well, of course there are countless optimizations

#

objects have "shapes" internally

sharp geyser
#

And yet js still sucks at heavy workloads

quartz kindle
#

depends on the work load

sharp geyser
#

If it can’t run my ai model trained on 5PB of data then it’s slow

quartz kindle
#

ye good luck running that on any language

sharp geyser
surreal sage
#

5 pb of mem ✅

#

who needs ssds anymore

sharp geyser
#

I’ll just use Tim’s dna

surreal sage
#

just keep ur server on

#

hardcore mode

quartz kindle
#

use youtube videos as storage, store data in pixels in frames in videos

sharp geyser
#

Not only can I store a gazziliom gigabytes of data

#

But it’ll be naturally optimized for quick access

sharp geyser
neon flicker
#

Thank you all, the new data structure pretty much worked

sharp geyser
#

Nice

surreal sage
#

can someone please help me with gh actions

sharp geyser
#

Google can

surreal sage
quartz kindle
#

no more parse/stringify gigantic json files

sharp geyser
#

Hey Tim I have a question

#

What turned you into the optimization god

#

And the pro benchmarker

quartz kindle
#

not wanting to pay for more hardware

sharp geyser
#

At this point I’m convinced you wrote the js programming language

sharp geyser
#

Except I push my hardware to the max

#

MacBook turns into a griddle

surreal sage
#

warm up some burgers

sharp geyser
#

Thought about it

frosty gale
#

youd be surprised at how many there are that have unrestricted file uploads which you can view at any time

lament rock
#

I get too many hits to phpmyadmin endpoints on my bot's website

surreal sage
#

DUDEEEEEE

#

WHAT IS THIS ERROR

pearl trail
#

it's panicked

#

you must make it calm

neon flicker
#

Is message.mentions.roles.first() still a valid function to get the first role mention of a message (djs)?

surreal sage
deft wolf
neon flicker
#

Thanks

neon flicker
#

Yes, it seems to work

green kestrel
#

someone ping me?

deft wolf
#

Probably a ghost ping, I personally haven't seen any ping

surreal sage
#

they took my vsc

earnest phoenix
#

hi quick question, what are some good d.py forks that I can use

solemn latch
#

👀 is there a reason you want to use a fork?

quartz kindle
earnest phoenix
earnest phoenix
#

Is pycord good? I've heard people saying their code is bad or something I didn't read it till the end but it was on reddit

quartz kindle
#

no idea, i dont use python

#

:^)

earnest phoenix
#

ah

#

no worries, thanks anyway!

frosty gale
#

although most of them will be relatively similar with changes to conventions

earnest phoenix
#

thank you

eternal osprey
#

does anypne know how the fuck they get 8n?

#

where does it come from

sharp geyser
#

Magic numbers

#

Once I start seeing infinity in the fucking formula

#

I stop paying attention

#

💀

scenic kelp
#

the infinity is not the issue it's a series

#

the 8n is

eternal osprey
#

yeah

#

how do they know that the upperbound of the sum must be 8n?

sharp geyser
#

chatgpt time /j

eternal osprey
#

chatgpt says its 3n instead of 8n

#

but these are the test answers lol

narrow valve
eternal osprey
#

that ain't my question tho

#

how

slender wagon
#

I've been using psql and prisma for my database, with discordeno. Now for some reason the size of the bot just keeps on growing until it crashes the vps. And for some reason the db is doing some visible caching, do u guys know where i can disable this or what could be the reason it's doing this. (Notice the allocation it does after each query)

lyric mountain
#

ok so, databases will always try to use as much memory as allowed for caching, this is intentional as it improves speed

#

but as a plumber would say: you got a leak there sir

#

let the bot run for a while, when the memory usage gets high enough, take a heap dump

#

this will allow us to know what's being accumulated in the heap

sharp geyser
#

classic memory leak with prisma

lyric mountain
#

also, I'm unsure if this is also the case for other lands/frameworks, but you should always free connections after using them, else it'll stay open until you either OOM or the database closes it

sharp geyser
#

prisma requires you to close connections after you are done with them

#

else like you said, they will stay open

#

$prisma.disconnect or smth

slender wagon
#

cuz really the bot is a bit basic

sharp geyser
#

swapping to a different runtime

#

why not just use node at that point

#

💀

slender wagon
#

i could

#

but bun has been a time saver

#

but for some reason now it started pointing the issues (if it is bun)

lyric mountain
#

do the heap dump, then we'll have something to work with

slender wagon
lyric mountain
#

all runtimes have some sort of heap dump tool

slender wagon
#

bun does but for some reason only safari can read it or smthn

#

💀

#

it provides it on a json

sharp geyser
lyric mountain
#

all frameworks will ALSO have some sort of tool to analyze the dump

#

you're not supposed to read it as-is

slender wagon
#

it's either safari or WebKit GTK (which i am totally not familiar with)

lyric mountain
#

safari is a browser no?

slender wagon
#

yes

#

and i am on linux

lyric mountain
#

well, use it then

slender wagon
#

i can't use it here

#

but

#

i will try to get it on my windows

digital swan
sharp geyser
#

Unless they changed their ways you have to do it yourself

digital swan
sharp geyser
#

Interesting

#

I guess they changed

#

You used to have to explicitly call them

slender wagon
# digital swan

eitherway it's a discordbot and it kinda uses it all the time so that wouldn't be an issue

digital swan
#

yeah i agree i doubt prisma is causing problems

#

from my experience bun uses more memory than node

#

could you try running it with node for some time or are you using bun features

quartz kindle
#

if its a discord bot, then most likely its the discord cache using all the memory lol

frosty gale
#

its also possible the gc just doesnt feel like running

#

it only runs when node starts running out or when its convenient bc it has to freeze everything

#

so old object pile up

sharp geyser
#

They are using bun tho

pearl trail
#

ew

spark flint
#

ew

pearl trail
#

ayo bun owner

sharp geyser
spark flint
#

v

spark flint
#

i am ms bun

#

owner of bun 👍

green kestrel
#

an async js interpreter in C++, using coroutines and a threadpool

sharp geyser
#

why

green kestrel
#

for game events

#

basically most of the games runtime stuff is js scripts embedded in game locations, effects, spells, achievements etc

#

but each was blocking and can take multiple milliseconds per script

#

so too many concurrent players could potentially lag it

#

basically most of the games content is configured in the db like this @sharp geyser

#

no need to hard code anything, can all be tweaked on the fly

sharp geyser
#

interesting

surreal sage
#

c#? the sea isn't sharp though

surreal sage
#

i agree

pearl trail
#

damn

slender wagon
#

ok docker

neon leaf
#

Ah right thanks for reminding

#

My HDD docker cache is 700gb

sharp geyser
#

wtf

#

why so big

lament rock
#

A reminder to everyone that a lot of the dependencies you install are bloat. The majority of them fan out to be massive dependency trees and very quickly become a bottleneck. There is no better way to combat this than to vertically integrate yourself. If you're a library developer, vet your dependencies and make use of tools your package manager may offer like explaining why a dependency was installed.

Why I mention all of this is because one of my projects had lodash in the dependency tree which is just pollution at best

frosty gale
# green kestrel

a cool suggestion would be to change the language for it to something that can be compiled

#

how is it executed? my worry is that the same exact script is evaluated many times instead of being compiled

neon leaf
frosty gale
sharp geyser
#

its in the browser

#

it has to be js no?

lament rock
#

You can run asm in the browser. Wasm

sharp geyser
#

i mean sure

frosty gale
#

i thought hes using that to quickly make changes to different achievements/xp gains scripts in his bot

sharp geyser
#

but thats still js

frosty gale
#

yes you can run js on the server

sharp geyser
#

oh wait he did make the browser version int oa bot didnt he

#

I was still thinking he had it all in the browser

frosty gale
#

i have no idea lol but last time he talked about it he mentioned this script runs in the bot

#

since its easier to be able to configure scripts on the fly like this instead of re-compiling and restarting the bot every xp/game adjustment

#

so its either some smaller version of the js engine or its v8 executing that script

#

v8 is a bit overkill for this so probably something smaller

lament rock
#

wasm can run at near native speeds because of assumptions the engine can make

#

js by itself is much less safe to do so

frosty gale
#

this isnt wasm though

#

its just js

sharp geyser
#

what if it wasm was

lament rock
#

nodejs can also import wasm

green kestrel
#

the scripts are usually about 15 lines long at most and execute in a couple of milliseconds, taking a handful of kilobytes

#

it's a different class of interpreter entirely to V8, made for a different task

#

if it was compiled to run natively sandboxing it would be a ton more risky

#

you can't run node on this for example

lament rock
#

Are the scripts user definable

green kestrel
#

depends on your definition of user

#

they're definable by bot staff who aren't c++ devs

lament rock
#

You, the host, are not considered a user in this scenario

green kestrel
#

but bot staff are chosen by me

lament rock
#

or people with admin access you trust to write the scripts

green kestrel
#

it doesn't make sense to compile it

#

you'd have to load it as a shared object each time

#

that takes tons of ram, and badly written code can crash the entire bot

#

as opposed to just logging an error

lament rock
#

interpretation does have its own overhead which can be more costly than additional ram usage from native code and you might not be at the stage where you should consider that anyways. I guess I also don't see you reaching the point where you'd need to consider it

green kestrel
#

the inability to quickly iterate is more expensive than a millisecond to run some code

#

having to create some C++, to compile it, check it compiles, and then load a shared object possibly across many clusters is a huge problem, compared to just drop-in a 15 line script and boom, a new achievement or potion

frosty gale
neon leaf
#

root@HDE-01:/mnt/hdd/containers/rjns-git# du -sh *
435G dind
300G registry

past field
#

is getting my bot verified a hard process?

pearl trail
#

nope

#

i heard they make it much easier

solemn latch
#

Its instantly verified now. No manual checking

pearl trail
#

oh damnnn

radiant kraken
lament rock
#

no server requirements now btw

#

Why? User installed apps have to be verified somehow

radiant kraken
#

oh nice

pearl trail
#

no way

#

so basically i can make all my testing bots verified?

lament rock
#

Well… Yeah, but there's literally no benefit to doing this as the only restriction is being able to go past 100 servers. Verified apps also have to apply for privileged intents

quartz kindle
#

what about old bots that were rejected for suspicious growth or wqhatever

lament rock
#

They can verify now afaik

quartz kindle
#

oh rly

quartz kindle
#

i have one like that lmao

pearl trail
#

then what's the point of being verified 💀

lament rock
#

Going past 100 guilds

#

???

pearl trail
#

well yeah hm

#

fair

quartz kindle
#

and getting the checkmark

#

:^)

lament rock
#

Oh I forgot about monetization

#

But thats a literal scam

#

Discord takes a large cut

#

They also require exclusivity when it comes down to users being able to access paid commands

#

The system only works when they vend through Discord

radiant kraken
lament rock
#

badge goblins

#

Active developer comes with the restriction that a user has to use one of your bots' commands every once in a while

#

I forever lost my VerifiedDeveloper badge and will forever be sad

lyric mountain
#

HOW did you lose it

#

didn't even know it was losable

solemn latch
#

Congrats! Become badge free!

frosty gale
#

for example if your bot gets unverified they remove it

#

im not sure if you can lose it now though

#

discord staff have to do it manually

lyric mountain
#

ah, this makes sense

#

as now you can get unverified if u dont re-verify every 3 years

#

I think it's 3 years

frosty gale
#

they probably wont remove it if you get unverified for not verifying again probably

#

they only usually do it if your bot gets unverified for abuse reasons

deft wolf
green kestrel
#

hmmm that badge is gonna become rarer

#

I had someone bugging me to sell my discord for £7k in bitcoin, I smell a scam lol

deft wolf
#

If someone offers you money for anything on Discord, it is 99% likely to be a scam

lyric mountain
#

ask for upfront payment of 50% of the agreed value

#

when they pay, go radio silence

quartz kindle
#

a few years ago i would get a lot of dms wanting to buy my account

#

i asked one dude for upfront payment, he asked to login to my account first for proof

#

lmao

crystal wigeon
#

hello

#

wot

#

anyway

#

anyone use rabbitmq?

#

i got a couple of questions

#

so i noticed that it creates multiple consumers if i have multiple channel.consume methods. is this expected? i thought you had create new channels to create new consumers. but i noticed the id was same.
Also im trying to like add a consumer once via some api call and then poll messages. how can i achieve this? without like closing the channel. i thought of storing the objects globally but it will probably lead to memory leaks. whats the recommended way to do this

#

My use case is basically to serve messages from the queue to polling requests and wait for an ack for that message. but i dont want to handle managing the worker poll since it is already taken care by rabbitmq i.e if i have multiple consume methods it will automatically figure out which worker is still processing data etc, it only requeues the message if the worker disconnects and it drops it if the worker acks it.

And the way i ack is via some api call with the same message that was processed. But now how do i reconstruct the channel that sent out the message? since if that channel is closed it will automatically re-queue the message and give the same message to the next poll request. flork_think

#

idk if anything i said made sense flork_think

eternal osprey
#

heyhey guys

#

does this also take categories:

#
 .addChannelOption((option) =>
      option
        .setName("category")
        .setDescription("The parent category.")
        .setRequired(true)
    )```
lyric mountain
#

categories aren't exactly channels

eternal osprey
#

is there a way to select one?

#

fuck it i will ask ppl to simply copy the cateogry id

full wolf
#

@eternal osprey no

neon leaf
eternal osprey
#

ah good one

lyric mountain
#

can you ping stuff in dropdown menu?

#

if so you can simply list the cats using <#cat_id> format

#

it wont become a ping, but it'll at least fill the name through the id

eternal osprey
#

i see, thanks for the help!

#

@lyric mountain you are good with java right, do you mind looking at my similarity checker in java? For some reason it's fucked

lyric mountain
#

similarity as in string?

eternal osprey
#

image similarity

#

or are you not that familiar with similiarity checkers in general?

lyric mountain
#

not really, that's usually something better left to AI

eternal osprey
#

Owh alright

#

well actually

#

it all comes down to calculations, whether it's with weights or just a eucledian distance.

#

i think that i know what my issue is.
I am using a similarity measure that's meant for grayscale... do you by any means know any lib or function in java able to grayscale an image?

#

aka, normalize the pixels to ranges of [0,1]

lyric mountain
#

you'd have to normalize to 0...255

#

as pixels use int for color channels

#

but well, it depends on what kind of grayscale u want

#

and u dont need a lib for that btw

eternal osprey
#

ah really

#

huh but don't pixels in grascale images either represent a 1 or 0

#

if i log my grayscale image i get a big matrix of 1's and 0's.

lyric mountain
#

that's a b/w image, not grayscale

eternal osprey
#

while a colored image returns me a matrix of values between 0 and 255

lyric mountain
#

grayscale

eternal osprey
#

ooowhh shit

#

wait can't i just simply normalize everything by dividing by, say 100?

lyric mountain
#

dividing by 255

#

to normalize you divide by the max value

#
int rgb = img.getRGB(x, y);
int r = (rgb >> 16) & 0xFF;
int g = (rgb >> 8) & 0xFF;
int b = rgb & 0xFF;

int avg = (r + g + b) / 3;

img.setRGB(x, y, (avg << 16) | (avg << 8) | avg);
#

this would be average grayscale

#

but it wouldn't match visible grayscale, for that you'd use luma formula

eternal osprey
#

owhh damn i see

#

i totally forgot i am currently using the sum of squared errors on the pixels but that's so stupid

#

would only really work on images with the same dimensions and or actually b/w images

#

i think i can use 1 - eucledian distance to get the similarty.
Your code is of grate help, thanks!!

lyric mountain
#

doubt b/w images would work for what u want

#

a dark enough image would be a plain black rectangle

eternal osprey
#

idk i recently had a lesson about this what i am implementing.

#

a quick talk with my teacher and he said it would be possible but that i had to normalize my shit

lyric mountain
#

normalizing is just a fancy word for n = val / max

#

all you need to do is divide the channels by 255f to get a range between 0 and 1

eternal osprey
#

i know yeah

lament rock
eternal osprey
lyric mountain
#

that's if you have a bottom boundary

eternal osprey
#

i see and standardization is not necessarily in [0,1] but simply dividng by the mean to standardize the outputs?

#

damn kuu learned me more than my teacher, get yo smart ahh in a classroom and start teaching 🗣️

lyric mountain
eternal osprey
#

Wait i got a cool scam story.
I recently got hired by someone to analyze his products and create an overview of which variables played the biggest roles in his sales.
I swear, this analysis was good. I even showed my supervisor and he said it was okay (he is harsh). I had put the analysis on a server for the clients to view it
That mf eventually knocked on our door and demanded a refund.
Weeks later the server is still actively visited by them 😭 .
forgot to put that bitch offline

lyric mountain
#

timebombing is a common tactic to protect oneself from "clever" contractors

eternal osprey
#

what's timebombing

lyric mountain
#

for example, you make a site for someone but they insist to pay after the job's done

sharp geyser
lyric mountain
#

but then after delivering the site, they tell you they aren't going to pay yet they keep the site

#

this ends up with you wasting time and they getting the work for free

#

timebombing is putting something in the project that WILL cause major disruption unless defused

sharp geyser
#

this is why you always have a backdoor ;)

eternal osprey
#

ahh i see

lyric mountain
#

that's illegal, there are more legal ways

#

for example putting a timer on the site that progressively reduces the opacity of the body

eternal osprey
#

yeah next time i will create a deadass black on white contract

lyric mountain
#

there's also a story of a guy who made a random word become "unpaid" every day

eternal osprey
#

this is a server that simply displays the notebook used for the data analysis.
Idk how it works, i just have to upload the files there and it creates a link and key for the users.

sharp geyser
#

oh im too patient

#

I'd make it take a year or two until it finally stops working

warm carbon
#

is it possible to check if a bot can access a specific channel ( with an id ) discord.py

lyric mountain
#

The International Journal of Advanced Computer Technology (IJACT) is a publication which has been described as a predatory open access journal—a publication which has some of the surface attributes of a benign open access journal but is actually an exploitative and deceptive corruption of that model, operating as a disreputable vanity press with...

quartz kindle
#

and if its a voice channel you can check if the bot can connect to it

warm carbon
#

i just wanted to know if it was possible to check

quartz kindle
#

yes its possible

warm carbon
#

ty

lyric mountain
#

for read access, you can check for VIEW_CHANNEL, for write access, you can check for WRITE_MESSAGE

#

for obvious reasons the latter implies the former

#

but to be safe just check for both

warm carbon
#

one more thing
how do you get the bot's integration role ( discord.py once again )

im trying to check if the bots role is higher than another role and i cant find any answers on the web

lyric mountain
#

it's better to check the bot directly, instead of its role

#

this is because there can be member overrides that add permissions to the member directly

#

or for example, if the bot has a higher role

eternal osprey
#

how hard is it to learn typescript?
I don't like the lack of concerete types in js

#

no

#

what's that

quartz kindle
#

what is this fake support server

#

@solemn latch

eternal osprey
#

nah wait let me play along

#

i am interested

#

@full wolf what does the server do my friend

solemn latch
quartz kindle
eternal osprey
#

no pretty sure he deleted it himself

quartz kindle
#

did the guy delete his own messages?

eternal osprey
#

otherwse he would have received a kick right lol

quartz kindle
#

ye nothing in the mod logs

quartz kindle
eternal osprey
#

but in reality, in any program that i use js, i can simply transform it to typescript and not lose functionality?

#

For example any libs running on nodejs, i can still use them?

quartz kindle
#

yes

#

the only thing is

eternal osprey
#

oowh damn, so typescript is just a type extender for js instead of a whole language basically?

quartz kindle
#

typescript might not like libs that dont have types included

#

and complain that types are missing

#

but i guess you can force it to compile anyway

#

and coerce unknown types yourself

quartz kindle
#

it compiles back to js in the end anyway

eternal osprey
#

ahhh i see

#

damn let me get right into it

#

you reckon it's possible to learn it in a week?

lyric mountain
#

The only thing that's hard to me is liking the gross syntax ts uses for typing

#

It's like they put a bandage fix over it but blood leaked and made a weird dry layer around it, then they put another bandage on top

quartz kindle
#

then over time you get used to the quirks and improve your usage of the typing system

frosty gale
#

but if a lib doesnt have types you can still use it without defining types

#

but its just like using javascript again

eternal osprey
#

finally i can enjoy js like it's a proper fucking language

#

i hated the lack of control over data types

quartz kindle
#

jsdoc in vsc actually uses the typescript engine, so its not limited to the actual jsdoc spec

#

its not as powerful as ts itself, but allows you to skip the build step entirely and keep using raw js while getting full type checking

#

vsc is also smart enough to infer a lot of stuff from js are you write it

#

for example (this is js, not ts)

neon leaf
#

I mean is the extra effort worth saving 20ms

quartz kindle
#

i find it easier to work with jsdoc over typescript

neon leaf
#

Ah okay fair point

quartz kindle
#

makes my work flow faster and more productive

neon leaf
#

I personally think jsdoc is a hassle

quartz kindle
#

i prefer it over the complexity of requiring a compilation step

sharp geyser
#

love the variable names

quartz kindle
harsh nova
#

Compilation step is ass but imo worth it for more stable code. JSdoc seems nice

quartz kindle
#

but i've also seen it work the otherway around and produce hard to spot bugs that are only discovered when you dive deep into the compiled code

#

although that mostly happens when the user misuses or abuses coercion, any and !

harsh nova
#

The classic any problem that quickly becomes compasses your whole codebase if you ain't diligent

harsh nova
valid epoch
#

Whats the best way to learn to code a bot

quartz kindle
quartz kindle
valid epoch
#

Should i start with js straight away

quartz kindle
#

its an option, you can if you want to

valid epoch
#

I can understand the discord.js codes like i can see what the code does its just hard for me to memorise it

quartz kindle
#

you dont really need to memorize it, as discord.js has a very extensive documentation on their website

#

but you need to know a little about js to be able to understand it

#

you can get pretty far with just the basics, the data types / structures, functions, conditions, loops, etc

valid epoch
#

I seethank u

lyric mountain
#

it's like math, if you're focusing on memorizing things, you're doing it wrong

past field
#

@quartz kindle would optimizing my click war game help with the interaction failed issue?

quartz kindle
frosty gale
#

how slow can your game be for interactions to time out

#

my local state of the art llama LLM generates tokens faster than the timeout period

lament rock
#

Interactions that are received over the gateway expire all the time when the gateway is asked to reconnect

quartz kindle
#

not only that, there are a lot of possible delays that can happen

#

which discord doesnt account for

#

and discord also constantly borks itself

#

for some reason

#

i keep getting "unknown interaction" randomly as well

timid spear
#

I am looking for a programmer who wants to partner with me to further improve my bot.

sharp geyser
#

Good luck

quartz kindle
#

i have a command that also uses buttons to navigate between pages

past field
quartz kindle
#

and if i click too fast, i do get random "interaction failed" errors

#

so i guess people are clicking too fast and causing discord app errors on their side

past field
#

in the console too? or just with the interaction in discord

quartz kindle
#

the bot never receives anything

#

its purely an app error

past field
#

from clicking too fast

quartz kindle
#

yes

past field
#

really 👀

quartz kindle
#

let me record

past field
#

ok

quartz kindle
#

not sure if this is how your users are clicking on your game tho

#

but it seems that a split second before the message changes, the buttons become avalable to click again

#

and if you click them during that window, it will cause the error

#

i imagine on mobile this happens more often, since mobile is more laggy and slow in general

past field
#

i can record a game for you and show you, but that would make sense

#

if that’s the case then i might just make every round last like 5 seconds so they don’t feel like they have to click it so quickly

quartz kindle
#

from what i remember, the game is not really about who clicks faster right?

#

the game is more about luck

#

who clicks the right button

past field
past field
quartz kindle
#

so there is no real reason to make it so fast, unless there is something like the last person who clicked loses a life lol

past field
#

per round

past field
quartz kindle
#

well yeah thats going to be entirely dependent on people's internet and phone performance

past field
#

i’m going to make each round last about 6 seconds and announce that change. see if that’ll help

past field
quartz kindle
#

sure

#

you can say its a test, no need to make it permanent yet

past field
#

i’m proud af of myself

#

i screenshotted that shit

#

i stg i did

quartz kindle
#

hahah

past field
#

@quartz kindle i made each round 6 seconds long, but this is how the game looks

#

i have 2 versions of it. click war where everyone starts with 1 life

click war reverse where everyone starts with 5 lives

sharp geyser
#

Looks cool

#

Congrats

past field
#

biggest lobby i’ve seen so far has been 153 people

quartz kindle
#

i have two suggestions, the final winner message could be a lot more grandious

#

does markdown work with bots? could at least make some big title

#

like this

#

another thing that would be cool, but i dont know if its feasible with too many people, would be to edit the game message to show what everyone clicked on

#

this way people can troll and roast each other, which makes it more engaging

#

xD

past field
past field
queen needle
#

Use canvas and make a graph?

quartz kindle
#

basically something like this:

@quartz kindle - Trap
@past field - Extra Life
...

past field
quartz kindle
#

at the same time as the message edits to show what the buttons were underneath, it could also show the names of the people and what each person clicked

past field
#

yeah that would be a little hectic with bigger lobbies, worth a try! i let it be known to all server owners that this bot is in development and will go through changes and updates

past field
quartz kindle
#

if there are too many people, you can define some threshold, for example only start showing it once there are less than X people remaining

past field
#

i always forget about canvas

queen needle
#

Like a pie chart(maybe another would be better idk how many options there are)

quartz kindle
#

if there are more than X people, you can instead show X people clicked on a trap and Y people clicked on extra life

#

and then transition to the full list once the remaining people fit in a single message

past field
#

🤔🤔🤔🤔🤔 that would make it more intense

#

to watch

hidden gorge
#

quick question could this be more secure?

sharp geyser
#

What exactly are you concerned about

quartz kindle
#

and even then ips can be spoofed

sharp geyser
#

yea

hidden gorge
#

how did i do this???

quartz kindle
#

apply the rule to something unique

#

such as an API key

#

access token

#

session / username / email / etc

hidden gorge
#

its currently for my api so i could look at adding api tokens but im gonna have to create a system to generate a GUID then store it

sharp geyser
#

if you have emails you can use that

quartz kindle
#

if the only ip that will ever have increased rate limits is your own ip that you control, then its fine

sharp geyser
#

assuming you dont allow multiple accounts with the same email

quartz kindle
#

but if you start adding the ips of people who pay for your service for example, then its not gonna be good enough

hidden gorge
quartz kindle
#

then its fine, as long as the ips are static

#

and your host doesnt share them with other clients

hidden gorge
#

it doesnt

#

also this is how im storing the ips

sharp geyser
#

can you please remove them

#

:)

hidden gorge
#

nope

#

aint doxing myself again

past field
#

@quartz kindle you should come play a few times man! i have a database set up to grant click war coins too and you can purchase lives from the shop lol

civic scroll
neon leaf
#

It's json

civic scroll
#

i mean as in the runtime that handle this

#

was about to have a crazy idea of encoding ip addresses as number literals

sharp geyser
#

I mean, using IPs isnt good no matter what anyway

#

Especially since hardly any ISP use static ips nowadays

civic scroll
#

yes

#

that would be one good day to make your server incredibly slower

#

by increasing the size of json file

hidden gorge
#

It's running surprisingly fast

civic scroll
#

i suggest you use a database engine for that

scenic kelp
#

i mean it's fine if you're only going to store a few ips

#

at first i thought you were storing the ips that got rate limited in there and i was going to scream

quartz kindle
#

its a config json, its not gonna be written to at runtime

sharp geyser
#

yknow tim

#

you say that but its tw we are talking bout

#

anything is possible with him

frosty gale
sharp geyser
#

yea no hes not doing that

#

doesnt even know how to hash passwords

digital swan
#

leave him alone hes actually developing a revolutionary database engine

quartz kindle
#

lmao

alpine sentinel
#

Hi

deft wolf
#

Yo

pine willow
#

i was bored??? and created an copy of spy.pet but for twitch

spark flint
past field
#

so the only perk to being verified is being able to have my bot in more than 100 guilds

deft wolf
#
  • monetization and app directory
pine willow
frosty gale
#

discord servers are largely public places and so you shouldnt expect any privacy

#

theres probably 50 different spy.pet instances running right now that just arent public

pine willow
eternal osprey
#

let my brother sky have his shine 🗣️

#

(i am just kidding Chloe, pls don't be mad notlikenoot )

frosty gale
#

i rarely get mad

#

more commonly disappointed

surreal sage
#

js' promise.all automatically handles threading right

vivid fulcrum
#

no, node is single threaded

#

it supports parallelism thanks to its event loop, if that's what you're aiming for

eternal osprey
#

hey, how do i create a big blue line at the bottom of the embed?
Some servers have it, it looks cool.
I know it's an image they set using .setImage(), but what should the image dimensions be lol, my images i put in take atleast half the screen.

digital swan
#

maybe like 5x512

quartz kindle
#

js is non-parallel, all its forms of concurrency including callbacks, promises and more, they are all non-parallel concurrency

surreal sage
#

oh yea that's what i meant 😓

quartz kindle
#

therefore no threading is involved

surreal sage
#

let me rephrase then

does promise.all automatically do parallelism

#

wait im actually blind

quartz kindle
#

it does non-parallel concurrency yes

digital swan
#

it runs them all at the same time

#

but not concurrently

quartz kindle
#

its the other way around lmao

digital swan
#

wtf

quartz kindle
#

it runs them concurrently but not at the exact same time

digital swan
#

yeah thats what i mean

quartz kindle
#

bits and pieces are still sequential

surreal sage
#

promise.all = fn1().then(fn2).then(fn3).then(…)

quartz kindle
#

no

#

promise.all = fn1(); fn2(); fn3();

surreal sage
#

ohh

quartz kindle
#

more specifically:

#
const results = [];
fn1().then(result => { results.push(result); if(results.length === 3) { return results } })
fn2().then(result => { results.push(result); if(results.length === 3) { return results } })
fn3().then(result => { results.push(result); if(results.length === 3) { return results } })
``` sort of like that
#

of course that return in there doesnt actually work, but you get the gist of it

surreal sage
#

can you perchance name a library that adds the parallelism functionality?

quartz kindle
#

if you want true parallelism akin to threading, the only way is child process or worker thread

surreal sage
#

no multi threading 😓

#

i want to iterate over my users (like 15-20) in a database and run a method on them but efficiently

quartz kindle
#

you can use Promise.all()

surreal sage
#

just KISS it?

quartz kindle
#

the promises in Promise.all() are run "concurrently", just not in "parallel"

#

lmao

surreal sage
#

yea fuck it ig ❤️

quartz kindle
#

put it this way, if you have 3 async db calls, and you put them in Promise.all(), they will be made at the same time yes

#

more specifically, they will "start" in sequence, but once the first call enters "waiting" mode, the second call starts immediately, it doesnt wait for the first call to finish

surreal sage
#

im worried about resource hogging

#

like, if you have 4 asyncs doing very cpu intensive tasks

#

and they'll all be slowed down a ton if the cpu cant keep up no?

quartz kindle
#

async and cpu-intensive is mutually exclusive, you cannot have async cpu-intensive

#

unless the cpu-intensive part is in a different process

surreal sage
quartz kindle
#

for example

#

you cannot run while(true) {} two times at the same time

#

1 while(true) will make your process use 100% cpu, and it will never even start the second while(true)

#

cpu-usage is blocking, no matter how async you make it, it will block the process