#development
1 messages · Page 10 of 1
I’m gonna throw up… I hate react because idk why. Just I tried to use it and just cringed.
i never even tried using it
it has
just looking at it gives me nausea
use one definition
Wait I thought react did something different…
doesn't work either
alright, now
play around with it in dev tools, add/remove styles, change colors and sizes, see if the text is actually being affected
target the said FontAwesomeIcon element in the DOM
I found the syllabes online, so we are starting with artificial intelligence???
I mean the shadow is literally so close to the text you will barely see it.
Quarter 1
SOW-BKI135 Introduction
Artificial Intelligence A
(3 EC)
Ye but if it’s like 1px depending on your screen resolution it might not be visable.
straight to jail
aye
right away
@stuck dawn also i don't think it applies to the text itself if said FontAwesomeIcon doesn't resolve to only one span element
you have to find the actual element that renders the text
color
and then apply the style from there
Fa icons aren’t text are they?
texted font element
Wouldn’t it just be shadow?
text-shadow
I’ll try with mine… cus that should work.
check the html side of the element inspector, see how the element is actually rendered
in my case it worked
Like text-shadow: 1px 1px #000; should work.
check whati said
no
we don't know what FAontAwesomeIcon resolves to
either a collection of components or single span
FAont is awesome
ima use svg at this point
It’s <li>
:^)
Fontawesome uses li
damn... tim's trolling is on point today
i have a huge svg project coming soon
Idk it’s in their docs
gonna be annoying af
@stuck dawn can you find it in the dom btw, if that code you use happens to be a library
why thank you mr faker
look at my endfield project
another project to delay the api?

no thats for after the api, its basically the UI for using it
even aurel died watching me writing them
can i join

