Introduction¶
Hi! So you want to make a bot starting from naffing. This guide aims to get you started as fast as possible, for more advanced use-cases check out the other guides.
Requirements¶
- Python 3.10 or greater
- Know how to use
pip
- A bot account
- An aversion to puns
Installation Methods¶
There are two different ways to install this library and create your bot.
We created a cookiecutter template which you can use to set up your own bot faster. With the template, your code will already have a well-defined structure which will make development easier for you.
We recommend newer devs to make use of this template.
Template Feature¶
- Basic, ready to go bot
- Implementation of best practises
- NAFF, and general extensibility
- Example command, context menu, component, and event
- Logging to both console and file
- Pip and poetry config
- Pre-commit config
- Dockerfile and pre-made docker-compose
Template Installation¶
- Install cookiecutter -
pip install cookiecutter
- Set up the template -
cookiecutter https://github.com/Discord-Snake-Pit/Bot-Template
And that's it!
More information can be found here.
Virtual-Environments¶
We strongly recommend that you make use of Virtual Environments when working on any project. This means that each project will have its own libraries of any version and does not affect anything else on your system. Don't worry, this isn't setting up a full-fledged virtual machine, just small python environment.
1 2 3 |
|
1 2 3 |
|
It's that simple, now you're using a virtual environment. If you want to leave the environment just type deactivate
.
If you want to learn more about the virtual environments, check out this page
Pip install¶
Now let's get the library installed.
1 |
|
1 |
|
Basic bot¶
Now let's get a basic bot going, for your code, you'll want something like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
|
Congratulations! You now have a basic understanding of this library. If you have any questions check out our other guides, or join the Discord Server
For more examples, check out the examples page