#development
1 messages ¡ Page 68 of 1
Well it happens during the compile time does it not?
Itâs part of the compilation process but itâs not âcompilingâ per se
so I could do
int add(int a, int b)
double add(double a, double b)
or smth
Yes
You could also keep the return type the same so long as the arg types are different
ic
However the argument types have to differ, otherwise it wonât work
Since it canât guess which version you want
ffmpeg -loglevel debug -y -acodec libopus -ac 1 -i ./src/recordings/1668904799882.pcm -b:a 128k -ar 48000 -f mp3 1668904799882.pcm
``` yes, when I decoded, the pcm file was fine too. After converting, the wav file was perfect. Thanks Tim
Also I notice that Clion includes the header file for the cpp file I just made
Yup
The power of modern IDEs
Because the cpp file corresponds to the declarations made in the h file
Most header files do not contain any actual source code, just the declarations for things (with some exceptions like templates because theyâre hell to work with in both an h file and a cpp file)
the only problem is to decode and merge the files in the recordings folder one by one and turn them into wav. đ
I see
and header-only libraries
god bless
Yeah
This is kinda annoying
One line of code changed requires the entire project to be recompiled 
try splitting your code into multiple files
This is interesting syntax
and watch the compiler re-include all headers onto every single file
class Math {
int add(double a, double b);
public:
static int add(int a, int b);
};
No idea why I had to make it static but
Because itâs not an object
Itâs the same thing as static in Java (in this context)
static to use directly, non static to use after initializing an instance with New
Itâs just a function on your Math class
no idea what static really does tbh
Not entirely true, new is only for runtime allocated memory
Otherwise you can instantiate objects like Math math; (with a default ctor)
ye
For every new you need one delete
yeah its a pointer because its on the heap
Thats what the IDE recommended kek
I would just keep Math* math = new Math() instead
Or use a smart pointer (donât worry about those yet theyâre outside a beginner level)
Im not looking at your code waffle I dont understand it
i have no idea what smart pointers do either
Shameless plug for an example on how I instantiate objects like that
đ
Itâs simple
It looks like DJS builders
That file at least
Theyâre basically just RCed memory so you donât have to manually deallocate them
you dont even need new?
âModern C++â
you can just do Math math = Math()?
Assuming youâre instantiating it at compile time yes
Interesting
If you need info to instantiate it that you donât have at compile time, youâll need to use pointers
This is getting a bit too much for what I currently understand but I am glad I looked at it
What should I do to decode all files in a folder with ffmpeg? I think it is very tiring to loop and decode each file one by one.
Compile time C++ generally doesnât use many pointers
Once you start getting into things that require runtime info is where youâll be working with (smart or not) pointers a lot
someone told me to do malloc(999999)
doesnt ffmpeg support multiple input files?
Youâll prob just crash your program
Actually yeah
thats just 1mb
1m bytes is childâs play for c++
so should I do malloc(9999999999999999999999999999999999999999999999999999999)
Donât think that works
yes
kek
malloc(size_t)
Ah yeah
size_t
size_t is just whatever the pointer size is on your OS
nice
I own a pc from the medieval era
1 kb
Imagine 1kb pointers
lol
apollo 11 had like 64kb ram
or you'd need some sort of special instructions to tell the cpu to read from multiple registers to get 1kb worth of pointer data lmao
A space ship had ram?
Woah
everything has a computer these days
as time has gone on tho, ram has become incredibly compact and cheap
so we don't care as much
also
otherwise we'd all be using C and microoptimizing the shit out of everything
My head has a computer
a spaceship doesnt have only 1 computer
but it's gotten to a point where we let a chatting app take up 3000 times the amount of RAM that we put man on the moon with
Tim any progress on ur astrology api?
because of cosmic rays
was that an actual fear
little but yes
I guess with 4 it's so incredibly improbable that it would never happen
rewrite it in assembly
it is even in airplanes today
you'll make massive progress
calcilations
I guess those are situations where you can't afford to make computational mistakes
even if they're dreamâ˘ď¸ level rare
on the internet we love pointing out peoples misspellings but hate when it happens to us

xD
a bit flip actually happened in a french election
and in a super mario 64 speedrun
I searched a bit but couldn't find. I guess we can't decode and combine files directly (with an one ffmpeg code)
nahhhhh
ain't no way
only in france
Let's say you have 5 pcm files, after decoding it, 5 more pcm files are created (decoded versions) then i need to merge all decoded files in this folder with another ffmpeg code lastly i need to convert pcm file which i combined with another ffmpeg code to wav
Okay but why
I took a single sound recording as an experiment and decoded it and converted it to wav format and this worked
I'm making a voice recorder
You can decode multiple PCM files with FFmpeg in one single command, this is possible via the -i option as you can specify it multiple times, and you can also use the -map option to specify the where the decoded output stream goes, such as
$ ffmpeg -i ./file1.pcm -i ./file2.pcm -i ./file3.pcm -map 0 ./decfile1.pcm -map 1 ./decfile2.pcm -map 2 ./decfile3.pcm
You can also combine audio files with a single command, you can use the concatenate filter (https://trac.ffmpeg.org/wiki/Concatenate)
its real, rheres a video about it
Another?
they behave like what static functions do in other OOP languages like TypeScript
I ended up writing my own http client and god do I have a headache now. The difference between chunked and not is so... Breh
Also determining when to use chunked is annoying af
Discord shits its pants if I tell it that I want to send my json on the next packet
but I haven't tried multipart/form-data yet
oh and did I mention this is based off net/tls and zero dependencies
Can we host kali nethunter gui with python http server or php ?
must be fun
it was so much fun trying to figure out how the client is supposed to know when the server was done sending packets in chunked encoding. I'm so glad that google had so little results for me to look through and still never really gave me an answer
Good, now rummage through opengl
with C++
and share your code and results with me
:D
what I found based off of Discord's responses is that each packet can be split by \r\n and then filtered through the array where only strings with a length > 0 can be in the Array and then take the last 2 entries in the Array. The first is the byte size and the second is the payload itself. Discard the rest of the chunk and push the remainder into the internal buffer if piping through a Transform stream
I guess it would suck if the payload itself had \r\n in it
but so long as Discord is consistent

As you can see, there are too many files, if I get 5 records from the person, there will be 5 raw and 5 decoded files. Is there another short way to this? (may also be for decoed recording while recording opus stream)
Iâve a question. Is the âsnipeâ command against discord tos? The command which makes the bot impersonate a user & sends their last deleted message in chat.
Not really, just don't save every deleted message in a database 
What are some tools/file formats to create a multilanguage discord bot? Can I use Crowdin or something similar to it?
Crowdin is just to let others translate
You upload a file, for example JSON file and then translate online
Once it's translated in a language, you download the file for that language and then use it in your bot
Ok so I want users to create free subdomains, my API is in a docker container, whats the best way to accomplish this? I use Nginx so my Idea was to mount a subdomains folder to the API which writes configs in there for nginx to use, but then how do I load the configs without restarting nginx completely aka how do I even restart it from the container? Can I just mount /etc/init.d/nginx and then do /etc/init.d/nginx reload on the container?
You must provide the command options as array, that's not up to you
options:
[
{
type: 1,
name: "sub-command",
description: "..."
},
{
type: x,
...
}
];
Any item of the array contains the option structure which is just an object
In the example above the sub command option can also have an options key, passing sub command options as array of objects as value
It doesn't matter how many files there are, you can just make a single command by looping through the existing files, and run it; it should be much more efficient instead of invoking FFmpeg multiple times
Other than that there's no shorter way to achieve what you're trying to do
I got this select i want to change the arrow icon to some like the calendar above and i want to know why is the color at the dropdown "transparent" and how can i change the dropdown style. Can someone help me?
hey guys i am back to postgress and i still have no clue what i am doing
This is my steal emoji command code. I wanna make the bot reply if the server has reached its emoji limit but instead of replying, my bot crashes. The try-catch and catch(err) also won't work, plz help me!
do you have an example of this but created with code, i am trying to leave the gui behind
can anyone help me?
i cloned this (https://github.com/nizewn/Dodong) repo and installed dependencies and bot token..but getting this error
have you tried reading the error
something to do with discord.js
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.GuildInvites,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.MessageContent
]
how do i do it then?
Integrate your service with Discord â whether it's a bot or a game or whatever your wildest imagination can come up with.
thanks..i was just reading it lol
just have to manually turn it on..i thought admin has every access
thanks to you too @earnest phoenix
sds
that...that is the example with code
that's how u declare table columns in sql
ah shit here we go again
what lang lib you using? sql is its own lang, but the sql libs you use may have differences
??
Format your code before sending it so others can read and help much easier, you can use <Promise>.catch() when creating the custom emoji and catch the error if any occurs, you can also check the boost level of the server with the <Guild>.premiumTier property and check the amount of custom emojis in the server by the <Guild>.emojis.cache.size property, and see if the maximum is reached or not
You need to hardcode the maximum amount of custom emojis yourself, and determine it by the boost level
Can u plz tell the emoji limits at every boost level?
Actually I'm new at coding đ
I learn from d.js docs and YouTube
Made my own Handler and stuff
postgresql actually
didn't see the code yet, but I imagine ur using an async method inside a try catch
in which case it'd do nothing since async happens outside of the context
that said, don't use exceptions for code flow, they're expensive to raise
Level 0 -> 100 custom emojis (50 static, 50 animated)
Level 1 -> 200 custom emojis (100 static, 100 animated)
Level 2 -> 300 custom emojis (150 static, 150 animated)
Level 3 -> 500 custom emojis (250 static, 250 animated)
I remember when the limit was 50

Will this work?
const serverTier = interaction.guild.premiumTier;
let maxSize = 50;
if(serverTier === "TIER_1") maxSize = 100
else if(serverTier === "TIER_2") maxSize = 150
else if(serverTier === "TIER_3") maxSize = 250
if(interaction.guild.emojis.cache.size >= maxSize) return interaction.followUp("The server has reached it's emoji limit!");
Looks good but you should use the strict equality operator (===) here, and https://tryitands.ee/
yandev moment
and use switch cases
most libs also include a guild.emoteLimit or something like that
and it wont return TIER_X, it'll just return 0, 1, 2 or 3
Has anyone had this issue when running a docker container?
node:internal/errors:484
ErrorCaptureStackTrace(err);
^
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".sh" for /app/wait-for-backend.sh
at new NodeError (node:internal/errors:393:5)
at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:79:11)
at defaultGetFormat (node:internal/modules/esm/get_format:121:38)
at defaultLoad (node:internal/modules/esm/load:81:20)
at nextLoad (node:internal/modules/esm/loader:163:28)
at ESMLoader.load (node:internal/modules/esm/loader:605:26)
at ESMLoader.moduleProvider (node:internal/modules/esm/loader:457:22)
at new ModuleJob (node:internal/modules/esm/module_job:63:26)
at #createModuleJob (node:internal/modules/esm/loader:480:17)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:434:34) {
code: 'ERR_UNKNOWN_FILE_EXTENSION'
}
Node.js v18.12.1
using switch cases barely makes any difference
Now see edited it, is it correct?
you cannot import sh files
shrimple
what you mean I can't import them?
it looks cleaner than if else hell
read the error
unless djs for some fuckin reason decided to use strings for tiers
yep
Can you give example code.(not the whole code)
classic d.jsâ˘
@radiant kraken boo winforms
How am I then supposed to run the script?
Should be correct
I'm sure it just returns a number so you could just do const maxSize = [50, 100, 150, 250][interaction.guild.premiumTier]
premiumTier property no longer returns a number
that's an oddly clever way of doing that ngl
now thats something ive never seen
and hi flaz
the what?
const maxSize = [50, 100, 150, 250][parseInt(interaction.guild.premiumTier)] then
Oh wait it went from TIER_X to just numbers now
Just enums, discord.js inconsistenciesâ˘ď¸
minor update changes
So do i need to change something?
đŹ
You should compare it with the Discord API types that comes with discord.js
import { GuildPremiumTier } from 'discord.js';
switch (<Guild>.premiumTier) {
case GuildPremiumTier.Tier1: ...
...
}
are u even paying attention to what we're talking abt or just waiting for a code to copy paste?
djs moment
F
F
bet theyre gonna make events no longer accept a string
Events type already exists so lol
They're encouraging to use them
i am using it rn
Granted union types help a bit with that
whats the best way to make a browser start a long process (over 1 min) on a server and get notified when its done?
websockets
can I send an apk through websockets?
hmm kinda
yes
both websockets and rest apis can only send one thing over network
bytes
apks are binaries, so u can send then, just make sure to checksum on both sides to assert integrity
while we're at that, everything is a binary, so anything presentable in a computer can be sent
@earnest phoenix you love? (revanced is making me go insane)
everything is a rock that we tricked into thinking by pumping it with voltage
just write a serializer
you can't just stringify 'em
its just better if you make it download as a file after the process finishes
ReVanced minor inconvenience
u can, u just need to use a serializer or use json
you have to turn the apk file to arraybuffers and make the browser encode that and download it
pov: maintaining a popular project be like
fr
i am not reaaally maintaining it but yop
basically i am trying to create a table with nodejs but i can't seem to do it the proper way
brb lemme clone linux
i only maintain helper which is closed sauce rn
How can I "automatically" put all files inside a folder into an ffmpeg command?
can i sort it with map?
After sorting and decoding, I save the pcm files in another folder, then merge them into a single pcm file with another ffmpeg command and convert them to wav
Use the built-in readdirSync() method of the built-in node:fs module to read the contents of the directory, declare a variable and set it's value to ffmpeg , and then use a for loop to iterate over the contents of the directory and add their path to the variable you declared with the -i option
nerdtrex
i should make one of my projects open source (ultimate compress đď¸)
open source is good
i mean i was going to but school and laziness
yes, so i can make sure the program won't generate 700 images of john cena onto my desktop (đ)
import { readdirSync } from 'node:fs';
import { join } from 'node:path';
const pathToDir = './my-dir';
const pathToDestDir = './out-dir';
let inputs = '';
let mapped = '';
const entries = readdirSync(pathToDir);
const len = entries.length;
for (let i = 0; i < len; i++) {
const entry = entries[i];
inputs += `-i ${join(pathToDir, entry)} `;
mapped += `-map ${i} ${join(pathToDestDir, entry)} `;
}
const command = `ffmpeg ${inputs}${mapped}`;
...
voltrex, remember that one project that i turned every 3 bytes into 1 pixel?
for (const i in entries)
ffmpeg imagine
or forof if u dont need the index
%Array.prototype[@@Symbol.iterator]% is inefficient against the in keyword, so a standard for loop is recommended instead
Yeah?
i wanna open source but school and laziness đż
also i think ill give up on the video conversion cuz it just takes too much space
What the fuck is that
like it gets bigger than the file that i turned into pixels
big brain
and the frames
thanks for helping
The iterator symbol of the arrays in JavaScript, it's the one used to create iterators and also the symbol called when using the of and in keywords against arrays
https://tc39.es/ecma262/#sec-array.prototype-@@iterator
You can also override it to make your own iterators, pretty much any good language allows you to customize and create iterators like that
Open-sourcing it should just take a few minutes
no like changing stuff then open source
Oh alright, have fun with that
When I do ```js
client.on('messageCreate', async (message) => {
if (message.mentions.has(client.user)) return message.reply({ content: Hey ${message.author.username}! Use </help:0> to view my commands})
});
I get this error- `client.on is not a function.`
Plz help
đŚ
did you initialize the client?
Yes like this-
I already defined it as ```js
const client = new Client({ intents: [Intents.FLAGS.GUILDS]});
try installing the latest version(?)
// Set the Bot status
client.user.setPresence({ activities: [{ name: `/help | ${client.guilds.cache.size} Guilds` }], status: "idle" });```
The status didnt change
What discord.js version are you using?
v14.6.0
Your code is correct, however statuses take a while to change, and resolve your promise as <ClientUser>.setPresence() returns a promise
its over 1 month
â
im trying to fix it over 1 month
Okay, and that's how it's possible; resolve your promise and wait for a while for it to change
If the status doesn't change your code probably doesn't even run
The normal text is working but its doesnt change from online to idle
Then try what I said
Your status is incorrect
The API expects a number not a status string
djs doesn't convert strings anymore
@earnest phoenix jfyi
Statuses aren't numbers in the Discord API, discord.js also expects strings
https://discord.js.org/#/docs/discord.js/main/typedef/PresenceStatusData
Errr yeah
Activities is the right word
He didnt provide a valid activity (not status) value
Man... im calling this status
If the activity type isn't provided it falls back to PLAYING
They said that the activity changes in their case, just not the status
I can't find this in the code tbh
But anyways since it's the status it doesn't matter anyways
Not in the discord.js code, the API falls back to it
It requires Visual Studio, which comes with the build tools needed
Its just vs build tools you need iirc
oh
The more other stuff I will forget