lmao
if it's written in react / angular
imagine finishing anything around the api, but never the api itself
since my upcoming university's web dev class
is probably gonna teach vanilla anyway
ballin rn
is it even necessary to add moderation commands?
i just noticed you can do it in discord itself to ban or kick users via slash commands.
ima write your api in rust
if you don't feel like it then don't
i didnt even start working on my front end product, but im likely gonna go for svelte
that depends on your bot, if it isn't supposed to be used as kick/ban bot, then don't add them lol
like i am new to this so idk how i can check how it is rendered xD
open dev tools
yes
I was thinking about adding moderation to it, but ig now it'd be useless because you can do it anyways if you have the permissions for it.
tf tim where did you get this money from?
donations
you click on the element that you want to inspect
rich bitch
imagine paying 2,4k taxes
i don't wanna install the library to help someone out please help
what i am supposed to see? the svg attributes?
do you have the site live somewhere by the way
OH wait
since you are developing in react
do you have react devtools
no but i can install it
install it in chrome plugin market
right click on the text, inspect element, show us a pic of how the html looks like
but we won't know where that awesome of a font icon component starts
ok, what do i do now?
ok..
should literally be f12 in your browser
yes
okay
click on the "<>"
then screenshot me the entire element
oh
wait wrong button
thats what i wanted to see all this time lel
which means you can only use either filter shadow or box shadow
:|
you can use filter drop shadow
example ```js
svg {
filter: drop-shadow(3px 5px 2px rgb(0 0 0 / 0.4));
}
how i can use that
but
give it a solid color
like if i use that i has blur
and i can't remove it
0.4 is opacity
see this shadow edge
change it to 1 to remove transparency
it looks bad i want to look similiar to the other text
here's it in svg
so i would use the filter if i were you
can't believe i had to define this myself
AH you want the outline for the text
but blurred right?
only outline
like the text
like this?
i can just apply to all of them by using the div
can i ask
xD
.phone-header-icons g g path {
stroke: black;
stroke-width: 10;
}
doesn't work :(
oh wait i haven't seen how many layers it's encased in
you can remove the --webkit-stroke-fill property, the transpiler will polyfill that in for you
it worked right?
then let it be that way then
nope
@civic scroll u're a pro, rate this svg
bro 💀
image parse --result text > sayuri-js-optimise -o $temp -l ts
oh you use g g path it's only path
gimme a moment
you didn't understand selectors
when you open an old js project after you enable strict type checking for js in vsc
@quartz kindle gimme a moment to optimise the screenshot code btw
this is what is looks like
quite nice tbh
this was a commission i made for someone 2 years ago
but im gonna use part of this code on my thing too
a bit hard to see the triangle borders for similar colors
sort of, but no
there are many things that can be read from charts like these
the most common use is to tell you about your personality, what to do to be happy and what to avoid
yikes, better not
but you can also use it to see why something is happening with you at a specific moment
or why something happened the way it it
xD
and of course you can try to plan your future with it
but things often dont quite work as you would expect when you try to control it too much
@civic scroll question, i have a font file made with one of those font creator softwares, that contains the icons and symbols for these charts, is it a good idea to use it as a font in svg? or should i try to convert the symbols into svg paths/objects and use that instead?
you can still use them via text and font font elements
just specify correct unicode chars
yeah thats what i did
i do use text and so far no issues
i want the symbols to be customizable via css, but i was also thinking about letting the user change them into custom symbols
but thats a bit tricky if the symbols come from a font file
like if a user wants to upload a png of a symbol, i have no idea how to enable it for use in the svg
i might have to force the user into providing an svg-compatible path or something
instead of an image
you can specify something like uh how you would use images
you can still display images in svg
convert it into base64 dataurl
but they wouldnt be css'able, like color and stuff
hmm
hue-rotation, saturation, brightness
that's inevitable tbh
use relative color differences rather than absolute btw
at this point just extract the svg from the image

most path tracers are garbage tho xD
lmao [object Object] transition
xDDD
ive always wondered if there was any benefit to using b64 data urls
tim here's the result of hell optimisation
// ...
svg += '<g class="planets chart1">';
chart1 = this._correct(chart1);
for (const planet of chart1.planets)
{
let { name, longitude, drawPosition, sign, house, speed } = planet;
let h = highlight ? (highlight[0] === name || (highlight[1] === name && !chart2)) : false;
let [sin1, cos1, sin2, cos2] = [longitude, longitude, drawPosition, drawPosition].map((v, i) => Math[i % 2 ? 'sin' : 'cos'](v * Math.PI / 180));
let {
glyphPosisition: r1,
degreePosition: r2,
lineStart: r3,
lineEnd: r4,
helperStart: r5,
helperEnd: r6
} = conf.planets;
const notEmptyString = v => !!v;
svg += [
'<g class="',
name.toLowerCase(),
Object.keys(glyph.signs)[sign].toLowerCase(),
house ? ` house${house}` : "",
h? "highlight" : "",
'"',
`data-longitude="${longitude}"`,
`data-speed="${speed}"`,
'>',
[...[
`<path d="M ${r3 * sin1} ${r3 * cos1} L ${r4 * sin1} ${r4 * cos1}"/>`,
`<path d="M ${r5 * sin2} ${r5 * cos2} L ${r6 * sin1} ${r6 * cos1}"/>`,
`<text x="${r1 * sin2}" y="${r1 * cos2}" dominant-baseline="central" text-anchor="middle" font-family="A">${glyph.planets[name]}</text>`,
`<text x="${r2 * sin2}" y="${r2 * cos2}" dominant-baseline="central" text-anchor="middle" font-family="san-serif">${(longitude % 30).toFixed(0)}</text>`,
]],
'</g>'
]
.filter(notEmptyString)
.join(' ')
};
svg += '</g>';
besides exploding inspect element
exploding inspect element
normally it would be a way if i want to preload the image
then put it in svg
lmao
yes, including the
xD
I am building a docker panel(cluster->server->container)..
So currently building/coding the permission system
As db , I am using mongodb
const user = new Schema({
email: String,
id: String,
admin: Boolean,
roles: Array,
accessToken: String,
});
const role = new Schema({
name: String,
description: String,
permissions: {
cluster: {
read: Boolean,
write: Boolean,
delete: Boolean,
}
}
})
What would be the best way to link the role to user.roles
I heard about subdocument , but hopefully somebody has an efficient/better approach
i think for this case role should be singular
but if you want you can
const role = new Schema({
name: String,
description: String,
permissions: {
cluster: {
read: Boolean,
write: Boolean,
delete: Boolean,
}
}
})
const user = new Schema({
email: String,
id: String,
admin: Boolean,
roles: Array<role>,
accessToken: String,
});
iirc
or you can use Array<String> as the roles' ids
and have the role schema an id field
I'm testing random bots on a throwaway discord server, and this one doesn't use subcommands 
volume the music
since sub commands are not hidden in the UI yet, it doesn't really matter
but this doesn't really look good tbh
also maybe people don't even know sub commands exist or how to register them :P
i mean they did use slash commands for these commands?
oh i can't even test it since the bot is offline
they don't necessarily
yeah they don't have to be
You have to still have a server up to receive the POST requests
test mine later 
I don't use slash commands though
undefined modshortcuts
what
wtf these are different bots but the pfp looks the same
different creators
lol this guy just copied the youtuber

@lone wing can you keep all of this related to development and not spam images please? It's kind of annoying for people who want to discuss dev stuff
sorry
damn fr i should apply for mod
?


minimodding also against rules
😳
which in a way makes me a minimod for saying that
omg banned
paradox
mini-modception
minimodding?!?!??!
minimodding is the stupidest rule
complaing about rules is also against the rules
minimod
soon everyone is banned
banned
you're minimodding
thinking loudly is against rules
tf, let's ban the mods for creating such rules
ye
I’m using google rn for this, but they charge by number per month… azure charge by X per second…. This would be a good step to change from google to right?
It’s a content moderation tool, and should help when the bot scales and it’s moderation system is going with more than 1000 interaction requests a month 😂
Idk, do I stick with the google one that’s expensive and has appalling support, or swap to azure that has great documentation, is cheaper priced for scale and I have a support agreement with that can resolve issues normally within the hour?
charge by X per second
excuse me???
interactions per second
that's a very low tps cap
its $2 per 1000 interactions over your first 1000 a month on google tho
This is 50% cheaper
and then add in my 50% partnership discount with azure...
thats $0.50 per 1000 transactions for my first million
why exactly are u using it btw?
or if I get 10m+ in the month... its $.20 ever 1000
like, what's a "moderation tool"
Content moderation for automod
can't u just integrate ur bot with the new discord automod feature?
Plus this will allow me to filter user input on the commands...
Not for the user slash commands like with my welcome banner
I use google to stop pornography being the banner image, this is the same... But cheaper lol
there's someone here that made an image filtering service
that uses machine learning to detect
aren't there options where u don't need to grab the wallet?
I just think that once I hit around 1000 interactions on google I should have a cheaper alternative
You only get a limit before its no longer free
And google works out a lot more at predicted numbers than azure does.
Plus 10 tps... I can make a queue on the commands that use it to await a response, meaning I can literally handle millions of requests at 1 second, but over the second it will pop in 10 from the queue and reply
So some commands may see the "unusually high requests on this command, please await response, you are position X in the queue" on their slash command response lol.
But ultimately I might move the welcome banner config to the website to me more useful and user friendly.
Plus this PC is built to work with Azure cus of work lol... It is only logical as I have all the tools to test and fail azure api requests without making actual requests that cost.
u could stay below the 10 TPS limit btw
just put a temp image like "Checking banner, please wait" while the request is not made
use a queue as u said to send batches
Yeah thats what I am doing lol
Just need to think if I want to use the website so its cleaner and I don't have hanging slash command interactions.
Because then you can have "Welcome banner content being reviewed. Please wait." shown blocking changes to the welcomer config for the guild.
Yeah 100% going to change from google because I have already used 100 interactions this month from testing alone lol.
And I know with azure they never charge me for test requests.
https://docs.microsoft.com/en-gb/javascript/api/@azure/cognitiveservices-contentmoderator/?view=azure-node-latest This is actually beautiful compared the the clusterfuck that is the google api reference.
isn't there a wrapper for it?
they generally always release wrappers for mainstream languages
Yes this is the node reference
a
And the google one for node just showed basic examples and leaves you to figure out what data is returned for image moderation...
Azure actually seem to show you the response example lol
It only shows typescript tho... I use javascript instead lol
Like this... Its kinda better than the google docs. Because it explains a lot more lol
hey i have set my topgg webhookurl to this url myvpsip:3000/dblwebhook
but it's telling me that the url is not valid
awesome, thank you!
Are you using express?
yeah
I have an example that might help you better...
A simple express listener to work with on node.js that recieves a vote webhook from Top.GG and responds by posting a message to a discord channel through your bot. - GitHub - JCoNet/node-topgg-webh...
It works like yours, but it uses /server and /bot to specify the difference between the two vote type
ye
owhh
I customised the code to like detect different things for bots too. So it shows if weekend modifier is active or not lol
Feel free to fork and modify it to your needs but I found this more reliable that the example topgg docs gave and IDK why lol
Oowh wow this example is awesome, thank you JCoDog
Probably because it handles the incoming request using express req and res instead of the topgg webhook library
It is literally an express version of the listener running on my website lol
I also think the "idiots guide to deploying this example" is what sets it apart.
on lines 34-36 would it not be client.guilds.fetch etc instead of client.guilds.cache.fetch
That may be a bug yes...
let me ammend
This is why I needed it reviewing. I made it early hours this morning on no sleep lol
cache is .get()
Yup
Im aware. I forget when I am tired lol
Fair
yea i get that LOL. dont forget the /bot part too
It's well written, can't blame you for making a small mistake lol
I believe the class decl for djs's collection is class Collection<K, V> extends Map<K, V>
Check now.
Im half tempted to not use the azure content moderation api on node and just write it using my php api handler and make webhook requests to that...
Like, then I can sell use of it to other bots lol
Meh... I'll have to get it working first lol.
This is going to be a huge project lol.
that's so java
I could go for some java rn
By that I mean coffee... But Monster energy tastes so good.
I mean, it's pretty generic syntax (no pun intended)
It's just a collection of helper methods for a map
ah
It is a map
That's why you can call all the map methods on it
But djs (and most libraries) have their own functions because Map doesn't include everything that's convenient to use
Feel that...
I feel like I should make a npm package to do my express webhook easier...
So a user just does let bot = listener.bot(authtoken) and it just returns an event or somethin...
idk... Maybe thats overkill... Considering express works fine as it is lol
tbh I was surprised when I learned that map doesn't have compute in js
LMAO
Nah, why would JS have useful features?
its just simplified java for web browsers
JavaScript
ham -> hamster
I love saying that cus it annoys java devs lol
tbh js was made to be a layer between browser and java
Im a php and node.js dev lol
since everything was using java at that time
This is why i say JS is simplified java for browsers... But it still annoys people.
I do nodejs with typescript, rust, c++, c#, java, and a little js
and applets were just awful
not really, it was just a compatibility layer
my cs teacher thought applets were still a thing last year
applets suffer the same issue as flash
I do C sorta... Python. Like python is based on C
gotta say that rust is fucking amazing
the pattern matching + the type system = pure bliss
the ultimate langdev language
yes
voted most loved language on stackoverflow for the last 7 years or something like that
LMAO
yup
When being boring is the best compliment you can get
out of its 11 or 12 years of existence, 7 years voted as most loved lang
I worked with 5 dickinsons at my last job...
It was so hard to resist asking them if they enjoy dicking sons...
also enums in rust are just amazing with the pattern matching it offers
very powerful
cockshott
Its structured like Go
I shit you not there was a kid in my elementary school that was named "Dick Dick"
wait is it go or kotlin... or both lol
neither
It's neither C:<
IDk... ive used go and kotlin for a total of like 3 hours in my life lol
Rust is focused on fast speeds with pure memory safety
And it's also just very focused on safety in general
just the println seems similar to kotlin
It's a macro
the only thing I like about rust is that it's not c++
Preach
Rust is by far the best language for metaprogramming imo
probably is, since its direct competitor is the awful c++
LMAO I used Rythm over groovy
and carbon, but it's still a newborn
I mean the language
I've heard that OCaml is really good for it too, but not mainstream enough to be worth using
I know lol
if you notice that reply was to the threat (not the bot) because it made me remember how youtube fucked over rythm
Carbon isn't meant to replace any language other than C++, they even recommend that you use rust or other languages if you are able
It's just meant to be a more modern option for migrating age-old C++ codebases
To be easier to maintain
And it's also designed so that C++ devs can easily learn it
I bet dealing with winapi will still be shitty
Any language dealing with winapi is shitty
but well, if u like js/ts I highly recommend it
it feels like them, but wields all the power of java
and tbh, ```
5.times {
println it
}
/*
prints:
0
1
2
3
4
*/
loops are the best part
wdym you don't like rust's macro syntax?? ```rs
macro_rules! add{
($a:expr,$b:expr)=>{
{
$a+$b
}
};
($a:expr)=>{
{
$a
}
}
}
:troll:
tf
The best part about macros in rust is that you can extend the language syntax without needing a whole compiler update
That's what allows async/await to be in rust without needing anything special on the compiler's end
Also I forgot to mention that Result<T, E> and Option<T> are absolutely amazing in rust as well
And the lack of a "null" existing is nice too
I've only been doing rust about 1-2 months now, and I already think it's the best langauge I've ever used
Am i calculating my resource usage wrong? My bot is in about 8 servers and it's only using 40mb
it's discord.js
with regular old node
Well I just spoke to an api maker and he told me that for what I need to do, I should be using CURL instead of the node library azure gave me. That is going to make things so much easier just being able to make rest api CURL requests
Node itself usually takes more than 40mb
ill be able to define all the methods how I want to define them and customise the responses perfectly!
process.memoryUsage().heapTotal / 1024 / 1024
the % is just /512mb since that is heroku mem usage limit
it gives mem usage in bytes
Yeah... why not handle it in mb?
yeah...
well, technically, yes
hold on im gonna locally host the bot temporarily and see memory usage
memUsage.rss is usually more accurate
but if you know your mem is 512 mb, why waste time converting both to bytes when you can handle both in mb?
if node has an internal memory size like java then that value is technically correct for the process only
since that's the Resident Stack Size, which is how much the process is currently taking regardless of if it's using it or not
wdym? the function return in bytes not mb
you need to convert to mb
the 40 MB is where they're doing the calculations
L Moment
It might be the process size not including node's internals
But what happens if you have 1tb memory?
it's probably that, most runtimes do that
Because even libless I can't really get a gateway connection open under 40mb of ram
u just convert to TB
(In node)
resource usage is actually pretty accurate
Dont ask how, but there are servers at ibm for banks with terrabytes of memory.
those are multi-machine environments
I can't even see what processes are taking up what though
not a single TB ram stick
The code isn't accounting for the fact that you can upgrade and downgrade total memory
like you could go from mb to gb, then you have to change your code
Learn a programming language, find a specialty, then get good at it with many many many hours of practice
Node.js is the one highlighted
the rest are the powershell processes
you see, you can't learn "how to become a dev", you learn how to think abstract and see things as a bunch of smaller parts
the rest is google
Not really
That's probably why
although i did update my config system to only load what is needed
You should probably be using RSS, not heapTotal
alr
For a more accurate count
Isn't that just allocated memory though
My entire career is based around being a DevOps Engineer and it being seen as a title of great stature due to the hours of schooling in the field and certification exams...
That's how much the process is taking up regardless of whether it's using it or not
Resident Stack Size
And you just put how the indepndent leaning of the Dev asapect goes like that... Just removed that "special" factor.
ok yeah then it jumps up to 90mb
If your machine needs it, it can free some of that RSS
gamers
But usually it keeps a little more than it needs, just in case
https://github.com/MinnDevelopment/discord-webhooks i wanna use this
which is java
It's usually going to be quite larger
how tf do i import that into my code
haha
You dont and learn how to do it yourself.
Well, you can use a dependency manager like gradle or maven
you learn java
Or you can download the jar file
this is my first time using java and i don't understand it
oh wait, forgot to reply
just CURL request to the webhook endpoint the content body outlined here: https://discord.com/developers/docs/resources/webhook
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
like, when you see an apple you say "It's a fruit", while we say "It's a round eatable object, with a sweet taste and crunchy texture. It's color is red with small lighter strokes. On the top of it there's a brown, slightly bent stalk."
yeah but idk how to
Like sheesh...
thats the point
CURL!
Have you ever used Java before?
once
It might be easier to start with some easier projects
Literally google how to make a CURL request to REST APIs in your language
Like console projects

Dependencies in Java are one of those things that kinda suck
jabba
I'm sure kuuhaku will correct me on that
@spark flint what lib?
used to, nowadays they're a lot easier
which is a much easier way to use webhooks
u want to make raw requests?
HttpUrlConnection then (has an Https alternative)
although I do recommend using Apache's HttpClient
i don't really wanna make raw requests
i like making my life easy and using modules/dependencies
idk how to import it 🗿
maven or gradle?

...
Check discord.js they can post without needed webhooks lol
I hate gradle
then discord java

there is a discord java library
yeah fuck this shit i'm out
implementation group: "the.group.name", name: "lib-name", version: "version"
kuuhaku is a java expert
put in build.gradle
nah, I'm far from that title
im gonna go work on my azure package
Idk, if you can pack 4000 lines of java into a single utility file, I'd consider you an expert
if u still use the old format: implementation("the.group.name:lib-name:version")
lmao u mean pagination utils?
or my bot's helper file?
yeah I split that thing into separated categorized files
another example of rust's insane pattern matching and error handling
that looks a lot like java's switch
It's essentially a switch statement but it requires you to cover all possibilities, and also gives you enum variant pattern matching
Here's a file that I think showcases the power of match expressions with enums very well: https://github.com/Jwaffled/math_parser_rs/blob/master/src/interpreter.rs
return switch (token.token_type) {
case TokenType.Minus -> // stuff
case TokenType.Not -> // stuff
default -> // stuff
}
In java for the same thing I would be using the visitor pattern which is far more annoying and basically makes it so you have to verify the types yourself since java can't do it for you at compile time
here's what it would look like in C#, but without any boolean support https://github.com/Jwaffled/MathExpressionParsing/blob/master/MathExpressionParsing/Core/Interpreter.cs
Thought you got rid of your demons
See how much casting you have to do
Since it's not technically type-safe
Whereas I never cast a single time in the rust version
I also much prefer using Result<T, Err> for errors instead of throwing them
Makes it so you never have an unhandled error (Unless you do something stupid like an index out of bounds on a vector or something)
Even then you can handle that because Vec<T>.get(index) returns Option<T>, so if it's out of bounds, then it'll just give you a None value
But using the direct indexing operator will cause a runtime panic if it's out of bounds
I like the concepts of Rust but don't have a use for the language myself.
though I have mixed feelings about Option<T>
Result and Option are godsends
Since you're guaranteeing the compiler that you're handling all of the possibilities at compile time
Which ofc you can bypass if you know exactly what you're doing
Yes, but if you later change your code to always return T, that's considered a breaking change, which is annoying.
Like this is unsafe and can definitely cause a panic at runtime, but I know that it won't happen because the way I'm writing code guarantees that when I call this function I am never out of bounds
Usually you would only make the return value Result or Option if you know something can fail, and that T is not guaranteed
Which in most cases doesn't change
I'm talking about if you go from Result<T, E> or Option<T> to just T, or the other way in some contexts.
i.e. you change your code
I know, I'm just saying that's a very rare occurrence
Either way it's still a relatively easy change to handle
Not really
If you're maintaining a library (though can apply to applications) and that happens, that sucks as it's a breaking change
It's like if you changed a function from being noexcept to being able to throw in C++, you'd have to wrap calls to it in a try/catch
If you go from T to Result/Option, then yeah, that's good. But the other way around, not so much.
I suppose, it's not a huge deal in reality though. That doesn't happen very often
And you could just keep it as that return type, just never return None or Err
I'm sure there's some way around it that I haven't figured out because I'm still not too experienced with rust
You could, but that practically mimics null and forces you to always check/assert beforehand.
if you compare snowflakes do you use a strict === or a normal == equals operator?
I talk about it because when you're confronted with:
fn identity<T>(value: T): Option<T> {
// ...
}
And decide that value should now be optional, that's a breaking change, as you have to change T to Option<T>, despite you not "really" doing something wrong. The same is true if you decide to change the return value to just T and change the code to reflect that internally. Callers of identity now need to update their code to get rid of the potential None checking beforehand, which, again, is not "really" your fault. That's one basic issue I have with it, as it makes breaking changes unnecessarily more common.
I've gotten kinda confused with this
can you show the scenario in which this would be happening
one second I'll send you the code I'm writing
It shouldn't really matter tbh
for js you almost ever want to use ===
But yeah
most IDEs will tell u that too
@wheat mesa sorry took so long I was writing another feature for this code```js
// Lets now write some code for our Afk System Module.
// First we check if it's enabled, then we check if the person typing is AFK.
if (settings.afkSystem === "true") {
// And now lets define our afkCache Collection again.
const afkCache = container.afkCache;
// Now lets define whoever was mentioned.
// If there is, lets now continue the code, else stop.
const mentionedMember = message.mentions.members.first();
if (mentionedMember) {
// And now lets actually check if the person mentioned is a person with an AFK status
// If not, again we will ignore it.
const afkData = afkCache.get(mentionedMember.id);
if (afkData) {
const [ timestamp, reason, guildId ] = afkData;
// We check if the afk was from the guild the person was mentioned in.
// ( We do not want the afk system to be cross guild, as some guilds may have disabled their AFK modules)
if (guildId == message.guild.id) {
}
}
}
}
not even sure if the code works since I haven't tested it
and sorry for the thousands of comments lol
I would just use ===
In js you usually need to use ===
In typescript it's not much of a problem because you know what types they're going to be
has anyone heard anything about the massive embeds 😢
// Lets now write some code for our Afk System Module.
// First we check if it's enabled, then we check if the person typing is AFK.
if (settings.afkSystem === "true") {
// And now lets define our afkCache Collection again.
const afkCache = container.afkCache;
// Now lets define whoever was mentioned.
// If there is, lets now continue the code, else stop.
const mentionedMember = message.mentions.members.first();
if (mentionedMember) {
// And now lets actually check if the person mentioned is a person with an AFK status
// If not, again we will ignore it.
const afkData = afkCache.get(mentionedMember.id);
if (afkData) {
const [ timestamp, reason, guildId ] = afkData;
// We check if the afk was from the guild the person was mentioned in.
// ( We do not want the afk system to be cross guild, as some guilds may have disabled their AFK modules)
if (guildId === message.guild.id) {
message.reply(`${mentionedMember.user.tag} is AFK!\nReason: ${reason}\nSince: ${timeAgo(timestamp)}`);
}
}
}; const afkData = afkCache.get(mentionedMember.id);
if (afkData.get(message.author.id)) {
const [ timestamp, reason, guildId ] = afkData;
if (guildId === message.guild.id) {
afkData.delete(message.author.id);
message.reply(`${message.member} Welcome back!\nI've removed your AFK status for you :thumbsup:`);
}
}
}
``` do you guys think this is good enough? (First time writing an AFK system)
let me know if I missed something important
I have some complaints about the code style
are you still storing true as a string?

I had to revert back to my old system because it broke
btw
Cannot read properties of undefined (reading 'set')
// Grab the settings for this server from Enmap.
// If there is no guild, get default conf (DMs)
// Also prevent people from using the afk command is the afk system is not toggled on.
const settings = message.settings = getSettings(message.guild);
if (settings.afkEnabled !== "true")
return message.channel.send(`The AFK system appears to be disabled! To enable this module please run \`${settings.prefix}set edit afkEnabled true\``);
// With that done, lets now get our afkCache Collection from our *client* object.
const afkCache = client.afkCache;
// And now lets define the variable we will use as the "reason" for the AFK status.
const reason = args.join(" ") || "No Reason";
if (reason.length >= 256) return message.channel.send("You can't have a status that's longer than 256 letters!");
// And now let's set or update our current AFK status
afkCache.set(message.author.id, [
message.createdTimestamp,
reason,
message.guild.id
]); return message.channel.send(`Done :thumbsup:\nYour AFK status is now set to: ${reason}`);
``` any ideas?
I swear Bea is like:
inb4 "why is my memory usage so high"
100%
I've done some optimizations and it's actually down to 40mb
yeah that's totally gonna stay at 40mb when you have to cache all those true/false strings
granted v8 is probably smart enough to have a string pool
and just assign pointers to those strings
40 year old C/C++ programmers looking at this storing a 1 byte value as 4-5 bytes every time be like
still its 8 bytes for a pointer vs 1 byte for a bool
but realistically it will make zero difference
I feel like it would make quite a difference at scale
damn
the problem with memory de-duping without knowing dev intent, when they mutate the string, other instances could just be like… Yeah uh what?
strings are immutable tho
Ah okay now I see that the new string would be alloc'd and pass pointer
Since they're immutable none of them are really shared references, they all just point to the same string until they don't
until they point'nt
I fixed that
yes ik I could just use c, but like no
store everything in a buffer :^)
for some reason I could only store strings in a discord.js collection otherwise it would return undefined when trying to get them
which made it buggy
Oh true actually
?
time to somehow cache entire classes in Buffers
Write your own js parser that is run on js buffers
but i plan to make a buffer-storage
Collections are just maps
I don't know what you were using to store them before that, but there is virtually no difference between a collection and a map, since I assume you were using a map
Can’t follow anymore how much unfinished projects you have

I was at least by 2763 so far…
not many tbh
whatever is public on my github and doesn't say "WIP"
Ok it's like 6 projects
lmfao
including some private ones that I'm done with
just that the projects i have shelved/planned are so painful
I'm currently working on my breakfast themed language
about 450 lines into the parser rn
i do love easy/small projects
my biggest challenge is going to be figuring out how to use LLVM/cranelift for codegen since I've never done that before
It must include waffles, does it?
I was told by the rust server to use cranelift since it's easier than LLVM but I can't seem to find much out there on the internet about it
I mean, if you count # as a waffle, yes
Lmao
I made the semicolon equivalent a # because it looks like a waffle
So I'm everywhere in the lang C:<
// Lets now write some code for our Afk System Module.
// First we check if it's enabled, then we check if the person typing is AFK.
if (settings.afkEnabled === "true") {
// And now lets define our afkCache Collection again.
const afkCache = container.afkCache;
// Now lets define whoever was mentioned.
// If there is, lets now continue the code, else stop.
const mentionedMember = message.mentions.members.first();
if (mentionedMember) {
// And now lets actually check if the person mentioned is a person with an AFK status
// If not, again we will ignore it.
const afkData = afkCache.get(mentionedMember.id);
if (afkData) {
const [ timestamp, reason, guildId ] = afkData;
// We check if the afk was from the guild the person was mentioned in.
// ( We do not want the afk system to be cross guild, as some guilds may have disabled their AFK modules)
if (guildId === message.guild.id) {
message.reply(`${mentionedMember.user.tag} is AFK!\nReason: ${reason}\nSince: ${timeAgo(timestamp)}`);
}
}
}; const afkData = afkCache.get(message.author.id);
if (afkData.get(message.author.id)) {
const [ timestamp, reason, guildId ] = afkData;
if (guildId === message.guild.id) {
afkData.delete(message.author.id);
message.reply(`${message.member} Welcome back!\nI've removed your AFK status for you :thumbsup:`);
}
}
}
``` TypeError: Cannot read properties of undefined (reading 'get') dude what
it's this line if (afkData.get(message.author.id)) {
A simple for loop to print 0-9: ```
prepare(preheat i at 0# cookwhile i tasteless 10# stirby 1) |>
say i#
<|
One way to take credit for the hard work of the language! When the creator is a waffle
😉
oh my bad
think -> idea
^-------- |
| v
finish |--- develop
true!

You never checked for undefined afterwards
Also why not use the has() method in that if statement expression?
I mean technically it's better to not call has since it'll end up in a redundant function call
If it does pass that is
Better to just check if it's null/undefined and if it's not then you don't have to call another function
Bae escalating again?
HOW DO YOU REMOVE SOMETHING FROM A COLLECTION 😭
(Assuming he needs the value)
<Collection>.remove() iirc
I said in the if statement expression, if they're just checking if the ID of the message author exists as a key in afkData
Ah no it's .delete()
@ancient nova there's documentation for the 5 billionth time: https://discord.js.org/#/docs/collection/main/class/Collection
But if they want to check the value rather than the key, then it's understandable

oh that's y
got damn I think I edited that over 6 times
That's all I need to see
Something worse than listening to BTS torture, looking at ItsOkayBae's code that was never showed to us
The hidden and forbidden sight of death
"Sir, that'll be $500,000 for giving me brain damage as well"
I need to sue for emotional trauma
So many things have been said like a thousand times already
Can we pin a link to documentation please
Nevermind there's already some pinned
just buried behind 30 other pins
"That won't stop me, because I can't read!"
I wanna say this isn’t djs support server but it literally is
volt teach me llvm
I was told by rust langdev pros to use cranelift
But I don't know if I want to install it if it requires that (Haven't looked into it yet)
He can teach you to craft non-working bombs
Because LLVM took like 55gb of space
And 2+ hours to build
😭
And I still have yet to use it
I'm sorry you had to sit through that, done that a 100 times already
god imagine editing one of the header files for this monstrosity
"Compiling 500 billion files that depend on this one header"
"Oh shit I forgot a character in this string"
This little maneuver is gonna take us 51 years
After I finish my AST parser I'll look into the differences between cranelift and LLVM
Since I was told that I'm good to generate my AST before I even touch codegen
how the heck does llvm have 55gb
isnt it supposed to be a small efficient cross platform low level vm
It's the fully built source code
Which includes all the developer stuff, not just an executable or anything
Well try to compile this whole thing
https://github.com/llvm/llvm-project
The debug folder alone takes 26.5gb
Oops I misplaced the parts
i still dont understand how is it possible to have 50gb worth of developer code/tooling
the runtimes folder is only 28kb, which I assume is where the magic happens
how big is the actual compiled llvm?
nvm this is just a folder of vs shit
The tools of LLVM itself, such as codegen, IR, optimizers, etc etc. reside in the llvm directory
liar, I see no such dir
my head has trouble processing such colossal projects
does it cure cancer?
yes
nice
it makes whoever sees it kill themselves, therefore killing the cancer too!
Also it seems like Linus Torvalds is slowly switching to using our Clang compiler to compile the Linux kernel
lmao
isn't clang slower than gcc on average though
or, well, produces slower code I thought?
Nope, Clang is well-known to be faster than GCC
inb4 russia
lmfao on gcc's own forum, someone had something like this happen

