#development
1 messages · Page 235 of 1
You have to get that right.
The worst feeling is watching peacock and it completely losing track
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
That and not keeping it between browsers/devices
I get what you're saying
^^^
Yeah that's fair
I plan on making a mobile app in the far future
I still think websockets would be nice for that, just making it easier to save it
not to mention people swap browsers like opera gives out cars sometimes
or they clear cache inadvertanly clearing local storage on websites too
how would you store it? Like key value of Id to timestamp?
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
That makes sense
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
💀
what isn't working?
This reminded me of the reason why tcp cookies were created
hm?
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
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
😭
does anyone know a good 4u case thats not 10 trillion usd and max 35cm in depth
4u case?
yes
ah
server rack
Talk to sky about that one
Bro knows everything there is about servers
there are many skys sir
Oh yea bro might be asleep
nah
but he's the best one to talk to
He knows more about servers than I'd wager anyone else in this chat
ok I will order everything else for now then
@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

sausage dog
"struggles to find a good font"
roboto

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
How to detect once a GuildMember updates their guild nickname?
member update events
Thanks
i tried to watch nl vs tr via hls playlist but it just didnt want to
online hls player did work
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
inventing something thats already existed under another name is such an apple thing
i think thats basically what hls is
i have no idea what im doing (send help)
and i dont wanna know what youre doing
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
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

Aw nope, I'm trying to add emojis into my bot
What im saying is
you can download the emote to your server via that link
Download the emote, save it to your server
It still doesn't allow me to copy the ID of it
Aw I found a bot which provides us the ID's of the emojis
bro couldve done it himself
i almost used all my github action minutes getting a Hello World zig lambda deployed
Nope, \:emoji: won't work as I don't have nitro and the emoji is animated
God so there's an option for it 🤦♀️
the debugging is real
await DB.set(`${interaction.guild.id}.blacklist.${userId.toString()}`,dataStructure)
RangeError: Invalid string length
It's quick.db if it's an important information
ur dataStructure is too long when stringified likely
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
-((-1) << 30 + 1) = 2147483648 = 2048M
im not sure
its a weird error and i dont rlly know how to fix it either
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)
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
quick.db uses sqlite right?
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)
this is very vue
(ik it's not)
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
@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
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
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
although you can also do a postgres routine to update a counter in a database so you can instantly fetch the subscribers a channel has without counting or caching much
So I can have
- User table
- Creator Table with a link to User table
- Subscribers table with a graph relation as User and Creator (user (node) -> subscribers (edge) -> creator (node))
If I was using pg sure
didnt mean to reply to you
this guy 💀
whats your question here exactly
ah ok
does a bot need manage threads to assign the thread perms on a role
yes
yes
ah that explains it
A bot needs the permission it wants to grant/revoke others
ah ok
i was wondering why my bot needed that but i figured out a bit later, just wanted to confirm
👍
wat
I was just saying ok
Sometimes i'm getting this error in my response from top.gg api back when trying to post changes
502 is a cloudflare error
Classic Bad Gateway error
Just ignore 502 errors
oh okay
Nothing else you can do
so it's a "deny" error, should i retry to post?
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
All you can do is ignore 502 errors and hope it gets resolved
any other error statuscodes i should "ignore"
it was resolved on the next restart couple mins later
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
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?
No
unless those messages are fetched and cached again.
Is there a way to stop reconnects?
yes
Owhh how
python?
Js
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?
Wha
Yeah
ping ponged?
So I must fetch the messages first and then it would work?
yes
I see, using that we can also allow older messages to be cached ain’t it?
yeah if you use the reaction.fetch
Yep, and specifically better-sqlite3
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
💀
I am too tired to try and help you diagnose that
I am barely pulling through my own project

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
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
dataStructure is a bunch of null values
log dataStructure
Oh sorry lol, I've read it as "I'm too tired of" instead of "tired to"
Nope, I tried printing it out and it's
{
reason: 'No reason was provided.',
date: 1720309497817,
moderatorId: '735807653594398742'
}
Yes, the error code prints out that line
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
Yep
key length issue?
RangeError: Invalid string length
yes
Is there a way to solve it?
break the data into smaller parts or shorten the key
The data seems to be really small already
then its the key length
Well, there doesn't seem to be any way to shorten it
I changed blacklist to b, it still does not work
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
😭
@neon flicker lmk
I'll let you know soonly
the problem is
quick.db works the same way as json files
it only has 1 table to contain everything
and it only handles the first key
Then it's useless for me for now
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
Or either I will have to store them as arrays
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
ah
What am I really supposed to do in this case?
if you want to keep using quick.db, you need to change the structure of your db in order to create smaller rows
Is there a useful alternative for quick.db?
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
Like firstkey.secondkey.thirdkey and the first key is firstkey in this case, right?
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
Yes, somehow
for example
quickdb uses dot prop to traverse the objects no?
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
lmao
Yes, I wouldn't be able to delete them all
Or maybe a.b-c would be an option as well
Another option : mongodb
yes, as long as you dont let the actual json value get too big, you should be fine
I never understood mongodb, tho the last time I used it was like 2 years ago
I think I will give it uh, another try
Tim
which is not very obvious
I never thought I’d see the day where you promote bad practices/j
the opposite is better btw
a-b.c
otherwise a will still contain everything
But then doesn’t a-b contain everything either way
But then it would look like guildid-logchannel => {c: {}}, and I can't really delete all the guildid-... values
You can
*At once
use separate tables
Ima be real json dbs suck but if it’s small scale it’s fine
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"));
Seperate tables for each guild?
Wait doesn’t quick.db use SQLite not json what was the one that used json
sqlite itself is table based, if you dont use tables then you are not taking full advantage of sqlite
enmap?
Enmap I think
separate tables for each type of thing, for example a table for blacklists, a table of users, a table for guilds, etc
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
Is enmap still relevant btw
so always use discord ids as the main key for each relevant table
i still see people using it every now and then
and having problems of course :^)
please my sanity is deteriorating
wtf
So it would be something like:
const DB = new QuickDB()
const Guilds = await DB.table("guildsettings")
const Logchannel = Guilds.get(`guildid.logchannel`)
yeah that should be fine
Thank you
Oh really?
[[],[],[]]
EVERYTHING in js is a hashmap
yes
well, of course there are countless optimizations
objects have "shapes" internally
And yet js still sucks at heavy workloads
depends on the work load
ye good luck running that on any language

