#development
1 messages · Page 184 of 1
I don't use mac, excuse the stupid questions.
Is desktop your home folder?
If you type "ls" in the terminal it should show what your local folders/files are for your current directory for that terminal window
This might be useful to help you learn terminal for mac.
https://phoenixnap.com/kb/wp-content/uploads/2023/05/mac-terminal-commands-cheat-sheet-pdf.pdf
We're currently only using commands from the "Directory Management" section to try to find the folder and set the terminal to be that folder.
Oh okay, perfect.
you can take this one step at a time.
if you do
cd Desktop
then
ls
It should show the folders on your desktop(you dont have to show it if you dont want to)
Then cd into the next folder you need to go to, once you see the package.json folder you're in the right spot and can stop.
At that point
npm i
or
npm install
should work.
^
i have to get on the road and will be back if i have any questions later
You can ping me if I dont respond, I should be around.
thank you so much!!!
yes!!
should i do the npm audit? or just continue on?
auditing is fine, you can also just wait until you're ready to deploy before doing it.
It can fix itself a lot of the time
ok gotcha
so at this point, he says the next thing to type is “node .”
Its just going to be
context.waitUntil(WhateverPromiseYoureWaitingOn);
yeah, that should start the program up.
You might get a discord error because the new download probably doesn't have its config edited.
If you do, you can just fix it after
yeah it gave me an error
You're using visual studio code right?
ok when i get back home (im at my moms now) ill go through the config i downloaded and fix it
correct
yeah but context is undefined
im trying to use it inside of a command thing
You might need to re-open VSC(visual studio code) to the new folder on the desktop.
It'll be in the top left.
You can do that later though.
like here
the runner might define global variables not natively in node
Unless there's a special context that variable is available, it would just likely be under global
I think it might be passed along from the event listener
I'm not entirely sure. I've never used cloudflares context.
Yeah, e might contain context
yeah it does
e.context.waitUntil
hm
but how would that even work
wouldnt that mean i need to make each cmd a function
Is this inside handlePost function?
Do you pass e all the way down to this?
Ie could you do e.context.waitUntil(...) here
(or whatever you change the name to)
You should be able to keep passing it down
I'd recommend each command being its own function anyways for readability
and use switches so the runtime can b-tree
I assume they're using express.
request.context.waitUntil doesnt work
i am using itty router
request.waitUntil wouldnt work either
hmm
It looks like your structure is a bit different than the example code itty shows.
Does handlePost use router.handle(event.request) somewhere?
You can pass additional args inside of router.handle.
Any args you pass, like context should be available in all of your router.post's
would this work
It might have to be
router.handle(e.request, {context: e.context});
then
router.post('/', async (request, args) => {
const { context } = args;
// ...
}
Depending on how itty actually works.
But yeah
(ittys docs are kinda meh)
ew express
actually
couldnt i pass e
speaking of express i want a panda express
instead of e.request
e.request still has to be passed as the first parameter
tried this and:
anyone have any idea why it isnt working?
@green kestrel i started with the tcp parser and it's currently kicking my ass so damn hard. Why is it so hard to keep track of the packet status upon sending 😭
lol
told you tcp is pain
if youre interested... https://github.com/brainboxdotcc/retro-rocket/blob/master/src/tcp.c
thank you so much
i hope it can help hahaha
like the begin is down for sure, just need to get the packets sorted and tracked.
context isnt supposed to be passed through e so im unsure where else to get context
youll probably also need the ip layer that sits below it
and for ip to work on top of ethernet you need ARP: https://github.com/brainboxdotcc/retro-rocket/blob/master/src/arp.c
yeah gets annoying because tcp is a free for all
as far as the os is concerned you can send and receive arbitrary amounts of data which is enough
yup
any idea why the code inside event.waitUntil isnt executing?? no errors
fixed it! used iife
hey! did this and i think i still have to go through the files in the folder and fix some stuff up, thanks for your help!! ill play around with it and see what i can figure out
As far as I know, no token was provided for the REST request. From what I saw, in this project you need to use an .env file to store your bot's token. Then this token is loaded from this file and used in your bot
It's strange that it hasn't been explained anywhere, but maybe it's because it's an old guide
Here is a mention of dotenv which you will most likely want to use (or you can paste the token directly into the code if you don't intend to show it to anyone but you better be careful with that)
hey this might be very dumb question but i want to ask that how much approximate storage a fully functional moderation discord bot takes to code
Storage do you mean disk capacity or RAM usage?
disk capacity
It depends on how many dependencies you use because node modules in most cases take up the most disk capacity
yea lets just take something like dyno or carl for example
My folder probably weighs 200mb even though I don't use half of these libraries
so approx. what will be the total storage capacity needed to make
smth like this
I have no idea, it's impossible to calculate it without running this bot and hosting it
Although I doubt you'll need more than 500-1000mb. I would be more worried about the RAM memory
and needed storage for gaming type of bots would be lower than that of moderation bot?
1gb will work?i doubt that
Command files do not weigh much because they are only a few kilobytes. It also depends on whether you will host the database on your server. It will probably be a bigger problem than the bot files themselves
♥️
Do u have a verified bot
or had one
im asking if you have had one or have one
i don't
u wanna apply for an intent?
i already did
they rejected?
well
i got accepted guild members but denied message content and presence
denied multiple times actually
what reason did u give?
im not understanding what a valid reason is to use both those intents
well for a feature in the bot i have a call command that needs message content
and for presence i
Have vanity roles
it needs to be for something out of scope for application commands
explain
something like a mini game that requires multiple user input for example
i see
so giving the call command as a reason wont work
maybe should i say its for trivia
yeah u can BS
believe me i do
matter of a fact i bsd the most on the members intent
idk how i got accepted that one
and for presence?
what kind of bot is urs?
multipurpose i guess
if it's a moderation bot u can probably say it's for some kind of a filter feature
filter ?
maybe bans someone that plays league idk lmao
At this point i might as well try it
u can also say it's for checking for users' game profiles
some activities have rich presence that includes those info (e.g. username)
just bsd the message content well see what happens
yeah exactly i already got that noted before i started.
I made a checklist of possibly all things i would need for each layer according to the OSI model.
i do have a question tho about a website, not necessarily this side project:
i have a website hosted with a certain domain name. I also have a vps that's not connected to that website or whatsoever, as the website is hosted on a 3rd party hoster.
For my site i have a few api's i want to use. How can i connect that api to my site?
(like can i just do fetch requests to: vps_ip:port?), or do i need to give it the same domain name
yes you can directly connect to an api via ip like that
but it isnt a good idea
you dont want to directly expose the ip of your hosting, instead get a cheap domain and protect/hide the ip with cloudflare
if you dont, and you ever get DDoSed then your hosting provider will send you a nasty bill
if the third party hoster is a friends raspberry pi or something, they will be very upset with you
if you already have a domain, you can use a subdomain
e.g. api.chittykat.mew
Anyone know if you can actually just disable an intent
wdym by disabling?
It depends on what intents you mean. If you mean GuildMembers type intents, you can simply not add them to your client and your bot will not have access to events such as guildMemberAdd in this case
i did, unless i did it wrong? i created an env file, typed in “DISCORD_TOKEN=“ copied token from portal” then saved it
i’ll take a look at this, maybe i did it wrong
It should be called just .env
okay gotcha!
im new to this so sorry if im asking a lot of questions lol
And I'm also not sure if the token should be in quotation marks
i do have a domain indeed
ok i’ll run node . with and without it to see if it’ll take it
it's tsfeerhuysch
how would i redirect that subdomain to my vps ip?
basically an A dns record? That redirect ip:port to domain/api_endpoint?
dns records dont deal with paths and ports, but yes, it will redirect a subdomain to an ip
.env goes in the "root" folder. The same one your package.json is in.
Also, we need to get you a screenshot tool so you don't have to pull out your phone ^-^
ok i’ll move it there & i’ll start screenshotting lol
I don't mind, just saves you time
your patience with me is unreal, i truly appreciate you
We've all been at this point when learning programming.
YES
IT WORKED
i could cry ugly tears rn and idek why cause ik i barely touched the surface of making a bot 💀
This is true, but with time everything will become easier and more logical for you. The beginnings are always the worst because then you know absolutely nothing 
Sadly bot development has gotten a lot harder for brand new devs over the past few years.
It wasn't that long ago that some reasonably successful bots were one file switch cased prefix command bots.
My first bot looked exactly the same in 2020 
Everything packed in one file. Even without config
the most successful ideas are still the simpliest
can it not be done the same way still?
if you can proof of concept your bot in <1000 lines, in on file, it may be a good idea
also.. another dumb question… when looking in the file to put in the commands
is it safe to have chatgpt create a code for a / command?
no
chatgpt cannot code
it just strings stuff together in a line that sounds like it will fit
if the code it gives you runs, dont trust it. it probably has security vulnerabilities, chatgpt is not intelligent
you can use chatgpt to help refactor and improve existing code, but again dont trust it, review it, treat chatgpt like a beginner junior dev, and you the senior developer
Personally, I would recommend getting pretty decent at your programming language before using AI.
yeah
ok that makes sense
you should be confident in reviewing other peoples code, and treat chatgpt's output like that, like some random sent you a pull request
but i can just pull slash command codes from discord.js right?
pull them how
ok got you
discord.js doesnt come with premade commands
ohhhhh ok i got you, i thought i saw on there some premade commands
ok i got lots to learn, but im willing to learn it!
examples maybe? but you have no idea if theyre any good
so like, right now the bot i have online just does /ping and it will respond with “Pong!”
if i wanted to add a /ban command to ban discord members/ID, there’s no where i can copy and paste a code to add it in VSC to configure in my bot?
sure you could find someone elses code and paste it in
but how would you know its correct, and how would you learn from it
ah ok i got you
there comes a point when you constantly paste in prewritten stuff without understanding it, they wont work together and you have to know how to code it to fix it and make them work
so it’s just a coding language i need to truly learn
yes
you can learn by example - i do
but you have to understand the example
so a small amount of base knowledge is all thats needed to get you going
im an old fart, and i never learned by video like a lot seem to now
i learned by messing with examples
ok got you, i still have about an hour left of Macs’ workshop video to watch.. maybe i’ll learn more from there (i’ve learned so much from it and you all)
take someones code that you know works, and mess with it till it breaks, find out HOW and WHY you broke it, and then put it back together
any recommendations on where i should start?
think of it like, dismantling a car and rebuilding the engine
find a bot with 3 or 4 commands
mess with it
try and change what the commands do
dont think of that as a bot you can release, more a learning tool
where can i find a bot and look at the coding if it?
github
dont be tempted to do a music bot though
theyre a LOT more work than you think they are
and most of the ones on github are against discord TOS
Have you finished getting that ping command working yet?
I think we might be jumping ahead a little bit if you havent gone through getting a simple call/response command running yet 👀
I must say that learning the basic syntax of a language, then understanding basic concepts like functions and types, and then understanding error messages will get you a LONG way
yes! got it working
oh cool ^-^
as soon as you learn the basics LEARN TO DEBUG
a lot of time people dont try to debug until they hit an error they cant find by looking at the code
but learn it early
youll feel less like throwing your PC case out the window
the bot went back offline though
learn about how to use a debugger, step through debugging, tracing, and stack dumps
I feel like I still dont know how to debug as efficiently as possible.
But I think thats mostly react errors being SO bad.
what is debugging like in js land anyway, does node have a proper step through debugger with breakpoints, watches etc?
in my world we use GDB
No clue lmao, I've been using js for years, I still console.log 👀
how do i keep the bot online?
JS errors are typically good enough.
i used ping twice, and it resounded both times, then it went offline
If you close your terminal, the bot will turn off
bots need to be run constantly to stay online.
Which is why a server is recommended
ohhh so like if i close my laptop it’ll turn the bot off
yeah
how do i run the bot in a server
off grid bots? sounds like a good project
This is kinda the biggest question.
Pretty much every dev will give you some other way to do it.
i used to joke that you can do that by putting a raspberry pi in a street lamp, next to your neigbours house, connected to their wifi
i stopped making this joke in case some moron actually tried it and electrocuted themselves

aw damn so i’m gonna have to do all of this over again on my pc
It doesnt really matter what host you use, I'd recommend
https://novonode.com/vps or https://galaxygate.net/
because my pc is always on lol
but if you want to host your bot for free a rasberry pi is a great start. you can host one for as much as it costs to run your internet router, it takes near no space and makes no sound.
keeping your pc on can cost about as much as a vps each month, it isnt cost effective for hosting
Yeah, a pi is a great local first setup.
raspberry pis are hard to get now though
You can learn a TON just by having to set it up, so that when you move to a rented VPS its so much easier.
its like the gpu shortage all over again
are they still? 👀
I feel like every time I want to get one they are impossible to get
i got one right in front of me, a pi 5, not built yet becasue i want to get an nvme hat next month
and i got a pi 4 behind my server
the 4 is easy to get... 5 is difficult to get hold of
mine was preorder
so right now, i set the bot as a private bot
if i change it to public, will it do it automatically?
$80 for the 8gb?
ok got you
if your bot grows make a second token and second app, have a dev copy and a live copy
then you dont need to shut down the live copy every time you make dev changes
i forgot how to get the link lol
Just dont buy 2
Bruh what
is this at pi hut
microcenter
ok so i'll buy one, then go back and put a 2nd one in a new basket

WHY IS IT 10K EACH
to stop people buying bulk
Its probably a 1 per customer thing yeah
bruh
I cant find any, even not in stock for under $80
at least the 8gb model
$60 for the 4gb
I'm going to have to buy a 5 at some point though
this lot was £80 preorder including postage
i ordered in november, took till jan to arrive
from pi hut
ok got it lol
so like, If I wanted to look at the code of a bot.. what do I search for on git hub?
just "moderation discord bot code" ?
ok
what's the mean
if you fork an existing one and slap your name on it, reviewers will reject it
oh I was just wanting a custom bot for my server
but I do want to learn enough eventually to make a unique bot, I just don't know enough about the coding yet 😭
should be fine then just be sure to understand what youre putting in your bot
or you could put a backdoor or nuker in your bot
If I can't vote for bots, where can I report this problem? because there have been problems with it for about a month now and no one wants to fix it
Thank you
ok so like
this is just an example for the sake of questions
i search "javascript discord bot" and found this
how exactly would I add the packets to the bot? Add this to the folder on my desktop path and install it with apm i? or would I add the code to the building blocks part in the config file?
idk if my question makes sense
In most cases, it is enough to copy the code of the command itself to your file. Then you can optionally download all the libraries you need with npm (and copy other files needed for this command to work)
I doubt the ban command needs anything extra, it's a fairly simple command
But it probably depends on how someone programmed it
ok what about this
But there is no ban command
gdb gives me a headache sometimes
yooo not sure if this was answered or what the context is. But what you using the pi for?
oh 🙂 github actions
they compile arm64 and arm7 (32 bit) deb packages for dpp and test them with unit tests
pls let me know if I get annoying with all the questions lol
cant do self hosted arm runners on my intel machines
so if I wanted to add this 8ball command to my bot.. what would be the best way to add it?
Just open this file on your browser
this came up
Now you can just copy paste it into your command file
lmao i figured out why it rebooted
When i click "commands" it dropped down some files
so I would create a new file and paste the code in there? or add it under the ping code in the "ping.js" file?
if you have a keyboard plugged into linux server dont knock it onto the floor "buttered side down"
its likely to register as ctrl+alt+delete and reboot the system, smh
i was sure i disabled that keypress anyway...
You can create a new file and paste this code there or replace the code in your existing command because it is useless anyway because it does nothing beside the reply with "Pong!"
lol idk why this made me laugh
so create a new file with .js extension and paste the code in there and save it? if i wanted to keep both?
Yep
Just remember to create commands inside the "commands" folder
If they are located outside this folder, your bot will simply not load them
Good luck 
thank you so much for your help
do I have to do anything in the terminal?
like do I need to run npm i again?
or node . ?
No, just turn on your bot normally with node .
oop was i supposed to turn it off before adding that js file for 8ball 🌚
It's not required to turn off your bot when modifying files :p But a restart will reload all the files and it should see your new one
how do i restart it?
nude . ?
sorry that was a terrible joke
pls dont ban me for that lame joke
💀
This will turn it on, literally
Just close your existing terminal, open new one and type node .
ok ill try it
LMAO
Closing the terminal will turn off your bot
I'm guessing this x will turn off the terminal
oop i messed something up lmaooo
ok maybe that code doesn't work
Did you see anything in the console?
Oh, wait. Since the code you downloaded from github is 2 years old, this code probably doesn't have a slash command builder
Which was used in this new command
ok that makes sense
well
it has slashcommandbuilder in there
I'm not sure if @discord.js/builders doesn't need to be installed via npm i separately. I have never used this builder and I always did the commands the way you did the ping.js command
Can you send me a link to this new command?
yes, here? or dm?
Here
rewrite of my python discord bot in javascript utilizing slash commands - alexx2021/alexxbot-js
that ping.js command was in a files that mac provided in his workshop
so it may be completely different
Damn, there is no packages.json file in the repository to check whether it is installed separately or not 
ah, so I should just move on from this one and keep looking for different commands with slashcommandbuilder?
i wish chatgpt could code well lol
No, no, this command is good, but it uses slashcommandbuilder which is not included in the main bot folder you downloaded from github (which is 2 years old) because the commands are registered using "raw json". You can try downloading this with npm install @discordjs/builders and see if that fixes your problem. If not, we will try to convert the command from slashcommandbuilder to raw json
ohhh ok
so I need to download the 8ball js code, add it to the main bot folder, add it under commands and install it with npm install @discordjs/builders
then node . again ?
No, no, we'll leave 8ball command alone for now. You just need to type this in terminal while being in the main bot folder
And now try to run your bot as before with node .
What about 8ball command?
Could you send the full error?
Ok, so i made it work but it's gonna be tricky. The question is whether you want to use slashcommandbuilder or raw json in your commands (or both as I managed to do)
in your opinion, what would be easier to work with for a beginner?
i’m a quick learner
I honestly have no idea, slashcommandbuilder is often recommended for new developers but I've never used it personally
which is more common?
You will definitely find more guides for slashcommand builder
Raw json is literally everything that is in the API documentation
for beginner def do slashcommandbuilder
ok then i’ll probably use slashcommandbuilder
i’m willing to learn both tbh but i can start with slashcommandbuilder if that’s better for beginners
i dont use slashcommandbuilder
bro got good taste
Okay, so I'll try to explain it to you as best as possible. The first thing we will do is edit the ping.js command to create it using slashcommandbuilder
thank you again for taking the time to walk me through all of this
i know it’s a lot and you have other things to do so it means a lot to me that you are taking time to do this
To do this, we need to edit it (first image) in the same way as it looks in the second photo. We import slashcommandbuilder and replace the raw json that was with slashcommandbuilder
okay gotcha, where do I get slashcommandbuilder in order to import it?
or is that a npm install type of thing
No, you just need to add const { SlashCommandBuilder } = require('@discordjs/builders'); in your code
ok gotcha
Just like I did in the second photo (preferably at the very top)
and you did that manually?
Yep, I just copy paste it from 8ball command
so the first pic is what's coded for the ping command right now, now I add const { SlashCommandBuilder } = require('@discordjs/builders'); to line 1?
OH
WAIT
I think I see what you're saying
ok hold on
nope nvm i suck
Okay, to simplify things, I can just send you the code here and you can paste it
It's nothing complicated but it can be annoying to write
We will soon have a more complicated issue, i.e. editing the index.js file 
I'll get it together i promise!
You need to add (), after .toJSON
ok done
Do you have any errors in code?
It's usually easy to spot because the text is underlined in red
You still need to add , after .toJSON()
It's gonna separate data from execute
OH ok gotcha
what about that , at the end
that's underlined too
do i need that there
this just taught me a lot
This shouldn't be a problem. If after adding , after .toJSON() nothing is underlined in red, it is good
If it is still underlined, remove it
"unexpected end of input"
Yea, remove it
oh wait
i noticed here you have another } down at the bottom
could that be why
Well yes, one is from execute and another one is from module.exports
can we try this so I can compare
Sure
const { SlashCommandBuilder } = require('@discordjs/builders');
module.exports = {
data: new SlashCommandBuilder()
.setName('ping')
.setDescription('Replies with ping')
.toJSON(),
async execute(interaction) {
interaction.reply("Pong!")
}
}
No, take it easy. We shouldn't run the bot yet because we still need to edit index.js file
The first step was to adapt the ping.js command to use slashcommandbuilder
The second step is to adapt index.js to load commands that were made using slashcommandbuilder
Ok, so you need to find const commands = client.commands.map(({ execute, ...data }) => data); and delete this line of code
I remember Mac kinda breaking this down and how it's like building blocks
It's not gonna be useful for us
Yep, exactly
ok it's deleted
Okay, now we need to create a new array (something that will store our command information). You can do this with const commands = []; (for me I added it on line 18)
and for me, that's what I'm going to put on line 24 correct?
No no, we need to put that higher
ok gotcha
I added it in this exact place
The next thing we need to do is change how the command name is saved in the bot's memory. Previously, the command name was available immediately, but now it is inside the data object. We need to change client.commands.set(command.name, command); to client.commands.set(command.data.name, command);
line 23
Yes
so replace line 23 with client.commands.set(command.data.name, command);
Exactly
The final step is to add commands.push(command.data); right below what we just did. This will put information about the commands inside our previously defined, empty array which we will then send to Discord to register them
ok
so nothing to change or replace here, just add it to line 24
which will then push } down to line 25
Yep
ok done and saved
This must be inside so that information about each command is put into this array
I'm understanding the marks a lot more
Now you can try to run your bot
No problem, I'm glad it was sorted out and you can finally move on with your adventure 
I can't believe it
thank you a million times
omg
ok so at this point, all of the commands I add needs to have the slashcommandbuilder on it
Not necessarily, if you find a cool command but it is in raw json, you can also use it. In both cases, your command should be registered, but for a beginner, slashcommandbuilder will definitely be easier
ok got you
so if I find a command that is in raw json, I just import the code like normal? or would I have to modify it?
The main factor in whether a command will be registered is whether it has data inside module.exports
Yes, I assume it could be done better and register commands if they have a data or not, but the important thing is that we managed to fix it
That's awesome. If you have a problem with something, you can come here and someone will definitely help you 
can I ask for a code? lol
or like, is there another website I can find codes on?
I know github has some
we generally advise against providing code directly ("spoon feeding") as it will not help you learn
People don't usually send ready-made code here. We help more with solving a problem with the code you already have or explaining various other things related to development. We can guide you on how to do something, but we won't write it for you
ah ok
I was wanting to see if I can get a /ban command for the bot
so I'll need to figure out how to write it
You should be able to find such a command on github. Most bots have it because it is very basic
and i'd just type like "javascript /ban discord bot code" ? or something like that?
I’d recommend thinking about your problem as a series of sub-problems
meaning?
How do you want to take input for the ban command? Should it take IDs, member objects, names, etc?
How should the user be banned? Look up how to create a ban in a guild in the discord api
Should you delete their messages? If so, how?
Etc
Thinking about problems in smaller steps is important because it allows you to define what your intended behavior is
It can still be written quite easily, it just depends on how complex you want it to be
very basic, i’m just creating it to learn right now
end goal is to have a multi use bot for moderation and engagement
your bot's code might be getting too big when...
thats not tooooooooo bad
why did you name ur user brain and ur hostname neuron and not reverse
all my machines are brain-y names
my server is neuron, my desktop is brainwave, my laptop is cortex, my router is synapse, my NAS is frontal-lobe

