#development
1 messages · Page 2065 of 1
nahh
oh wait shit im dumb, chrome updates the arrays...
I am still confused if you are cause this can be done way easier
nop
then wtf is i
mixed, pinged and not pinged on collection
collection
What
brutal code
getting an ID from message content if it has a mention
/<!?@(\d+)>/
collector
I see
You're using a message collector?
yep
if you are using a message collector how the fuck are you doing i.user.id
The result of the Promise of a Message Collector.next is a Message
tried and error
I hate you
Love you too
its better
no its not
it makes it a nightmare for people to debug your code when they have no idea what i is cause it is not descriptive at all
Just use the raw API like I keep telling people. I haven't thought about updating my bot or anything related in a long time because I don't have to
good point
I do use the raw api a lot
Actually ima make a framework for djs maybe
no stupid abstraction layers with a huge import memory footprint or circular dependencies or volatile arbitrarily assigned naming schemes
if i make a lib it is going to be pretty baremetal
just some helper methods and thats it
sharding is something you'd do on your own cause fuck setting up that
Good
I fucking hate managed libs because of assumptions they make or their aggressive caching policies
I don't need that
caching is also a thing I'd leave up to the user
Thank god they're now serializing the client's permissions for the channel an interaction was instigated in
since bot not going to response
ill just create a message if bot got mentioned
lmao

