Creating an Application, a Bot, and a Guild
In this lesson, you’ll create the components required before you can start writing some Python code. You need to first create these Discord components:
- An application
- A bot
- A guild
An application allows you to interact with Discord’s APIs, by providing authentication tokens, designating permissions, and so on. A bot user is one that listens to and automatically reacts to certain events and commands on Discord. A guild (or a server, as it is often called in Discord’s user interface) is a specific group of channels where users congregate to chat.
Once you’ve created all of these components, you’ll tie them together by registering your bot with your guild.
00:00 Creating your application and guild. Previously, you had just created a Discord login, if you didn’t already have one, and signed into access the Developer Portal homepage.
00:10 The next step is to now create an application. This application will allow you to interact with Discord’s APIs, by providing you with authentication tokens, designating permissions, and so on.
00:21 Once logged in, you should be sent to the application page by default, which is what you can see here. In order to create a new application, start by clicking on the New Application button, located in the top right of the screen, up here.
00:36
Next up, you’ll have to name your application, so give it a name and click on Create. You can use any name you want, I suppose, but let’s go here with RealPythonTutorial
.
00:49 Well done. You have created a Discord application. On the resulting screen, you can see some of the information about your application. Keep in mind that an application is not limited just to bots.
01:02 Any program that has to interact with Discord APIs requires one. Bot-related APIs are just a subset of Discord’s total interface. That being said, as you were here, first and foremost, for creating a bot, navigate to the Bot tab on the left-hand navigation list.
01:18 As mentioned earlier, a bot, or bot user, is a user that listens for certain key commands or events, and automatically responds once these commands or events occur.
01:28 In order for your code to manifest on Discord, a bot user needs to exist. In order to do this, click on the Add Bot button on the right-hand side of the page.
01:38 Once the new bot is confirmed to be added to your application, you will see the new bot user in the portal. You will probably have noticed that your bot has taken the name of your application.
01:49
This is a default setting. You can change it to whatever you want, but I’m changing it to RealPythonTutorialBot
. Very creative, I know. Make sure you click Save Changes at the bottom of the screen once it pops up.
02:01 Good work. This bot is now set and all ready to go. You just need to give it a place to go, to give it purpose in life, because to be useful, a bot needs to be able to interact with others.
02:13 The next component to create is a guild, which will allow your bot to interact with other users. A guild, also known as a server in Discord’s user interface, is a specific group of channels where users can congregate to chat, either by text or through a voice call.
02:28 Now, while these two terms are mostly interchangeable, the rest of this course will be primarily using guild, as this is what the APIs use. The term server will only be used if and when referring to the guild, within the graphical UI.
02:44 As an example, let’s say you created a guild as a place where you can discuss the latest Triple-A title to come out with your friends. To do this, you would start by creating a guild, and within that guild, you would then have different channels.
02:58 For example, General Discussion, where you can discuss the game in general, Spoilers, Beware!, where you can discuss certain plot points with less risk of spoiling it for others, Announcements, where you can post any game updates that users need to see, or you could even create a Rules channel, so that users can read them at any time.
03:17 Once this guild has been created, invite people to use it. Now, before adding people to your guild, you must first create the guild of which your bot will be a part.
03:27 To do this, navigate to the Discord homepage. It may be useful at this point to keep two different tabs open in your browser, one with discordapp.com/channels, and the other with the developer application page.
03:42 It’ll just save time a little bit later on. From here, you can view and add friends or send direct messages to other Discord users and guilds. Select the + icon to the left-hand side of the window in order to add a server.
03:56 This will then give you two options, Join a server, or Create a server. Select Create a server. The next set of options that show up allow you to use a template to set up your server.
04:09 You can Create From Scratch, or you can go Gaming Group, and it will give you these default text channels and voice channels, or you can go Friend Group, and it will give you a very similar list, Study Group, Hobby Group, Content Creator, if you are so inclined to try that.
04:25 I’m just going to choose Hobby Group, just here. You can, of course, choose anything. And Create From Scratch gives you a blank template, so you can create whatever channels from the get-go.
04:36 Now, we can give it a name,
04:41 and press Create Server.
04:46 That ding that you heard is the usual Discord joined sound. Once the guild has been created, you’ll be able to see guild members to the right and channels to the left.
04:56 Finally, you must now register your bot with the new guild to complete the Discord components. To do this, however, you’ll have to join me in the next part of this course.
Become a Member to join the conversation.