when your laptop cant reach the NAS do you call that a lobotomy?
lol yes
nice one, i'll do that from now on
or perhaps i'll call my managed switch lobotomy
wait did I just steal Astrids joke? I promise it was accidental
no astrid was there first
also
am i the only one who thinks skyrim when someone says astrid
ooooohhh
dark brotherhood ftw
never completed skyrim tbh
i didnt do any of dark brotherhood quest line until after i did the main quest
basically for whole main quest, my character was a goody two shoes
and after that power must have gone to his head because he joined the thieves guild and dark brotherhood, assassinated the emperor, made daedric pacts...
kinda makes sense in headcanon
lol
not sure what the issue is as InteractionType.ModalSubmit is just type 5
noob question but how else would it be done considering it appears to be vanilla js
this is cf worker stuff
i havent had this error for practically any other interaction
its only erroring with modalsubmit
any idea how to fix ??
You know you like cf workers
i have a question
i have the bot set as a public bot
so it’ll join a server
but i dont see the commands for it
did you push the slash commands
Did you register the commands globally?
If you registered them recently it might take an hour or so before they propagate to cache
how do i register them
Hard thing to say without knowing what library / language you use
how can i transition height in css
like i just have a div
height isnt explicitely set
but how can i like
animate its position to smoothly go back to the center
(its in a flexbox, centered)
javascript
coding with .js in visual studio code
are you using discord.js
yes
follow this to register your commands: https://discordjs.guide/creating-your-bot/command-deployment.html#command-registration
(assuming youre using v14, if youre using v13 switch to v13 guide and search slash command registration)
can i be honest
yes
no, honesty is discouraged here
i really just started all of this yesterday, so it’s hard for me to follow this guide a little bit
LMAO
learn C++, it's easier
watch a youtube video
theres plenty of them with discordjs
although if you dont know basic javascript, id start there first
yeah i’ve been trying to learn last few days
so for now, i’ll have to update the guildID in config.json to get the commands to work in a specific server?
i’m guessing … until i globally register the commands
are your commands working in one server
if so then yeah
im not sure what that guildid is used for, but if its used for registering guild cmds, then yeah that should work
it worked
anyone know the fix to this 
That doesn't work like that
learn Rust 🚀
learn asm 🚀
it is quite easy

