Hello. In this new series, I teach you how to code your own Discord in Java using Discord JDA! In this episode, we go over how to create your bot, then we add some commands to it, as well as create an embed to pretty up our bot responses!

Updated source code for the Main class when using JDA 3.8+:
https://gist.github.com/nkomarn/4b437fd54b40fed74b37412f17ebac41

» Links
‣ Previous Video: https://youtu.be/ibIFRDvitlg
‣ Source Code: https://github.com/nkomarn/JDA-Tutorial/releases/tag/1.0
‣ Java JDK Download: https://goo.gl/eWuFnY
‣ Eclipse IDE Download: https://goo.gl/mXmcz9
‣ Discord JDA Download: https://github.com/DV8FromTheWorld/JDA
‣ Discord Developer Portal: https://discordapp.com/developers/applications/
‣ Discord Server: https://discord.gg/UACRzwe
‣  My Gear: https://kit.com/nkomarn/video-gear
‣ Current Rig: https://goo.gl/t4aDpf

Disclaimer: Any/all songs used in this video are/may be protected by copyright. I by no means take credit for them; please read the “Music Used” section of the description for more information.

» Music Used
‣  Taurtollo – Stomp
‣  Blue Wednesday – New Shoes
‣  engelwood – woah
‣  ProleteR – Slits
‣  Taurtollo – April Showers
‣  Prycees – Arc
‣  Jack Elphick – Keep On Going (Instrumental)
‣  ProleteR – Memories
‣  Pryces – Sango Flip
‣  Ridm – This Jazz Retains a New Format
‣  Ukiyo – Just for a Thrill

For inquiries, contact: [email protected]

Fix boot windows 10

Previous articleCode Your Own Discord Bot – Basics (2021)
Next articleCome scaricare DISCORD su PC *2019* (Link in descrizione)

