🤖Basic Bot
Here are the basics to get your bot up and running.
Last updated
Here are the basics to get your bot up and running.
Last updated
Once you're done Creating a Project and the process of Installing the Package is complete, your project should look like this. If you're using an executable, it will look like .
The next step is to import the library so we can get your bot online. You'll need your token for this. If you didn't save it somewhere, don't fret. Head to and reset your token. Once you have your token, run the following code and you'll see your bot come online.
It's that simple. Even though it's online, it doesn't do much at the moment so lets change that. Lets have your bot respond to a simple message.
The library comes with the EventListener
class. This is used to listen to a handful of events that can be dispatched by Discord. This is how you add an event listener.
When you send a message in a channel, you should get a response.
Discord.swift doesn't support the old format of text commands (!command
). It utilizes Discords feature rich, UI based slash commands (/command
). Lets create one!
Once you've executed the above code, it should show up in your server like so.
When you've used the command, it will produce the following.