Discord bots can have so many different uses and applications. They can preform pre-programmed tasks such as notification or moderation and interact with end-users. Or they could be programmed to play your favorite music!
No matter what you want it to do, we first have to create a base application.
Discord Developer Setup
Before we can write the code, we need to get our authentication credentials and register the bot with discord.
Do not share your token with anyone!
Installing Required Libraries
To use code our bot, we will use Hikari and Hikari-Lightbulb. Hikari is a discord micro-framework for python and ayncio. Hikari supports the latest versions of discord api. Hikari-Lightbulb is a command handler built as an extension of Hikari. To use both of these libraries, we first have to install them into our system.
Creating a Basic Application
We can make an application to use slash commands in only a few lines of code. Heres a simple command that responds with “Pong!” when the command is run.
Breaking it Down
To create a command, there is a few things that need to happen.