#development
1 messages · Page 95 of 1
skill issue
Shut up null
update: it did not work
Now bogo sort’s worst case time complexity is O(infinity)
They’re not very hard
Algorithms are more interesting when you have a use case for them
true
become rust dev and your brain will grow
Binary search is SUPER useful
What use cases are there in binary search?
but only if the list is sorted tho
Im sure they are used in almost everything i've used
If you know the array is sorted, you can find an element in O(log(n))
binary search only works in sorted arrays
I would but I have no use for rust
Based
I don't see a reason for me to use rust
Blazingly fast
Serious reasons
Graphics programming with rust looks kinda fun
I dont do graphic related stuff rn
Tauri looks very interesting
It’s very good for string parsing
looks like a good replacement for Electron
I told you about that one
guys is this right or wrong
/pls|hello|example.com/i/g
Rust is like a super modern c++
still wrong
frfr my most popular rust project is literally about that
bruh
. is not escaped
whats wrong
. is a reserved keyword in regex
Have you considered not using regex in a project until you understand it @hushed robin
Rust is C++ but everything is perfect
no
Every beginner jumps to regex like it’s some super essential tool when in reality it’s not necessary in most situations
regex was made in the old days for a specific problem that doesn't exist anymore /s
idk if this is true im talking out my ass
Just let users filter by words using <String>.contains()
*includes
Shame on you waffle
such method doesnt exist in js
Yes it does
I always forget
wait rly?
Contains exists for arrays doesn’t it?
Yea, if I make it
Nope it doesn’t damn
nope
theres no contains in js
it uses includes on both
includes is such a vague naming
but
fr
what about if they wanted to filter multiple values ☹️
i assassinated him
@boreal iron ello php man
fake literally ->explode()d
so would this be correct?
/pls|hello/i/g
no
bruh
learn what regex is
(pls|hello)
I got one for you.
I have a bunch of user variables in a string, there could be 1, there could be 30
for example
"some string, wee woo <uservariable>, <someothervariable>"
currently I'm using
const variables = {
uservariable: "something",
someothervariable: "something else"
}
const newString = input.replace(/<(\w+)>/g, (match: string, variable: any) => variables[variable] ?? match);
👀 how do I do it without regex?
ok lemme see
variable is string
Just iterate over each word split by space and see if it exists in your map
iirc
For complex parsing cases you can use recursive descent parsing or Pratt parsing since they’re more practical than a giant regex too
just use Array.some + String.includes
I know, but this isn’t a giant solution with iterating either
Plus it’s faster
Also I find that regex is difficult to read and understand quickly
what is w+
I have 23 variables, will that really be faster?
words
any word
Yes
alphabetical + numbers + _
It’s faster but I suppose it doesn’t matter too much if you’re not doing it a ton
But I prefer iterative solutions and avoiding regex at all costs just for readability reasons
good to know, I'll look into that.
I think this solution should be fine, as its not done too often yeah but its good to learn better methods
It makes it easier to remember what I wrote
Just toLowerCase the string bruh
if thats js, nothing is faster than indexOf + slice
/i/g
sigh
/(pls|hello)/i/g
?

Haven't had any time the past weeks/months to hang around in discord
What's up?
brotha just use .contains instead of regexes you don’t understand
ITS INCLUDES
no cus i'd only be able to chec for one value
You have tons of solutions for that
You could separate by commas, and search for each string in your news to filter it
also, its possible to use regex to find the indexes and then slice
is this correct yes or no
/(pls|hello)/i/g
No
Even that way it would be 100x easier for your users to understand
whats wrong
wait, for my thing?
what about them
in your case i would just use indexof
a few ms faster!!! 💪
wjere
While this was fun
I'll look into it, thanks tim and waffle ^_^
Rust
bye
thank you for the help
Rust is always the answer
doing backend in rust is pain for me
skill issue
yes i spend hours and hours to get a few ms more speed
Start off with standalone rust projects at first
:^)
wtf death threats (at cosmic)
/(pls|hello)/ig
It’s much easier if you don’t hop into some complex magic framework right off the bat
what about me wtf
is so fun tho, i keep finding tricks to make things faster than are not obvious
im ignored
You will just troll me
Yes
smh
that would be very easy to implement as a simple state machine
waffle if misty asks you about rust tell him to ask to me instead ty
have one state for parsing normal string and another state for parsing variable locations
isn't working 🤨
gi
How do I create my own webhook?
there are many things in js that one thing is faster up to a certain size, and then another thing starts being faster after that size
Well then more context please what it should do
just write an entire node addon in c++ just for string.includes
thats gonna be slow
I ain’t even gonna try anymore because he doesn’t provide info on what’s wrong, what he’s inputting, what he’s expecting, and doesn’t even try to create more reasonable solutions to his problem
who cares at least its faster by a few microseconds
its not gonna be faster lmao
fuck it write your own JavaScript engine and runtime
node gyp probably has more overhead than benefits that would provide
node addons are not fast
they have quite a high call cost
they are only good for large calculations
It’s worth it for heavy lifting tasks like video editing or stuff like that
napi.rs tho 🚀 💪
based
pure js is gonna be like 1000x faster
imagine being stubborn
they use JavaScriptCore and Zig because they want to be quirky
exactly
Not exactly difficult to predict tho
Node.js Killer!!!!!!
and then faded to obscurity
tbh ironically ____ killer projects will never kill the projects they intended
🚀
Carbon 🤮
That's not sort of the context I meant
bun's ideas are great tho, but the way they marketed it was terrible
Blazingly fast!!! just look at our very real benchmarks!!!!
I like Carbon
they tried to make it look like bun is js-fast and not interop-fast
Carbon is shit
I love those job ads that say you have to have 10+ years of carbon experience
Carbon is a great idea but it’s too young as of right now
I can see it being more popular in 5-10 years
but everyone forgot about it now
by then job ads will ask for 30+ years of experience
lmao, bun's issues:
Anybody wanna explain to me what tf is wrong with my keyboard in discord?
bun bad
its written in php
Not many people heard of rust when it first released, 8 ish years later it’s the most loved language on stackoverflow like 3 years in a row
@spark flint how you feel bout this comment?