You shouldn't use the non-LTS releases of Node.js (19.1.0 in this case) in production, use the latest LTS release (18.12.1)
And it seems like it's looking for Visual Studio 2019 or something?
npm ERR! gyp ERR! stack Error: spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe ENOENT
This means that C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe doesn't exist, try going to that path to confirm if it exists or not
You're welcome
Eny ideas whats wrong here? I cant install a packages in replit.. :/
Ping me if eny one have some ideas. Thanks đ
I can't install even discord.js... i cant install anything đ
Doesn't replit have a built in way of installing packages outside the terminal?
yep
Ehmm idk... But A magic happend đ I just deleted all npm modules and run the bot and noww everything is working đ
funny question, is it possible to run bash scripts (and java apps from it) on windows? Im too lazy to port my script to windows
windows has wsl
yeah but I want the average user to be able to run it, I think wsl is too complicated
well, then port it
mh
u can also write ur script in a cross platform lang like js or python
or c++ /s
ah, how can I use things like sed in fs?
what is sed?
tool to replace for example all occurences of "cool" with "uncool" in a file
that's literally <string>.replace()
It does more than just replacing but yea
just read the file -> replace -> overwrite file
You'd have to loop through the contents though to find the word you wanna replace unless I am just not thinking of a more efficient way
can I run tools like apktools, apksigner, etc using js on both platforms?
yes
He'd have to bundle those apps with his though right?
Unless he wants people to install em themselves
use child_process for that
obv
apktools and apksigner are java apps so no problem but zipalign may be
I mean you could always have em install them themselves so
well I think the only thing I need is to know if the Javascript file was run on Windows or Linux / Mac, how do I know that?
win32 is windows then, id guess?
well obviously
channels.cache.get() no?
assuming its in the cache sure
I prefer using .fetch as it checks cache first before doing api calls
djs caches just about everything regardless of if your pc is struggling with memory alloc
cache broadly means to store data somewhere you can easily access without having to request the data from the holder like in this case Discord
cache is like a temporary storage for recently/commonly used data
to get stuff like channels or guilds, the library has to request from discord api, but doing that constantly would quickly reach ratelimits
so to prevent that, it "saves" recently fetched data instead of disposing of it instantly
get your token reset speedrun any%
cache is good, yes, but too much cache is equally bad since it'll use all your free space and reduce your app to a crawl
so it's important to fine tune the cache according to your usage
Which is why djs doesn't cache all members at ready unless you tell it too
which you absolutely shouldn't do
that or they were too lazy 
the real memory leak are presences, not GuildMembers
I don't cache anything I just fetch the api all the time 
slash commands give me just about everything
I only cache users and their voice states
You stalking their voices?
music bot
Do you record their voices like alexa and google?

