Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/dotenv #90

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.pyc
*.env
*.save
*.save.1
cookies.txt
*/__pycache__
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ A Discord music bot written in Python with support for Youtube, SoundCloud, Spot
- Client ID
- Client Secret
- Note: Limited to 50 playlist items without API

Obtained keys must be entered into ```config/config.py```
* After obtaining API keys:
1. Change the name of ```config/.env-example``` to ```config/.env```
2. Enter API keys into ```config/.env```

#### Requirements

Expand Down
8 changes: 8 additions & 0 deletions config/.env-example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#Discord
BOT_TOKEN = ""
APP_ID = ""
PUB_KEY = ""

#Spotify
SPOTIFY_ID = ""
SPOTIFY_SECRET = ""
15 changes: 11 additions & 4 deletions config/config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
BOT_TOKEN: str = ""
SPOTIFY_ID: str = ""
SPOTIFY_SECRET: str = ""
from dotenv import load_dotenv
import os

load_dotenv()

BOT_TOKEN = os.getenv('BOT_TOKEN') #Discord
APP_ID = os.getenv('APP_ID') #Discord
PUB_KEY = os.getenv('PUB_KEY') #Discord
SPOTIFY_ID = os.getenv('SPOTIFY_ID')
SPOTIFY_SECRET = os.getenv('SPOTIFY_SECRET')

BOT_PREFIX = "$"

Expand Down Expand Up @@ -90,4 +97,4 @@
HELP_CHANGECHANNEL_SHORT = "Change the bot channel"
HELP_CHANGECHANNEL_LONG = "Change the bot channel to the VC you are in"

ABSOLUTE_PATH = '' #do not modify
ABSOLUTE_PATH = '' #do not modify
4 changes: 3 additions & 1 deletion config/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ yt-dlp
aiohttp
asyncio
beautifulsoup4
spotipy
spotipy
dotenv
discord