Check out my game code for roblox
https://github.com/Mistyerious/forsaken
I yoinked most of the state management code from another repo and tailored it for myself

ads smh
give me feedback then

idk lua but code looks decent
Thanks
any plans on learning more about C++/Rust?
maybe at some point
I kind of am just focusing on this game in roblox rn
Once I have it in a place I feel comfortable leaving it in then I will proceed to learn C++ so I can try and make the same game in unreal 
lua is just easier to use right now, so it will help me practice some game dev skills and think like a game developer rather than a bot developer

based
make custom engine
easier than unreal tbh 😭
uh no thanks
I'd rather use an already made 3D engine
If even you wont touch 3D then how would someone whos leagues dumber do so

I won't touch 3d not because it's hard to do, but because I'm too lazy to do it
There's tons of resources out there
Just requires the grindset
im not smart enough
Don't have that mindset
You'll only be not smart enough if you believe you're not smart enough
so do i. if u put effort in, u can still do it. like waffle said, u need the proper mindset and motivation for it
make opengl from scratch and then make your own engine from it

thats fair, but at the same time I simply don't think I will ever be able to do it
because u never tried?
I have been plagued by the disease that is bot development and am constantly just looking for the easy way to do things which is copying shit instead of figuring it out myself
Not to mention in servers I ask people for help in they seem to have this bad mood about helping me
despite me stating I am new
there's nothing wrong with that if u learn what the code does during the process
thats the thing, I hardly ever do becasuse of what I just said
I’ll be real with you I started programming when I was 15 and had no idea what I was doing
I'd ask people to help me understand or google it and when that doesn't work i'd ask again
People just have a bad mood when helping others it seems
I still have a long ways to go but I learned because I had the motivation to learn
i started when i was like 14 coding php
I started when I was 12 💀
Thinking you’re not smart enough for something is guaranteed to stop you from achieving it
Now look at me, still haven't accomplished a damn thing
I can tell you that you know more than a hell of a lot of university students
I don't think I can be self taught anymore. Its hard to just go about it my own way
I am more used to being given a schedule
You can self teach, you just need proper motivation
Sometimes we get into places where we’re not motivated
damn, i'm the exact opposite
i like doing things my way (slowly but surely)
if i have someone else to teach me it'd be too overwhelming
I just got that motivation back and in the last week I’ve learned a ton
motivation is hard to come by when i've been doing it for so long and have felt no accomplishment in my time of doing it.
Out of the 7 years i've been programming 4 of which was bot development and I made nothing exciting, the 2 of which was web dev/applications/libraries and then I took a year off
I am honestly not sure I want to continue down the programming path, but it feels like a shame to just give up so much time for naught
I've been self teaching and even when I had the motivation I still wasn't actually learning anything. I learned what was on the surface of a programming language but I've never learned the depths of it. Like with typescript, I only used it for type safety but there was so much more to it I never bothered to learn, and even with js I never learned the stuff you can do with it. Self teaching just doesn't seem to be the right path for me. Yet I also don't want to pay out the ass to learn something that others can learn easily on the internet.
Maybe you'd enjoy low level languages more if you want to learn about the "depths" of programming
I don't care all that much for typescript outside of the type safety; most people don't
You don't need to be a type theory wizard to be good at programming
I mean I'd love to learn a low level language, I just feel my method which I use for just about everything is the wrong method
There's no right method
There's no wrong method
Berry got a job being self taught, proves you don't need school or a degree to be good at it
I mean while yes, but also no
Some methods of learning just isn't right for them
For me I tend to just dive into the language without any knowledge and just play around with it, but that also makes me lack fundamental knowledge about it.
That's perfectly fine
You learn as you go
I learned Go by literally starting a project with it, then learning things as I went
that's how you'd learn most things in the actual industry anyways
i've tried to follow https://learncpp.com but I just lose focus reading all that information
That's why you can't hop into a senior role right after you graduate, because school doesn't teach you everything
it makes me feel bored cause im not doing anything
Then don't do it that way
Start with a project idea
As you need to learn things, look up how to do them
Ask here
Anything
All of these resources people recommend are just recommendations
It's not a blanket thing for everyone
There's no one set way to learn
if you remember I made my own vector implementation in C++
I do recall yes
I wonder if I should try and reimplement a lot of other C++ classes myself
I'd like to hear it
a bitset (std::bitset), a binary search tree (essentially std::set), a linked list (essentially std::list), a stack (std::stack), a queue (std::queue)
Start out with a non-templated version of them, then try to convert to templates
You'll find the templated version of a BST may be challenging
What exactly do you mean by templated
Accepts generic types
Like how std::vector accepts std::vector<int>, std::vector<string>, etc
Data structures are a great way to learn
Gotcha
But also if you have ideas for other projects that maintain your interest, go for it
Out of this list I'd probably start with like a stack or a bitset
Since those are the easiest to implement
uh oh
BST is fairly easy to write if you research it a bit, but gets a little more complex when you try to template it
vs is erroring when I try and run my vector code 
(Deallocating is also slightly difficult for anything recursive)
((Although you can write non-recursive BST methods, it's just more difficult to understand))
kids are now starting coding since they were like 5
who knows maybe soon we'll have someone making an entire operating system while they're 13
gen alpha is scary
comparison is the thief of joy
they live up to their name
Many kids have unlimited access to resources that simply weren't as abundant when we were kids
Youtube tutorials have grown infinitely, tech is now being taken seriously in schools
Ima be real I have no idea what this code means anymore https://github.com/Mistyerious/Vector/blob/master/Vector.h

no
nah I actually fucked it up
I did most of it with the help of waffle and voltrex and null
I didn't even know waffle forked it
did he?
no i did

on my phone
cuz at the time i was in my school
can u explain that in league terms
i uh was on voltrex mode for a day or two
wtf is league

oh right that shitty game
Also I realized I am using templates for the Vector class but not entirely
Vector() : capacity(1), length(0), array(new int[1]){};
explicit Vector(size_t size)
: capacity(size), length(1), array(new int[size]){};
I am still using ints here
though I supposedly support the usage of anything
yup
just replace int with T
so new bool[1] is a valid thing?
cuz they have constructors and destructors
oh wait you use new so that should work fine
can a vector support a mixture of types in normal c++?

thats not a thing apparently
it is
a template argument list is not allowed in a declaration of a primary template
show full error stack
>------ Build started: Project: CMakeLists, Configuration: Debug ------
[1/2] Building CXX object CMakeFiles\Vector.dir\main.cpp.obj
FAILED: CMakeFiles/Vector.dir/main.cpp.obj
C:\PROGRA~1\MICROS~2\2022\COMMUN~1\VC\Tools\MSVC\1437~1.328\bin\Hostx64\x64\cl.exe /nologo /TP /DWIN32 /D_WINDOWS /EHsc /Ob0 /Od /RTC1 -std:c++20 -MDd -Zi /showIncludes /FoCMakeFiles\Vector.dir\main.cpp.obj /FdCMakeFiles\Vector.dir\ /FS -c C:\Dev\cpp-classes\main.cpp
C:\Dev\cpp-classes\Vector.h(11): error C3856: 'Vector': symbol is not a class template
C:\Dev\cpp-classes\Vector.h(11): error C2146: syntax error: missing ';' before identifier 'T'
C:\Dev\cpp-classes\Vector.h(11): error C2059: syntax error: '>'
C:\Dev\cpp-classes\Vector.h(11): error C2143: syntax error: missing ';' before '{'
C:\Dev\cpp-classes\Vector.h(11): error C2447: '{': missing function header (old-style formal list?)
C:\Dev\cpp-classes\main.cpp(6): error C2079: 'vec' uses undefined class 'Vector<int>'
C:\Dev\cpp-classes\main.cpp(16): error C2109: subscript requires array or pointer type
ninja: build stopped: subcommand failed.
this is what the builder gives me
this is what visual studio shows inline
I dont need to do Vector<T>
this is wrong
stackoverflow says so
It's ```cpp
template <typename T>
class Vector {
// Can use T here
}
you're mixing c++ and java
impl<T> Vector<T> {}
Java does ```java
public class ArrayList<T> {
}
oh no
public static<T> void DoSomething(ArrayList<? extends T> list, T something) {}
valid Java
cursed but valid
Well
my vector class is templated
:D
It works with any types
wait are bools in C++ not represented as true and false when logging them?
they log as 0s or 1s
which makes sense but thats something I didn't know
it seems true or false are binded to 0 or 1
fair
I just know that most other languages log them as true or false instead of their number counterparts
I thought that was the case with C++ but I don't do much printing of booleans
Ah I see
Yeah
it's derived from c and c doesn't have bool data type
On another note my Vector class supports any and all types it seems
theoretically using a template this should support custom types as well no?
me when #include <stdbool.h>
yes
or is there something special I have to do to not just support primatives only
wtf is static<T> for
is it like impl<T> in rust
it tells the compiler that this is a function that has a generic type T
well I fucked up somewhere

tried nesting a vector inside a vector and looping over that vector to print out the values
that didn't work out too well though
'Vector.exe' (Win32): Loaded 'C:\Dev\cpp-classes\out\build\x64-Debug\Vector.exe'. Symbols loaded.
'Vector.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'.
'Vector.exe' (Win32): Loaded 'C:\Windows\System32\kernel32.dll'.
'Vector.exe' (Win32): Loaded 'C:\Windows\System32\KernelBase.dll'.
'Vector.exe' (Win32): Loaded 'C:\Windows\System32\msvcp140d.dll'.
'Vector.exe' (Win32): Loaded 'C:\Windows\System32\vcruntime140d.dll'.
'Vector.exe' (Win32): Loaded 'C:\Windows\System32\vcruntime140_1d.dll'.
'Vector.exe' (Win32): Loaded 'C:\Windows\System32\ucrtbased.dll'.
The thread 0x6374 has exited with code 0 (0x0).
HEAP[Vector.exe]: Invalid address specified to RtlValidateHeap( 000001B7C4840000, 000001B7C48465D0 )
A breakpoint instruction (__debugbreak() statement or a similar call) was executed in Vector.exe.
send code
#include <iostream>
#include "Vector.h"
int main() {
//Vector<int> vec;
//vec.insert(0, 100);
//vec.insert(1, 1000);
//vec.push_back(10000);
//std::cout << vec.size() << std::endl;
//Vector<std::string> vec;
//vec.insert(0, "Hello, World");
Vector<bool> vec;
Vector<Vector<bool>> bool_vector;
vec.insert(0, 1);
bool_vector.insert(0, vec);
std::cout << vec.size() << std::endl;
for (int i = 0; i < vec.size(); i++) {
std::cout << vec[i] << std::endl;
}
for (int i = 0; i < bool_vector.size(); i++) {
for (int l = 0; l < bool_vector[i].size(); l++) {
std::cout << bool_vector[i][l] << std::endl;
}
}
return 0;
}
//
// Created by dyeaaaronjr on 11/13/2023.
//
#ifndef VECTOR_VECTOR_H
#define VECTOR_VECTOR_H
#include <stdexcept>
template <typename T>
class Vector {
T *array;
size_t capacity;
size_t length;
void resize_to_fit(size_t index) {
int newCapacity = capacity;
while (newCapacity <= index) {
newCapacity *= 2;
}
T* temp = new T[newCapacity];
memcpy(temp, array, sizeof(T) * capacity);
capacity = newCapacity;
delete[] array;
array = temp;
}
public:
Vector() : capacity(1), length(0), array(new T[1]){};
explicit Vector(size_t size)
: capacity(size), length(1), array(new T[size]){};
size_t size() const { return length; }
inline void push_back(T element) { insert(length, element); }
void insert(size_t index, T element) {
if (index >= capacity) {
resize_to_fit(index);
}
if (index >= length) {
length = index + 1;
} else {
length++;
}
array[index] = element;
}
T &operator[](size_t index) const {
if (index >= length) {
throw std::range_error("index out of range");
}
return array[index];
}
~Vector() { delete[] array; }
};
#endif // VECTOR_VECTOR_H
This is generally not how I would recommend implementing an insert method
Vectors should not have potential for empty element slots
The reason your code is crashing isn't due to that though
It's due to the fact that your array is never resized
Is it due to me nesting a vector inside it?
You're not checking if the length of your array is greater than or equal to the capacity, only the index
Yeah but that was a long time ago and I wasn't thinking straight
I didn't even know that was a potential issue tho
void insert(size_t index, T element) {
if (index >= capacity || length >= capacity) {
resize_to_fit(index);
}
// ...
}
That's probably your error
But keep in mind you should fix this as well
remove insert(), just use push_back() instead
Hm nope, it still causes an error
Why?
It's nice to be able to insert at a specific index
When inserting something into an array, if the index is out of bounds you should not change the size of the array to accommodate it, UNLESS it is only 1 over the length of the array
causes a lot of unnecessary headaches
Inserting at a specific index is going to require you to shift elements around
You should start with a simple push back method
^
I already have push_back no?
i mean
Yeah but it's based on insert
Which honestly I'd just implement push back alone

bro I haven't touched this code in ages
I didn't even know it was based off insert

Yeah, start with push_back and pop_back
also change push_back to not be inline anymore
Okay so the premise of the push_back is to take the element and push it to the back of the vector
yes
Yes
just like .push()
I already was going to tho idk what inline really means