I again have same problem đ Wdym with this :?
Idk, I just know it exists
replit has an interface for installing packages
I dont use replit but it has a built in package installer
use it instead of cmd line
inb4 sftp
Well... My bot is running but its not going online... Like all commands it loads but it does not do firther from there... it should sync with / commands in discord and log in to db (mongodb)
try debug logging like gateway messages
And there he stops đ
hmm
that's great and all, but says nothing Discord related
if you import modules in your files and catch errors when loading them, then might not be modules
might be the node you're hosting on is blocked
but debug log gateway messages before assuming
how do I make a select menu like in create-vite (cli)?
Here is debug logs
Well it is something called logs đ
Maybe can u come in to my replit and see the logs by ur self?
I have debugger active
but no errors it shows đ¤ˇââď¸
and yet, it is not the logs we asked for
:/ Can i dm u my replit link? Maybe u can lookup there - that was will be much easier to see
No
Help me
Show code maybe
Well... respond accordingly to your interaction event
label: "đ¤ Support",
description: "Click for Support",
value: "six",
},```
.setTitle("đ¤ Support")
.setDescription(`
Testing
`)
.setColor("GREEN");```
Non of that is a response
its working
but on this part is not working
Now you need to respond to interaction with embed6
You've created the embed, use it to respond with it
ohh thanks
Or whatever function you want of course, you can edit the message, reply to it, delete it, etc..
thanks
I have doubts... but do your thing
thank you too đ

