<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Java Playground - Medium]]></title>
        <description><![CDATA[Java Playground is a publication showcasing various Java projects and experiments. - Medium]]></description>
        <link>https://medium.com/java-playground?source=rss----7c115b7703f4---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Java Playground - Medium</title>
            <link>https://medium.com/java-playground?source=rss----7c115b7703f4---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 11:42:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/java-playground" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Discord Bots with Javacord: How to Make Your First Bot]]></title>
            <link>https://medium.com/java-playground/discord-bots-with-javacord-how-to-make-your-first-bot-5df8d26c154d?source=rss----7c115b7703f4---4</link>
            <guid isPermaLink="false">https://medium.com/p/5df8d26c154d</guid>
            <dc:creator><![CDATA[Caleb Garcia]]></dc:creator>
            <pubDate>Thu, 13 Aug 2020 17:03:35 GMT</pubDate>
            <atom:updated>2020-08-13T17:03:35.623Z</atom:updated>
            <content:encoded><![CDATA[<p>You’ve been waiting to starting writing the code…</p><p><a href="https://medium.com/java-playground/discord-bots-with-javacord-how-to-make-your-first-bot-f199bd1f11db">Here’s how to do it</a>.</p><p>After setting up Java, IntelliJ, and the Discord Developer Application, it’s finally time to move on to creating your first Discord bot. In this new article article I cover the basics of the Javacord library, testing your bot, and giving it its first bit of functionality.</p><p>Make sure to stay tuned for new articles coming out showcasing more ideas for your Discord bot, playing with Java principles, and much more!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5df8d26c154d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/java-playground/discord-bots-with-javacord-how-to-make-your-first-bot-5df8d26c154d">Discord Bots with Javacord: How to Make Your First Bot</a> was originally published in <a href="https://medium.com/java-playground">Java Playground</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Discord Bots with Javacord: How to Make Your First Bot]]></title>
            <link>https://medium.com/java-playground/discord-bots-with-javacord-how-to-make-your-first-bot-f199bd1f11db?source=rss----7c115b7703f4---4</link>
            <guid isPermaLink="false">https://medium.com/p/f199bd1f11db</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[discord]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[bots]]></category>
            <category><![CDATA[javacord]]></category>
            <dc:creator><![CDATA[Caleb Garcia]]></dc:creator>
            <pubDate>Thu, 13 Aug 2020 14:20:35 GMT</pubDate>
            <atom:updated>2020-08-13T14:34:32.889Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xBGsXRSjXmC_06V965D0yg.png" /><figcaption>Javacord logo supplied by <a href="https://javacord.org/">Javacord</a> community</figcaption></figure><p>In my last article, <a href="https://medium.com/java-playground/discord-bots-with-javacord-creating-a-discord-developer-application-f8e4a391ff12">Creating a Discord Developer Application</a>, I talked about the Discord Developer Portal, how to create a Developer Application, and I gave you a few ideas on what you can do with your bot. In this article, I’ll finally be answering some questions you might have about this whole series. Before I answer any of those questions, though, allow me to provide a quick disclaimer.</p><p><strong>Disclaimer Time!</strong></p><p>This article assumes you understand the basics of the Java programming language to a functional level. This includes but is not limited to an understanding of methods, object creation, and lambdas. If you are not familiar with these concepts, save this article on the side and come back to it when you are. For total beginners, I would recommend <a href="https://www.w3schools.com/java/default.asp">w3schools</a> as an excellent place to learn the basics of Java and other languages.</p><p>On another important note: <strong>This is not an official Javacord article or series, and I am not a Javacord team member.</strong> I am simply spreading the word and proper usage of the library I like to use for my Discord bots. This article <em>does</em>, however, include information provided directly from the Javacord team to ensure I am giving you the most correct and clean code as possible.</p><p>Now, it’s time to answer that first big question.</p><p><strong>What is Javacord?</strong></p><p>Javacord is an amazing library that allows you to communicate with the Discord API from your Java code in a greatly simplified manner. You can create objects and call methods that your bot will use to send messages, manipulate roles on a user, and so much more. The <a href="https://javacord.org/">Javacord website</a> has everything clearly laid out in terms of proper documentation and example code so that even the total beginner can create a basic Discord bot. I’ll be referencing some of their examples, wiki pages, and JavaDocs in this article and any future articles about bots for you to read up more on how the library works.</p><p>I would <em>highly</em> recommend you join the official <a href="https://discord.gg/0qJ2jjyneLEgG7y3">Javacord Discord server</a> before you start working with this library. There is an absolutely wonderful community surrounding it (and I’m happy to say I’m a part of it) that is always willing to help you with an issue if you’re willing to learn. Here you can speak with me, the creators, the contributors, and plenty of other bot developers just like you. Come join in on the discussion!</p><p><strong>So I need Javacord for my bot, how do I get it?</strong></p><p>The <a href="https://javacord.org/wiki/getting-started/welcome/">Javacord wiki’s welcome page</a> tells you exactly what to do to put Javacord in your bot project whether you’re using Gradle or Maven. In our case of using Gradle, it’s a very simple couple of steps:</p><ol><li>Open the <strong>build.gradle</strong> file in your IntelliJ bot project</li><li>Delete the <strong>testCompile</strong> line in the <strong>dependencies</strong> block (this line is for doing tests on your code, which I may cover in a later article)</li><li>Where you deleted the previous line, add the following: <strong>implementation ‘org.javacord:javacord:3.0.6’</strong></li></ol><p>Make sure to click the <strong>Load Gradle Changes</strong> button at the top right after you add this line. This allows Gradle to import Javacord into your project for you to create your bot.</p><p>Congratulations! After a few moments of importing, you will officially have access to countless tools to use to write your bot with. Now, we’re going to use them for a very simple bot that we’ll expand on later in this article.</p><p><strong>How do I make my bot do something?</strong></p><p>Back on <a href="https://javacord.org/">Javacord’s home page</a>, there is an excellent example labeled “Logging in” we are going to use to verify that your bot is up and running. This is always a good test to run right after you do all of this setup, so we’re going to do it here as well. When you are done following the example, your main file should look something like the picture below (remember to replace <strong>yourtokenhere</strong> with the bot’s token we got in the last article).</p><pre>import org.javacord.api.DiscordApi;<br>import org.javacord.api.DiscordApiBuilder;</pre><pre>public class Bot {</pre><pre>    public static void main(String[] args) {<br>        DiscordApi api = new DiscordApiBuilder().setToken(&quot;yourtokenhere&quot;).login().join);</pre><pre>        // Add a listener which answers with &quot;Pong!&quot; if someone writes &quot;!ping&quot;<br>        api.addMessageCreateListener(event -&gt; {<br>            if (event.getMessageContent().equalsIgnoreCase(&quot;!ping&quot;)) {<br>                event.getChannel().sendMessage(&quot;Pong!&quot;);</pre><pre>            }<br>        });</pre><pre>        // Print the invite url of your bot<br>        System.out.println(&quot;You can invite the bot by using the following url: &quot; + api.createBotInvite());</pre><pre>    }<br>}</pre><p>From here, you can run your bot by pressing <strong>Shift+F10</strong>; if you’ve followed all of these steps correctly, you should see the print statement with the bot’s invite link appear in the console at the bottom of the screen. Use this to invite your bot to your server so you can test out how it works!</p><p><strong>What did I just write?</strong></p><p>At the beginning of getting into this library, some things may be a little confusing, so I’ll break down what’s going on inside of the main method here:</p><ul><li>First: we’re creating a <strong>DiscordApi</strong> instance. Simply put, this is what allows us to interact with the Discord API. We create an instance of the <strong>DiscordApiBuilder</strong> class, pass it the token to login with, and then tell it to log in to the bot’s account. <strong>join()</strong> is a method of the <strong>CompletableFuture</strong> that <strong>login()</strong> returns; it blocks the current thread and returns the completed <strong>DiscordApi</strong> instance to the <strong>api</strong> variable.</li><li>Second: we add what’s called a “listener”. A listener does exactly what it sounds like; it waits and listens for a certain thing to happen, and in the following code block, it reacts accordingly. In our case, we’re listening for any message that the bot can read. Every time that happens, it’s called an event and the bot can access information about it using the <strong>event</strong> parameter. You can use whatever name for the <strong>event</strong> you’d like, but you want it to still be representative of the event you’re passing in to the lambda (in this case, a <strong>MessageCreateEvent</strong>).</li><li>Third: every time the bot gets a message, it checks to see if the message content of the event matches “!ping”. The <strong>equalsIgnoreCase()</strong> method does this comparison and, as the name entails, ignores upper or lower case letters, and returns a true or false value based on the match.</li><li>Fourth: if the message content matches, we get the text channel that the event happened in, and to it, we send the message “Pong!”.</li><li>Lastly: The final line in the main method is simply a print statement that calls the <strong>createBotInvite()</strong> method of the API instance. This prints out the URL that you can use to invite the bot to your server.</li></ul><p>Once your bot is in your server, testing the code you just wrote is very simple. In any channel the bot has access to, send a !ping message and you should get the programmed response back almost immediately.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/0*fb6kzG2aD968fClL" /><figcaption>Testing the ping command (supplied by author)</figcaption></figure><p>Congratulations x2! You technically have a functional Discord bot. It doesn’t do anything too helpful at the moment, though, so let’s fix that!</p><p><strong>I want my bot to do something useful!</strong></p><p>I may show more example projects in time, but for the sake of this article, let’s work on a very simple task to give your bot: welcome new users to your Discord server!</p><p>The main driver behind this task is a different kind of listener, called a <strong>ServerMemberJoinListener</strong>. As the name entails, this waits and listens for a member to join any server the bot is in. We want to welcome new users to the server, so we want to use this listener to act when somebody joins.</p><p>As you can see in my code below, I’ve introduced something called an <strong>Optional</strong>. Javacord’s wiki has a <a href="https://javacord.org/wiki/essential-knowledge/working-with-optionals/">great explanation</a> of how to use this Java class, and I would highly recommend checking out the page to understand what I’m doing with <strong>channel.ifPresent()</strong>.</p><pre>import org.javacord.api.DiscordApi;<br>import org.javacord.api.DiscordApiBuilder;<br>import org.javacord.api.entity.channel.TextChannel;</pre><pre>import java.util.Optional;</pre><pre>public class Bot {</pre><pre>    public static void main(String[] args) {<br>        DiscordApi api = new DiscordApiBuilder().setToken(&quot;yourtokenhere&quot;).login().join());</pre><pre>        // Welcome new users to your server<br>        api.addServerMemberJoinListener(event -&gt; {<br>            Optional&lt;Textchannel&gt; channel = api.getTextChannelById(yourchannelidL);<br>            channel.ifPresent(textChannel -&gt; textChannel.sendMessage(&quot;Welcome to the server, &quot; + event.getUser().getMentionTag() + &quot;!&quot;));<br>        });</pre><pre>        // Print the invite url of your bot<br>        System.out.println(&quot;You can invite the bot by using the following url: &quot; + api.createBotInvite());</pre><pre>    }<br>}</pre><p>Like I did earlier, let me give you a quick rundown on what the code is doing:</p><ul><li>First: add a <strong>ServerMemberJoinListener</strong> to wait and listen to a Discord user joining the server the bot is on. This is the <strong>event</strong> trigger we’ll be using to mention the user in a moment.</li><li>Second: request an <strong>Optional</strong> object with the type parameter <strong>TextChannel</strong>, use the API instance to get a text channel by its ID (check out <a href="https://support.discord.com/hc/en-us/articles/206346498-Where-can-I-find-my-User-Server-Message-ID-">this post</a> by Discord support on how to get a channel’s ID), and assign that value to the <strong>Optional</strong>. Because we’re just feeding in a string of numbers, this channel may or may not exist, and that’s why we’re using an <strong>Optional</strong>. (Note: the <strong>L</strong> at the end of the numbers indicate a <strong>long</strong>, a Java datatype. When hard-coding IDs, it is best practice to use this datatype as opposed to a <strong>String</strong>, as the natural form of IDs is <strong>long</strong>.)</li><li>Third: handle the <strong>Optional</strong> appropriately. Call the <strong>ifPresent()</strong> method of the <strong>Optional</strong> to check if the channel exists <em>and</em> if the bot can see it; if it does and if it can, use the lambda’s <strong>textChannel</strong> parameter to send the programmed message. Get the user who joined (the <strong>User</strong> is stored in the <strong>event</strong> variable, so we use <strong>event.getUser()</strong> to retrieve them) and get their mention tag to use in the message. The mention tag is, in the test below, where the user’s name is preceded by an @. Using the mention tag “pings” the user and lets them know someone is trying to get their attention; in our case, that’s our bot!</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/0*EJFr43j4xLHh5htd" /><figcaption>Testing the bot’s welcome message (supplied by author)</figcaption></figure><p>Congratulations x3! After you write all of this code and restart your bot, any user should be given a warm welcome in whatever channel you specified. It’s not the most spectacular first project, but it’s a very good introduction to the basics of the Javacord library and Discord bot development. It does have a practical application, as some server owners want to automate welcoming new users. If you want to pretty up the bot’s welcome message, I’d suggest checking out Javacord’s <a href="https://javacord.org/wiki/miscellaneous/embed-faq/">Embed FAQ</a> and learning about embeds to make things look just a little neater.</p><p><strong>That does it for your introduction to Discord Bots with Javacord!</strong> I’d like to thank the Javacord team for personally providing the proper information to me so I could make this article accurate and as high-quality as it can be. I’ll be happy to respond to any questions, comments, or suggestions you may have about this article or future ones. Make sure to subscribe to The Playground Digest newsletter to get the first word on new articles playing with Java, and make sure to give me a follow to see more like this in the future. If you know anybody who isn’t quite sure how to make a basic Discord bot in Java, share this article with them to give them a great place to start!</p><p>Want to see all of these concepts in action? Check out my <a href="https://www.fiverr.com/caleb_garcia/create-a-custom-discord-bot-for-your-server">Fiverr®️ Gig®️</a> to see how I can make a custom Discord bot for your server using everything I discussed in this article, and whatever else you want your bot to do!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f199bd1f11db" width="1" height="1" alt=""><hr><p><a href="https://medium.com/java-playground/discord-bots-with-javacord-how-to-make-your-first-bot-f199bd1f11db">Discord Bots with Javacord: How to Make Your First Bot</a> was originally published in <a href="https://medium.com/java-playground">Java Playground</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Discord Bots with Javacord: Creating a Discord Developer Application]]></title>
            <link>https://medium.com/java-playground/discord-bots-with-javacord-creating-a-discord-developer-application-f8e4a391ff12?source=rss----7c115b7703f4---4</link>
            <guid isPermaLink="false">https://medium.com/p/f8e4a391ff12</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[bots]]></category>
            <category><![CDATA[discord]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[developer]]></category>
            <dc:creator><![CDATA[Caleb Garcia]]></dc:creator>
            <pubDate>Thu, 06 Aug 2020 09:08:04 GMT</pubDate>
            <atom:updated>2020-08-06T09:07:44.629Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*v-QlLsaHuyrMYjq41hvFew.png" /><figcaption>Discord Logo by <a href="https://discord.com/new">Discord</a></figcaption></figure><p>In my last article, <a href="https://medium.com/java-playground/discord-bots-with-javacord-setting-up-intellij-a02f7a7b3585">Setting up IntelliJ</a>, I spoke on the IntelliJ IDEA, a little bit about what it can do, and how to get it on your computer so you have the resources necessary to create your Discord bot. In this article, I’ll be answering the next question I left you with at the end of the previous installment: What in the world is a Discord bot application and why do I need one?</p><p><strong>What is an application?</strong></p><p>A Discord developer application is something a developer can create to communicate with the Discord API; whether it be for creating a bot or a Rich Presence-enabled game, there are quite a few ways to use applications. Creating a developer application is very simple, but first, you should familiarize yourself with the <a href="https://discord.com/developers/applications">Discord Developer Portal</a> made for developers like you.</p><p><strong>What is the Developer Portal?</strong></p><p>On this page, you can create developer applications, join and view developer teams, and you even have access to the various sections of Discord’s documentation. For our Discord bot project, we’re mainly interested in the “create developer applications” section of the developer portal.</p><p><strong>How do I create the application?</strong></p><p>Creating your application is as simple as following these few steps: Go to the Developer Portal and navigate to the Applications tab. Click “New Application” in the corner, type in the name of your bot project (“MyFirstBot” for me), and click Create. Ta-da, you’ve made your Discord bot’s application!</p><p><strong>What’s this thing called a Client ID in my application?</strong></p><p>The Client ID is, simply, a string of numbers that is put into the bot’s invite link. When you replace the appropriate section of the link below with your application’s Client ID, you can use that link to invite the bot to any server you are an administrator of. You can also send this link to anybody else to do the same thing, and this is how your bot will get around Discord!</p><p>https://discord.com/oauth2/authorize?client_id=&lt;clientidhere&gt;&amp;scope=bot</p><p><strong>This is all great, but why do we need to do all of this in the first place?</strong></p><p>The Discord bot sits in the applications we create from the Developer Portal; the code we write afterward is what can be considered the bot itself. When you go to the bot’s application page and navigate to the Bot tab, you have the option to add a bot to the application. Simply put, this brings the bot into existence and allows you to change and access some very pertinent information including changing the name, profile picture, and permissions, and having access to what’s called the bot’s “token”.</p><p>The token is a string of essentially random letters, numbers, and symbols that act as a password for our code to log in to the bot and tell it what to do. If anybody else has access to your bot’s token, they can make it do whatever they want, so it’s important that you don’t share it with anybody. Keep it secret, and keep it at the ready for the next article, where we’ll start the coding process to give you Discord bot life.</p><p><strong>What can I do with a bot anyway?</strong></p><p>To start thinking about what you want your bot to do and how to code it, you should know some of the reasons you would even want to make one in the first place. Discord bots are a very good way to do any number of things, such as:</p><ul><li>Welcoming new members with a friendly and informational message,</li><li>Assigning and removing roles from users,</li><li>Create complex games and features that anybody in the world can play with on their servers,</li><li>Play music in a voice channel,</li><li>And much, much more!</li></ul><p>I, personally, have created a bot that manages users’ roles for the <a href="https://eledris.com/art-prompts/discord-server-invite">Art Prompts Discord server</a>, a bot that fetches <a href="https://www.wordnik.com/">random words</a> from the English language, and another one that gets random facts about numbers. There are countless ways to program a Discord bot and what it does is all up to your imagination. I have a very simple but funny idea that I would like to showcase later on, and later installments in the series will be exactly that; showcasing ideas I’ve had, or suggestions you may have for bots to write and explain.</p><p>Now that you’ve created the application for your bot, you’ve completed the very last step before you can code your bot to do whatever you want! In the next article I’ll cover the basics of Javacord, the Java library we’ll use to create our bots, some basic bot functionality, and a few tips and tricks to making your bot the most awesome it could possibly be. If you sign up for The Playground Digest newsletter, you’ll be the first to get pointers on how to work with your bot’s backend.</p><p>Make sure to follow me to see more articles like this one, and much more in the future! If you know anybody who needs a quick rundown on what a Discord developer application is and how to make one, show them this article to give them the information they need!</p><p>If you’d like to support me, I can create one of these awesome Discord bots for your server through my <a href="https://www.fiverr.com/caleb_garcia/create-a-custom-discord-bot-for-your-server">Fiverr®️ Gig®️</a>. Check it out, and shoot me a message if you’d like me to make one for you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f8e4a391ff12" width="1" height="1" alt=""><hr><p><a href="https://medium.com/java-playground/discord-bots-with-javacord-creating-a-discord-developer-application-f8e4a391ff12">Discord Bots with Javacord: Creating a Discord Developer Application</a> was originally published in <a href="https://medium.com/java-playground">Java Playground</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Discord Bots with Javacord: Setting up IntelliJ]]></title>
            <link>https://medium.com/java-playground/discord-bots-with-javacord-setting-up-intellij-a02f7a7b3585?source=rss----7c115b7703f4---4</link>
            <guid isPermaLink="false">https://medium.com/p/a02f7a7b3585</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[bots]]></category>
            <category><![CDATA[intellij]]></category>
            <category><![CDATA[discord]]></category>
            <dc:creator><![CDATA[Caleb Garcia]]></dc:creator>
            <pubDate>Mon, 03 Aug 2020 01:00:57 GMT</pubDate>
            <atom:updated>2020-08-03T00:58:46.503Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1WYqtQRCIgLXehL_7Akrig.png" /><figcaption>IntelliJ logo by <a href="https://www.jetbrains.com/">JetBrains</a></figcaption></figure><p>In my last article, <a href="https://medium.com/java-playground/discord-bots-with-javacord-installing-the-jdk-3bd6d40ec875">Installing the JDK</a>, I discussed why you would want to use Java over other languages, how to install the JDK on your computer, and how you’ll be writing your Discord bot’s code. In this article, I’ll be answering a question I may have left you with: What in the world is IntelliJ?</p><p>IntelliJ is what’s called an IDE, which stands for Integrated Development Environment, that was specifically created by the company JetBrains for coding with the Java programming language. JetBrains has made many other popular IDEs such as Android Studio (which I may cover in a later article), and they are very well known for a specific way of setting up their editors. It has many features that can seem fairly scary and complicated at first, but after a while of working with it in personal projects, I have found IntelliJ to be an extremely well put-together and sleek IDE. Because of some of what it integrates, I specifically choose to use it when making Discord bots, and I’ll discuss why another time.</p><p>If you go to IntelliJ’s <a href="https://www.jetbrains.com/idea/">amazingly beautiful website</a> and head to the download page, you’ll be able to see the differences in the IDE’s “editions”; since the Ultimate edition costs money and we want to get right to coding bots, we’ll only be focusing on the usage and features of the free Community edition. On this page, hit the download button under “Community”. When the download finishes, open and follow the installation wizard (don’t check any boxes!) and open up IntelliJ for the first time. You’ll be given some settings to choose from before you can use the IDE including the UI theme (I like Darcula, personally) and plugins. Skip the plugins section, as everything is enabled by default and these can be played with to suit your needs later.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/1*DoAPQSa5JrBsXqNQQ0ZxIQ.png" /><figcaption>IntelliJ homepage upon opening (supplied by author)</figcaption></figure><p>Now that IntelliJ is open, you can create a new project that will hold your bot’s code. When you do this, make sure to select Gradle from the menu, and include Java as an additional library/framework. Then, give your project a fitting name and location on your system. Make sure to expand the “Artifact Coordinates” button and change the following values: GroupId to something like com.name.projecttitle, so I’ll do com.caleb.myfirstbot; ArtifactId to your project title, so in my case “MyFirstBot”; and finally, Version to 1.0. After this, that big blue Finish button will take you to your new home away from home, the IntelliJ UI.</p><p>Before you do anything else, IntelliJ has to download all the necessary files for Gradle to function properly. <a href="https://gradle.org/">Gradle</a>, a necessary piece of this project, is a build automation tool that works with multiple languages for software development. It helps with compiling code into distributions, fetching necessary dependencies, and much, much more. When Gradle is done doing its thing (which may take 5–10 minutes), you’ll see a “src” folder appear in the Project explorer on the left side of the window. Expand src &gt; main to show the “java” folder which you’ll right-click on, hover over New, and click Java class. This file will be where your bot’s main code will be, so give it a simple name like Bot or Main.</p><p>Just to test that this new file works, type out a quick print statement demonstrated in the image and press Ctrl+Shift+F10 (shortcut to run the file). You should see a “Hello World” in the console at the bottom of the window, and this means that everything ran with no problems.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*Y61WMqDcu-GY5FpB2Ht9hA.png" /><figcaption>Bot class with test print statement (supplied by author)</figcaption></figure><p>If you’ve made it to this point, congratulations! You’ve successfully set up your IntelliJ environment and you’ve created and tested for bot’s main file. The last step before you can start coding is to create the Discord bot’s application in the developer portal, which I’ll cover in my next article in the series. If you subscribe to The Playground Digest newsletter, you’ll be first in line to read that article.</p><p>Make sure to follow me to see more articles like this one, and much more in the future! If you know somebody who wants a good Java IDE to use, show them this article so they know how to get their hands on the best there is!</p><p>IntelliJ is my IDE of choice for coding Discord bots, and there’s no exception when it comes to making bots for my <a href="https://www.fiverr.com/caleb_garcia/create-a-custom-discord-bot-for-your-server">Fiverr®️ Gig®️</a>! Check it out now and shoot me a message if you’d like me to code a Discord bot custom-built for your server!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a02f7a7b3585" width="1" height="1" alt=""><hr><p><a href="https://medium.com/java-playground/discord-bots-with-javacord-setting-up-intellij-a02f7a7b3585">Discord Bots with Javacord: Setting up IntelliJ</a> was originally published in <a href="https://medium.com/java-playground">Java Playground</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Discord Bots with Javacord: Installing the JDK]]></title>
            <link>https://medium.com/java-playground/discord-bots-with-javacord-installing-the-jdk-3bd6d40ec875?source=rss----7c115b7703f4---4</link>
            <guid isPermaLink="false">https://medium.com/p/3bd6d40ec875</guid>
            <category><![CDATA[bots]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[discord]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Caleb Garcia]]></dc:creator>
            <pubDate>Fri, 31 Jul 2020 07:15:28 GMT</pubDate>
            <atom:updated>2020-07-31T07:30:58.004Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2yekvip0YxnrkVrr3b0eGQ.jpeg" /><figcaption>Stock image from <a href="https://www.pexels.com/photo/person-looking-at-phone-and-at-macbook-pro-1181244/">Pexels</a></figcaption></figure><p>Do you want to make a bot custom-made for your Discord server, but just don’t know where to start or what to use?</p><p>By coding a Discord bot in Java, you’re learning the very valuable skill of software programming, and you’re learning it with a widely used programming language. Java is used worldwide for all sorts of web applications, desktop applications, mobile apps, and much more. Coding a Discord bot in Java is an amazing way to get yourself into programming, and it’s a perfect introduction to working with the Java programming language.</p><p>Coding a Discord bot allows you to do a wide variety of things to spice up any server; whether you want to automate managing your server’s roles, welcome new members to your community, or get a <a href="https://eledris.com/art-prompts/discord-bot/">drawing prompt</a> for the artists in your server. Learning to code your own Discord bot allows you to do all of these things, plus whatever else you could want for your server!</p><p>Before you can start the coding process, you have to install what’s called the Java Development Kit, or the JDK, on your computer. This is what enables you to write code in Java, and it’s what allows your code editors to work with Java. To install the JDK, go to <a href="https://www.oracle.com/java/technologies/javase-downloads.html">this</a> link and click on JDK Download under Oracle JDK. From here, scroll to the bottom of the table and download the Windows x64 installer file. Make sure to accept Oracle’s License Agreement when the window appears.</p><p>When you run the freshly-downloaded setup file, you’ll click “Next” twice, and then “Close” the window after it finishes installing. After the JDK has been installed, the last thing task to set up Java is to add the directory of the JDK’s “bin” folder on your computer to the PATH variable. First, open your File Explorer and navigate to C:\Program Files\Java\jdk-1x\bin. Right click on “bin” in the directory bar and click “Copy Address”. After you do this, open your Control Panel and follow this path: Control Panel &gt; System and Security &gt; System &gt; Advanced System Settings &gt; Environment Variables. In the lower box, double-click “Path”, and in the new window click “New”, and type Ctrl+V to paste in the JDK directory. From here click “OK” on the last three windows, and close the rest.</p><p>Congratulations! You’ve completed the first step towards coding your very own Discord bot in Java! Now that you’ve installed the JDK, you can download the <a href="https://www.jetbrains.com/idea/download/#section=windows">IntelliJ IDE (Community Edition)</a> that you’ll be using to work your magic. I’ll be writing a continuation of this coding series soon; if you subscribe to The Playground Digest newsletter, you’ll be the first to know when it comes out.</p><p>Make sure to follow me to see more articles like this one, and if you know somebody who wants to get in to programming, have them read up on getting started with Java!</p><p>If you’d like me to code a custom Discord bot for your server using the methods described in this series, check out my Fiverr®️ Gig®️ <a href="https://www.fiverr.com/caleb_garcia/create-a-custom-discord-bot-for-your-server">here</a>!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3bd6d40ec875" width="1" height="1" alt=""><hr><p><a href="https://medium.com/java-playground/discord-bots-with-javacord-installing-the-jdk-3bd6d40ec875">Discord Bots with Javacord: Installing the JDK</a> was originally published in <a href="https://medium.com/java-playground">Java Playground</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>