https://github.com/namelessproj/discordbot_boilerplate
This python project give you the necessary tools to write your own Discord bot in python.
https://github.com/namelessproj/discordbot_boilerplate
boilerplate boilerplate-template discord discord-bot discord-bot-template discord-py
Last synced: about 2 months ago
JSON representation
This python project give you the necessary tools to write your own Discord bot in python.
- Host: GitHub
- URL: https://github.com/namelessproj/discordbot_boilerplate
- Owner: NamelessProj
- License: mit
- Created: 2025-04-07T15:11:36.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2025-05-17T12:07:18.000Z (about 1 year ago)
- Last Synced: 2025-08-20T05:38:54.588Z (10 months ago)
- Topics: boilerplate, boilerplate-template, discord, discord-bot, discord-bot-template, discord-py
- Language: Python
- Homepage:
- Size: 14.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Discord Bot Boilerplate
This python project give you the necessary tools to write your own Discord bot in python.
## .env
To be able to use this exemple bot, you'll need a `.env` file.
```env
BOT_TOKEN=Your_Discord_Bot_Token
GUILD_ID=The_Discord_Server_Id
PYTHON_ENV=dev
```
The `BOT_TOKEN` will be used to connect the bot to your server.
The `GUILD_ID` will be used to get the server where the bot is connected and to get the channel where the citations are.
The `PYTHON_ENV` will be used to set the environment of the bot. It can be `dev` or `prod`. If you set it to `dev`, the bot will be only available for you. If you set it to `prod`, the bot will be available for everyone.
> [!note]
> ### How to get your Bot token ?
> To get your bot token, you'll need to go to the [Discord Developer Portal](https://discord.com/developers/applications).
> You'll have to create a `New Application` and in the `Bot` page, you'll have to:
> - Turn on `Presence Intent`
> - Turn on `Server Members Intent`
> - Turn on `Message Content Intent`
> - Check `Administartor` in the `Bot Permissions` that way the bot can do anything. _(Make sure to trust the code)_
>
> Then on the `OAuth2` page, in the `OAuth2 URL Generator` part, check `bot`, copy the url and pasted it in your browser.
>
> Once your bot on the server you wanted it to be, back on the `Discrod Developer Portal`, in the `Bot` page, you'll find a button `Reset Token`. Click on it and then your token will be displayed. __Make sure to save it, it'll be showed one time only__.
> [!note]
> ### How to get the ID of your Server ?
> On Discord, you'll have to go to your `user settings` and in the `Advanced` tab. In there, you'll have to turn on the `Developer Mode`.
>
> Then make a right click on the server you want the bot in and at the bottom of the context menu, you'll find the possibility to copy the ID of the server.
## How to run the bot
1. Clone the repository
```bash
git clone https://github.com/NamelessProj/My-First-Discord-Bot.git
```
2. Create a virtual environment
```bash
python -m venv venv
```
3. Activate the virtual environment
```bash
# Windows
venv\Scripts\activate
# Linux
source venv/bin/activate
```
4. Install the dependencies
```bash
pip install -r requirements.txt
```
5. Create a `.env` file in the root of the project and add everything from the [`.env.example`](/.env.example) file.
6. Run the bot
```bash
python main.py
```
Everytime you want to run the bot, you'll have to activate the virtual environment and run the bot _(step 3 and 6)_.