never do your thing
it usually involves pesky php
Shhh little purple name
If php wouldn't be a thing you wouldn't be able to browser 50% of the web, or actually even more
Imagine a dark web without php but js instead 
I didn't say you enjoy it but we all need it unfortunately
sometimes
Fortunately PHP is not used much anymore, victory to the web! 
At least more than 50% of the webservers still sending integrated php in their header
If we wanna trust statistics
I would say it's way less than that, I barely come across any websites or web servers that actually use/send PHP files as responses anymore
Oh wow
77%
More than 77% of the existing websites
I guess fuck you thrn

Errr 70,7% not 77 my bad
That's not right, probably old statistics; you can barely find any websites or web servers that does use it nowadays
What is php 
Im still speaking about webservers sending php headers
oh
Not sure about websites itself tho
Guess that's not that easy to detect without like browsing any website
But only by clicking a few links regarding its market share I'm still surprised...
Seems to be far over 35% for websites
Probably caused by million of WordPress shops etc
Wordpress best
WordPress still uses PHP?
Voltrex seems to think that any service out there is always up to date using the latest technology
I do not think like that, I heard that they migrated or something but it may not be true
Voltrex, I wanna bet that most of the visible infrastructure is built on fucking old technologies probably lots of them being outdated
Nope, it isn't
Only a couple of banks and governments use ancient software for obscure reasons, most of them these days don't even look back at that old software anymore
It also applies to countries that are not so technologically advanced and falling behind, and have no interest to upgrade whatsoever such as where I live, Iran
Almost every single ATM I've seen here runs on like Windows Vista, 7, XP, or something way older
Or other stuff
Windows 95 moment
Theres a lot of infrastructure which needs to be changed but it isn't touched to prevent large blackouts due to simple update issues
At least all the stuff that hasn't intentionally be replaced the last 10-20y
ssh into it 
Nowadays newer developed systems and infrastructures might not have that issue anymore
Welcome thunder, here in development we are talking about how lazy our government is
They do change stuff and maintain things behind the scenes but of course not so frequently, they usually do every month or 3 months or so
ads
Just like large servers big companies maintain, it's usually a similar pattern
I should buy a server rack and offer hosting plans
throwback tto when a guy tried to say you can have your account stolen with oauth
I could probably hack every single ATM here due to how old their software and OSes are, so many security vulnerabilities
voltrex caught in 4k
No wonder hundreds of ATMs were hacked like a few years ago
Fbi being informed right now
Voltrex if you hack an atm make sure to route some money my way /s
Sure 
Okay so thunder brief explanation on what you need to do
Doesn't discord OAUTH has a relatively short session timeout?
You will need 4 things, Client ID, Client Secret, Scope, and Callback url
I mean instead of storing the logged in user data and handling the OAUTH flow, a simply login/register and account management system is probably less work to do
Especially if those things aren't necessarily connected to each other
If you don't need the user account info in any way, why using discord login flow then?
Are you going to bind anything o their account with this id for future use?
token
What if somebody using your service doesn't have discord ?
^
Use my service go make a discord account and come back 
Anyone can visit your site
nitro exclusive to create an account
Then have a whitelist only system and just use their ips ez
what if dynamic ip
"Work"
What's even locked behind the registration requirement?
Registration -> email/password
And you will have an email, too
Like anybody can abuse it?!
Either with a discord account or fake registered account
Create a verification system
Only accepted registered users can use your service
A normal login isn't trustworthy
Wut
Well I'm using cookies and a remember mr checkbox to save user sessions to prevent multiple logins
In your words the need to enter passwords

