Introduction#

I hightly recommand an intermediate level of Python knowledge before you begin this guide.
If you don’t know Python well, Carberra Tutorials is a good place to get started: https://www.youtube.com/playlist?list=PLYeOw6sTSy6bHRFwzIA3VAy05J2tJAAoS

Throughout this guide you will see links like “Read the docs” which go to the Hikari docs, Lightbulb docs or other documentation. I try to put them in useful places where people might need them to modify their code to suit a different purpose.

The GitHub Repository for this guide is located here
This should really only be used as an assist to the guide, and not to just copy and paste. :<

This guide was last updated on 17 August 2022.

What does this guide cover?#

  • Commands & command options (text-based prefix & slash)

  • Lightbulb extensions & plugins

  • Message components (specifically select menus)

  • Command checks & cooldowns

  • Basic error handling

Making your Discord Bot Application#

Carberra Tutorials made a video on Creating a bot on the Developer Portal which you can follow to do this:

Setting up the files#

Make a folder for your bot:

mkdir my_bot
cd my_bot

Then, make 3 files:

  • bot.py

  • requirements.txt

  • .env

After all that, your file structure should look like this:

my_bot
│ bot.py
│ requirements.txt
│ .env

Make a virtual environment#

This is optional, but recommended.

Windows:

python -m venv .venv
.\.venv\Scripts\activate

Linux:

python -m venv .venv
source .venv/bin/activate

You’ll need to activate this venv when running your bot.

Read more about virtual environments here: https://docs.python.org/3/tutorial/venv.html.

Installing requirements#

In requirements.txt paste the following

hikari[speedups]>=2.0.0.dev111
hikari-lightbulb>=2.2.4
hikari-miru>=1.1.2
python-dotenv>=0.21.0

And then run

python -m pip install -r requirements.txt

What have we just installed?#

  • Hikari - a “sane Python framework for writing modern Discord bots”

  • Lightbulb - a “simple and easy to use command framework for Hikari”

  • Miru - an “optional component handler for Hikari”

So now, let’s begin!