MAKING A DISCORD BOT IN C# - CREATING & SETTING UP THE BOT (#1)

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 ธ.ค. 2024

ความคิดเห็น • 72

  • @samjesus8
    @samjesus8  5 วันที่ผ่านมา +1

    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

  • @KingMob4313
    @KingMob4313 10 หลายเดือนก่อน +6

    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.

  • @Sashkobg97
    @Sashkobg97 ปีที่แล้ว +8

    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

  • @ManfredVonKarma-Omni
    @ManfredVonKarma-Omni 7 หลายเดือนก่อน +2

    I love that he tries to explain what he's gonna do bur VS always guesses what he gonna say.

  • @jonathonsissom6655
    @jonathonsissom6655 11 หลายเดือนก่อน +1

    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

  • @TeKKietekno
    @TeKKietekno 11 วันที่ผ่านมา

    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.

    • @samjesus8
      @samjesus8  10 วันที่ผ่านมา

      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

    • @TeKKietekno
      @TeKKietekno 10 วันที่ผ่านมา

      @@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.

  • @ClowReed.
    @ClowReed. ปีที่แล้ว +4

    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!!

  • @sefahamza5451
    @sefahamza5451 7 หลายเดือนก่อน +1

    9:34 discordclient does not appear

  • @slaquemerda
    @slaquemerda 6 หลายเดือนก่อน

    Best person who i've seen to teach this :>

  • @vicjay1139
    @vicjay1139 ปีที่แล้ว +1

    Great video. NO joke! Nice Job SamJesus

  • @FragZ999
    @FragZ999 ปีที่แล้ว +2

    Love to see a new and updated version

  • @TvoyOtchimPupsik
    @TvoyOtchimPupsik 11 หลายเดือนก่อน +1

    Imagine this combo of C#, C++ and Lua :0

  • @Aquilesxd
    @Aquilesxd ปีที่แล้ว +1

    Thank you soo much! Loved the videos man!

  • @echospace7347
    @echospace7347 หลายเดือนก่อน

    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?

  • @a.9913
    @a.9913 2 หลายเดือนก่อน

    Thank you, based vegeta.

  • @LazerDynastio
    @LazerDynastio 6 หลายเดือนก่อน

    Best teacher

    • @samjesus8
      @samjesus8  6 หลายเดือนก่อน

      much appreciated

  • @abigailastora9129
    @abigailastora9129 16 วันที่ผ่านมา

    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?

    • @samjesus8
      @samjesus8  13 วันที่ผ่านมา

      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

  • @guygurman2890
    @guygurman2890 2 หลายเดือนก่อน

    Great tutorial! Thank you

  • @98lp65
    @98lp65 ปีที่แล้ว +1

    Awesome video, tutor, very underrated sadly

  • @nate1211
    @nate1211 ปีที่แล้ว +3

    Thanks for the help!! You really explained everything very well

  • @Rayleigh1423
    @Rayleigh1423 ปีที่แล้ว +2

    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.

    • @krowalski7906
      @krowalski7906 ปีที่แล้ว

      Do you have the config file with the exe file

    • @Rayleigh1423
      @Rayleigh1423 ปีที่แล้ว

      @@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.

  • @NexonMotion
    @NexonMotion ปีที่แล้ว +1

    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?

    • @NexonMotion
      @NexonMotion ปีที่แล้ว

      nvm im just dumb I didnt notice i had the json.Reader.Token in caps in the second line oops nvm we good

    • @samjesus8
      @samjesus8  ปีที่แล้ว

      @@NexonMotion glad you got it fixed, i recommend joining our server if you need any further help👍

  • @RACER1562
    @RACER1562 ปีที่แล้ว +1

    Thanks man! I belive discord bot is one of the best pet projects for me!

  • @loka5789
    @loka5789 11 หลายเดือนก่อน +1

    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

    • @samjesus8
      @samjesus8  11 หลายเดือนก่อน

      You need to edit the config.json that is in the bin/Debug folder, not the one in the project

  • @J_1709
    @J_1709 6 หลายเดือนก่อน

    What is this +- thing to insert a method??
    Edit: I just saw it's += my bad

  • @user-wq3hu2pq4e
    @user-wq3hu2pq4e ปีที่แล้ว +1

    thank you so much for this series mr samjesus

  • @Ata5ll
    @Ata5ll 27 วันที่ผ่านมา

    Moving that config folder like that seems very odd behaviour to me.

  • @nightmere33
    @nightmere33 9 หลายเดือนก่อน

    thanks bro , it was nice and clear

  • @Jibreel294
    @Jibreel294 8 หลายเดือนก่อน

    I have problems with the debug folder when I open the folder is the folder empty

    • @samjesus8
      @samjesus8  8 หลายเดือนก่อน +1

      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

    • @Jibreel294
      @Jibreel294 8 หลายเดือนก่อน

      @@samjesus8
      I joined to your discord server where i can write to you?

  • @bobthina7209
    @bobthina7209 10 หลายเดือนก่อน

    i loved it i works great❤

  • @charonvacheron1797
    @charonvacheron1797 ปีที่แล้ว +1

    thank you for this video(s).

  • @a.9913
    @a.9913 2 หลายเดือนก่อน

    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

  • @ThinkInGold
    @ThinkInGold ปีที่แล้ว +1

    Works perfectly. Thanks

  • @Blank-qk8qo
    @Blank-qk8qo 10 หลายเดือนก่อน

    i got this message "connection terminated (4014, 'Disallowed intent(s).')

    • @aqxat1crei
      @aqxat1crei 9 หลายเดือนก่อน

      sameee idk whats wrong

    • @aqxat1crei
      @aqxat1crei 9 หลายเดือนก่อน

      oh i figured it out. i need to enable privileged gateway intents in discord dev portal

    • @burntdorito8297
      @burntdorito8297 6 หลายเดือนก่อน

      Under "bot" in Discord Development settings turn on all intentions.

  • @disfordungeon
    @disfordungeon ปีที่แล้ว

    Where does the token go? Still in the config file or elsewhere?

    • @SetAngelGreen
      @SetAngelGreen ปีที่แล้ว

      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).

    • @samjesus8
      @samjesus8  ปีที่แล้ว

      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

  • @tatybara
    @tatybara 8 หลายเดือนก่อน

    why are you using net framework instead of plain console app?

    • @samjesus8
      @samjesus8  7 หลายเดือนก่อน

      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

    • @tatybara
      @tatybara 7 หลายเดือนก่อน

      ​@@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.

    • @samjesus8
      @samjesus8  6 หลายเดือนก่อน

      @@tatybara you can run .net framework applications on linux as I've shown later on in the tutorial. Sorry for the late reply

  • @villocity5794
    @villocity5794 ปีที่แล้ว +1

    The bot wont go online?

    • @thfiee
      @thfiee ปีที่แล้ว +1

      getting the same issue but code not showing errors

    • @lucatamborrelli3625
      @lucatamborrelli3625 8 หลายเดือนก่อน

      same here

  • @Nixohc
    @Nixohc ปีที่แล้ว +1

    Nice work

  • @Ja-Sharp
    @Ja-Sharp ปีที่แล้ว +1

    Hi. thank you and thank you for this video

  • @ArdLight
    @ArdLight 8 หลายเดือนก่อน

    This guy stutters a lot :D

    • @MidnaTv
      @MidnaTv 8 หลายเดือนก่อน

      Doesn't matter, still a great tutorial by him. He put himself to test and managed to make a great resource. Chapeau.

    • @tatybara
      @tatybara 8 หลายเดือนก่อน

      Rude

  • @Batman14156
    @Batman14156 4 หลายเดือนก่อน

    Thank you