brb
With discord releasing more features for bots, imo start with the bot first. It sounds like you know how to do that too.
Once you have that done you can move onto oauth and site stuff.
postgres
do you have a vps?!?!1
it's pretty much sudo apt install postgres
that's it
u just need to setup users so u dont use root user for everything, but it'll come ready from the get go
just read some postgres quick start
there are a ton on the net
Here is a complete log... I cant install a important package called @discordjs/opus - Can some one help :0
basic what...
just a joke, for how every line has a number before it
but really, what the hell is that log
i did cat cmd to pull the complete log
like that đ
but that is a error what keeps away from installing that dam package đ
And iDk WhYYY
đ
helP
I cant really help
o i did one ytb tutorial... SO basicly it needed to do this... I guess it didnt like some version or smthing of node ir smthing - idk... But now everything works đ
16 đ
hack all atms to advertise Node.js and clang 
How do I pass a bot instance as a parameter when initializing the class?
class PinRequestModal(discord.ui.Modal, title="Pin Request"):
def __init__(self, bot: commands.Bot):
super().__init__()
self.bot = bot
Is there a way to do this in javascript?
const constant = "
Text
"```?
self.bot 
use ``
It's what two d.py people suggested, then left when they realized that it's an OOP thing
Let's say you have 2 objects, see them as headers
One object are your standard http headers
user agent, host all of that
The other one are also headers but pre-defined
{"authorization":"123"}```
What would be the fastest and smallest way to make sure the keys and values in the second object are included and equal in the first object?
just modal = PinRequestModal(bot)?
Suppose I can just use a function to compare
I don't understand how that makes sense
use Object.entries() and Array.prototype.every(). make sure that the keys and values in the second object exist and equal to the ones in the first object
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every
Object.entries(preDefinedHeaders).every(([key, value]) => httpHeaders[key] === value)
const user = await interaction.options.getString('name')
const id = await interaction.options.getInteger('uid')
const db = new QuickDB();
await db.set("MemberInfo", { name: user, uid: id });
const info = await db.get("MemberInfo");
interaction.reply(({ content: `${info}` }));
it is replying object object
haven't coded in js in a while
soo this is for my friend team
He wants to add all the members info and display all the members and its info
and remove it if needed
First of all you don't need to await getString() or getInteger()
They aren't async functions, they just access the options
also correct me if I'm wrong but the ${} for your content is unnecessary if it's already going to be a string you should just be able to do content: info
info is shown as object since it actually is an object
The result of your database request returning the structure you have set
So if you wanna see the keys/properties it holds/you can access, just log the var info
Ik with my database by default it would be like this: thing[0].whateverImGrabbing
but that's mysql (maria DB)
Those generally return an array of your results, yes
But his request seems to return the result structure directly
He must have created the structure before, so if he can't remember anymore, it makes sense to just log the result (info) to know which properties he wanna get
facts
Also i can see one () too much inside reply()
Not needed to nest another parentheses in there
Oh I have a mysql question if your familar with it
let checkBal = await client.extends.database(`SELECT currency FROM user WHERE userid = ${message.author.id}`, false, true)
let checkDuelBal = await client.extends.database(`SELECT currency FROM user WHERE userid = ${user.id}`, false, true)
Is there a way to make this a 1 line thing
same DB, just two different userIds
ignore false, true. It just means I am saving it to an variable.
https://scs.twilightgamez.net/kxdx0.png the table layout
well no
it's a like 1v1 thing so I need to save BOTH users currency
so I do need both at all times
https://scs.twilightgamez.net/Oz6YJ.png so both of these rows in 1 line of code
No you haven't set a limit
not at all
So it searches any result that matches either that or that or another one etc
When dealing with doubles you can also use this
WHERE userid IN(id, id, id)
AH ok ok
In this case the result would be the same
You will just have to use the OR operator when it comes to strings
đ
ye
Also make sure if an user id wasn't found you don't compare something with null or undefined etc
already had checks b4 this so were good đ
Always expect the unexpected
Do you think Math.random() > 0.5 is a good 50/50 odds chance thing.
Technically not exactly 50% as random() doesn't include 1 as result iirc
But 49,99999999...

all seriousness, why is mySql not good
Instead of copy and pasting any of its disadvantages you might wanna search em up yourself
Literally there's no reason to use that unmaintained beast of a big unfriendly buggy engine anymore
I never had any issues with it to be fair. Atleast for the reasons I use it.
When you can at least mariadb or postgres
ok well
I do use maria
so i guess im in the clear
I just assumed they were essentially the same thing since queries are literally the same.
They are mostly the same because they are all written in sql
Differences are just specifically to which database engine supports which features and which not
I c I c
The main difference between mariadb and MySQL is that the creator (of both) spends his time and love developing and improving mariadb instead of milking the cow like Oracle does, completely ignoring the user base and wishes and can't actually fix issues in their engine for the past 10y
You literally just don't wanna touch anything Oracle has its hands on
It is and there aren't any fundamental differences to postgres
Just a bunch of features both engines support or not you need or not
Hey I am trying to make my bot reply if someone mention it.
Can anyone tell me that will this work?
const { MessageEmbed } = require ('discord.js');
module.exports = client => {
client.on('messageCreate', (message) => {
const mentionEmbed = new MessageEmbed()
.setTitle(`Hello ${message.author.username}!`)
.setDescription("To view my commands, use </help:0>")
.setColor('#4169E1');
if (message.mentions.has(client.user)) return message.reply({ embeds: [mentionEmbed]})
});
}
Rn, I can't use my pc so if anyone don't mind plz try and tell me.
My discord.js version- 13.12.0
you shouldnt recreate mentionEmbed when messageCreate event is fired
So what changes I have to make?
#include <iostream>
#include <vector>
int n = 0;
std::vector<int> fibb()
{
std::vector<int> sequence {};
int t1 = 0, t2 = 1, nextTerm = 0;
for (int i = 1; i < n; i++) {
if(i == 1) {
sequence.push_back(t1);
continue;
}
if (i == 2) {
sequence.push_back(t2);
continue;
}
nextTerm = t1 + t2;
t1 = i;
t2 = nextTerm;
sequence.push_back(nextTerm);
}
return sequence;
}
int main() {
std::cout << "Enter number of terms: ";
std::cin >> n;
std::cout << "Fibonacci Series: " << std::endl;
for (int nums : fibb())
std::cout << nums << std::endl;
}
So this could be simplified quite a bit
Keep in mind that the sequence starts like so: 1 1 2 3 5
So if you just start with a vector of [1, 1], then you can just sum the two previous terms to get the next term
I thought it started with a 0
:^)
std::vec<int> vec = [0, 1];
for(int i = 2; i < howeverManyTermsYouWant; i++) {
int firstTerm = vec[i - 2];
int secondTerm = vec[i - 1];
vec.emplace_back(firstTerm + secondTerm);
}
``` some pseudocode for the basic idea
seems to be the same thing yea
Aint no fucking way its this simple
đ
My code was indeed bloated
Works perfect
now if you want to make it REALLY bad you can use recursion đ
The fibonacci sequence is just the previous two numbers added together
First numbers: 0 1 1 2 3 5
0 + 1 = 1
1 + 1 = 2
2 + 1 = 3
2 + 3 = 5
Oh wait
nvm I get how it works
first term is vec[i - 2] since i starts out as 2 it'd be 0, and second is vec[i - 1] would would be one so yea nvm it makes sense
Yup
I couldn't visualize it for a second