I’ll just use Tim’s dna
use youtube videos as storage, store data in pixels in frames in videos
Not only can I store a gazziliom gigabytes of data
But it’ll be naturally optimized for quick access
Pfft videos? I use movies
Thank you all, the new data structure pretty much worked
Nice
can someone please help me with gh actions
Google can
it will be much mmuch faster as well
no more parse/stringify gigantic json files
Hey Tim I have a question
What turned you into the optimization god
And the pro benchmarker
not wanting to pay for more hardware
At this point I’m convinced you wrote the js programming language
That’s so relatable
Except I push my hardware to the max
MacBook turns into a griddle
warm up some burgers
Thought about it
find some random php website/instance with an open upload endpoint and use it as file storage
youd be surprised at how many there are that have unrestricted file uploads which you can view at any time
I get too many hits to phpmyadmin endpoints on my bot's website
Is message.mentions.roles.first() still a valid function to get the first role mention of a message (djs)?
https://tryitands.ee ... if it works it works :3
This function works on every possible collection in discord.js afaik
Thanks
Yes, it seems to work
someone ping me?
Probably a ghost ping, I personally haven't seen any ping
they took my vsc
👀 is there a reason you want to use a fork?
Well honestly, I've been using nextcord since d.py was dead back in the day and there are a little things of nextcord that I can't adapt to which is why I would like to move to a different fork
Thanks, I'll check all of those
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
choose one thats recently maintained and figure out if you like it
although most of them will be relatively similar with changes to conventions
alrighty
thank you
Magic numbers
Once I start seeing infinity in the fucking formula
I stop paying attention
💀
chatgpt time /j
8n represents the number of terms used to get the intergral over the interval
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)
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
classic memory leak with prisma
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
prisma requires you to close connections after you are done with them
else like you said, they will stay open
$prisma.disconnect or smth
some guy on another server pointed out bun
cuz really the bot is a bit basic
i could
but bun has been a time saver
but for some reason now it started pointing the issues (if it is bun)
do the heap dump, then we'll have something to work with
what should i use
all runtimes have some sort of heap dump tool
bun does but for some reason only safari can read it or smthn
💀
it provides it on a json