yeap
Unpopular opinion, but people should stop making bots unless they're smart enough to make something objectively better
nah want to give myself a large stress
You’ll wish you stopped sooner down the line
You'll always stress about memory management or server costs or active users or cluster sizes and maximizing hardware efficiency and networking and all of this other shit you do not want to try to solve, because there's no real good answer other than to just stop entirely
💀
if it's a source of income, then great. You're a lucky % and you can continue, but it is not worth time and money stressing about a hobby project which is supposed to be fun
i have full time job, told u its only my playground
Thanks for coming to my ted talk. It is early as fuck o'clock and I have work tomorrow
how do env files work again?
Do they set the values in them to the environment automatically or do you have to read from the file
On node they just set the key and value in process.env, it doesn't actually modify the system environment variables
I don't get what you mean by "automatically", where would it be pulling the keys and values if not from a file?
It parses the file thou
laravel set the values on .env automatically
i think that was misty want to ask
🤝
only fake stoop that low
Just found out with diff user and client user in collector
f
probably i.author.bot i can use to detect if bot got pinged
I am confused on what you are wanting to do anymore
Lol
import {readFileSync} from 'fs'
import {sep} from 'path';
import {getProperty} from "dot-prop";
export class Localization {
private localesFolder: string;
constructor(localesFolder: string) {
this.localesFolder = localesFolder
}
get<T>(locale: string, prop: string, defaultValue?: T): T {
const contents = this._getFileContents(locale)
const property = getProperty(contents, prop, defaultValue)
return property!;
}
private _getFileContents(file: string): any {
const content = readFileSync(`${this.localesFolder}${sep}${file}.json`)
return JSON.parse(content.toString());
}
}
How could I make this better
Should I allow them to set a default locale they wanna get from if one isn't specified ?
cause its to long if i explain what i literally doing
How do you expect us to help if we have 0 clue of your end goal or what you wanna accomplish
but short story, i wanted to return the collection or stop if i.author.bot === true inside the collector.on
after i saw the bot == true i was like f myself, why do i keep comparing ids
anyway it still not returning tho lmao
🤔
how though
only way it'd ignore the condition is if it isn't a bot's message being collected
Cause It'll only collecting the data after the person answer
probably after the first collector done, i.author.bot is useless
because second collector will came up
🤔
the more you try and explain the more it becomes unclear
but if it works it works
How can I generate a random base64 string with custom character length, like YT's unique url id?
in JS
do you want it to be unique?
yeah but I can check that in my DB. First how do I even generate them?
There's like nanoid npm package and I can make a custom alphabet with the 64 chars then it generates me a string I can check if it already exists. But is that the way to go?
Well I don't think you can actually set the length of a base64 string I might be wrong but I have never seen/heard of a way
code first a generator for random strings => base64
economy.findOneAndUpdate({
memberID: i.author.id,
spouseStatus: true,
spouse: s.author.username
})
economy.findOneAndUpdate({
memberID: s.author.id,
spouseStatus: true,
spouse: i.author.username
})``` overwrites my data, but in my casino it doesnt, what an actual f
If I create statistics for the apikey if someone makes an api request with an api key, how should I make the stats?
1:
Create an entry for each api key with columns like requests etc. and just increment this value everytime
2:
Create a new db record every request and put stuff like timetamp, requestRoute etc. in it?
Which option is better?
usually sites will do a combination of both. You might have detailed stats on how users do requests in the past month or something with #2 and then aggregate any data older than a month into less-specific stats like #1
oh that's actually a smart way.. So like specific data for the last month with all things like requestRoute, timestamp, country etc. and after a month this data gets deleted and the request count for this api keys incremented normally?
The thing is what if someone would like data from the last year? In this case if I want to provide this I need to store every data for a year right?
If you have an app that makes e.g. 1000 requests a day this one app alone is 365k db records in a year.. If the app grows wouldn't this be way to many records? I don't know I think 1m records isn't that much in production for some companies...
that's what's tricky about storing timeseries data. You need to think about the granularity of the data you need
a question you have to ask yourself is why would someone need data from last year, and what data could they need?
because you can keep data from last year without storing every single request
maybe like a yearly report. How did we grow and what was popular etc.
do you need to store every individual request to answer this question?
I don't know..
It's like I want to be able to provide as much data/statistics as possible but don't have too many db records.
How am I able to store statistics (you can sort after time) for stuff like country, apiRoute, request method etc. without creating a record for every request? Creating a record for every country and just incrementing this value is stupid and I can't sort it after time..
filter what?
creating a record for every request isn't necessarily a bad thing
you can use #2 now and figure out how you want to do data retention when it starts to become a problem
yup
not really but I don't know if this decreases the performance if I have alot of records. I don't know much about this because I don't have any apps that have a couple 100k records xDD
you'll be fine with the right indexes
I could technically make a "month record" after the data gets older than a month. Like combine all the record in this month and create a graph with it and just store this graph. And with the other stats the same
if space isn't a problem now you don't have to think about it now 
Yeah true, but if I build it stupid now I will have bigger problems in the future as the codebase expands not? xD
you will have the raw data available, all you'll have to do is figure out how you want to downsample it
yeah I guess I need to find it out on the way of development :) thanks
there's no one size fits all solution for these. For some you can just drop data after a certain date and it doesn't even matter
yep
hey so I'm about to write a double if statement checking if the either the user is pinged or he messages himself
//afkCache would be a collection
//member would be the person pinged, if anyone does
if (settings.afkNotifSystemOn === true && (client.afkCache.get(message.author.id) || client.afkCache.get(member.id)) {
// do stuff
}
so what I'm asking is, whether there is any way to save on performance (for eg. not cache client.afkCache or member or at least don't cache them until settings.afkNotifSystemOn without having to hoist if statements?
- If the
settings.afkNotifSystemOnproperty is always a boolean, there's no point in comparing it such assettings.askNotifSystemOn === true,settings.askNotifSystemOnwould be enough - It would be better to check for the first condition first on a separate
ifstatement, and then get thememberor others - Use the
has()method instead ofget()since you're just checking it's boolean value
so 1. wouldn't help since I gotta prepare if the users select it to anything other than true or false since sadly I haven't added a detection system or anything like that yet
2. I was thinking of doing it like this, but isn't hosting if statements worse?
and for 3. I forgot that was a thing so ty 🙂
also using a triple = there because I'm comparing strings as well
settings.afkNotifSystemOn can also be a string depending on what you do
Oof
Then yeah as I said, only if it's always a boolean
I know it's bad but it works
For the second one, no it's not worse
really? I always thought hosting statements no matter the reason hinders performance
Nesting not hosting
I did watch a video about hoisting once though.. it didn't really stuck to me
It's all optimized at the end anyway, so it's better to check for the first condition, then get needed objects and then checking for the second conditions, or others
Hoisting and nesting are entirely different from each other
what's the difference?
it does make sense
I would check the first condition
if (true)
// cache elements
// do stuff after the &&
do I make the second if statement have both of those conditions in it?
If you have a look at the definitions of both, you'll notice; hoisting means moving something to the top-level or higher in any case, nesting means moving something inside something else, and goes on and on
oh I see, I guess I never really noticed the difference here
Yeah, you just check for the first condition and then short-circuit if it's not true, preventing the code from reaching the part where it gets the objects needed for the later part
okay that's fine. Am I okay with putting it in the messageCreate event?
trying to optimize it as much as I can since it's already clustered enough
it's got logic from all over the place
You can put it anywhere you want as long as it makes sense and you've got the things you need to work with
around 24KB - the filesize
great
while I'm already asking a lot of questions, may I ask how buttons work in detail?
while trying to do
<interaction>.update more than one times, or doing anything more than one time, even when trying to respond an ephermal message to an user about a wrong choice in the game, the collector always breaks
I can only do i.update ONE single time
and every person says that buttons are soo good and way better than reactions
or am I understanding it wrong?
the collector always breaks
Breaks in what way?
"interaction failed" when pressing any buttons
for example if I'd send that ephermal message before doing i.update, i.update would never show up
"Interaction failed" or "Interaction application did not respond"?
literally "this interaction failed."
idk where to ask this but how/where/can i let my bot detect when a user votes for a server
I think top.gg has an API endpoint for that
It shouldn't happen just because of updating the interaction response, you're doing something that causes it
I assure you there is nothing I'm doing wrong
You can ask about that in #topgg-api
//Lets now write functionality for our collectors
collector.on("collect", async i => {
// And now lets write a cool if statement to detect who pressed which button.
if (i.user.id === message.author.id) {
//await i.reply({ content: `${i.user.tag} your choice have been acknowledged.`, ephemeral: true });
authorChoice = i.customId;
}
if (i.user.id === user.user.id) {
//await i.reply({ content: `${i.user.tag} your choice have been acknowledged.`, ephemeral: true });
enemyChoice = i.customId;
}
// And now let's check who wins and who loses
if (enemyChoice != null && authorChoice != null) {
await i.update({
content: `${message.author.tag} picked ${authorChoice}\n${user.user.tag} picked ${enemyChoice}\n\nWho won? ${whoWon(authorChoice, enemyChoice, message.author.tag, user.user.tag)}`,
components: []
});
}
});
that's the entire collector
what could I possibly be doing wrong?
ty
I'm pretty sure the response you're getting isn't "Interaction failed", that only occurs if Discord wasn't able to trigger your interaction, "Interaction application did not respond" occurs if your bot did not respond to the interaction in 3 seconds, or 15 minutes after the response was deferred
and while were on the topic
collector.on("end", async i => {
if (enemyChoice === null || authorChoice === null) {
await i.update({
content: `${message.author.tag} picked ${authorChoice || "Nothing :C"}\n${user.user.tag} picked ${enemyChoice || "Nothing :C"}\n\nWho won? Time sadly run out.`,
components: []
});
}
});
``` this never shows up, regardless of me doing i.update before or not
it is, you can try it yourself if you want
I can invite you to a testing server
Try logging both of enemyChoice and authorChoice
Both in the collect and end events of the collectors
just checked the logs
ERROR Unhandled rejection: TypeError: i.update is not a function
what 😭