Also waffle no school tomorrow for me again
fucking buss route cancelled once more
more time to learn c++
Im doing what I can from home with my homework
now learn templates 
but they don't exactly notify me on canvas with homework as majority of the classes I take do it in person
đ
tbh we don't even have homework thats assigned
is just whatever we didn't complete in class 
No idea what that is
Yeah it's simple
is it actually?
definitely
it's not that hard but the errors are horrendous and they can be finicky
so far the compiler has been pretty nice
Also waffle did I tell you my ambition to make my own game editor in c++ if I feel like it after learning enough c++

imagine not modifying winpe
this is not a joke with template errors
go for it
it'll be a lot of work
but definitely a good project
Is this seriously how they say it?
there's some horror stories with templating errors
I am regretting c++ now
let's just leave it at "they're not pretty" for right now

go with rust
nah
you'll cross that bridge when you get to it
I am pursing c++ heavily rn
@radiant kraken you know what to do
null loves C though too
I plan on making a triple A game by the end of 2025
that might be a little too ambitious lol
it was a joke
only by yourself
You think I got that?
good luck
C++ and rust are good to know
At best it will be a single A game 
rust because it's clean but low level and C++ because it's common and low level
can you go lower than C++?
C
without breaking your neck
assembly
without breaking your neck
yea no
Fortran
Also wasn't there this super popular game that was made purely in assembly
@sharp geyser make an os in c++ NOW
RCT
thats speedy's thing not mine
most games in the 80s is in assembly
It was a modern game
Not on the scale of roller coaster tycoon though
or a more modern game
Objective-C best
C++ has a lot of stdlib bloat
so true
time to die
C is just plain simple and straight to the point
I think rust has the correct approach for libraries
JS > *
So should I be learning C over c++ then đ¤ /s
yes
yes
and suffer
The stdlib in rust is very small but gets the basics done, then you use crates for smaller things
no
No
but you have to do everything from the ground up
i still didnt die
I donât think itâs worth learning C over C++ at this point
like dynamic arrays and strings
thats suprising

