Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kkrypt0nn/Python-Discord-Bot-Template
🐍 A simple template to start to code your own and personalized Discord bot in Python
https://github.com/kkrypt0nn/Python-Discord-Bot-Template
discord discord-automation discord-bot discord-bot-template discord-net discord-py discord-server discord-slash-commands discordapp discordbot disnake krypton python python-bot python-discord-bot python-discord-bot-template slash-commands user-discord
Last synced: 3 months ago
JSON representation
🐍 A simple template to start to code your own and personalized Discord bot in Python
- Host: GitHub
- URL: https://github.com/kkrypt0nn/Python-Discord-Bot-Template
- Owner: kkrypt0nn
- License: apache-2.0
- Created: 2019-02-26T10:12:10.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-07-21T14:00:10.000Z (4 months ago)
- Last Synced: 2024-07-22T15:19:47.327Z (3 months ago)
- Topics: discord, discord-automation, discord-bot, discord-bot-template, discord-net, discord-py, discord-server, discord-slash-commands, discordapp, discordbot, disnake, krypton, python, python-bot, python-discord-bot, python-discord-bot-template, slash-commands, user-discord
- Language: Python
- Homepage: https://krypton.ninja
- Size: 159 KB
- Stars: 868
- Watchers: 19
- Forks: 307
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Python Discord Bot Template
This repository is a template that everyone can use for the start of their Discord bot.
When I first started creating my Discord bot it took me a while to get everything setup and working with cogs and more.
I would've been happy if there were any template existing. However, there wasn't any existing template. That's why I
decided to create my own template to let **you** guys create your Discord bot easily.Please note that this template is not supposed to be the best template, but a good template to start learning how
discord.py works and to make your own bot easily.If you plan to use this template to make your own template or bot, you **have to**:
- Keep the credits, and a link to this repository in all the files that contains my code
- Keep the same license for unchanged codeSee [the license file](https://github.com/kkrypt0nn/Python-Discord-Bot-Template/blob/master/LICENSE.md) for more
information, I reserve the right to take down any repository that does not meet these requirements.## Support
Before requesting support, you should know that this template requires you to have at least a **basic knowledge** of
Python and the library is made for **advanced users**. Do not use this template if you don't know the
basics or some advanced topics such as OOP or async. [Here's](https://pythondiscord.com/pages/resources) a link for resources to learn python.If you need some help for something, do not hesitate to join my Discord server [here](https://discord.gg/mTBrXyWxAF).
All the updates of the template are available [here](UPDATES.md).
## Disclaimer
Slash commands can take some time to get registered globally, so if you want to test a command you should use
the `@app_commands.guilds()` decorator so that it gets registered instantly. Example:```py
@commands.hybrid_command(
name="command",
description="Command description",
)
@app_commands.guilds(discord.Object(id=GUILD_ID)) # Place your guild ID here
```When using the template you confirm that you have read the [license](LICENSE.md) and comprehend that I can take down
your repository if you do not meet these requirements.## How to download it
This repository is now a template, on the top left you can simply click on "**Use this template**" to create a GitHub
repository based on this template.Alternatively you can do the following:
- Clone/Download the repository
- To clone it and get the updates you can definitely use the command
`git clone`
- Create a Discord bot [here](https://discord.com/developers/applications)
- Get your bot token
- Invite your bot on servers using the following invite:
https://discord.com/oauth2/authorize?&client_id=YOUR_APPLICATION_ID_HERE&scope=bot+applications.commands&permissions=PERMISSIONS (
Replace `YOUR_APPLICATION_ID_HERE` with the application ID and replace `PERMISSIONS` with the required permissions
your bot needs that it can be get at the bottom of a this
page https://discord.com/developers/applications/YOUR_APPLICATION_ID_HERE/bot)## How to set up
To set up the bot it was made as simple as possible.
### `config.json` file
There is [`config.json`](config.json) file where you can put the
needed things to edit.Here is an explanation of what everything is:
| Variable | What it is |
| ------------------------- | ---------------------------------------------- |
| YOUR_BOT_PREFIX_HERE | The prefix you want to use for normal commands |
| YOUR_BOT_INVITE_LINK_HERE | The link to invite the bot |### `.env` file
To set up the token you will have to make use of the [`.env.example`](.env.example) file, you should rename it to `.env` and replace `YOUR_BOT_TOKEN_HERE` with your actual bot's token.
Alternatively you can simply create an environment variable named `TOKEN`.
## How to start
To start the bot you simply need to launch, either your terminal (Linux, Mac & Windows), or your Command Prompt (
Windows)
.Before running the bot you will need to install all the requirements with this command:
```
python -m pip install -r requirements.txt
```After that you can start it with
```
python bot.py
```> **Note** You may need to replace `python` with `py`, `python3`, `python3.11`, etc. depending on what Python versions you have installed on the machine.
## Issues or Questions
If you have any issues or questions of how to code a specific command, you can:
- Join my Discord server [here](https://discord.gg/mTBrXyWxAF)
- Post them [here](https://github.com/kkrypt0nn/Python-Discord-Bot-Template/issues)Me or other people will take their time to answer and help you.
## Versioning
We use [SemVer](http://semver.org) for versioning. For the versions available, see
the [tags on this repository](https://github.com/kkrypt0nn/Python-Discord-Bot-Template/tags).## Built With
- [Python 3.11.5](https://www.python.org/)
## License
This project is licensed under the Apache License 2.0 - see the [LICENSE.md](LICENSE.md) file for details