Preamble
Let's get a bot running as quick as possible. For this we're going to use cookiecutter and NAFF. Cookiecutter will build us an oven-ready project, and NAFF will facilitate using the Discord API.
Disclaimer
This tutorial does not aim to teach you how to program a bot, purely how to use cookiecutter to build a NAFF project. Check out the other guides in this series for that.
Let's get started
First, let's get cookiecutter installed:
>$ python3 -m pip install cookiecutter
And now let's build our project.
>$ cookiecutter https://github.com/NAFTeam/Bot-Template
< There will now be a couple of terminal prompts to help you set up your personalised discord bot
----------------------------------------------
Arguments:
'project_name' - The name of your project
'project_slug' - A formatted version of your project name, which is used as a filepath and for the docker container names
'license' - What license your project should have. Can be safely ignored should you not plan on openly publishing this project on the internet
'license_organization' - The name that should appear on the license
'load_debug_commands' - If some helpful debug commands should be loaded. These will only be accessible to the owner of the bot
'discord_token' - Your discord bot token. This will not be pushed if your use this project with git
----------------------------------------------
Press 'Enter' to start
]:
From here, answer the questions, and when you're done, your project will be ready.
< project_name [New Discord Bot]:
>$ test project
< project_slug [test-project]:
>$ test-project
< Select license:
1 - MIT
2 - BSD-3
3 - GNU GPL v3.0
4 - Apache Software License 2.0
Choose from 1, 2, 3, 4 [1]:
>$ 1
< license_organization [Your Name]:
>$ LordOfPolls
< Select load_debug_commands:
1 - true
2 - false
Choose from 1, 2 [1]:
>$ 1
< discord_token [changethis]:
>$ [your_token_here]
You now have this project structure:
test-project
├───core
└───extensions
core
contains the bot itself, logging, and an extension loader. extensions
holds all of your extensions which will be automatically loaded thanks to the extension loader.
From here, you can run the bot by running this:
>$ python3 -m pip install -r requirements.txt
>$ python3 main.py
Have a look around, and enjoy developing your bot! If you want more info, check out NAFFs Docs or one of the other guides in this series.
Top comments (0)