actually it does make sense
the collector ends
so the interaction ends with it
gonna edit the original message instead, I hope it works this time
If that occurs on the end event, that's because the end event returns the collected interactions/components, not the original interaction
makes sense
and about the interaction failed thing, do you want to check it out for yourself?
Nah, again try logging those variables and see what they log
nah the end works, I made a mistake and doing m.edit instead of i.update solved it
I'm not talking about the end event
why would I need to log the variables I set because of the interaction failed error?
Log the enemyChoice and authorChoice variables in the collect event
they're null at the very beginning and they get updated if the user presses a button
They might be the cause of the error because of incorrect values
Just log them God damn, this is why you always fail to debug stuff
okay.. give me a second
what's windowRef
has resiziable and ref attached
windowRef.current is definitely not null at the time of execution
I don't think there are resize events for elements like those
To debug this further, it's probably better to put a log in the third if statement in the collect event to see how many times the <Interaction>.update() method is actually called, if it's called the expected amount of times, then it's caused by something else rather than the collectors
it's called once, I'm absolutely sure of that
the collector is limited to 2 button presses from the 2 users who started the RPS match
but fine
I'll put the log in there

Finally you're getting a hang of it, that's how developers truly debug things
I love when people say things like that and then when they actually go to log stuff they turn out to be wrong majority of the time
Anyway it's 4am gn peeps
yeah but I have to change the code each debug cause everyone is still asleep 😭
the game needs two people to test it
it shows the interaction as failed whenever I update
Have you ever thought of testing them on an alt account? It's pretty easy
You don't need other people to test it with
in the last cloudflare outage I lost accesst to all my alts cause all the passwords I saved are deleted
Then create a new alt account
reseting the password to them would be a pain
Mind showing your whole code rather than just the collectors?
2 times it appears
and the user can change the answer after it's been called
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Looking at your code, I don't see anything that could be causing, I still think it's something from your Discord client, or the bot crashes before Discord can send the interaction data to it
And the collector in your code doesn't stop even after one of the users have won, because you're not stopping it until 30 seconds has passed
oh I see I've forgotten to include limit: 2
discord developer team when you ask them to make a linked list
won't that break if the same user presses the button twice though?
I have no idea how to fix I still think it's something from your Discord client, or the bot crashes before Discord can send the interaction data to it though...
You aren't supposed to set a limit/max in this case, you're supposed to stop the collector manually
and I think those ephermal messages are the one thing that makes the buttons actually better than reaction "buttons"
c.stop()?
Yeah
so that would fix those replies?
No because it doesn't seem like that's causing that failure, I'm just pointing out a bug in your code
I see...
that kinda sucks
Invite me to the test server I guess, I'll test it with you
thank you 🙂
@ancient nova What's your problem? I already have your bot in my server
is it possible to attach an api to the wesbite from the bot even if they are separate code?
"from the bot"?
yea
for a status page
I meant like that doesn't really make sense, maybe rephrase it?
That is what people use api for
uhh..
so i am creating a status page, i want to use an api that would link the website to the bot. My question will it work if the bot and website have a separate code as in separate repos
Absolutely
oh can i use express? or do i use the in built api next.js has? (i am using next.js for my website)
You can use any of them you like
ohh alright
oh yes, are there any good packages for image gif generation?
One message removed from a suspended account.
One message removed from a suspended account.
Well there's https://www.npmjs.com/package/make-a-gif for simple GIF generation
There's also https://www.npmjs.com/package/gifencoder for generating GIFs using Canvas contexts and buffers
A pure typescript module to create a gif in the easiest way possible.. Latest version: 4.1.2, last published: 2 months ago. Start using make-a-gif in your project by running npm i make-a-gif. There are no other projects in the npm registry using make-a-gif.
ohh alright
i will check it out
What's the error message though?
Ah that's because there's no module property exported by default, and you haven't assigned it either
ah
oh wait ii've done it the wrong way wround
round*
fml
module.exports not exports.module

