This is just a quick announcement for anybody new to watching this tutorial. Currently, I am waiting for D# Version 5.0 to release which requires me to make a brand new tutorial for 2025. This means that this current tutorial will become outdated when this version comes out in a Stable release. If you want to know more about why this is happening, please join my server in the description of this video for further queries
18:55 - "Why are we doing this? This seems very weird, why don't I just set it to include on every build?" [TEN SECONDS LATER] OOOOOH! And showing what EXACTLY you mean at 19:19 is so huge, thank you.
I was waiting for this kind of tutorial for making a discord bot with C#. The other tutorials are already outdated and doesnt work. Thank you so much for this, ill watch all the series
For your config file a better way to handle getting it into your output directory would be to go to the files properties and set the build action to none and copy to output directory to always or if newer. I would recommend if newer most of the time
Really loved this vid, only the juggling with the config file seemed really confusing and odd, then again i don't plan to put it on git anyways :) Thank you a bunch, hoping the rest of the series will be just as good and doesn't stop at a weird incomplete point like most tutorials about this.
the whole reason to use a JSON file to store the token and prefix is to prevent hardcoding the token into the code, which is a sensitive piece of information. If another user got access to your bot's token without your knowledge or permission, then they have direct access to the bot. So by using an external file like JSON, we can input the token and prefix into the bot safely
@@samjesus8 I understand that, it was the moving of the file and such which was confusing to me personally. Not using github and only running it from home does also help in not giving away the key.
This works, thankyou man! I'm creating a server & making a Discord bot of my own was the way to go. I just got the bot to come online & am about to watch part 2!!
I wanted to add a new field to the config.json file and change the prefi but when I do the program still uses the old values and gives null for the new ones. How do I properly update the config file?
@@krowalski7906 Yes, apparently I had 2 different discord bots, and im only allowed one or something. so I used the same bot and it worked. Thanks for replying though.
So im getting into coding and when I tried starting it, it wouldnt run so i looked and on this code var discordConfig = new DiscordConfiguration() { Intents = DiscordIntents.All, Token = jsonReader.Token, TokenType = TokenType.Bot, AutoReconnect = true }; it kept giving me this message and idk what to do System.ArgumentNullException: 'Token cannot be null, empty, or all whitespace. Parameter name: value' and im just lost as to how I can fix it because i have the token in the file, i coped and pasted it into the bin, and I mean i rewatched the video 3 times and redid it all to make sure but it still pops up so I really dont know what to do about this any help?
I get this error: "Authentication failed. Check your token and try again." I just resetted my bot token and copied it. But it didn't work. So i'm confused should i copy the ( config.json ) to the exe file and edit it there (talking about >>> /bin/debug), or edit the one that in file config/config.json
You need to build your solution first, go to the Build tab at the top, then press Build Solution and then your bin/Debug folder should have an output where u can then put in the config.json file. If you are having further issues, please join our discord server
You know what I don't get? Why is visual studio so much better than vscode for C#? They are both made by microsoft; let me just use all the visual studio stuff on vscode Q_Q
First in %project_name% /config/config.json (contains the word "token"). Second in %project_name% / bin/Debug/config.json (contains 28 characters the real token).
Still in the config.json file yes. But only the one in your bin/Debug folder since that is where the streamreader will go If you plan to upload your code to a github repository you don't want your token in the project. The gitignore will ignore the bin folders and will only push the main project. So this means if you have your token exposed in the config.json of your solution, discord will detect your token going public and auto reset it So if you only change the JSON file in the bin folder, it'll still function while still being able to push code to the repository I admit there are better ways to store the token but json is quick, easy and secure
what do you mean by "plain console app", this makes no sense as C# is the programming language for .NET Framework and .NET Core which is a more up-to-date version. I use .NET Framework in the tutorial as just a basic example but using .NET Core is a good idea for the latest features
@@samjesus8 i meant console app with .net core. you know, the one without parentheses after the name? instead of console app (.net framework). i was just wondering if there was a reason it had be to .net framework because i dont want to run this on windows.
This is just a quick announcement for anybody new to watching this tutorial. Currently, I am waiting for D# Version 5.0 to release which requires me to make a brand new tutorial for 2025. This means that this current tutorial will become outdated when this version comes out in a Stable release. If you want to know more about why this is happening, please join my server in the description of this video for further queries
18:55 - "Why are we doing this? This seems very weird, why don't I just set it to include on every build?"
[TEN SECONDS LATER] OOOOOH!
And showing what EXACTLY you mean at 19:19 is so huge, thank you.
I was waiting for this kind of tutorial for making a discord bot with C#. The other tutorials are already outdated and doesnt work. Thank you so much for this, ill watch all the series
I love that he tries to explain what he's gonna do bur VS always guesses what he gonna say.
For your config file a better way to handle getting it into your output directory would be to go to the files properties and set the build action to none and copy to output directory to always or if newer. I would recommend if newer most of the time
Really loved this vid, only the juggling with the config file seemed really confusing and odd, then again i don't plan to put it on git anyways :) Thank you a bunch, hoping the rest of the series will be just as good and doesn't stop at a weird incomplete point like most tutorials about this.
the whole reason to use a JSON file to store the token and prefix is to prevent hardcoding the token into the code, which is a sensitive piece of information. If another user got access to your bot's token without your knowledge or permission, then they have direct access to the bot. So by using an external file like JSON, we can input the token and prefix into the bot safely
@@samjesus8 I understand that, it was the moving of the file and such which was confusing to me personally.
Not using github and only running it from home does also help in not giving away the key.
This works, thankyou man! I'm creating a server & making a Discord bot of my own was the way to go. I just got the bot to come online & am about to watch part 2!!
9:34 discordclient does not appear
Best person who i've seen to teach this :>
Great video. NO joke! Nice Job SamJesus
Love to see a new and updated version
Imagine this combo of C#, C++ and Lua :0
Thank you soo much! Loved the videos man!
if im making multiple discord bots in one server can I just copy all this code and folders? do i have to name things differently?
Thank you, based vegeta.
Best teacher
much appreciated
I wanted to add a new field to the config.json file and change the prefi but when I do the program still uses the old values and gives null for the new ones. How do I properly update the config file?
you need to change the config.json file in your /bin/debug folder as that folder is where your program is reading this file from
Great tutorial! Thank you
Awesome video, tutor, very underrated sadly
Thanks for the help!! You really explained everything very well
I get this error: "Authentication failed. Check your token and try again." I just resetted my bot token and copied it. But it didn't work.
Do you have the config file with the exe file
@@krowalski7906 Yes, apparently I had 2 different discord bots, and im only allowed one or something. so I used the same bot and it worked.
Thanks for replying though.
So im getting into coding and when I tried starting it, it wouldnt run so i looked and on this code
var discordConfig = new DiscordConfiguration()
{
Intents = DiscordIntents.All,
Token = jsonReader.Token,
TokenType = TokenType.Bot,
AutoReconnect = true
};
it kept giving me this message and idk what to do
System.ArgumentNullException: 'Token cannot be null, empty, or all whitespace.
Parameter name: value'
and im just lost as to how I can fix it because i have the token in the file, i coped and pasted it into the bin, and I mean i rewatched the video 3 times and redid it all to make sure but it still pops up so I really dont know what to do about this any help?
nvm im just dumb I didnt notice i had the json.Reader.Token in caps in the second line oops nvm we good
@@NexonMotion glad you got it fixed, i recommend joining our server if you need any further help👍
Thanks man! I belive discord bot is one of the best pet projects for me!
I get this error: "Authentication failed. Check your token and try again." I just resetted my bot token and copied it. But it didn't work.
So i'm confused should i copy the ( config.json ) to the exe file and edit it there (talking about >>> /bin/debug), or edit the one that in file config/config.json
You need to edit the config.json that is in the bin/Debug folder, not the one in the project
What is this +- thing to insert a method??
Edit: I just saw it's += my bad
thank you so much for this series mr samjesus
Moving that config folder like that seems very odd behaviour to me.
thanks bro , it was nice and clear
I have problems with the debug folder when I open the folder is the folder empty
You need to build your solution first, go to the Build tab at the top, then press Build Solution and then your bin/Debug folder should have an output where u can then put in the config.json file. If you are having further issues, please join our discord server
@@samjesus8
I joined to your discord server where i can write to you?
i loved it i works great❤
thank you for this video(s).
You know what I don't get? Why is visual studio so much better than vscode for C#? They are both made by microsoft; let me just use all the visual studio stuff on vscode Q_Q
Works perfectly. Thanks
i got this message "connection terminated (4014, 'Disallowed intent(s).')
sameee idk whats wrong
oh i figured it out. i need to enable privileged gateway intents in discord dev portal
Under "bot" in Discord Development settings turn on all intentions.
Where does the token go? Still in the config file or elsewhere?
First in %project_name% /config/config.json (contains the word "token").
Second in %project_name% / bin/Debug/config.json (contains 28 characters the real token).
Still in the config.json file yes. But only the one in your bin/Debug folder since that is where the streamreader will go
If you plan to upload your code to a github repository you don't want your token in the project. The gitignore will ignore the bin folders and will only push the main project. So this means if you have your token exposed in the config.json of your solution, discord will detect your token going public and auto reset it
So if you only change the JSON file in the bin folder, it'll still function while still being able to push code to the repository
I admit there are better ways to store the token but json is quick, easy and secure
why are you using net framework instead of plain console app?
what do you mean by "plain console app", this makes no sense as C# is the programming language for .NET Framework and .NET Core which is a more up-to-date version. I use .NET Framework in the tutorial as just a basic example but using .NET Core is a good idea for the latest features
@@samjesus8 i meant console app with .net core. you know, the one without parentheses after the name? instead of console app (.net framework). i was just wondering if there was a reason it had be to .net framework because i dont want to run this on windows.
@@tatybara you can run .net framework applications on linux as I've shown later on in the tutorial. Sorry for the late reply
The bot wont go online?
getting the same issue but code not showing errors
same here
Nice work
Hi. thank you and thank you for this video
This guy stutters a lot :D
Doesn't matter, still a great tutorial by him. He put himself to test and managed to make a great resource. Chapeau.
Rude
Thank you