THE RUNTIME
wtf !!!!

it was cool

gross
but not supported by a lot of things
good
Gotta update it tho
class VariableParser
{
public string Input { get; init; }
public Dictionary<string, string> Variables { get; init; }
StringBuilder output = new StringBuilder();
int position;
public VariableParser(string input, Dictionary<string, string> variables)
{
Input = input;
Variables = variables;
}
public string Parse()
{
ParseString();
return output.ToString();
}
void ParseString()
{
while (true)
{
if (position >= Input.Length) break;
if (Input[position] == '<')
{
position++;
ParseVariable();
}
else
{
output.Append(Input[position]);
position++;
}
}
}
void ParseVariable()
{
int start = position;
while (true)
{
if (position >= Input.Length) throw new Exception("Unexpected end of input");
if (Input[position] == '>') break;
else position++;
}
string variableName = Input.Substring(start, position - start);
if (!Variables.ContainsKey(variableName))
{
output.Append("{undefined}");
} else
{
output.Append(Variables[variableName]);
}
position++;
return;
}
}
``` that's what i came up with really quickly
seems to wokrk
its like 20 versions behind
VariableParser parser = new VariableParser("Hello, <first> <last>! It is <day>", new()
{
{ "first", "John" },
{ "last", "Doe" },
{ "day", DateTime.Now.DayOfWeek.ToString() }
});
Console.WriteLine(parser.Parse()); // "Hello, John Doe! It is Tuesday"
Basically a lexer, good solution
wust
probably also faster than using regex
wuwust
I have multiple versions of rust on my pc
BASED
Even some nightly versions 😎
Waffle <3
also really easy to implement escape sequences as well
I guess I will use rust
but I can already tell ima lose motivation when using something im not confident in
Don’t use it for your project idea misty
why use rust then
the compiler will spoonfeed you
uwuwust
Use something you have experience with
don't listen to him
No
wtf
there's literally no reason to use it if you don't want (or more importantly need) to learn it
Use it for fun projects until you’re confident with it
Then you can use it for more serious ideas
^ this tbh
I don't know what would be fun to mke with rust as I have no idea about its core concepts
then don't even bother picking it up if you don't know why to
if you dont want to work with rust
that's the way i look at things at least
work on your website
if you don't get a tangible benefit from investing your time into learning it then it's a waste of time
its not that I don't want to
I don't know if i do or not, but to find out I have to figure out what it excels at
speed and performance, it's good when you want to make a c++ app without all the pain
Without knowing the usage behind it, I hve no idea if its right fit for me
you really don't need rust for like 95% of things
and without all the headaches like segfaults and linker errors
i will ALWAYS be of the belief that you should pick one language and learn it super well and pick up a couple of other ones just to cover the weaknesses of your main language
for me that's C# and javascript and python on the side
yuck
Rust is really nice for a low level language feel without all the bugs that complex memory semantics cause
this
My first lang was js, but I don't really like it
pick up the paradigm and general skills of the language rather than the language itself
My head hurts thinking about this stuff rn
Java
:(
😎
Script
no thanks
we know
For my career path tho js wont cut it
don't say that right now either
you don't know unless you're going into hardware lmfao
Java is a good language to have under your belt for any job in the software industry tbh
Used in like half of all enterprise level jobs or something like that
the thing i don't get is a lot of people will 'learn' like 40 different languages
there is no way companies want to see that
they'd much rather see you have a diverse profile of languages you know really well
Java is only good because it gives you money?
I would rather master 1 language than be an intermediate in 40
“Jack of all trades, master of none” type thing
java is just really well used and also a super simple language to initially pick up
have you actually seen what companies look for in an app
cause they're only spending like 10 seconds reading it
sadistic
String.prototype = Number.prototype (if only it actually worked)
they want to see all the 40 languages i spent 3 days learning
more = better!!
you can see how much experience i have because i've worked at 6 different jobs in 2 years!
Do you guys double your vote rewards on weekends?
what context then
Votes reset is dependant on the bot
Votes technically reset once per month tho (on topgg)
Fake meant you need to be more specific on your requirements
Learn to ask proper questions
"it should return true" is way too vague
you can vote once every 12 hours, votes on bots reset at the start of each month
well i had a regex that works but i'm trying to make it not case sensitive
What do you mean by reset?
goes to 0
I know but what part of it gets reset?
Every users' votes get set back to 0 or the bot's vote on the site?
No, topgg doesn't store user votes
^
Only the total vote count for bots
This one.
yes
Anything else depends on what the bot developer chose to do
Ok, it's fine I guess, I don't find the bot's vote count that useful.
Is it really necessary to use regex?
For users it matters very little, it's sole purpose is contributing in the sorting algorithm
but i'd like to
So a user can revote every 12 hours? So I can just store the timestamp of when the user voted, right?
yes
You're aware regex is extremely slow and expensive compared to other alternatives right?
what alternatives
contains()
Wait, do I have to handle this?
handle what?
Are you trying to make a voting feature for your bot?
The vote webhook only gets triggered when the vote is actually valid right?
Yes.
Could've said before
yeah
Ok, I don't need to handle it then.
You'll need a database, if that's what ur asking
I know.
what is this
Then don't worry, webhook will only trigger on actual votes
Unless u press the test button
I don't think I have to store any timestamps. I can just store the amount of votes a user has.
A fuckin basic javascript function
hm
If u don't want to track vote streaks, yeah
The webhook data I think has a streak.
It doesn't
The only thing the webhook tells u is who and when someone voted
Nothing else
i don't see it on mozilla
Then search for includes()
It'll be either contains or includes
Eh?
What is this then?
{
"value": 1,
"name": "Total Votes:",
"inline": true
},
{
"value": 1,
"name": "Current Vote Streak:",
"inline": true
},
```I got this from the `Embed.fields`
yeah ik includes but that can only check for a single value right?
Simplifying top.gg webhooks for all users, allowing non-developers and developers to use webhooks for their bot and server without confusing configuration.
That ain't from the official api yeah
Yes
but it was made by one of the mods i believe
It was made by Woo.
But writing it twice will be orders of magnitude faster than regex
Still not official
I know.
Woo made it to help new devs
sooooooo how do i check twice
||
I just wanna know how to make my own webhook so I don't have to rely on this site.
See the official docs, they have examples there
i don't wanna hardcode it tho
Not really helpful.
That's not what hardcoding means
Kinda hard to explain here, but really, the docs include basic examples for what the lib does, the rest can be asked in #topgg-api
You'll still need to think how you want to approach it tho
You don't want to write long code, I get it
What are u even trying to accomplish?
well
I just need a webhook with the ID of the user that voted, then I can handle it from there.
it's fine i just won't use regex
The official webhook gives that yeah
Iirc it gives user id, auth key, timestamp and whether it's weekend or not
I know but I don't know how I can get that data.
Google topgg api, should be the first result
Neither does any of the SDKs help with that.
How so? They show u exactly how to do it
well i'm trying to check if a body of text contains either one of multiple values
...do you know what an webhook is?
Ok, but in what context?
Yes, but I don't know what to provide.
User messages?
Like they said, I can't just slap a Discord webhook into the bot webhook.
You have to provide your endpoint, the server listening for post requests
Since ur a whitename, I don't think you'll be able to use the webhook until your bot gets approved
yes
It's already been approved.
Is it for custom responses?
Then go to the bot edit page, click webhooks and scroll down
no
There should be a field to put ur server url/ip and another to put an authentication key
Then what's it for?
What is the server and IP?
The site I'm using doesn't have static IP.
checking if the body of text includes one of multiple values
Or at least they don't provide one.
Where are u hosting it?
railway.app
In what context
why would that matter?
Man is really refusing to explain the context
Because the approach changes depending on what u want it for
Well, then you won't be able to use the webhook
Then use your hostname
Since it's impossible for topgg to know where to send the info to
Ah yes, if it has a hostname use it
Anything that can be used to refer to ur bot address
why would that matter tho
A public url for example
For example, if you were trying to match those two words once in a big file, I'd tell u to use regex
If it's for user messages, I would tell u to stay away from regex
The answer is entirely dependant on what u want it for
well it's "user messages", not on discord though
Ok, go on
on what
i've said it like 10 times
delete badness
Ok, so it's for a swear filter?
💩 👉 🗑️
well not exactly theoretically it could be used for anything
delete if contains one of many words
Ok, so a blacklister
so... then... use... includes... like... I... said... 20... times...
Where do I get public URLs I can use to get the webhook data?
Yes, use includes on a loop
Ok so... you're using a regex pattern to simply check if some content contains your filter?
so
Depends on ur provider
Yes it is
Literally anything is faster than regex
Or even ["array", "of", "words", "to", "filter"].some(word => stringToLookAt.includes(word));
why regex exist then
This is doable with a one liner
Bogo match tho
So you should only go with it if things and pattern really get complicated
would this be more efficient than loop
It would be the same
It's just syntactic sugar
It is a loop, technically
Yeah
ty guys
Because sometimes you don't have a static pattern
For example, consider this:
This is basically doing ```js
for(const word in arrayOfWords) {
if(stringToLookAt.includes(word)) {
return true;
}
}
"The orange circle resembled an orange"
Also it's much more simplified than writing dozens of statements which are doing the same as your pattern
I only want to match colors that are succeeded by a shape
If I searched for "orange" it'd match twice
Pretty bad example tbh, but it should do
At least you got it yourself

Anyway, regex is used when a pattern is known, but the values aren't
Or when you're extracting data from a text
What if I just use an empty website created by my bot?
Webhooks are literally reverse apis
It doesn't need to serve a site or html code etc
me when I realize one of the most widely used editors uses regex for half its parsing
Lmao which?
vim
It had to be vim smh
It'll do, but isn't needed if u use the library
Since it has it built-in already
But doing it though flask shouldn't be too hard either, the payload ain't complex at all
What do you mean by library?
Topgg py lib
It's listed in the same site u found the docs
Just click on "libraries" at the left
bot.topgg_webhook = topgg.WebhookManager(bot).dbl_webhook("/dblwebhook", "password")
```Oh, so this line of code creates a webhook that I can put in the `bot/webhook`?
Yep
Keep in mind to open the port your webserver is listening to in your server firewall, as the webhook is an incoming connection
I'll just use the SDK then.
this works perfectly 👌
# The port must be a number between 1024 and 49151.
bot.topgg_webhook.run(5000) # this method can be awaited as well
```I need to open this somehow?
Most "automatic" hosts already give u a port to use
How do you even open a port.
In this example 5000 (tcp) needs to be opened
Just see which port it gave u
Depends on your system, os etc
It's an auto host
Or service yeah
Railway app
railway.app doesn't provide me any port.
Well, that's complicated then
You'll need one to be able to listen to incoming requests
I'm using mongoose, and recently when fetching a document inside a collection, the response is very very slow, this just started happening today the document contains an array of 10,000 objects, is it because the number of items?
Do you guys double your rewards on weekends?
i've seen a few do that, higher incentive to vote
Weekend is just Sunday or Saturday, too?
friday too
Sunday can't be considered weekend
its the beginning of the new week
Friday is also not the end of the week
Saturday is the true end
Dont give me PTSD of libraries that have their weeks start on Sunday please
Especially Java
Lmfao
Im just saying man. People call Saturday and Sunday weekends, but in the work force, you pay week always starts on Sunday and Ends Saturday
And ESPECIALLY ones where the datetime related settings are set to private
not Monday to Friday
Fuck the workforce
just field.setAccessible(true) 😉
Hell yeah
why is school monday to friday then
the weekend is only a day? 🤨
Although I am sure some countries dont give no fucks
Yes but then you only have 1 day off
That would be hell and inefficient
Hey, I need to make the bot listen to incoming server requests, any way i can make this possible?
(Python)
yes
i just said that earlier 
imagine only wanting to be spoonfed
how am I only wanting to be spoonfed ❓
i've just said Array.some + String.includes
ok but how does that explain anything
Explains that you need to turn on more than 2 braincells and search on Google or similar how Array.some works, as well as String.includes, with examples if needed and then use again a few braincells to put them both together to get your final solution.
❓no, how does it explain how I was wanting to be spoonfed. I was trying to figure out how to work regex not use those. i then decided to use another method instead and if you read above I was going do it myself, I didn’t ask for any code.
Yeah understandable
Might just go back to hibernating
How can I optimize large images?
the images size are >20mb
and I want to have a good quality
where do you want to display them?
a website?
yes
I looked for cdn but it is too expensive
a backend server would be too complicated
I dunno where to host those images
😢
Developers using Rust when their program is faster by 0.000000000001 ms: 🔥🔥🔥🚀🚀🚀💯
faster is faster!!!! 🚀
no matter the difference
if its less time then its faster 😎
Definitely worth learning an entirely different language that's probably 10x harder than what you're already using!!!!!
why do you need tjem to be 20mb?
most people use screen resolutions between 720p and 1080p, displaying images bigger than that in those screens will make no visual difference
and even if you have 4k screen, 20mb is still too big, you can have 4k images much smaller than that
@earnest phoenix btw, why is DataView so slow to inatantiate?
its literally faster to copy a buffer into another buffer that already has a dataview attached than creating a new dataview on the buffer
there is actually a difference, if the user zoom in
that said, 20mb makes me think they're using png instead of jpeg, which is not really necessary
webp ftw
there's that too
It's the purpose of the format, so I'd use that
Hosting? Honestly you can just make a github repository lmao
That's because DataViews are much more complex internally compared to just Buffers which are just ArrayBuffers internally, DataViews provide a direct interface to the data and the buffer to be modified in however you want, meanwhile Buffers don't provide as much control as DataViews
Here are implementations:
DataView: https://chromium.googlesource.com/v8/v8.git/+/refs/tags/11.2.207/src/builtins/builtins-dataview.cc
Buffer: https://chromium.googlesource.com/v8/v8.git/+/refs/tags/11.2.207/src/objects/js-array-buffer.tq (the object) | https://chromium.googlesource.com/v8/v8.git/+/refs/tags/11.2.207/src/builtins/arraybuffer.tq (the actual ArrayBuffer implementation)
Note that Buffer itself is not an API provided by JavaScript engines themselves, it's an API provided by the runtimes like Node.js, which is an ArrayBuffer internally as mentioned
Crab language
🦀
yeah but like, they dont hold any actual data, they are only an interface around existing data
while buffer and uint8array holds actual, much larger, data
in my benchmarks they break even at around 13kb in size
meaning its faster to copy 13kb of data from one arraybuffer to another arraybuffer than it is to instantiate a DataView on one arraybuffer
which doesnt make much sense to me
also, TypedArray.byteLenght is very slow to access, about 10-20x slower than TypedArray.length
is it a getter that calls native code?
also, pls expose bigint raw bytes in js :^)
It's unrelated to the data itself, the interface is the one that takes the most time to instantiate because it attaches itself to the array buffer directly, which takes time as it does multiple checks and whatnot to do so, you can see from the implementation
Huh? Are you testing on a version with a regression again? :^)
no pc?
🗿
it'll output biased results
u need to do something inside the loop, else it'll get inlined
also, run 2 separate scripts, to prevent jit from kicking in
They won't get inlined because they're getters internally that have multiple checks which V8's inliner basically considers important
Barely any different in that regard
chromium 109 xD, let me try the latest 110
same thing on 110
and DataView
compared to copying
even worse with small buffers
yup lol, performance is equal in node 18
in node 19 performance is same as in chromium
not sure which version it started, but it seems i did indeed find another regression xD
Tim the regression finder in unstable builds
:^)
so where do i report this, or who/when/where did made the last changes to typedarrays?
Did you try that in the latest Node.js v19 release?
yes, tested in 19.7
I'm not exactly sure if this should be reported to V8 or Node.js because this is intertwined with both, try opening an issue about it in https://github.com/nodejs/node/issues for a heads up
but it also happens in chromium
Then it's a V8 issue, but I have no idea from which V8 version that regression started from, you can compare Node.js v18 and v19's V8 engine versions
18.14 uses 10.2
19.7 uses 10.8
why doesnt google use github
google git is so damn confusing, i cant find anything
The latest is v11.2, we'll be updating to that, though I have no idea if that issue was fixed on that version
Though if you want to report the bug anyway here's the V8 issue form:
https://bugs.chromium.org/p/v8/issues/entry
is there no way to test 11.2 without manually building it?
like some nightly chromium test build that includes the latest v8
also, how to see v8 version from chrome?
or is it implied from the chromeversion, like v110 = v8 11.0?
We don't provide pre-built binaries for V8 due to significant resources needed to compile so many release tags, and the fact that pretty much nobody uses pre-built binaries as we provided them before, because building from source allows you to configure it in many ways to make it much more compatible, so building it from source is your only option
Go to chrome://version
@lament rock yo, i pubished the etf thingy, if you want to give it a spin
indeed
lmao
its not really finished tbh, there are still things it can be added
but should work for using with discord
Those are some impressive performance benchmarks
nah, a straightforward swing would suffice
🐐
Idk why my bot is occupying high amount of ram, like it has an uptime of 42 hours now, and it has occupied around 3gb ram.
Is there any way to reduce this amount and have a control on it?
would be good if you could figure out what is taking up much of the ram
think node has some snapshot tool
could also check if you have some sort of caching
Inb4 cache
Unsure if djs supports it right now
But forums are essentially threads so these would not be hard to implement
Wym
It is ?
<ForumChannel>.threads.create() should do the trick
oh
Same thing yea
You can ignore this:
Hello it's only once in a blue moon I come over here and reach out for help, I tried reaching out to stackoverflow but one person responded and were awfully rude about it and didn't even help so I have come here as my last resort.
My monkey brain cant uncover this problem:
I may be a bit slow but I have tried many times using guides, youtube tutorials, google searches etc. etc. to make a discord button that is attached to this motherfucking embed but my god what ever i try is failing due to the search or guide being either out of date or doesn't work with my command handler (im pretty sure that's the issue anyways).
const { MessageActionRow, MessageButton, MessageEmbed } = require('discord.js');
module.exports = {
name: 'client',
description: "Check to see how Nonay is holding up!",
showHelp: false,
execute({ client, inter }) {
const commands = client.commands.filter(x => x.showHelp !== false);
const button = new MessageButton()
.setLabel('Click Me')
.setStyle('PRIMARY')
.setCustomId('exampleButton');
const row = new MessageActionRow()
.addComponents(button);
const embed = new MessageEmbed()
.setColor('#0CEC1D')
.setAuthor(client.user.username, client.user.displayAvatarURL({ size: 1024, dynamic: true }))
.setTitle('📑 Client Info')
.setDescription("``Nonay Client Ver``\nv3.4.9\n\n``Client Performance``\nExcellent\n\n``Client Discord.js``\nv14.2.0\n\n``BETA Whitelist Commands``\ncontroller, update, filter, console")
.setFooter('Powered by Nonay', inter.member.avatarURL({ dynamic: true }));
inter.reply({ embeds: [embed], components: [row] });
}, };```
if needed i can run this command and try and find the error again
What exactly doesn't work?
Because the command itself looks to work, there is nothing in it that could not work
i will send over the error message im pretty sure im doing something stupid
but either way i cant get to the bottom of it due to my inability to solve errors
D:\Nonay\nbot\commands\other\client.js:11
const button = new MessageButton()
^
TypeError: MessageButton is not a constructor
at Object.execute (D:\Nonay\nbot\commands\other\client.js:11:24)
at module.exports (D:\Nonay\nbot\events\interactionCreate.js:15:17)
at Client.emit (node:events:513:28)
at InteractionCreateAction.handle (D:\Nonay\nbot\node_modules\discord.js\src\client\actions\InteractionCreate.js:81:12)
at module.exports [as INTERACTION_CREATE] (D:\Nonay\nbot\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
at WebSocketManager.handlePacket (D:\Nonay\nbot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:352:31)
at WebSocketShard.onPacket (D:\Nonay\nbot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:481:22)
at WebSocketShard.onMessage (D:\Nonay\nbot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:321:10)
at WebSocket.onMessage (D:\Nonay\nbot\node_modules\ws\lib\event-target.js:199:18)
at WebSocket.emit (node:events:513:28)
Node.js v18.7.0```
i swear some developers must be screaming at their monitors right now and yelling at me because its right there
Are you using discord.js v14?
You have migration there
e.g.
// v13
const button = new MessageButton();
// v14
const { ButtonBuilder } = require('discord.js');
const button = new ButtonBuilder();
Probably worth taking a look at https://discordjs.guide/additional-info/changes-in-v14.html overall when you face a future issue
bloody legend thank you
well it was going great but its flopped now
D:\Nonay\nbot\node_modules\@sapphire\shapeshift\dist\index.js:76
throw this.error;
^
ValidationError: Expected the value to be an object, but received string instead
at ObjectValidator.handle (D:\Nonay\nbot\node_modules\@sapphire\shapeshift\dist\index.js:1182:25)
at ObjectValidator.parse (D:\Nonay\nbot\node_modules\@sapphire\shapeshift\dist\index.js:142:88)
at EmbedBuilder.setAuthor (D:\Nonay\nbot\node_modules\@discordjs\builders\dist\messages\embed\Embed.cjs:42:37)
at Object.execute (D:\Nonay\nbot\commands\other\client.js:20:14)
at module.exports (D:\Nonay\nbot\events\interactionCreate.js:15:17)
at Client.emit (node:events:513:28)
at InteractionCreateAction.handle (D:\Nonay\nbot\node_modules\discord.js\src\client\actions\InteractionCreate.js:81:12)
at module.exports [as INTERACTION_CREATE] (D:\Nonay\nbot\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
at WebSocketManager.handlePacket (D:\Nonay\nbot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:352:31)
at WebSocketShard.onPacket (D:\Nonay\nbot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:481:22) {
validator: 's.object(T)',
given: 'Nonay'
}
Node.js v18.7.0```
ValidationError: Expected the value to be an object, but received string instead
setAuthor
Ctrl+F on the migration guide
thanks bro, one last question that should be more simple
if 'interaction' is not defined is that an intents issue?
the error im getting:
D:\Nonay\nbot\commands\other\client.js:33
const collector = interaction.channel.createMessageComponentCollector({ filter, time: 15000 });
^
ReferenceError: interaction is not defined
at Object.execute (D:\Nonay\nbot\commands\other\client.js:33:27)
at module.exports (D:\Nonay\nbot\events\interactionCreate.js:15:17)
at Client.emit (node:events:513:28)
at InteractionCreateAction.handle (D:\Nonay\nbot\node_modules\discord.js\src\client\actions\InteractionCreate.js:81:12)
at module.exports [as INTERACTION_CREATE] (D:\Nonay\nbot\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
at WebSocketManager.handlePacket (D:\Nonay\nbot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:352:31)
at WebSocketShard.onPacket (D:\Nonay\nbot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:481:22)
at WebSocketShard.onMessage (D:\Nonay\nbot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:321:10)
at WebSocket.onMessage (D:\Nonay\nbot\node_modules\ws\lib\event-target.js:199:18)
at WebSocket.emit (node:events:513:28)
Node.js v18.7.0```
No, that means it's not defined
E.g
console.log(x); // x is not defined
let x = 1337;
console.log(x); // x is defined
brilliant u have been lots of help thanks
What kind of old code do you copy from 
all kinds of shit
well actually
now that i think of it
i ran it through ChatGPT-3
and its out of date and ended training in 2021
yoikes here we go
so it doesnt know about discord v14
yeah big oopsies
the time you save from cloning/cheating almost always come to bite you back later on
in worse
interaction.channel is an incredibly terrible option
instead use ```const message = await interaction.reply({ embeds: [Confirm], components: [Buttons] })
const collector = message.createMessageComponentCollector({ time: 15000 });```
its replying to a button and everytime i try to define interaction it kills itself
so i guess im trying everything now
even with ur code
D:\Nonay\nbot\commands\other\client.js:39
const message = interaction.reply({ embeds: [embed2], components: [row] })
^
ReferenceError: interaction is not defined
at Object.execute (D:\Nonay\nbot\commands\other\client.js:39:25)
at module.exports (D:\Nonay\nbot\events\interactionCreate.js:15:17)
at Client.emit (node:events:513:28)
at InteractionCreateAction.handle (D:\Nonay\nbot\node_modules\discord.js\src\client\actions\InteractionCreate.js:81:12)
at module.exports [as INTERACTION_CREATE] (D:\Nonay\nbot\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
at WebSocketManager.handlePacket (D:\Nonay\nbot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:352:31)
at WebSocketShard.onPacket (D:\Nonay\nbot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:481:22)
at WebSocketShard.onMessage (D:\Nonay\nbot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:321:10)
at WebSocket.onMessage (D:\Nonay\nbot\node_modules\ws\lib\event-target.js:199:18)
at WebSocket.emit (node:events:513:28)
Node.js v18.7.0```
do you know how to code in js?
@low moat So Basically Interaction can be used only for slash commands
if your not using slash commands
send me a sample of one of your commands
i am using slash commands
const ms = require('ms');
const { MessageActionRow, MessageButton, EmbedBuilder, ButtonBuilder, ButtonStyle, ActionRowBuilder } = require('discord.js');
const { ApplicationCommandType, ApplicationCommandOptionType } = require('discord.js');
module.exports = {
name: 'client',
description: "Check to see how Nonay is holding up!",
showHelp: false,
execute({ client, inter }) {
const commands = client.commands.filter(x => x.showHelp !== false);
const row = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setLabel('Up to Date')
.setStyle(ButtonStyle.Success)
.setDisabled(true)
.setCustomId('exampleButton'),
new ButtonBuilder()
.setLabel('Check for Updates')
.setStyle(ButtonStyle.Danger)
.setCustomId('Check BETA Whitelist Perms')
)
const embed1 = new EmbedBuilder()
.setColor('#0CEC1D')
.setTitle('📑 Client Info')
.setDescription("``Nonay Client Ver``\nv3.4.9\n\n``Client Performance``\nExcellent\n\n``Client Discord.js``\nv14.2.0\n\n``BETA Whitelist Commands``\ncontroller, update, filter, console")
const embed2 = new EmbedBuilder()
.setColor('#0CEC1D')
.setTitle('📑 Client Info')
.setDescription("Button Pressed")
inter.reply({ embeds: [embed1], components: [row] });
const message = interaction.reply({ embeds: [embed2], components: [row] })
const collector = message.createMessageComponentCollector({ time: 15000 });
}, };```
this is the entire shit show
tiny bit
Oh
const { MessageActionRow, MessageButton, EmbedBuilder, ButtonBuilder, ButtonStyle, ActionRowBuilder } = require('discord.js');
const { ApplicationCommandType, ApplicationCommandOptionType } = require('discord.js');
module.exports = {
name: 'client',
description: "Check to see how Nonay is holding up!",
showHelp: false,
execute({ client, inter }) {
const commands = client.commands.filter(x => x.showHelp !== false);
const row = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setLabel('Up to Date')
.setStyle(ButtonStyle.Success)
.setDisabled(true)
.setCustomId('exampleButton'),
new ButtonBuilder()
.setLabel('Check for Updates')
.setStyle(ButtonStyle.Danger)
.setCustomId('Check BETA Whitelist Perms')
)
const embed1 = new EmbedBuilder()
.setColor('#0CEC1D')
.setTitle(':bookmark_tabs: Client Info')
.setDescription("``Nonay Client Ver``\nv3.4.9\n\n``Client Performance``\nExcellent\n\n``Client Discord.js``\nv14.2.0\n\n``BETA Whitelist Commands``\ncontroller, update, filter, console")
const embed2 = new EmbedBuilder()
.setColor('#0CEC1D')
.setTitle(':bookmark_tabs: Client Info')
.setDescription("Button Pressed")
const message = await inter.reply({ embeds: [embed1, embed2], components: [row] });
const collector = message.createMessageComponentCollector({ time: 15000 });
}, };```
use this
instead of the above
did it work?
@low moat
I'd recommend learning more about js before attempting a bot, else you'll struggle a lot keeping it alive
^^^
besides, your code cannot possibly work
first because interaction is supposed to be inter, second because you cannot reply twice
yes because he didnt define message
i fixed it here
check at the bottom
u forgot to add embed 2 to the reply
oh
also I'm not sure but, doesn't reply need to be awaited? since it's an api action
👀
forgor to put here
XD
not my problem
lul ik

Time to have it randomised
it's just ironic that the entire bot stats is hardcoded
he has to manually update it 
no no its a simulator mini game thing
like the aim of the game is to crash/over heat the bot (not actually obviously)
you should really take your time to study how d.js works (and js in general)
it's much more efficient than doing corrective programming
but i dont have time i just do things on the spot because i can yk
yk what i dont have? the dedication
i have short attention span i cant sit there and focus
i am professional unfocuser
well, you'll struggle a lot then, programming is all about focusing and entering a "lock-on" state
typing is just a side-effect
If you don’t care about trying to learn to program then why are you trying to program anything
At that point you’re just wasting your time
when did i say that
i never said i didnt care
i just said i simply dont have the focus required
Then you don’t care
it's a sisyphean task in the end, until it gets so unmaintainable that it requires complete rewrite
I mean, it also happens with every other programmer, but we try to delay it as much as possible
ah yes adhd = no care
I’m not saying that
I understand that adhd makes it difficult to focus, but it seems like you preemptively blame adhd before even attempting to study a bit
It’s okay if you lose focus, by trying a little bit each day you can get better at it
there are games that teach programming (or just logical thinking), they were made specifically for people with focus issues
You shouldn’t think that you can’t do anything because you have adhd, you can definitely learn stuff even if it’s just 5 minutes a day that you’re focused on it
heck, I learned programming playing gmod
Making things that you’re interested in doesn’t require as much focus because you’re having fun
If you think of it less as a task and more as an enjoyable activity, you’ll learn a lot
im not aware of your situation but you are blaming adhd!
I am not blaming adhd
I am saying that always assuming you are incapable of doing something that requires focus is going to set you back
🦆
You never know until you try
And like I said it’s okay to lose focus even if you only get a few minutes in a day
A few minutes a day is still a LOT better than no minutes a day
basically
To learn programming
You need to get your hands dirty with projects and exercises that get harder with time
keywords are "get harder with time"
people often jump into hard/complex projects from the get-go and give up because "programming is too hard"
Failed to make an OS when learning C - programming is definitely too hard
@wheat mesa TIL if let [..] in Rust is a thing
Oh you didn’t know that?
yeah
i didnt know that .. also works in if lets
god i don't find the point behind &literal in Rust ```rs
let next = *text.get(i + 1).unwrap_or(&0);
like why &0 😭
is it something to do with pointers versus literal values
without &, 0 will feel lonely. with & makes it look like there is someone else with him
Um, why in God's name does Rust allow you to get the address of an rvalue? 0 is a value that doesn't have an identifiable address in the memory
Probably gets thrown away in compilation
Or maybe even allocates memory for it temporarily though that would be kinda dumb
Yeah that's pretty stupid, you would be hit with an error if you try to do that in C/C++
I guess Rust maintainers wants it to be some kind of undefined behavior or something
Weird Rust semantic, I don't think any other programming language out there that allows you to manage memory manually allows that
But ¯_(ツ)_/¯
Oh yeah, definitely :^)
:^)
@earnest phoenixbtw, there is pretty much only one thing left that node has that is faster than browser/v8 alternatives
text encoding/decoding
pls make TextEncoder/TextDecoder faster kthxbye
just copy the node:string_decoder source code, ezpz
We've already done that, we replaced our text encoder and decoder implementations with https://simdutf.github.io/simdutf/ which makes encoding/decoding text much much faster and more consistent
Expect these changes in Node.js v20 after we release it and mark it as LTS, we might backport these changes to the older versions but that's unlikely
Might be considered breaking since even performance numbers are to consider
ayyy
im trying to get rid of Buffer and use only Uint8Array with DataView, text encoding/decoding is the only thing i still need Buffer for
Why Uint8Array when Buffer extends Uint8Array
browser compatibility
dont wanna check if typeof Buffer !== undefined everywhere lol
and DataView's methods are faster than Buffer's, its just painfully slow to instantiate
Funny how they deprecated BufferConstructor
lies
also compared v18 to v19.7 and no difference
fake news
@earnest phoenix also please for the love of god make TextEncoder.encodeInto accept start index
look at this crap
literally half the speed because i have to use subarray instead of start index
I think you're benchmarking in a non-realistic way, our benchmarks showed very high performance improvement rates
https://github.com/nodejs/node/pull/45803#issuecomment-1353832681
whats the best tool for automatic api docs with laravel? I found rakutentech/laravel-request-docs but it seems to only be erroring, Error: Call to undefined method ReflectionUnionType::getName()
I would rather recommend for you to open a feature request about that, so others can weigh in their opinion
there was already a thread about it, but it seems you guys were not interested because "views are the correct way to do things"
its a few years old tho, maybe opinions change
Yeah that's why I'm saying that, lots of things have changed since that time so it's better to give it a shot again
is whatwg the right place for it?
Both of the TextEncoder and TextDecoder APIs in Node.js are the ones from the WHATWG's encoding standard, so yes
https://encoding.spec.whatwg.org/
the actual implementation comes from v8 tho right?
or is this something that is done by a third party addon?
V8 does not implement additional web APIs, Node.js does
Ah, yeah those are implemented by V8
Though Node.js has this implementation
https://github.com/nodejs/node/blob/main/lib/internal/encoding.js#L323
Though V8's codebase pretty much has no sign of the TextEncoder/TextDecoder implementations, so I have no idea on that regard to be completely honest
There's a high chance Chromium itself implements them instead of V8
hmm
ah, they are implemented by ICU
not v8
Hmm yeah
ICU sounds like a hero squad name
Hero: ICU (I see you)
Power: can see anyone from anywhere regardless of distance or line of sight
I was analyzing the "ActivityType" of discord.js and I noticed that the invisible doesn't exist anymore, is there any way to set the invisible status in the bot?
invisible does exist, but most libs no longer list it
hm...
since it only makes sense for yourself, for everyone else you'll have the status "offline"
do you know what type it is?
you can do a lot of cursed stuff in Rust that other languages can't do
like ```rs
let something = *troll();
or ```rs
let something = func(&yes());
why
it does exist?
I gave a console.log on the "ActivityType" and received only
Playing: 0,
Streaming: 1,
Listening: 2,
Watching: 3,
Cistom: 4,
Competing: 5
&0 does not mean that its a null pointer, & in Rust is a reference, not a pointer
I said nothing about pointers, let alone a null pointer
But it seems like they actually make it a temporary value that has an identifiable address unlike C/C++
you can see this everywhere in the Rust docs, since most arguments take a reference (or borrowing), instead of a value
status and activity are two different things
"I was analyzing the "ActivityType" of discord.js and I noticed that the invisible doesn't exist anymore, is there any way to set the invisible status in the bot?"
:V
invisible is not an activity type, it never was
invisible is a status
but formerly, in older versions, you could set bots status to invisible
Is this no longer possible?
I want to set bot state, like: idle, invisible, online
c.c
this is activity
Playing: 0,
Streaming: 1,
Listening: 2,
Watching: 3,
Cistom: 4,
Competing: 5
this is status ```
online
idle
invisible
dnd (do not disturb)
ok
for status you use client.setStatus or client.setPresence({status:})
for activity you use client.setPresence({ activities: [] })
now it's well explained, thanks
hey guys in java i have a question about interfaces.
I still don't fucking understand why i should use them
imagine i want to get the price of all sorts of products yeah
I hvae different classes for each product
I can then create an interface like: void Interface test {
double getPrice();
}
now i n all classes i must define this fucking price again....
why would i bother using an interface then? Because i could define the double getprice without the interface?
I think we gave u a pretty good example last time
yes i know i still didn't get t
public interface Walkable {
public void walk();
}
public interface Human implements Walkable { ... }
public interface Dog implements Walkable { ... }
var walks = new Walkable[]{new Human(), new Dog()};
for (Walkable w : walks) {
w.walk();
}
basically, so you can have a common method signature, allowing u to reference them by the interface, instead of the specific classes
huh isn't var walks an array of interfaces now?
Why would that be needed because 1 interface can be used in multiple classes if it gets implemented
show me how would you put Human and Dog in a single array
and call walk() from each entry
that'll make u understand the reason
You might need to look into inheritance/interfaces before understanding it
Also didn't know you could cast these into a list
New to me