all frameworks will ALSO have some sort of tool to analyze the dump
you're not supposed to read it as-is
it's either safari or WebKit GTK (which i am totally not familiar with)
safari is a browser no?
well, use it then
i believe prisma handles connections for you
i've never had to use prisma.$disconnect before
eitherway it's a discordbot and it kinda uses it all the time so that wouldn't be an issue
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
if its a discord bot, then most likely its the discord cache using all the memory lol
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
They are using bun tho
ew
ew
ayo bun owner
Damm
v
todays craziness: https://github.com/brainboxdotcc/ssod/blob/main/include/ssod/js.h
an async js interpreter in C++, using coroutines and a threadpool
why
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
interesting
c#? the sea isn't sharp though
i agree
damn
ok docker
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
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
i build images
maybe something like c# where you can build a bytecode version of it and have that directly execute the code
You can run asm in the browser. Wasm
i mean sure
i thought hes using that to quickly make changes to different achievements/xp gains scripts in his bot
but thats still js
yes you can run js on the server
maybe idk
oh wait he did make the browser version int oa bot didnt he
I was still thinking he had it all in the browser
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
wasm can run at near native speeds because of assumptions the engine can make
js by itself is much less safe to do so
what if it wasm was
nodejs can also import wasm
it's interpreted on demand, compiling it doesn't give much performance increase, it's executed server side using a library called duktape that is for embedded systems
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
Are the scripts user definable
depends on your definition of user
they're definable by bot staff who aren't c++ devs
You, the host, are not considered a user in this scenario
but bot staff are chosen by me
or people with admin access you trust to write the scripts
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
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
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
writes cute script to exploit a duktape vulnerability to break out of sandbox and cause mayhem
i dont think theres ever been such a thing
only ever been one CVE in 2022 which would cause a DOS
root@HDE-01:/mnt/hdd/containers/rjns-git# du -sh *
435G dind
300G registry
is getting my bot verified a hard process?
Its instantly verified now. No manual checking
oh damnnn
oh nice
no way
so basically i can make all my testing bots verified?
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
what about old bots that were rejected for suspicious growth or wqhatever
They can verify now afaik
oh rly
wh-
i have one like that lmao
then what's the point of being verified 💀
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
b-b-but the badge!!! 😔😔
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
badge and will forever be sad
why did you lose it?
Congrats! Become badge free!
its very possible
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
ah, this makes sense
as now you can get unverified if u dont re-verify every 3 years
I think it's 3 years
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
It seems that if you fail to re-verify your ID, they remove the badge (source: #1237101449398194176 message)
dang lol
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
If someone offers you money for anything on Discord, it is 99% likely to be a scam
ask for upfront payment of 50% of the agreed value
when they pay, go radio silence
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
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. 
idk if anything i said made sense 
heyhey guys
does this also take categories:
.addChannelOption((option) =>
option
.setName("category")
.setDescription("The parent category.")
.setRequired(true)
)```
categories aren't exactly channels
is there a way to select one?
fuck it i will ask ppl to simply copy the cateogry id
@eternal osprey no
or do a string autocomplete
ah good one
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
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
similarity as in string?
image similarity
or are you not that familiar with similiarity checkers in general?
not really, that's usually something better left to AI
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]
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
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.
that's a b/w image, not grayscale
while a colored image returns me a matrix of values between 0 and 255
grayscale
ooowhh shit
wait can't i just simply normalize everything by dividing by, say 100?
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
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!!
doubt b/w images would work for what u want
a dark enough image would be a plain black rectangle
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
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
i know yeah
@lyric mountain @frosty gale if the bot the badge is tied to gets deleted or loses the badge, say bye bye to the badge
isn't normlization n - min / max - min
that's if you have a bottom boundary
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 🗣️

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
timebombing is a common tactic to protect oneself from "clever" contractors
what's timebombing
for example, you make a site for someone but they insist to pay after the job's done
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
this is why you always have a backdoor ;)
ahh i see
that's illegal, there are more legal ways
for example putting a timer on the site that progressively reduces the opacity of the body
yeah next time i will create a deadass black on white contract
💀
there's also a story of a guy who made a random word become "unpaid" every day
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.
whahahah that's genious
is it possible to check if a bot can access a specific channel ( with an id ) discord.py
https://www.scs.stanford.edu/~dm/home/papers/remove.pdf not more than this
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...
what kind of access? you can check if the bot can see a channel and also if the bot can type in a channel yes
and if its a voice channel you can check if the bot can connect to it
oh ok
i just wanted to know if it was possible to check
yes its possible
ty
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
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
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
oh alr
how hard is it to learn typescript?
I don't like the lack of concerete types in js
no
what's that
nah wait let me play along
i am interested
@full wolf what does the server do my friend
shouldnt be hard
Was this already handled?
no idea
no pretty sure he deleted it himself
did the guy delete his own messages?
otherwse he would have received a kick right lol
ye nothing in the mod logs
its pretty much the same as js with very minor syntax changes, the typing system itself is the actual annoying part
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?
oowh damn, so typescript is just a type extender for js instead of a whole language basically?
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
its techincally a piggy back language, sort of like c++ for c
it compiles back to js in the end anyway
ahhh i see
damn let me get right into it
you reckon it's possible to learn it in a week?
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
you can learn most of it in a day
then over time you get used to the quirks and improve your usage of the typing system
yeah any types can be defined easily and the transpiler wont complain
but if a lib doesnt have types you can still use it without defining types
but its just like using javascript again
🗣️
finally i can enjoy js like it's a proper fucking language
i hated the lack of control over data types
i still prefer using jsdoc
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)
I mean is the extra effort worth saving 20ms
there is no performance difference, its just a matter of productivity
i find it easier to work with jsdoc over typescript
Ah okay fair point
makes my work flow faster and more productive
I personally think jsdoc is a hassle
i prefer it over the complexity of requiring a compilation step
love the variable names
e d
Compilation step is ass but imo worth it for more stable code. JSdoc seems nice
it can produce more stable code and also has the bonus of transpilation, if you ever need that (although these days one would rather drop support for older browsers instead)
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 !
The classic any problem that quickly becomes compasses your whole codebase if you ain't diligent
Had one where a pdf to json library that advertised TS type bindings forgot to document an essential function. Took a while to realise that the function was actually there just not typed. That whole library was a mess
Whats the best way to learn to code a bot
or even worse, a mistyped function that errors or causes unintended results if you use it as it is typed
there is no "best" way, but a good idea would be to get started with programming/coding in general
Should i start with js straight away
its an option, you can if you want to
I can understand the discord.js codes like i can see what the code does its just hard for me to memorise it
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
I seethank u
it's like math, if you're focusing on memorizing things, you're doing it wrong
@quartz kindle would optimizing my click war game help with the interaction failed issue?
possible but not guaranteed
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
Interactions that are received over the gateway expire all the time when the gateway is asked to reconnect
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
I am looking for a programmer who wants to partner with me to further improve my bot.
Good luck
i have some info for you tho, i just tested here
i have a command that also uses buttons to navigate between pages
👀👀👀👀👀
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
in the console too? or just with the interaction in discord
from clicking too fast
yes
really 👀
let me record
ok
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
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
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
the game is actually pretty quick.. well structure i’d say lol
correct, but it’s set up to be more challenging as the game progresses. round 1 is 3 buttons and lots of time, and as it goes on, it adds more buttons and less time
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
per round
there is sudden death round lol, anyone who loses last at the same time has to tap the sudden death button first to win
well yeah thats going to be entirely dependent on people's internet and phone performance
i’m going to make each round last about 6 seconds and announce that change. see if that’ll help
mind if i share this video in my announcement?
i just can’t believe you complimented the game
i’m proud af of myself
i screenshotted that shit
i stg i did
hahah
@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
this is regular click war
you should come play sometime!
biggest lobby i’ve seen so far has been 153 people
looking good
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
yes, i have some markdowns in the lobby embed where everyone joins
what would that look like 👀👀
Use canvas and make a graph?
basically something like this:
@quartz kindle - Trap
@past field - Extra Life
...
oooo that would be funny to see lol
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
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
👀👀👀👀
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
i always forget about canvas
Like a pie chart(maybe another would be better idk how many options there are)
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
quick question could this be more secure?
What exactly are you concerned about
IPs are not a good way to make such a rule, unless you know for sure they are all static ips and never changing
and even then ips can be spoofed
yea
how did i do this???
what should i do then?
apply the rule to something unique
such as an API key
access token
session / username / email / etc
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
if you have emails you can use that
if the only ip that will ever have increased rate limits is your own ip that you control, then its fine
assuming you dont allow multiple accounts with the same email
but if you start adding the ips of people who pay for your service for example, then its not gonna be good enough
the only ips that will be increased will be me and the servers
then its fine, as long as the ips are static
and your host doesnt share them with other clients
this is also a great idea
sorry I cant do anything with those red marks there
can you please remove them
:)
@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
in response to this
is this js
It's json
i mean as in the runtime that handle this
was about to have a crazy idea of encoding ip addresses as number literals
I mean, using IPs isnt good no matter what anyway
Especially since hardly any ISP use static ips nowadays
yes
that would be one good day to make your server incredibly slower
by increasing the size of json file
it won't be, once the size goes up
i suggest you use a database engine for that
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
its a config json, its not gonna be written to at runtime
yknow tim
you say that but its tw we are talking bout
anything is possible with him
what if he one upped everyone and set up a file system listener for the config file to detect saves and updated the config in memory
leave him alone hes actually developing a revolutionary database engine
lmao
Hi
Yo
i was bored??? and created an copy of spy.pet but for twitch

so the only perk to being verified is being able to have my bot in more than 100 guilds
- monetization and app directory

about the spy.pet thing people are making too much of a deal about it
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
yea i know. I was just bored
let my brother sky have his shine 🗣️
(i am just kidding Chloe, pls don't be mad
)
js' promise.all automatically handles threading right
no, node is single threaded
it supports parallelism thanks to its event loop, if that's what you're aiming for
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.
maybe like 5x512
js is non-parallel, all its forms of concurrency including callbacks, promises and more, they are all non-parallel concurrency
oh yea that's what i meant 😓
therefore no threading is involved
let me rephrase then
does promise.all automatically do parallelism
wait im actually blind
it does non-parallel concurrency yes
its the other way around lmao
wtf
it runs them concurrently but not at the exact same time
yeah thats what i mean
bits and pieces are still sequential
promise.all = fn1().then(fn2).then(fn3).then(…)
ohh
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
can you perchance name a library that adds the parallelism functionality?
if you want true parallelism akin to threading, the only way is child process or worker thread
no multi threading 😓
i want to iterate over my users (like 15-20) in a database and run a method on them but efficiently
you can use Promise.all()
just KISS it?
yea fuck it ig ❤️
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
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?
async and cpu-intensive is mutually exclusive, you cannot have async cpu-intensive
unless the cpu-intensive part is in a different process

