#development
1 messages · Page 103 of 1
really?
ok so, for future reference, use a debugger when something isn't working the way it should, it's the easiest way to find out what values are being passed to the functions
i m not used to it tbh
i generally find out by console
but this time diff case
so say where is the isue anyways
console is great but it can't solve logic errors
simply because it doesn't cause "errors", as in, written errors
yea
see if you notice anything out of place here
no?
wait
should it be
client.slashCommand
did u really write that code?
yea i did when i was rlly new
saw some part fro internet but most of it i wrote
you're retrieving a slash command using a slash command (not id)
and then executing the whatever thing returns from the function
if i remove the last line
and then execute the slashCommand,it still shows errors
"shows errors"?
What kind of errors?
les say i do
slashCommand.execute(client,interaction)
it says that execute isn't a function
show how you're registering client.slashCommands
k
client.on('ready', async () => {
const rest = new REST({ version: '9' }).setToken(process.env.token);
try {
console.log('Started refreshing application (/) commands.')
await rest.put(
Routes.applicationCommands(process.env.applicationid),
{ body:slashCommands },
);
console.log('Successfully reloaded application (/) commands.')
} catch(error) {
console.log(error) ```
that's where ur publishing to discord
I want to know where you're registering the variable client.slashCommands
u mean in code?
Yes
well ofc in code
client.slashCommands = new Discord.Collection()
and where are you populating it?
index.js file
the code
const { readdirSync } = require("fs");
const Discord = require("discord.js")
const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');
const { token } = process.env.token;
const ascii = require("ascii-table");
const client = require("discord.js");
const { clientId } = process.env['applicationid'];
let table = new ascii("SlashCommands");
table.setHeading("SlashCommand Name", "Loaded Status");
const slashCommands = []
module.exports = (client) => {
readdirSync("./slashCommands/").forEach(dir => {
const commands = readdirSync(`./slashCommands/${dir}/`).filter((file) =>
file.endsWith(".js")
);
for (const file of commands) {
const pull = require(`../slashCommands/${dir}/${file}`);
slashCommands.push(pull.data.toJSON());
if (pull.data.name) {
client.slashCommands.set(pull.name, pull)
table.addRow(pull.data.name, "✅");
} else {
table.addRow(
pull.data.name,
`❌`
);
}
}
console.log(table.toString());
});
client.on('ready', async () => {
const rest = new REST({ version: '9' }).setToken(process.env.token);
try {
console.log('Started refreshing application (/) commands.')
await rest.put(
Routes.applicationCommands(process.env.applicationid),
{ body:slashCommands },
);
console.log('Successfully reloaded application (/) commands.')
} catch(error) {
console.log(error)
}
});
}```
handler slash command
you're printing a table to the console, does it mention every command correctly?
good catch
see if it works
k
@lyric mountain @deft wolf so i changed it to pull.data.name and changed the slash.execute to slashCommand.execute and now its working
nice
but i m sure bro it was pull.data.name before
few days back ,one guy asked me
to inv to repl
seems like he did some sussy things
@lyric mountain any thanks bot u guys have
?
what
oh
btw how many years into coding
u guys
me about 1 year
lot more to learn ig 😢
16 I think, but most of it unrelated to discord or actual programming
@deft wolf @lyric mountain thank you guys once again 🙂
wha
16?????
isn't that supposedd to be ur age lol
too many grown ppl here
not really, I used to play gmod when I was 8
and my favorite mod was wiremod, which includes E2
which is technically programming
u must be programing for some company?
cool
Nice to meet you guys
yw
The Java god
nah, far from it
good morning mr waffle
Good morning
which lang u master in
its evening here btw but who cares l
7:45am here
"master" none, but I program in java
and 2 years
and cough delphi
dem
so kinda new to js?
i m sure u guys know python very well
||html>>>>>||
not much, just enough to automate a few tasks
I do know my way around js, just not as fluent in it as in java
I know pretty much no python other than basics, one day I’m sure I’ll have to learn it for build scripts and such
But until that day I refuse to touch python
💀
which app ur company/u made
only 2 times I touched python were to make an automatic spotify ads skipper and an encryption executable
i touched during my annual exmas like 2 weeks ago
mostly to share sensitive files with my team over email
very secret info 💀
I have a Java certification pretest today (basically a test to see if you qualify for the school to pay for your full oracle Java certification exam)
which class
But the certification exam is so stupid
It’s all about archaic or obscure syntax and “will this compile” type shit, pretty much nothing actually related to programming
i took ai for my 9th and 10th skill subject and prolly will take computer science in high school
Just memorizing rules
exam for that? 💀
at least they didn't ask you to fix their printer
most programming exams are stupid anyway
bruh lol
my bot got denied from top.gg coz of a silly mistake ah
i made a dm command and accidentally wrote "administrator perm needed"
Java fans when their Java certification isn't wrapped in 10 boxes on top of each other (reference to dir/dir/dir/dir/dir): ☠️
and...
they think a programmer needs to know if something will run or memorize functions and paradigms
while in real applications you leave all that to the IDE/compiler
WELL DONE!
which country u guys from
usa right
ic
brazil
oh my
US for me
no, I hate soccer
@wheat mesa "its football"
why is my mongoDB findOne returning null even tho it is founded in the collection?
show code please
helloo
line 28
the line 77 was a test
to see if the await Users.findOne return the document with the member Id init
from what I see it should only return null in the first time someone is warned
ye
but i warned that test dude alot of times already
and it always insert a new document
do you wanna see the schema too?
jade u wrote that code combined in many langs?
what
don't think I know mongoose enough to understand a schema
that code written in js only or other lang used too
theres a ton of document with the same id
js
you'll need someone else to help you with this one
replit
Thats mongoDB atlas
what?
This one
@topaz terrace what u want to do?
im trying to this object inside a user.warnings array js { warnID: id, mod: message.author.id, reason: reason }but everytime i did that it always create a new document. when i log user it shows me null.
Is member.user.id the same as message.author.id?
no, i don't think so
ye
its not
console.log(member.user.id === message.author.id)
Because you are creating a document with message.author.id as the id in database
@deft wolf hey can u access the topgg api?
Yea, api works
Like my vote tracker not working from last night
When the site gose down and till now
So I have a bot which has good amt of users . . . and am using aiomysql but recently am facing lots of error which are Failed to connect Connection timed out
Well I asked around and people are asking me to shift to mongodb but the thing is I have like 20 systems and shifting wont be easy as Ill have to almost recode 20 systems
What are your opinions?
To elaborate good amt of users ~ its more than a million users . . .
Ik not a big thing but kinda f up as it keeps crashing
I'll ask you to move to postgres instead
Never heard about aiomysql, but there are probably better wrappers out there if u want to stay with mysql
If it's crashing it means you're not catching your promises, which leads to uncaught exceptions
Switching from sql to nosql is most of the time not worth it unless you'll be rewriting the entire codebase, and given you're dealing with users (so relationships) its more efficient to stay with sql
what does top.gg use to make that cool gradient on their site
that's some cool stuff
well the site is chakra
oh ok
Man, I hate Next.JS, it's confusing.
How come this is returning true in next build but returning false in next start -p 5000? (ternary operator)
https://cdn.hamoodihajjiri.com/swY1wMRHIZ
@wheat mesa how did the test go?
i've encoutered plenty of issues while setting my project on prod
it's a nextjs thing to confuse u
apperantly the eslint rules become way more strick when you build it
Not sure why all the blog posts would disappear when I build and not during the development.
Apparently, during development, allBlogs.length > 0 returns true although during start, it returns false. I'm confused as to why.
Went ok, may or may not have failed it. Not too worried because I have another attempt on Monday if I did fail
I only need to pass one of them
btw, I continued the game project but got hooked by the project, ngl this is pretty fun to make
wdym by "ecs" btw?
Entity component system
Every entity has a set of reusable behavior called components, which are updated by systems that iterate over the entities with specific components
My components in there are like the TransformComponent class, and the example systems are like the FontRenderSystem and PhysicsSystem (but I haven’t worked much on those yet since I’m working on getting the engine working before that)
ah, that
It’s basically what Unity uses
And many game engines have some form of it
It’s nice because the behavior is easy to reuse and it’s super fast and cache friendly
@wheat mesa got it in a somewhat "done" state, wanna see it?
Sure
fun fact: in this case you could have the condition as follow
allBlogs.length && !search.query.length && <.../>
made it in a different way, maybe went a bit too overboard lmao
oh wait, one of the files didn't commit
ok, now it's there
feel free to clone it to analyze or fork if u want, just learned how to use Semaphore in that project
was supposed to have a boss at round 10, but I suck at space invaders
Looks really nice actually
Might try to make a similar clone of this using my engine to test it
sure
i've just made the pr for the php-sdk
https://github.com/top-gg/php-sdk/pull/4
nicely done, making it object oriented also allows it to be used with more than 1 bot

thanks :D
@lyric mountain I was the only one out of 53 students to pass my exam!!!
Lol
Barely passed it but still
Means the school will pay for my $500 certification exam when it comes to the real thing
Worth it
Really worth it. Good job
thanks C:
Hi, Phil Swift here with Flex Tape! The super-strong waterproof tape! That can instantly patch, bond, seal, and repair! Flex tape is no ordinary tape; its triple thick adhesive virtually welds itself to the surface, instantly stopping the toughest leaks. Leaky pipes can cause major damage, but Flex Tape grips on tight and bonds instantly! Plus, Flex Tape’s powerful adhesive is so strong, it even works underwater! Now you can repair leaks in pools and spas in water without draining them! Flex Tape is perfect for marine, campers and RVs! Flex Tape is super strong, and once it's on, it holds on tight! And for emergency auto repair, Flex Tape keeps its grip, even in the toughest conditions! Big storms can cause big damage, but Flex Tape comes super wide, so you can easily patch large holes. To show the power of Flex Tape, I sawed this boat in half! And repaired it with only Flex Tape! Not only does Flex Tape’s powerful adhesive hold the boat together, but it creates a super strong water tight seal, so the inside is completly dry! Yee-doggy! Just cut, peel, stick and seal! Imagine everything you can do with the power of Flex Tape!
that is a joke
flex tape 🤩
why is this code: https://sourceb.in/rAIcZr3b54 showing that the fields cannot have an empty value
this is what i got
for commands2 log
afk - sets an AFK status
av - get an avatar of a user
dm - dm a member
help - displays all available commands.
lookup - look up a user with a specific discriminator!
membercount - shows current member count of the server.
say - say a certain word
ui userinfo - check for user information
kill - kill a member
sex - get sexual with a member
ban - ban a user.
banner - generate a banner with the user's name
kick - kick a user
lock - lock a channel
mute - mutes a user
nickname - nickname a user
purge - purge a certain number of messages in a channel
role - assign or remove a role from a user
serverinfo - displays server information
serverpfpset - sets the server profile picture.
slowmode - slowmode
s snipe - snipe a message
unban - unban a user
unlock - unlock a channel
unmute - unmute a user
s command.name and snipe is the command aliases
sex - get sexual with a member
im not gonna ask what the commands are for this bot 😭
i wanna try to add () for the aliases but i cant seem to do it
totally not something suspicious
real question is why are you using message commands
because its a bit fast
slash commands are fast. 
its missing value
a value in what
field is empty
hmm
Yeah, was about to say that this is probably related to an empty field 
I would simply print something inside the loop to see if it's even doing what you want

what i got for logging command inside the for loop
who knows
how do i check if the string has a empty space?
wym
like if it equals a space?
o
o
💩
who knows pt. 2
flex seal like bun said already
no
that only works with real life leaks 🤬
someone plssssssss help
Hard innit, when the hands are no longer feeding
why does this code: https://sourceb.in/cEOGXvTYgt warnID saying that it cannot be found in the database even tho it is already in the collection?
Your code is contradicting itself
Is warnID a string or a number
also what exactly is warnIndex at the end of you using forEach
oh
forget about it
i fixed it
but now
why is this code: https://sourceb.in/w5Xrjus4Wo not updating the updated user.warnings to the DataBase?
Any errors?
nope
theres no error too
bump again
because you're using slice() instead of splice() to remove the warning. The slice() method does not modify the original array, while the splice() method does
Replace this line:
user.warnings.slice(warnIndex, 1);
With this line:
user.warnings.splice(warnIndex, 1);
oh
mhm
to separate statements
even if you don't include it, the interpreter will automatically add it before JIT compilation
yes it's optional btw
without semicolons you can't put many statements in one line tho
Okay let's omit semicolons for a moment, tell me, what do you think happens if you run this?
const foo = 9 ** 5
(async () => {
const bar = await someFunction(foo)
for (const baz of bar)
await someOtherFunction(baz)
})()
(Assuming that someFunction and someOtherFunction exists)
ReferenceError: someFunction is not defined\n\tat async (anonymous) (Message 4:21)
no semicolons >>>
@earnest phoenix i hate the fact that black enforces 4 spaces for indentation, and has no customization for it (https://github.com/psf/black/issues/378#issuecomment-400112373)
it also adds... trailing commas 🤮
why would you put many statements in one line
average semicolon fan vs average no-semicolon enjoyer 😎
No, omitting semicolons doesn't even make the code cleaner and also makes it much harder for the parser to actually parse expressions and statements, every sane programming language will enforce you to use semicolons (almost every mainstream programming language enforces this) or at least automatically place missing semicolons as much as possible (JavaScript does this, see https://tc39.es/ecma262/#sec-automatic-semicolon-insertion)
no semicolons look just way cleaner and faster to code imo
idk it's just personal preference
No customizability is literally the point of the Black formatter, it's supposed to bring "sensible" defaults as a configuration to bring consistency to all Python codebases, though yeah no customizability is generally frowned upon
like imagine if prettier has no .prettierrc.json
Hopefully Google's YAPF Python formatter is going to solve this problem
and forces users because yknow "iT cOmPlIeS wItH A sTaNdArD"
Would've been chaos
or Linux with no rice
To be fair most Linux users don't even care about customizability to an extent of ricing, but it's good to have anyway
Unlike Windows and macOS that have limited customizability
ill customize you
I'll rice you to a lovely extent
you are saying as if it puts JIT compiled js straight in your code editor 
trailing commas are cringe
imagine ```json
{
"a": 2,
"b": 3,
}
someone's ocd would like to disagree with this
i don't know why it's an issue. but it's an issue, and now seeing a trailing comma hurts me because it's an issue
what is your perspective on ASI's potential to inadvertently introduce bugs, given its reliance on certain heuristics and the potential for misinterpretation by developers (see https://tc39.es/ecma262/#sec-hazards-of-automatic-semicolon-insertion)
?
also, I'd be curious to hear your thoughts on languages like Python that utilize whitespace and indentation for similar purposes; do you believe this approach is equally effective in ensuring clarity and ease of parsing, or do you maintain that semicolons are irreplaceable for achieving optimal code readability and parsing efficiency?
would certainly affect the code formatting process 💀
Going by the rules we've written to the ASI, the ASI cannot produce bugs if the user understands what expressions have relations to the others, such as function calls tracing back to the qualifier if it wasn't terminated with a semicolon
About misinterpretation by developers, if you're talking about the implementers of the programming language these are basic rules compared to all the others in the whole standard so it's highly unlikely for them to misinterpret it, but it can happen and it has for different areas of the standards, but this has happened for every programming language standard
Especially the grammars of the C++ programming language standard, such as templates which have puzzled implementers for a long time
Semicolons are indeed irreplaceable for the general purpose of ease of parsing and readability, utilizing whitespaces and indentation for contexts and scopes makes things much harder to parse as it involves trickier token consumption, lookbacks, and lookaheads, especially the trace backs which causes lots of problems because it has to ensure where specific grammars are allowed while also accounting for all the context and scope in such a manner
There's a reason why is breaks when mixing tabs and white spaces at the same time, parsing everything sucks
Yeah
Yeah your point is true regarding ASI and it's potential for producing bugs are reasonable. It's true that if a developer fully understands the rules governing ASI and the relationships between expressions, the likelihood of introducing bugs due to ASI would be minimal. Well It's understandable that, given the complexity of programming language standards, implementers might occasionally misinterpret specific rules or concepts, which has indeed occurred in various languages, including C++.
Btw, speaking of C++ and its challenging grammar, particularly in the realm of templates, I'm curious about your thoughts on concepts, a feature introduced in C++20 to enhance template programming (https://en.cppreference.com/w/cpp/language/constraints). Do you think Concepts effectively address some of the complexities and pitfalls that have long troubled C++ developers and implementers? Considering the importance of readable and well-structured code, do you believe that the use of Concepts can improve overall code quality, or do you think their adoption might introduce new challenges and potential misunderstandings among developers?
indeed
It's evident that relying solely on whitespace and indentation for managing contexts and scopes can introduce complexities in the parsing process, including challenges with token consumption, lookbacks, and lookaheads, as well as the need for intricate tracebacks to ensure correct grammar interpretation
Mhm yeah thanks, about your perspective for semicolons, indentation, and whitespace in programming languages. Your perspective on the trade-offs between languages like Python and those that use semicolons and braces for scope delimitation offer valuable context for understanding the complexities involved in designing a programming language's syntax. It's clear that striking a balance between readability, ease of parsing, and maintainability is crucial for a language's success and user adoption. 🤷
C++ concepts are pretty useful and have been getting adopted by the developers all around, it helps with multiple cases of type deduction and selection, boundary checks, and such, but it also introduces even more grammar complexities especially considering how incredibly complex C++'s overall grammar is, given that they can also be used with templates and a new requires clause, it makes it hard to implement properly, this caused multiple front-end (the front-end is the parser, AST builder, and everything similar) issues in our Clang compiler but we've fixed them though there are a few more to be fixed
It's not surprising that some areas still need attention. Addressing these concerns might involve refining the implementation of concepts to ensure correct parsing and handling of complex grammar combinations, improving diagnostics to provide clearer error messages, and optimizing the compilation process to prevent potential performance degradation due to the increased complexity. Providing thorough documentation and examples (real) to guide developers in using concepts effectively can help reduce misunderstandings and promote best practices
Correct, it's funny that some parts of the C++ programming language standard (especially it's grammars) are so complex that we had to step up and not only report issues to the C++ Standard Committee (of ISO), but also fix a few mistakes that made us (the implementers) confused for many weeks
Though we have multiple people who are members of the C++ Standard Committee in our implementers group so it becomes easier to spot issues
Considering that we're also a group of 2,000+ implementers... 
It's indeed fascinating how the complexity of the C++ programming language standard, particularly its grammars, has led to a situation where implementers not only report issues to the C++ Standard Committee but also actively contribute to fixing mistakes that have caused confusion. It's a testament to the collaborative nature of the programming community and the shared goal of improving language standards and tools for everyone
Having members of the C++ Standard Committee within your group of implementers undoubtedly makes it easier to spot issues and maintain a strong connection between language development and real-world implementation. With 2,000 implementers working together, it's evident that there's a wealth of knowledge and experience being shared, which greatly benefits the continuous improvement and evolution of the C++ language and its ecosystem
Yep, absolutely

great essays
@earnest phoenix wait you're a member of the C++ standard committee?
No, I'm a member of the LLVM Developer Group, in this case I was talking about our Clang compiler and how we implement the C/C++ programming languages, hence we're the implementers
But we do have multiple members of the C++ Standard Committee in our group
Though I might become a member of the C++ Standard Committee
if you do pls add a package manager to c++ thx
i don't want to read docs from 2001 just to install something
god making cross-platform programs in C++ is borderline impossible
Well, package managers have nothing to do with the standard of a programming language, the user-land (users) implement one for convenience but I'm not sure how incredibly complex it would be to make a C/C++ package/dependency manager
yeah
the Makefiles, CMakefiles, specific compiler flags for specific OSes and Architectures, behaviors of specific compilers, requirement for a dependency to be installed first...
it's a giant mess

Though https://vcpkg.io/ exists but it's definitely not great
yeah
and several other package managers
like Chocolatey, Conan, etc
@earnest phoenix this screams Rust traits to me
It pretty much is a Rust trait
See https://youtu.be/E-2y1qHQvTg if you want a thorough comparison
C++ Concepts
Haskell Typeclasses
Rust Traits
Swift Protocols
EVENT:
Meeting C++ 2020
SPEAKER:
Conor Hoekstra
PUBLICATION PERMISSIONS:
The author provided Coding Tech with the permission to republish this video.
Become a more effective Developer by using Kite!
Kite is a free AI-powered coding assistant that will help you code faster a...
i'ma create a Rust version of your protonug
I would like to see you do that
i have been planning of rewriting protonug in Rust but i don't understand on how to do the tar part
again i'm not experienced in working with tar.gz files

@earnest phoenix if you do pls dont use reqwest thanks
I won't
I mean, https://crates.io/crates/tar exists
I'll use surf 
again i'm not experienced in working with tar.gz files
also i use a Windows machine
so i can't test it
cringe
native-tls my beloved

All you need to do is just extract a TAR file to a specific location in the file system which that crate handles 👀
nah
i'll just refactor sanz's code
or just learn Rust yourself

become one of us
yeah just refactor my code
I don't know that shit

Ah hell naw, I'll only make others learn it so they become catgirls enjoy modern low-level programming
:^)
winrar and 7zip handle these i think
They need to do it programmatically in Rust
I want to like thirty thousand credits and I need help. Can you help me?
With what exactly?
Buy a server
What kind of server?
عربي؟
hi :D
hruuu :)
tired
I don't understand what you want from me
I still don't get what they're trying to say
I want credit
What credits and what does this have to do with any programming?
probably trolling ignore them
are topgg credits (if that's what they mean) even transferrable?
cuz sleep schedule borked
damn
@radiant kraken
https://github.com/pneb/rust-protonug
indian tech scam be like
send a pr to @earnest phoenix's repo
also don't forget to credit Voltrex as the original developer
mb
i'm too busy rn, will refactor later
what repo
look at his github
okay
also @earnest phoenix instead of .ok_or(STRING_LITERAL)? you can use .expect(STRING_LITERAL)
it would panic instead of passing it into a Box<dyn Error>
you should try out things like clippy
permission denied
I'll change it later
bro Replit is shit
can't even use the git command properly
why are you using Replit
just turned off my computer
did you rewrite protonug in Replit
nah
I'm on my computer earlier
fuck this bro
this new Replit authentication update is shit
no code
you didnt show code
That's very nice, good job
i feel like this is the worst place to ask
because thats for another bot list
also you did ```
"url"
true
let x: string | string[]
x = Array.from(x)
// x should now always be an array of all strings in x, basically string -> [string] & [string, string] -> [string, string], right?
Also consider not using Axios, because it contains lots of bloat and is a source of very strange errors, use something like https://undici.nodejs.org/
A HTTP/1.1 client, written from scratch for Node.js.
Hey! I wanna learn making bots. What language is recommended and where do I start?
The most popular languages are JavaScript and Python
Python for bots has somewhat waned over the years but it's still very popular
If you'd like to start with JavaScript Discord.js is the most popular library for that
Of course, it depends on what you're making
Okay I understand that. But it's just I- I don't know where to begin.. I tried it sometime. I wanna make a multipurpose bot. Like for example something with a embed builder. Reaction roles etc. I mean it doesn't matter what I make. I'm just very interested in discord bots 😄
I'd recommend by starting with some tutorial on how to use one of the languages
Are you familiar with any programming languages?
Then you can use one of the libraries for the language to build something
There are many guides online on how to add certain functionality to bots when programming
So most of your time will probably be spent learning how to apply stuff
Not really. I have rewritten from videos. But i'm not familiar.
Then yeah do what Klay said, pick a beginner friendly programming language like JavaScript or Python and look up guides for them, spend time to learn it's basics and fundamentals, and finally choose a Discord API library made for the programming language you've learned and make a Discord bot with it
uuh what do i do if there is conflict between react versions on a library i am trying to install
--force
when/where does the conflict occur
I'm not sure what you're trying to actually ask here, it's type will just be string[]
is there a more non-brutal way
not that i know of
i get conflict errors with next.js and libs using react 17
--force is what fixes it for me
all i am trying to do is @material-ui/core
Can you show the actual conflict errors you're encountering?
npm i @material-ui/core
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: @0.1.0
npm ERR! Found: react@18.2.0
npm ERR! node_modules/react
npm ERR! react@"18.2.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.8.0 || ^17.0.0" from @material-ui/core@4.12.4
npm ERR! node_modules/@material-ui/core
npm ERR! @material-ui/core@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
Then you'll either have to use React 17 or contribute to @material-ui/core to update it's React version to 18, or you can use the --force (-f for short) CLI flag to force installation but it can be broken
it already broke so i'll try to install react 17
i found something on stackoverflow
npm install @mui/material @emotion/react @emotion/styled --legacy-peer-deps
npm install @mui/icons-material --legacy-peer-deps
Voltrex, how long have you been working with programming?
I'm just wondering
Voltrex is as old as dirt ngl
For about 7 years
https://discord.com/developers/docs/resources/invite#invite-resource I am viewing DiscordAPI about invites, there is no method that we can use to know the source that people use to join our server (like Twitter, Youtube, ...), but I don't understand why some Discord bot like Invitelogger can do that?
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
Discord doesn't provide a way to know the source of the invites at all, what some of those bots do is guesswork, they regularly keep track of what invites were created and watch which of the invites' uses get incremented when someone joins the server, there's no guaranteed way to know this
As for external sources like YouTube, Twitter, and whatnot, the bots might be creating a custom link that points to the invite, and keeps count of how many people visit it's custom link
can i push data to my mongo database with the api of nextjs?
I had the code for invitelogging in v12, I have no idea if it would work on v14
From what I remember, I found this code on github just because I needed something to learn mongodb
This one iirc
so Im trying to make a radio mp3 that when you access it goes through all files in the songs folder, it works for the first song, it gets played fine but at the second one nothing gets transmitted anymore, why?
https://pastes.dev/Z5EN70lvYr
like throttle.on('data', console.log) will spam on the first song but send literally nothing on the second one
help
it's been 3 days already, by that time you'd already have solved it if u even tried
hardly anyone will answer, because those who could answer were stepped onto by you
figure this one out yourself too
sucks to be you then
^
why is dotenv such a strugle with nextjs
its been about 3 weeks or so for my bot to get approved, should i keep waiting or contact
Youre behind this came out in the March 2023 update
who knows 😤
Google knows
It does cause I just googled and found a possible solution though it’s completely unknown whether it’s relevant to you since you provide no fucking code
send solution
🥺
No
🤨😢😭
You google it yourself if I can do it then you can
It was literally my first result as well
what did you google
Exactly what you’re asking
i don't see a solution
Oh Thanks for your explain
@earnest phoenix is it possible to turn ```py
def a(b):
if c:
return True
```py
def a(b):
if c:
return True
``` by just using Regex substitution/replace?

nvm ```py
equivalent to x.replace(/(\n| {4})? {4}/, y => y[0] === '\n' ? '\n ', ' ')
re.sub(r'(\n| {4})? {4}', lambda y: ' ' if y.group()[0] != '\n' else '\n ', x)
can be like this:
# equivalent to x.replace(/((?:^|\n)) {4}/g, '$1 ')
re.sub(r'((?:^|\n)) {4}', r'\1 ', x)
what does ?: do
or that whole (?:^|\n)
also why double brackets
?: is a part of a non-capturing group in regex. It allows you to group expressions without capturing the matched content
(?:^|\n) means either the start of the string (^) or a newline character (\n) but doesn't capture the matched part
because they are used to define the non-capturing group and the outer group. The outer group ((?:^|\n)) is a capturing group to include both the start of the string or newline character followed by four spaces. This helps to replace the matched part with the desired content while keeping the (^|\n) part intact
what about \1?
what's that all about
it's a backreference in regex. It refers to the content matched by the first capturing group. In this case, the first capturing group is ((?:^|\n)), which matches either the start of the string (^) or a newline character (\n)
so when using re.sub(r'((?:^|\n)) {4}', r'\1 ', x), the \1 in the replacement string will be replaced with the matched content from the first capturing group, either (^|\n). This helps preserve the (^|\n) part while replacing four spaces with two spaces in the string
all good?
not yet
my mind needs to process your highly technical explanations
i don't what you just said and am just gonna copy-paste your code anyway
thanks


after my preacher curl, I'll explain it more
🥺
@earnest phoenix why tf is Python's default encoding ASCII
that's probably the worst default encoding to use in your programming language
Yeah probably
UTF-16 is good tbh but endianness ruins it 😭
Though tbf, dont think you'd use UTF-16 unless you're providing international applications that allow content that is non-alphabetical
alphanumerical*
people still use UTF-16 because Windows still use it

Python™️
how can I remove a listener from a eventEmitter? it has alot of listeners on the same event so I need to delete a precise one (nodejs)
you can remove a specific listener from an event by using the removeListener method. first, you need to reference the listener function that you want to remove. here's an example:
const EventEmitter = require('events');
const myEventEmitter = new EventEmitter();
// define your listener function
const myListener = (message) => {
console.log(`received: ${message}`);
};
// add the listener to the event
myEventEmitter.on('myEvent', myListener);
// emit the event
myEventEmitter.emit('myEvent', 'hello world!');
// remove the listener from the event
myEventEmitter.removeListener('myEvent', myListener);
// emit the event again (but the listener is already removed)
myEventEmitter.emit('myEvent', 'no output this time');
the myListener function is added and then removed from the 'myEvent' event. After the listener is removed, emitting the event again won't have any output.
thanks!

this should be correct then, right?
oh my god the formatting
and missing types
const endRequest = options?.endRequest ?? true;
const destroyAbort = options?.destroyAbort ?? true;
ctx.waiting = true;
const dataListener = (data: Buffer) => {
if (!Buffer.isBuffer(data)) {
data = Buffer.from(data);
}
res.write(data, 'binary');
ctg.data.outgoing.total += data.byteLength;
ctg.data.outgoing[ctx.previousHours[4]] += data.byteLength;
};
const closeListener = () => {
if (endRequest) {
ctx.events.emit('nowaiting');
}
};
if (destroyAbort) {
ctx.events.once('endRequest', () => stream.destroy());
}
stream
.on('data', dataListener)
.once('close', closeListener);
ctx.events.once('endRequest', () => {
stream
.removeListener('data', dataListener)
.removeListener('close', closeListener);
});
yeah it's correct
this code will run alot of times, will it still work if that exact code applied an event listener a few times before already, aka will it always remove the listener it actually created?
yeah
when you add a listener using stream.on('data', dataListener) and later remove it with stream.removeListener('data', dataListener), it will only remove the specific listener that was added in the same scope
do you know what could cause my "radio" aka an audio that looks for local files and plays them together though a website (https://pastes.dev/zIJcB65D3D) doesnt work on some specific audio files? like I have 2 rn that work without issues and loop infinitely but some other ones are from the same creator but dont work and when they switch to one of the non working ones it does a small sound & then you need to refresh for it to work? like generally what do I need to look for
I have a question for everyone:
I need a bot who can manage clans and is easy to use for newbies. Do you guys have something like that?
No
:[
how to remove status bot like this
Something like
client.user.setStatus('online');
?
thats an application, not actually a bot
these do not have online-statuses
http-based bots
Hey guys so im trying use the <t:1679077771114:R>
but it says its <t:1679077771114:R> which is wrong, when i use new date i get this - Fri Mar 17 2023 23:59:31 GMT+0530 (India Standard Time)
am i supposed to use UTC ms?
seconds from epoch
divide it by 1000 and round it
you're currently using milliseconds from epoch, which is incorrect
Thanks
@earnest phoenix is GitHub Wiki good for writing documentation
or can you recommend something else
GitHub Wiki is good enough though most people don't look at the wikis since they don't expect documentation to be there
so what should i use
What are you writing documentation for?
my python library
i've seen other python devs use readthedocs.io
Read the Docs simplifies technical documentation by automating building, versioning, and hosting for you. Build up-to-date documentation for the web, print, and offline use on every version control push automatically.
thats true
Python-libraries always tend to use readthedocs lmao
what about JS library devs
like most of the time they would just straight up make their own website
You should use that for Python libraries
^
i have one TypeScript library and it's undocumented for months now
You can either write up a website and host it with GitHub Pages (recommended), document everything in the README.md, or write it in GitHub Wiki
but people never use GitHub Wikis
also it's hard to automate a GitHub Wiki
People do use GitHub Wiki, but mostly for FAQs and instructions, or similar
A very good example of this would be https://github.com/Automattic/node-canvas/wiki
But yeah you shouldn't use it for documentation
why
Because as I said, people most of the time don't expect the documentation to be in the wiki
And as you said, automating GitHub Wiki is not easy
@earnest phoenix to be honest, is documentation really necessary when you already have docstrings?
like you can just rely on IDEs to display them
Can I play the audio played on one channel simultaneously on another channel using another bot?
I will use 2 bots, 1st bot will listen to the sounds on the channel and transfer them to the other bot, and the 2nd bot will play the incoming sounds simultaneously.
Any way I can make pycharm understand the references (with CTRL+B) from cog functions?
How can I get info if someone voted for my bot (webhook, etc)
the webhook will receive a vote notification whenever someone votes automatically
you just need to set it up
anyone have an idea ?
Sounds like something that could be used with malicious intent not sure if it’s ok for discord tos but you could use a recording library (if that exists) and send it through an api to your second bot
@rigid maple
Not everyone uses ide’s to write code
i already do this but how can i make it synchronous
yes, it is spoken on one channel, I want to pretend that it is spoken on the other channel instantly.
sorry for my bad english
Stream it
Stupid question
But why is the "profile views" not showing up? I've tried like the top 3 and none of them work.
can you link where you put that
wdym?
you seem to already use markdown images via the syntax so I don't see why it wouldn't be working
and it works for me on a markdown tester (though it's commonmark and not github's flavor)
or maybe
yeah idk
<details>
<summary>💻 GitHub Profile Stats</summary>
<br/>
<p align = "center"><img src="https://github-readme-stats.vercel.app/api?username=ishaantek&show_icons=true&theme=tokyonight" /></p>
<p align="center"> <img src="https://github-readme-stats.vercel.app/api/top-langs/?username=ishaantek&layout=compact&theme=blueberry" /></p>
<br/>
<b>Note:</b> Top languages is only a metric of the languages my public code consists of and doesn't reflect experience or skill level.
<br>

<br/>
</details>
yeah I know why now
?
ohh
since you want aligning you're better off using <img> with alt=...
<p><img src="https://gpvc.arturio.dev/ishaantek" alt="Profile views"></p>
yes
🙌who knows, i need my memory to stop being leaked
ditch node?
You’ve been nonstop asking for the last 48 hours, I think it’s pretty clear nobody is going to answer you
Especially because you (as usual) have given no details on your issue other than “how do I stop this”
waffle stop replying if you have no answer
I need an answer you’ve said the same thing 3 times
Stop asking questions if you’re not going to give details required to answer them
what details bro
Imagine if memo leak was as easy as finding a hole in a boat
☹️fr
it'd be easier to fix too\
Besides, I don't think "memory leak" means what you think it means
it doesssssssss
my bot is constantly restarting because it's hitting 200mb of memory usage
which is very high
...yk anything image-related is going to put you over a few tens of mb right?
Anyway, that's as far as I'll go, up to you to solve it
😢
stop replying if you can’t help
(one sec trying to find the emoji)
😤
if anyone knows pls spam me with pings
Except I didn't reply, did I?
I made a comment on waffle's message
Besides, I'm free to answer as I see fit, you can make a new post on stackoverflow if you want only serious answers
200mb is literally nothing in js, plus you don’t even know if the “leak” is coming from canvas anyways because I highly doubt you even tried ANYTHING to confirm that
good luck trying to read heapsnapshots
you did
you made useless comments that didn’t help ☹️
I do know that it is
memory only starts rapidly increasing when I use the commands that use canvas
would anyone be able to help me figure out some code, possibly thru pseudo code, for how to "properly" update bot stats via the api? (using node.js)
I tried that’s why I’m asking for assistance 🙄
If you don’t wanna help then don’t reply
smh
^
I only replied to you when you replied to me
Before that I commented on waffle's
As I said, go to stackoverflow if you want serious answers, otherwise tank it
We tanked your comments before
Btw waffle, how's the game going?
Haven’t finished the engine yet, haven’t had the time to work on it since you helped me lol
tbh i just tried looking back thru messages and the only thing i saw was the channel description
no
nah he keeps trolling into people
last 2 days ago, yesterday, earlier, and now
If u need help feel free to ask, if it wasn't for you I'd never learn why semaphores are used lul
asking for help = trolling 🤯
ikik what i meant was the troll of not following the description thats all 🙂
i see
what are semaphores?
sure
It's basically a "ticket" system used for managing multithreaded tasks
Like, if you make a semaphore with 4 slots you cannot have 5 threads executing the same thing
It kinda means “only this many threads can access this data at a time”
ahh so basicallly talk to other processes that could be on a different thread
similar to CAN network?
Not exactly, it's more like a way to reserve a spot in processing something
Idk what's CAN
yay you unblocked me 😘
Imagine this:
- You make a semaphore with 2 spots
- You create 10 threads and make them execute something, each claiming a spot in the semaphore
i have no idea how to explain it properly but basically its a bus to allow multiple things to talk to each other (thats how it was explained to me)
The first 2 threads will be able to claim it, while the other 8 will be put in a queue
yeah you're really an hopeless dude
😞
So until one of the threads return a spot, no other thread will be able to claim one
why
ok i see,
This guarantees you don't get a ton of threads doing the same thing
In the project I did I used it for preventing CMEs
this may or may not make sense to you but it sounds like pooling for DB
Since the render thread cannot use the entities set at the same time its thing modified by the simulation
asking a question, then not believing or accepting the answers, and not treating the helper with respect 🤷
bruh
Very very close to that
no one gave me an answer
that makes way more sense
im still getting used to it and am in the process of redoing my bad earlier code and man its been a trip lol
The only difference is that semaphores aren't necessarily synchronized, since 2 or more threads can have a spot
a guy who is very hopeless and helpless and who goes up to people every day to start stupid fights
I’ve been trying to find an answer got days my bots performance is being very hurt from canvas memory leaks that I can’t fix
lmfao, I'm done with this guy
While queues are synchronized (only one task at any moment is being executed)
I’ve never started a fight with anyone
interesting
last time, he's into Sayuri, then into me, then into someone else, then into KuuHaKu now
😂
me and kuuhaku aren’t fighting
Nah, my time was several days ago
oh then
Now I use the teachings of Sun Tzu
"The best fight is the one you don't need to fight"
And "If the enemy is doing a mistake, don't tell them they are"
do you guys have another good js server I can ask for help
lmfaoo
what’a funny
basically he's mentally destroying and trolling everybody he talks to
talk to a brick wall, but I'm leaving you here
i looked for your past 48+ hr messages regarding the issue and there are key details missing which are preventing me(or anyone) from helping. you are asking for help but are not clarifying. memory leaks can range from many items and can be blinded. for example, im missing info like the package name, library your using, steps you tried already, what you have been told. and i dont mean "well this guy said blah but didnt give link"... sorry you wont get the help you want with out all details
👋 bye
u ain't no worth my time 😉
Btw wonder if I can make the game multiplayer
Shouldn't be too hard ig, I just need a main menu
what game u making kuuhaku? and what engine u doing?
It's the side project i did earlier, it's a space invaders-like game
package: node canvas
what I already tried: googling things about memory leaks on node canvas and couldn’t find anything ☹️
why not code your own engine and use it Kuu 
^
Meh I pinged myself
Kinda did
u gotta watch jdh on YouTube
next steps; redefine your search. if you dont know what i mean, you are looking for a cookie cutter answer which wont help in the long run.
also thats the only package being used? highly doubtable
Jdh?
i assume against AI bots for now?
why would you doubt that?
Not exactly "AI", just brainless enemies that shoot continuously and have varied movements
yeah, he's completely writing games on scratch, and writing a new engine just to run his game
because from what i assume its a discord bot? written in node, so must have discord.js, eris, etc some other library aiding
some were made on Assembly
Naaaah thank you, chris sawyer was enough for a millenium
yes discord.js but that isn’t causing it
oh alright then
lol i always refer to bots as AI even if not true AI\
who the fuck is Tom Sawyer
ah
99% assembly, 1% C
a Tycoon game
😳
And the most succesful game in the century
And that shit doesn't even have bugs
Idk, he was just born different
insane
but yet again i refer to what i said earlier, missing details; i was working off of assumptions. not the best of ways to look for help. lots of downtime cause by that. Discord,js is known for memory problems as well depending on the version. node canvas also known for problem. is there bad code? for example variables that lead to nothing, endless operations, proper try catch?
It's like the Holy C guy
the life lmao
Idk how or why they one day woke up and thought "meh, imma make an insane project today"
I said earlier that the memory issues only start occurring when I run the command that uses canvas
and my code is pretty barebones
thats most of my projects, im just like i wanna do blank or i wanna learn blank so i start doing it... now that project may or may not see daylight but i can at least say i tried lol
Lmao average day in a dev life
A huge pile of started projects that may or may not be resumed
again i refer to what i said earlier, bland information is almost like no information at all. for example code is pretty barebones could mean everything is coded correctly or could mean i forgot one simple catch statement
But it's essential to have one, else you lose interest and get out of touch
im going thru and cleaning my old ones
you're focusing on the wrong thing, im using that as an example not what to do
They don't get examples btw, it's always taken literally
im aware dw
what wrong thing
by bare bones I mean if I remove one thing in my code it won’t create what I want it to
there’s nothing extra
ill refer to what i said earlier, you are looking for the cookie cutter answer which you wont get.
as far as the wrong thing this could be a misused method, wrong variable assignment, redundant code, etc.
“But I need it done for me 🥺”
assuming nothing is wrong is your first mistake; every coder almost always has something wrong
Not with a profiler, I suppose
Or reading a thread dump (does js even have this?)
not a easy one as far as i know
u have to use chrome i think/something similiar
is this directed to me?
are the image proportions the correct ratio? @hushed robin
for canvas/any image processing program, wrong ratios can cause memory spikes
you can read about it on this thread: https://github.com/mrdoob/three.js/issues/11378 You will NOT find solution here
Narrator: "And they went looking for solutions there"
why did i read that in a dreamworks voice

i don't know what this means
if you dont know what it means, then that means you have research todo sadly.. it takes time but is needed so you know what you are doing; I.e. lookup what you dont understand
as some great people have told me, Too bad; i wont do your job for you so time to learn
as for what to google split your inquires for what you want to look up
examples could be something like "what is <term to look up>?", "how does <blank> affect <blank>?
damn
thanks for the help
i think imma just let it slide tho cus it sounds too advance for me
Asks for help
Immediately rejects any help because it’s too hard
This is why we don’t like helping you 🤦♂️
BRO FINALLY WAFFLE SAID THISS
this tbh
that's ok 👌
you guys have already helped me a lot tbh
why do you only want to be known as a leech here
@earnest phoenix does dependabot also take into account of devDependencies?
im not a leech 🤨
fact checked: FALSE!
i am nnot
please stop the defamation
it's illegal

Can’t tell if you’re serious or not
But if you’re serious that’s somehow more ridiculous than the average john barilaro defamation lawsuit

yoo I need some help
on my listing
https://top.gg/bot/1082401009206308945
my iframes have scrollbars, is there anyway to get rid of that?
@dense flame should i add overflow-x: hidden; to css within the description, or the webpage the iframe points too
alr
still doesnt work
its still has the scrollbar, and its still like- mini sized
Is that the scrollbar of the page or the iframe
If its the scrollbar of the page then overflow-x: hidden wont work
hmm alr ill check that
Youd have to apply overflow-x: hidden on the body but that doesn't make sense and probably isnt allowed since it would prevent people from scrolling on the bot page
I’m serious
I could sue you
am I going to? no
yea true, im trying to do what the bot Karuta has done
https://top.gg/bot/646937666251915264
where its one big thing
fml
so in theory, if I transfer the html and css code over to the description, it should work like that
I can confirm it works
pls block me again
anyways guys i have a question so i have a canvas how can i get it in a previous state
like i want to remove something that i have added
no i'm asking a question
i don't care
not sure how you say i start arguments when you're literally trying to start one right now
ain't starting one, just stating the fact that you can't sue no one
meanwhile you're still saying that you can
when you cannot
bro literally just said earlier that he isn't changing the topic but now he's saying this 😭
I'm done with ya peep
everythings good now
iframes just wernt working for what I wanted it to do, so what I did was just put the code for the website I was trying to show with the iframe, into the description itself
works perfectly now, and it looks cool asf
oh i see. Great then
Still waiting for a revision
cc @rose warren
though tbf, probably better to have other devs working around php to approve that merge
👍
how would I install this on linux? would it just be apt install sqlite3 https://sqlite.org/cli.html
yes
im not gonna ask what the commands are for this bot 😭