exports.chunk = ... works as well without the module
ah

await Promise.all(smallerCollector.map(async (collection) => {
await channel.send(`${(loop === 0 ? `**New servers added**\n` : ``)}${await collection.map(async (server) => {
`------------------\n${server?.invite ? `**Invite**: .gg/${server.invite}\n` : ``}**Server ID**: ${server.serverID}\n**Reason**: ${server.reason}\n**Reason key**: ${server.key}`
}).join("\n")}`)
console.log(loop)
loop += 1
}))```
it was the rock paper scissors command, I managed to fix it by doing something very dumb that didn't work before
but it did work because of @earnest phoenix
turns out I should've dropped i.update from the start and just reply to the message, that way the intercation won't fail 
you should really really really make this code more readable lmao
Promise.resolve you can use this code to resolve singular promises
just loop through your map and resolve it without all the mess
That’s just how Discord formatted it
It’s more readable in VSC
will doing
some_struct some_array[1024];
int main() {
some_struct item = some_array[index];
item.some_prop = 2;
}```
result in a copy or a reference
or do i need to add a & after the type
this is the shit im still not certain on in c++/c
i dont know when something gets copied or referenced
or whether something is released prematurely
that tends to fuck me up a lot
Whahahahahahahahahahaat
No async functions in map()
it doesn't even need to be async
For Promise.all(), it needs to be an array of promises but you're not returning anything
Shouldn't that copy?
Can't you test it out yourself
some_struct some_array[1024];
int main() {
some_struct item = some_array[index];
std::cout << &some_array[index] == &item;
item.some_prop = 2;
}
ah
For the 2nd .map() ^^
smallerCollector.map(async (collection) => {
await channel.send(`${(loop === 0 ? `**New servers added**\n` : ``)}${collection.map((server) => {
`------------------\n${server?.invite ? `**Invite**: .gg/${server.invite}\n` : ``}**Server ID**: ${server.serverID}\n**Reason**: ${server.reason}\n**Reason key**: ${server.key}`
}).join("\n")}`)
console.log(loop)
loop += 1
})```
removed the Promise bit
oh sorry, neither does the first .map()
Any web developer here?
You're using Promise.all() though
increment the loop first and return the send() method
not using promise.all now
No need for await
removed that
If you have a question, just ask it here, people will respond eventually
Ok
whats the most slash command options possible lmao
choices?
25
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
ah 😔
Choices for STRING, INTEGER, and NUMBER types for the user to pick from, max 25
i have 65 options i want to add 💀
👀 gl
How to delete commands in d.js?
You mean slash-commands?
Yes
You can use this method to do so
https://discord.js.org/#/docs/discord.js/stable/class/ApplicationCommandManager?scrollTo=delete
For global commands: <Client>.application.commands.delete()
For guild commands: <Guild>.commands.delete()
It will delete all guild commands i wanna delete a specific onr
If you read the documentation, you can specify the commands you want to delete
i have 500k+
your argument is invalid

And the best part, the options are based on already supplied options
mongodb how do I check if something exist in db? findone method?
Hmmm
speedydb has a method which does that
wrong database
in mongo i believe the only way is to findOne
but you can make it faster by not returning any columns
columns in mongodb?
what else would you call them
documents
^

i believe the preferred way to check if something exists in mongodb these days is either .find() because it returns a cursor, or .countDocuments()
youd call properties documents?
i was saying you should only return the _id field because you dont need anything else
in mongo they are called documents
really?
ye
this is news to me
really strange
thats document?
yeah so why are fields called documents
each document contains key value pairs of data
u can say that
mongodb is cringe
yes thats what i meant
i thought you all were calling the things inside of the actual documents documents
💀
or database > collection > document > fields
^ that yeah
I only use json databases
whats speedydb?
mongodb too emo
im glad you asked

no sql right

oracle db tho
sqlite is a tiny sob that can fit all atoms in Earth inside 1MB
it's oracle what you expect
still at war with them?
lmao
bro they will not let me
i might try play around with some of the information i entered but dont feel it right now
the second card wasnt banned but it says "your trial cannot be processed because of a few plain basic reasons"
Lol
wha
and when emailing them i get the same we cannot process the trial and wont tell you why response
oracle is simply:
we provide nice shit but you need to agree that we can sell your data
yeah after
it verifies the card successfully
it just wont start the trial
rip
oof
i went through all of the reasons and concluded none of them are the reason except the one that says "any software which may be used to obfuscate your identity"
i used brave and then tried doing it on chrome but still
i did it on firefox with all extensions disabled
might also be my internet
possible
might also try it when im on break at work
gl
¯_(ツ)_/¯
they found speedyOS and they found it to be of criminal nature
or it may be the fact indeed that they have an ai which measures the probability of you using the cloud for free without paying and declines you without telling you
💀
speaking of speedyos i got paging working
very cool
nice
well i know what page files are, and that paging on windows is basically like swapping on linux
but i also know memory allocators organize everything into "pages" of memory
which are fixed sized blocks, and act as the minimum allocatable amount of memory
yeah paging is usually known as swapping memory from the ram and disk to free ram
but actually its a more complicated process where your second point relates to
memory is divided into fixed size blocks (usually 4kb but can be 1mb or 1gb with certain extensions)
yeah depending on the allocator
and from that point all memory you reference is virtual
for example jemalloc uses "arenas" which are various different sized pages
you dont refer to physical locations anymore
you actually cant do that
what allocators do i think is request pages from the os
and then its up to the allocator what they do inside of the pages
because all memory addresses from the point of enabling paging is virtual the OS can easily make memory appear sequential when its actually located in two completely different parts of ram physically
so if an allocator needs more memory it requests more pages which the os sends back in blocks which appear sequential
and because all addresses are virtual the os can mark certain addresses as "unavailable" which will cause the cpu to inform the OS everytime a program references a memory location thats unavailable
thats whats done when memory is swapped onto the disk
possible
depending on what the backend server does, yes
depends on logic
How to make numbers like going form 1 to x depending on y fields?
huh
dam I can't find anymore games to add to my bot
I've got no ideas
my last idea is to make a hangman type game
you have to guess a word by typing letters in chat
if you type incorrectly you get a strike
3 strikes = death
but it sounds pretty incoherent
so I need a better idea
In this thing adding sr. No.
Like
1] djjdj. 2
2] sjdjj 5
i+1 isn't working
idk
🤔 I'm having a hard time following it just because the variable names are so undescriptive.
I was tired of thinking of var names so random names
I just give up, noice, hi, shy, baba
var names are not for you, its for the people reading your code(which can be you, down the road)
so what is the problem?
you dont have to think of names
just name them what they do
for eg name an array ur going to change later to
CHANGEABLE_ARRAY
¯_(ツ)_/¯
While its not necessarily a rule here, the odds of getting help goes up dramatically if you properly form your code to common standards before asking.
also 😔
I'm so bad at coming up with ideas
Blackjack?
I don't really know how that game works tho 😭
I've never played it
Its pretty simple
google :D
google describes it as pretty complicated
so it is very simple
I think first you get 3 cards
if the sum of those 3 cards more then 21
u lose
I was thinking of adding something like tic tac toe level of simplicity, though I do already have tic tac toe made
if not, you can either stop or take more cards
Yeah i would do that at some point of time
so you play until u lose?
kinda weird lol
Tic tac toe was actually harder than blackjack for me to make.
nope
if u get like 19
there is a high risk to lose
and if you stop
I want like sr no.
Like
1] username votes
2] username votes
Here 1 , 2 are.missiong so what should I do?
if I'm understanding, 2 people get 3 cards, the one who has the less total number wins?
what is missing?
noooo, who get more sum win
but the sum cannot be more then 21
and if first 3 cards sum is too small, you can take more cards
you can something like Array.indexof(item) to get the item's possition
I'm so so lost
ok so
heads up on indexOf tho
it's not a boolean
nor does it return a bool
I got confused first time I used it as well
it return the possition of the item in a array
yeah
okok
ok
and by the rule, the sum cannot be more then 21, if it is more then you lose
ok
ok ok wait
I lose
ok hold on
A video or a guide will be faster.
Or finding someone's bot with a blackjack command will do too.
if I create the game, it would start with the bot telling you the 3 cards with an ephermal message, now that ephermal message would have 2 buttons
for example Doreamon
raise number, stay
you choose raise number = 1 more card, stay = go
yes
same for the other person
yes
you compare those 2 player's card
It goes on until you lose, or you ask for no more cards.
can we use J, Q, K ?
i dont reaslly remember
if the sum more then 21
Those are 11 iirc.
I've not played in years
but the sum to have more than 21 literally would take 1-2 turns so
I've had games with 6 cards before I stood
plus what's the point of continusing a game for longer if there is like 99% chance the game will be decided the instant one user makes a choice
1 gets 16 other one gets 18
no need to continue
I'm
so
yeah, it is the hard part. You decide, take more card and accept the risk. Or play with small sum
confused
The dealer follows a set of rules
The player is facing the dealer, not another player
The dealer has to make certain choices.
I'm still confused
I'd rather not
me 2
this seems more like a chore to play than a fun game
You hit, if it's under 21 you can keep going but the bot gets another card aswell
so thanks for the help but I think I might pass on this..
you stand if you want too and bot will try to either win or they'll lose
blackjack is my all time favorite card game 😔
nah I'm making my game system to be an online-type game
you can only play with other people
well its the same thing if you had another player
well, blackjack is typically played at a table of 5 people
oh I see
this might be quite hard to get 5 people together then lol
my bot has only 51 servers atm so even if it was global I doubt a lot of people would acc use it
🙏
draw
thank you
well, its a 1-5 player game in most casinos. you're playing the deck and dealer, but you're watching others moves too
you're using emojis as buttons
👀 we havent even gone into splits yet ^_^

I really need to restart my blackjack bot, that thing was beautiful
I get 20, so I will stop
simulated decks, 5 players, full blackjack support with multiple rulesets
dealer get 20 too, so tied
nah
this will be too hard to make online
I doubt many people will understand how to play it as well
I think its the most popular casino game next to roulette
forsure the most popular card game
maybe I'll add blackjack once I decide on an economy system
but not as a fun game
cause it doesn't really seem fun if I'm honest 😭
to be honest I was thinking of a 2 person type of game
I already made ttt, c4, rps and was thinking a good way to make hangman
those seem like the type of games to make like that
I think at least..
Blackjack is nice because it’s a simple game at its core, you have two (or 3 depending on the situation) options at all times, mostly based on luck
Yeah, its super approachable.
I can't really think of a good way to make this into a 2 player game even with the examples you guys showed me
so idrk..
Speaking of which, is there any issues regarding Discord ToS when it comes to things like gambling? As in, pure virtual currency, and 0 connection to real currency whatsoever
Not that I'm aware of
I don't think so... otherwise dank memer would be non existent at this point
any connection to real currency is taken really seriously.
even if its just a games currency.
some gambling communities around mobile game currency have been shut down
as they could be sold online
that's plain stupid?? discord taking dank memer "memecoin" as currency lol
no, I mean like an actual games currency
pretty sure you can sell dank member coins for some reason
well it just depends on how it's done I guess
👀 really
I got 10 billion anyone wanna buy 
I used to farm that's y
nah
does anyone know the scroll bar class name for discord?
I wanna make it transparent but I can't seem to be able to find it's color property even in inspect element
typically scrollbars are just ::-webkit-scrollbar ::-webkit-scrollbar-track ::-webkit-scrollbar-thumb
for example,
::-webkit-scrollbar {
width: 5px;
}
::-webkit-scrollbar-track {
display:none;
}
::-webkit-scrollbar-thumb {
background: #515151;
border-radius: 10px;
}
I tried changing both the color and backgroundColor properties it doesn't seem to change anything
which browswr
google chrome
Webkit style selectors are for Firefox/IE iirc
I tried fetching the query, class and ID
browsers are totally not weird and ultra legacy
I got results which werent null and clearly pointed to the scrollbar yet changing the properties didn't have any effect
and it makes me so irritated when I look at it
looks so out of place
Can you show what code you’re using
for (const query of document.querySelectorAll('*')) {
query.style.backgroundColor = 'rgba(0, 0, 0, 0)';
}
BetterDiscord ig
Try using a hex color instead
right now I'm fetching every query and this makes most of the objects transparent
hex doesn't have transparency tho
omg, discord client disabled f12 or ctrl shift i
no way
Just try it, you might not be allowed to set the transparency of the scroll bar with color properties
i spamming f12 it doesn't work
See if it’s at least selecting it
Depends on the browser
if it was selecting it then the scroll bar would turn black
Some browsers that won't work on
My dude just try it
I can't remember which browsers but I know that is a thing
Oh I’m just realizing that the scrollbar probably isn’t even an element
Probably just y-overflow of some sort
Idk
wdym waffle?
Yeah
Also don't know if you knew this
These are the vendor-prefixed properties offered by the relevant rendering engines (-webkit for Chrome, Safari; -moz for Firefox, -o for Opera, -ms for Internet Explorer). Typically they're used to implement new, or proprietary CSS features, prior to final clarification/definition by the W3.
if you did sorry for already explaining but hey now its there for those who didn't

So happy that we need 30 different brands of css for 30 different browsers
yeah
Well now, css wouldn't be torture if there wasn't now would it?
you'd be taking the fun out of css
scrollbar is for firefox only
oh
yea
isn't it --webkit
browsers are totally not weird
i think
nah
I had a rough time dealing with all this too
do we know what browser he is on?
it's honestly so infuriating
chrome
I just used these guys temporarily until I feel like fixing it for a website of mine
then -webkit should be working
it doesn't
maybe something is overriding it?
it just returns null
discord front end dev :>
so the properly doesn't exist
try it then
it doesn't appear to do anything so idk how you managed to get it working
there are 2 scrollbar, 1 for user list, 1 for chat
also -webkit-scrollbar doesn't change the actual scrollbar it just changes thebackground of the scrollbar, thumb iirc is what changes the sscrolling part
so it's impossible?
okay it actually worked
scrollbar is the container isnt it?
scrollbar > track > thumb
track is the background
what work
thumb is the sliding part
ah maybe you're right
so touching scrollbar there really is no point unless you wanna change the width of the entire thing ig
you'd wanna focus track and thumb if you wanna change its color and such

Probably some weird discord flaw in their design
Cause technically the scrollbar stops at where the chat input starts
just apply to every class :DD
though I see changing the backgroundColor property changes the actual element background instead of the scroller background
so that's annoying
ah now I see
it increases when you type in the chat
you're trying to change the track background?
the scroll bar and the bar handle to make it a little bit transparent to fit with the rest of the theme I'm going for
::-webkit-scrollbar-track {
background: red;
}
I can't inject custom CSS I need to override the existing property..
editing discord CSS is tricky because it constantly changes
the trick I used is to track location and update CSS when that changes
@sharp geyser how did you do your css edit?
🤔 isnt it the same process, i'm just saying its the track you need to select, not the scrollbar itself.
discord updates it when you hover on it so any change u made changes back
:/
You can inject your own custom css and js into electron ig
I'll try figuring it out in a bit
@boreal iron @quartz kindle speedyos bouta finally have segmentation faults
you can stop laughing at my os being broken because when it is broken i'll know
As long as there’s no PHP support I can’t take it seriously
only c++/c/rust support
take it or leave it
basically anything that can compile down to assembly
leaving the room
no pages for you
😥
thats like playing minesweeper with no safe zones
make a minesweeper game but if you hit a bomb the os segfaults/bsods
good idea
make it display random garbage on screen so its different every time
if you hit a bomb it will wipe your hard drive
lol
thats a bit too much
should be enough motivation
Or it literally renames and moves all your files
lmao
That’s enough I guess
scramble the file table
Only URLs with a scheme in: file, data are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:' tf does this mean
😔
if it detects you pressed the power button during the game it will wipe it anyways
it means exactly what it says
yes but why
I have no idea how i should do that tho
bro file system support comes later
once i have fs support i'll also add disk thrashing
resolve only returns
C:\Users\dyeaa\Documents\github\misty\locale\locales\de.json
C:\Users\dyeaa\Documents\github\misty\locale\locales\en.json```
Boot loader and logo first
if you want to troll the OS make a bunch of processes and make them each allocate multiple blocks of massive chunks of memory and then continuously access them in a loop so the OS cant move them to the drive temporarily
dont want to write a bootloader just yet
because i think that makes it so you have to load the rest of the OS from the drive to memory
and idk how to access fs yet
i only know the built in bios emulated way of writing/reading from disk exists
Fuck the fs, try something new and innovative
the rest i think you need usb support
well yeah im writing my own file system
using someone elses is mid
should probably add a waiting for IO status to my os now
just so i dont forget
I see
All you need is a marketing manager
I’m available
Only taking 90% of your profit and 110$/h
🙃
I'll think about it
I know you worked on a localization thing before, any opinions on this shit show 
https://www.toptal.com/developers/hastebin/soqojepuni.typescript
I basically save all the stuff from the locales files into a map that I call later when translating using a key/prop
So say I have an json file full of data, some nested some not.
What would be the easiest way to get that data as I need it.
I was trying to use the dot notation of like
get(contentsFromFile, 'bot.welcome.message', 'Nothing at this Path')
this would traverse the bot object, and welcome object and finally arrive at message which has an actual value to display
I was using the https://npmjs.com/package/dot-prop but it is full esm and I don't wanna go through the headache of making my package esm rn
you can still use esm libs with async imports
wdym
what is async imports?
await import("dot-prop")
don't you need your package.json to have type: "module" for that ?
nop
node:internal/process/promises:288
triggerUncaughtException(err, true /* fromPromise */);
^
Error [ERR_REQUIRE_ESM]: require() of ES Module C:\Users\dyeaa\Documents\github\misty\locale\node_modules\dot-prop\index.js from C:\Users\dyeaa\Documents\github\misty\locale\out\struct\Localization.js not supported.
Instead change the require of index.js in C:\Users\dyeaa\Documents\github\misty\locale\out\struct\Localization.js
to a dynamic import() which is available in all CommonJS modules.
at C:\Users\dyeaa\Documents\github\misty\locale\out\struct\Localization.js:37:81
at async Localization.t (C:\Users\dyeaa\Documents\github\misty\locale\out\struct\Localization.js:37:33)
at async C:\Users\dyeaa\Documents\github\misty\price-check\main.js:7:15 {
code: 'ERR_REQUIRE_ESM'
}
Then what tf
public async t<T>(prop: string): Promise<T | string> {
const { getProperty } = await import('dot-prop')
return getProperty(this.locales.get(this.options.lng), prop, 'Nothing to find at this path.')!
}
it says you're still using require?
But I'm not
I only use require when I'm testing my package in a js file
Could that cause it to have issues?
are you using ts-node?
No
Alright
async t(prop) {
const { getProperty } = await Promise.resolve().then(() => __importStar(require('dot-prop')));
return getProperty(this.locales.get(this.options.lng), prop, 'Nothing to find at this path.');
}
they used require
can you guys help me.
I'm making games for my discord bots and going to give coins to them
what should i do with that coin
then you need to edit your tsconfig
try setting "module": "node12"
anyone know how to resent the voice connection? on a bot
everynow and then my internet cuts off for a second or two and i have to reboot the entire bot for voice to start playing again
even if the bot wasnt in a chat at the time
or if i kick it and make it join again
is there any fix for this other than just make my bot reboot every hour?
node12 errors saying tsconfig.json:3:15 - error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'nodenext'.
well, the pink elephant would be finding why a vps is losing connection
or are u self-hosting?
then try node16 or nodenext
same as tsconfig.json:3:15 - error TS6046 or same as import transpiled into require?
import transpiled into require
yea that made it transpile into import but other things get broken in the process
C:\Users\dyeaa\Documents\github\misty\locale\out\index.js:1
export * from './struct';
^^^^^^
SyntaxError: Unexpected token 'export'
at Object.compileFunction (node:vm:353:18)
at wrapSafe (node:internal/modules/cjs/loader:1040:15)
at Module._compile (node:internal/modules/cjs/loader:1076:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1166:10)
at Module.load (node:internal/modules/cjs/loader:988:32)
at Module._load (node:internal/modules/cjs/loader:834:12)
at Module.require (node:internal/modules/cjs/loader:1012:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (C:\Users\dyeaa\Documents\github\misty\price-check\main.js:1:26)
at Module._compile (node:internal/modules/cjs/loader:1112:14)
Now this becomes an issue
my barrel files break
welcome to ts
lmao
apparently the only 100% reliable solution is this ```ts
Function('return import("abc")')() as Promise<typeof import('abc')>
lmao
well then
What the actual fuck
basically set the import as a string and eval it
that will prevent ts from transpiling it
😩
someone else said that it works now with "module":"nodenext" on ts 4.7+ but you get warnings for being nightly/unstable
Well if i do it this way how will I use dot-prop's methods
🤔
const importDotProp = Function('return import("dot-prop")')() as Promise<typeof import('dot-prop')>;
const { abc } = await importDotProp;
That is funky
That might work in some cases but not here apparently
TS2349: This expression is not callable. Type 'Promise<typeof import("C:/Users/dyeaa/Documents/github/misty/locale/node_modules/dot-prop/index")>' has no call signatures.
are you having mjs issues
show code
and not experimental
public async t<T>(prop: string): Promise<T | string> {
const importDotProp = Function('return import("dot-prop")')() as Promise<typeof import('dot-prop')>;
const { getProperty } = await importDotProp();
return getProperty(this.locales.get(this.options.lng), prop, 'Nothing to find at this path.')!
}
Actually that makes sense tim
What's this supposed to achieve anyway? I'm interested
prevent ts from transpiling import to require
but for some dumb reason ts transpiles dynamic imports to require
Does this need to be imported in the function to begin with?
now to figure out why I am getting the default value instead of what I am actually looking for
😔
bot.message
{ lng: 'en' }
{ bot: { mesaage: 'Hello, World' } }
Nothing to find at this path.
Tell me bot.message doesn't exist
smh
Sorry just trying to figure out if this needed to be dynamically imported.
it does
mesaage
thanks I am a fucking idiot

I thought you were making a joke lmfao
Hmm I THOUGHT it was possible to import esm with es2020
I might be misremembering
I just remember hating esm so much lol
bot.message
{ lng: 'en' }
{ bot: { message: 'Hello, World' } }
Hello, World
esm can import cjs cjs cannot import esm
that is one of the reasons a lot of people are swapping to esm
One thing I am wondering is though
Is it good to be saving all the contents of their locale files to a map?
Right now I am reading the data of their locale json files and saving its content to a map with the file's name being the key which is also the files locale key e.g en
i dont see why not
Watcha making though @sharp geyser
The way I did it is by having an external package require something for you and return it since TypeScript doesn't change the code for those https://github.com/flazepe/inclusion
^ that's just a fork to fix it crashing on Windows
print_rich() has to be the best feature added to Godot 4.0 so far
2320
477
localization package
How can I stop node-gyp trying to use multiple visual studio versions? I have 2022 version installed, and both yarn and npm config are set to use the 2022 version.
wha-
Is that the actual syntax? Seems… odd
I was logging some stuff
const { Localization } = require("locale");
(async () => {
const locale = new Localization({ lng: "en" });
await locale.addMultipleIn("locales");
console.log(await locale.t("bot.message"));
})();
this an example of how I was doing it
lng would be set with some kind of language detector what not. (I could probably do something better but this is my first version of it so leave me alone before you bully me waffle)
locale.t is getting the message you set for bot.message right? Shouldn’t you make this a synchronous operation?
Why not load the locale file into a Map
I am dummy
O(1) access too
I am
dummy
what you think addMultipleIn does?
it takes the files in locales folder and reads it's contents putting it into a map with the locale as the key
I don’t know because apparently you need to await more things after loading the file which should in theory be your only async operation 
WELL TS IS JUST DUMB WAFFLE
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
Why not store all your locales as Map<Map<string>>
Where the first map key corresponds to the locale, and the second key corresponds to the message