Learn C after C++
but what i love about C is it's simplicity
Itâs very simple which is a gift and a curse
strings in C are a myth
Because you have to start thinking about things you wouldnât normally think of
no
Strings in every language are a myth
char * 
isn't that how you had to do it in c++ ffor a long time?
A string doesnât even exist
just an array of numbers, since everything in C is a number/byte
Fun fact waffle is edible
am bored
So true
won't 
If you learn C++ then youâve basically already learned C
Just have to think about the smaller structures that arenât available to you if youâre using C
i just love the fact that everything is a number/bytes in C
I've learned with C++ I am more interested in how the data is stored and works more than anything else
with C++ I am actually focusing on optimizations
i love structure-based and pointer-based things
Donât worry about optimizations too much
Learn how pointers and references and the features of the language work first
Then you can worry about making things super fast
Super sped
True!!
C++ is faster than the speed of light wym
but Rust is miles beyond that!!!!!!!!!!!!!!!!!
look at me not even a full day of work using c++ and I am already defending it
waffle what have you done to me
To move one value into a register on your CPU, it takes the same amount of time it takes light to cross a standard 17â laptop screen
đ
Its weird you know this
Itâs fascinating how fast it is
c++ that fast?
goddamn that's slow
Thatâs really fast đ
saw that misty
oh some mod lurking probably deleted it
so rude
In one second light travels 300 million meters, think about how incomprehensibly small 17 inches is compared to that
sorry i don't speak inches
Like 40cm
Okay you metric boy
metric >>>
At this point ima just make a bot that calculates conversions
Just so I can talk to null
foreigner
ew american
Time to move to nulls house
Lmao using fucking decimals
Liberia and Myanmar:
Should I spend my time making a bot that calculates conversions or continue working on c++
C++
bot it is /s
bots are boring
The other one would just be argument parsing busy work while looking up conversion formulas
you should learn about pointers and references, since they are a core part of cpp
I will eventually
rn I am trying to make it so the exe window doesn't close immediately after smh
Thereâs a solution online for that
what are you making
fibb thingy
First c++ project might as well make it smth special
even tho waffle pretty much gave me the asnwer
hmph
just make the program wait for a character input in stdin
that's what almost every programming tutorial in a compiled language does
std::cin.get() is what I am doing
yes
but it no work
int main() {
std::cout << "Enter number of terms: ";
std::cin >> n;
std::cout << "Fibonacci Series: " << std::endl;
for (int nums : fibb())
std::cout << nums << std::endl;
std::cin.get();
}
what's fibb
I assumed adding it at the end would be that it would wait
std::vector<int> fibb()
{
std::vector<int> vec {0,1};
for (int i = 2; i < n; i++) {
int firstTerm = vec[i - 2];
int secondTerm = vec[i - 1];
vec.emplace_back(firstTerm + secondTerm);
}
return vec;
}
isn't it push_back
emplace_back does same thing as push_back
oh
waffle said emplace_back is faster tho so
what's n tho
cause I wanted it to be null
đ
and I also didn't think about passing it as a arg
will running cmake build again rebuild the project or?
try running cmake build again
I did and it just says they have been written to build
but nothing changed so I was curious
still exits immediately
remove the build directory and re-run everything again
or just use g++, you don't have to use cmake for a small c++ project
Still no
g++ is not a cmd since i haven't added it to path
too lazy to do it as well
huh
@sharp geyser use getch(); from conio.h
Enter number of terms: 100
Fibonacci Series:
0
1
1
2
3
5
8
13
21
34
55
89
144
233
377
610
987
1597
2584
4181
6765
10946
17711
28657
46368
75025
121393
196418
317811
514229
832040
1346269
2178309
3524578
5702887
9227465
14930352
24157817
39088169
63245986
102334155
165580141
267914296
433494437
701408733
1134903170
1836311903
-1323752223
512559680
-811192543
-298632863
-1109825406
-1408458269
1776683621
368225352
2144908973
-1781832971
363076002
-1418756969
-1055680967
1820529360
764848393
-1709589543
-944741150
1640636603
695895453
-1958435240
-1262539787
1073992269
-188547518
885444751
696897233
1582341984
-2015728079
-433386095
1845853122
1412467027
-1036647147
375819880
-660827267
-285007387
-945834654
-1230842041
2118290601
887448560
-1289228135
-401779575
-1691007710
-2092787285
511172301
-1581614984
-1070442683
1642909629
572466946
-2079590721
-1507123775
708252800
-798870975
-90618175
-889489150
Oh?
fibonacci goes into negative?
nop
0
1
1
2
3
5
8
13
21
34
55
89
144
233
377
610
987
1597
2584
4181
6765
10946
17711
28657
46368
75025
121393
196418
317811
514229
832040
1346269
2178309
3524578
5702887
9227465
14930352
24157817
39088169
63245986
102334155
165580141
267914296
433494437
701408733
1134903170
1836311903
2971215073
4807526976
7778742049
12586269025
20365011074
32951280099
53316291173
86267571272
139583862445
225851433717
365435296162
591286729879
956722026041
1548008755920
2504730781961
4052739537881
6557470319842
10610209857723
17167680177565
27777890035288
44945570212853
72723460248141
117669030460994
190392490709135
308061521170129
498454011879264
806515533049393
1304969544928657
2111485077978050
3416454622906707
5527939700884757
8944394323791464
14472334024676221
23416728348467685
37889062373143906
61305790721611591
99194853094755497
160500643816367088
259695496911122585
420196140727489673
679891637638612258
1100087778366101931
1779979416004714189
2880067194370816120
4660046610375530309
7540113804746346429
12200160415121876738
19740274219868223167
31940434634990099905
51680708854858323072
83621143489848422977
135301852344706746049
218922995834555169026
Why the hell is mine in negative then
the math looks correct

whatever I can't be bothered anymore
Ima go look into pointers and reference
int has a max value, which is 2147483647
So you have an overflow when adding 1134903170 to 1836311903, that is when you first get a negative value
Ah right