80 COMMENTS

  1. this is one of the best explanatory video i could find on youtube. but the problem is, i am watching this in 2021, and thats even more than 2 years this video was made so much has changed till then about those files we import and so it isnt working the same. when i hit ctrl + shift + o, to import files for that presence thing, it doesnt import anything.
    so if u can, please make this kinda video for 2021, that would be so cool

  2. SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”.
    SLF4J: Defaulting to no-operation (NOP) logger implementation
    SLF4J: See for further details.
    SLF4J: Failed to load class “org.slf4j.impl.StaticMDCBinder”.
    SLF4J: Defaulting to no-operation MDCAdapter implementation.
    SLF4J: See for further details.
    [main] INFO JDA – Login Successful!
    [JDA MainWS-WriteThread] INFO WebSocketClient – Connected to WebSocket

    Anyone know why?

  3. SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”.
    SLF4J: Defaulting to no-operation (NOP) logger implementation
    SLF4J: See for further details.
    SLF4J: Failed to load class “org.slf4j.impl.StaticMDCBinder”.
    SLF4J: Defaulting to no-operation MDCAdapter implementation.
    SLF4J: See for further details.
    [main] INFO JDA – Login Successful!
    [JDA MainWS-WriteThread] INFO WebSocketClient – Connected to WebSocket

    thats my cnosole…. it never shows finished loading… any idea why?

  4. I think I’m doing exactly what you did but I still don’t get any responses from the bot, any idea why?

  5. For everyone in 2021 getting ridicoulous amount of errors, just because you typed exactly the same things. I do this tutorial with jda 4.2. You should not set the latest JRE possible while creating project file (in my case it was JavaSE – 15), but the one that is used in the video- JavaSE – 1.8 It helped in my case. However, you have to use the updated version of code that is in the description (yeah, I didn’t see it too), because for user privacy cases, there is no longer possible to use net.dv8tion.jda.core.AccountType; You will get an error in jda 4.2 H.O.W.E.V.E.R you still can’t finish this tutorial with the fixed code in the description. You have to go to the link from which you downloaded jda. There, you have to read the introduction, that will lead you through setting a new bot. For 10:36 error I found a fix JDA jda = JDABuilder.createDefault(“token”).build(); rest is in your hands. When I finish these tutorials I’ll try to upload the code for the newbies like me 🙂

  6. For anyone new that may be watching, to send your token and connect your bot, you now need to use the code below as AccountType is deprecated.
    jda = JDABuilder.createDefault(“tokenid”).build();

  7. To set the Presence Activity you have to do “jda.getPresence().setPresence(Activity.watching(“Title”), true);” instead of setgame

  8. IntelleJ IDEA is better for beginners. I know it’s preference that has a lot to do with it, but its been said the learning curve goes quicker with intelleJ vs Eclipse. However thanks for your video.

  9. I didn’t only learn how to program a discord bot in java but learned how to rename a class. You are truly the best to ever live!

  10. 11:15 when i run the bot, it spits this out in console:
    [JDA RateLimit-Worker 1] ERROR Requester – There was an exception while executing a REST request
    javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

    any help?

  11. Ive got a problem:
    The Bot runs and does answering me on privat Chat if i write there, but not on Servers, does anyone knows whats wrong?
    I used the same code as in the video.

  12. Can you tell me how I can send my private channel messages to the general channel? it’s urgent. If I’m using this event syntax it’s giving me an Illegal state exception and I know the reason why. I’m stuck on how to solve this issue.

  13. I got a problem with dislplaying a bot message. It just does not want to display anything. I wrote the same code as you in the “”Commands” class.

  14. what does this mean?

    Exception in thread “main” java.lang.NoClassDefFoundError: okhttp3/RequestBody
    at net.dv8tion.jda.api.JDABuilder.build(JDABuilder.java:1877)
    at bcode.SpamBot.Main.main(Main.java:14)
    Caused by: java.lang.ClassNotFoundException: okhttp3.RequestBody
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    … 2 more

    I have the same code as you.

  15. I have one trouble. The point is, when I turn on my bot, only the “Main” function works, and the “Commands” function in which I have commands doesn’t respond. I will say right away that I did everything the same as in the episode. Is there any simple explanation / solution for this problem?
    Could this be due to other version of the resources? Please for quick answer.

    P.S. I don’t know it’s important but on console doesn’t write “Finished loading”. I think it’s the source of the problem.

  16. I know this is an old video but in all the following imports “.net” is deprecated:
    import net.dv8tion.jda.api.JDA;
    import net.dv8tion.jda.api.JDABuilder;
    import net.dv8tion.jda.api.OnlineStatus;
    import net.dv8tion.jda.api.entities.Activity;
    any help would be greatly appreciated

  17. Exception in thread “main” java.lang.NoClassDefFoundError: net/dv8tion/jda/api/JDABuilder …
    How do I fix this? It has a problem with “JDABuilder” and whenever I enter this command: jda = new JDABuilder(AccountType.BOT).setToken(Token).build();
    It doesn’t work..

  18. Great tutorial, but I’m running into an issue where Commands.java doesn’t seem to ever be loaded or acknowledged when I run. I put a few printlns in it and they never send. Anyone have any advice? I am using Eclipse.

  19. Guys!
    Change jda = new JDABuilder … blah blah blah with:
    JDA jda = JDABuilder.createDefault(“Your Token”).build();

  20. Some thing might be outdated, but if it works. Mother o mercy… IT WORKS!!!!

    new sub btw you’re welcome

  21. I love how he skips the “throws loginexception” part… but that has literally been the problem the entire time

  22. Not sure if anyone else had this issue but jda.getPresence().setGame(Game.watching”boring comedy shows”)); didn’t work for me. I used this:
    jda.getPresence().setPresence(Activity.watching(“boring comedy shows”), true);

  23. If you’re getting the class is not accessible error, make sure your referenced libraries (aka the imported jda) is under classpath, not modulepath

  24. Why do i need to create an account to download, it says it needs a job, but im a student lmao

  25. I probably wont get a response, but I get this error when i try to run it.
    “Error: Main method not found in class nondious.GRIM.GRIM, please define the main method as:
    public static void main(String[] args)
    or a JavaFX application class must extend javafx.application.Application”

  26. 8:42 what if when I hover over it, import doesn’t come up and ctrl + shift + o doesn’t work?

  27. Omg this video is so well made like the little cardboard that appears when you do something. How you speak fast and have good rythme so that we are not bored. Everything is incredible

  28. Very interesting, although the tutorial is outdated.
    I think I’ll be able to find my way around using JDA’s Documentation and just messing around a lot XD

  29. its giving exception in line 21 of commands class PS:its also not working I am using InteliJ help me please

  30. my only complaint is that this is not just a discord bot tutorial for java… it is also a java tutorial… its actually really annoying

  31. I installed all the files needed even tho i already had a functioning Eclipse. And nothing worked. I wasnt even able to create the public static JDA jda;

  32. Umm i got an error on “public static JDA jda;” i even did the import but the import also causes an error.

  33. Can someone please help me, I’m getting error : The package net.dv8tion.jda is not accessible
    [ I have added the JDA that is referenced it into my project, still the error keeps coming] 🙁

  34. can’t isntall Eclipse IDE, i have newest version java from java.com but it says me to download java :///

Comments are closed.