Although there is a catch, GCC implements the newer features/changes of the C/C++ standards way faster than Clang because they usually don't do much optimizations
good thing c/c++ barely ever has significant changes
We usually focus on optimizations so it takes a lot longer to implement them on the Clang side
how are these stats?
Not bad, but I would suggest removing the Users field because nobody really cares about that, since they're not the actual users and just the cached users
memory usage went from 150mb to ~40mb
uptime is constant, it can go weeks without restarting, I supprossed most errors with my errorss handler and the ping is quite ok ranging from 50-150
oh no worries
memory usage, lemme guess you changed it from process.memoryUsage().rss to process.memoryUsage().heapTotal 😛
didn't change anything
😠
What are you using for memory usage
hold on I don't even remember what I put there
@earnest phoenix for memory usage, RSS is more accurate right?
lemme check
Yes
${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)} MB
``` this is precisely what I'm doing
alright let me try that
resident stack size will be larger because it keeps track of more stuff in your process
Like stack allocation, not just heap
pls reload stats
Which is a big part of v8's internals I'm sure
whoops
😭 it jumped to 117.54 MB
wonder what it would be if I changed it to rss before I did the optimizations
Yup, because it includes that other stuff which is important too
more than 300MB?
I highly doubt you optimized it THAT much
Unless you were doing something horrifically wrong
I've turned some modules into events
That really wouldn't make much of a difference, whatever that means
before executing most things I checked if they're working so no calculations are being done as well
I've mainly optimized the messageCreate event
Alright well, go ahead; compare the before and after of the optimizations
Again, unless you were doing something horrific I doubt you would've been able to force 200mb more of allocations lmao
from ~500 lines to 323
just saying how much I redid
I can write a memory leak in like 5 lines in C
:troll:
int main() {
for(;;) malloc(10);
return 0;
}
4 lines if you wanna adhere to c standards
😭
I think the return 0 is forced to compile
oh so you will just keep allocating more memory until blue screen of death 
Normally you'd use it to allocate space, and cast it to a pointer of your choosing
Or just 1 line in JavaScript
for (;;) Buffer.alloc(50);
lmao
A good example is dynamically sized arrays
Where you have to resize and reallocate the array because arrays have constant size and cannot change size
Ah, C, the language where you have to do EVERYTHING yourself
Ignoring assembly
Well yeah but very few people actually hand write asm now, unless it's for like os dev and some other stuff (which I'm sure you have done some of for LLVM of some sort lol)
Yep
Even the Linux kernel writes assembly instructions using the asm function/keyword in C
So much optimization 
lol
having issues with this... Its not resolving to my app on port 3000
llvm and such have gotten so advanced that you probably would not be able to hand write a program in asm that is faster than a c program optimized by a compiler
unless ofc it's this, since this function only returns 1 for any value given to it 
Yeah, it's extremely hard to compete against writing a program in ASM yourself that would be faster than a compiler-generated ASM
so many people working on so many areas of specialty in those optimizations
you'd have to be a literal god
Unless you know ASM very well
the compiler's only purpose in life is to write asm
do u think u can compete with that?
Compiler: "You underestimate my power!"
I just realized I store afk cache by author ID so even if I check for guild ID as to not make it cross compatible it would still override the users afk if he set it in another guild
anything I can do to fix it?
design a system that doesn't have 2d maps
lol
think about your logic before rushing to write it
I won't be able to use collections for it tho
and I don't think I wanna stuff another thing into my bots DB
Anyone know anything about DNS SRV records?
Ok, 2d maps are a decent use case for this. I would have something like Map<guildId, Map<afkPeoplesIds, yourObjectForReasonAndStuffHere>>
I love this little app.
why ascii mode tho
its weird... its for on an ubuntu ssh terminal lol
they have a way to view it in a browser but its paid...
most ssh clients can do better than that lol
why can't they just use window drawing characters?
This is my creating an image SFW checker first test...
How do I convert a buffer to an object?
What exactly do you mean by that?
I get a response of json in buffer form from a CURL... I need to turn that buffer into JSON.
nevermind I need to convert the buffer to string then parse it...
The data is received in chunks, so if you don't seem to have the full data, you can create a variable, concat the buffer to it on every data event call, and convert it to a string
And finally parse it
Like this basically. Because this works.
Well yes because I suppose you already have the full data
As the image url sent in is pornography to test the call response, I obviously hid the details.
its azure
This is what it sends back, but as a buffer lol
probably because of HTTPS being used... IDK.
I know, that's not really the point though; the entire data is usually not received as one part, it comes in chunks; you can also you things like https://undici.nodejs.org/ to make it easier to work with
A HTTP/1.1 client, written from scratch for Node.js.
Unless you don't want any dependencies in your program
Building a private package so basically no dependencies allowed
im just testing the azure responses to make sure that I handle it properly before creating the package.
I mean not really unless something else is actually preventing you from using dependencies, private packages can always have dependencies
Unless the licenses say otherwise
The company I am making it for specified 0 dependencies
Understandable
However, I am allowed to make a public version of it if I want to lol
I dont get this company, but they paid for it and gave weird specs...
As long as it pays ¯_(ツ)_/¯
down for me





