Whenever you get stuck, remember that someone has likelyĮncountered and solved the same problem at least once before.
How to start creating a world of warcraft bot code#
If you go to GitHub Explore, type the keyword “discord bots”, and browse around, you’ll find thousands of great code examples for you to use. Every project that’s made public can be accessed, GitHub is the modern equivalent of “open source heaven”,Īs we like to call it. A Lot of What You Need Can Be Found On GitHub and StackOverflow It’s much more challenging, but at the same time, you’ll learn significantly more through the struggle. If you’re feeling adventurous and willing to tackle some low-level code, you can skip the library altogether and write each individual web request. This is the beauty of OAuth2.Īnd although it’s good for you to know what it is, it’s highly unlikely you’ll actually be programming anything at such a low level if you’re using libraries (as we suggest throughout the rest of this guide). It all works off of temporary access codes called “tokens”. Its real power is when you realize you can do all of this without giving out your Discord username and password. Your server as well as login/authenticate with the Discord API. We’re not going to dive into OAuth in detail right now,īut you should remember that OAuth2 is how you’re able to add a Discord Bot to This is also how you add bots to channels - using OAuth2 requests. Your Discord bot connects to the Discord API through “ OAuth2”. Your bot (running on your server) then interacts with Discord through their API, figures out what events or triggers happened, and reacts in a pre-programmed way. These are the four primary elements of any Discord bot.ĭiscord users interact in a channel, send messages, and take This is the actual code behind your bot that lets it do what it needs to do. Is on the right and can be running on either your personal computer or anĪnd finally, your bot code also on the right. Server and API, maintained and run by Discord itself, is in the middle. People who are connected to your server, are on the left. We talked about how Discord bots work in a general sense, but let’s get into the In fact, we don’t see why you wouldn’t use a library! It’s highly recommended, and it’ll save you a bunch of time. We will be using Discord API libraries throughout this guide to make all of this information easier to digest and easier to follow. In the Discord API into a nice, clean set of commands. To put it simply, libraries package up everything you can do Instead of writing low-level codeĪnd handling a bunch of web requests, a library does all of the hard work for The good news is, there have been dozens of packages createdįor the Discord API making it easier to use.