Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cozmycdev/discord-python-bot
https://github.com/cozmycdev/discord-python-bot
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/cozmycdev/discord-python-bot
- Owner: CozmycDev
- License: mit
- Created: 2024-06-07T16:41:37.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-06-07T18:10:54.000Z (7 months ago)
- Last Synced: 2024-06-07T19:49:10.732Z (7 months ago)
- Language: Python
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Simple Discord Bot
This is a simple example of a Discord bot implemented in Python using `dotenv-python` for managing sensitive keys, `py-cord` for interacting with the Discord API, and `cogwatch` for dynamic cog reloading.
This repo can be forked and modified to include unlimited capabilities and features; from complex view-flows, modals, MySQL, anything!
## Features
- Loads Discord token and other sensitive keys from a `.env` file.
- Loads less sensitive configuration from `bot_config.json`
- Implements a single slash command example, `/ping`
- Utilizes `cogwatch` for hot-reloading modules in the `cogs` sub-directory.## Requirements
- Python 3.8+
- `dotenv-python`
- `py-cord` (https://docs.pycord.dev/en/stable/api/index.html)
- `cogwatch` (https://github.com/robertwayne/cogwatch)## Installation
1. **Clone the repository:**
```sh
git clone https://github.com/cozmycc/PythonDiscordBot.git
cd PythonDiscordBot
```2. **Create and activate a virtual environment:**
```sh
python -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`
```3. **Install dependencies:**
```sh
pip install -r requirements.txt
```4. **Set up your `.env` file:**
Create a file named `.env` in the root directory of your project, if it doesn't already exist, and add the following:
```env
DISCORD_TOKEN=your_discord_token_here
```## Usage
1. **Run the bot:**
```sh
python bot.py
```2. **Interact with the bot:**
Use the slash command `/ping` in your Discord server where the bot is present to verify it is working.
## Example Configuration
### bot_config.json
```json
{
"main": {
"version": "1.0.0"
}
}