Merge branch '2-load-token-from-env' into 'develop'
Implement loading token from ENV Closes #2 See merge request ekzyis/musicube!1
This commit is contained in:
commit
2a31fa6059
|
@ -0,0 +1 @@
|
||||||
|
BOT_TOKEN=
|
|
@ -1 +1,2 @@
|
||||||
venv
|
venv
|
||||||
|
.env
|
||||||
|
|
|
@ -11,6 +11,7 @@ multidict==5.1.0
|
||||||
pycodestyle==2.7.0
|
pycodestyle==2.7.0
|
||||||
pycparser==2.20
|
pycparser==2.20
|
||||||
PyNaCl==1.4.0
|
PyNaCl==1.4.0
|
||||||
|
python-dotenv==0.19.0
|
||||||
six==1.16.0
|
six==1.16.0
|
||||||
toml==0.10.2
|
toml==0.10.2
|
||||||
typing-extensions==3.10.0.2
|
typing-extensions==3.10.0.2
|
||||||
|
|
13
src/bot.py
13
src/bot.py
|
@ -1,10 +1,15 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
|
import os
|
||||||
|
|
||||||
import discord
|
import discord
|
||||||
import youtube_dl
|
import youtube_dl
|
||||||
|
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
|
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
# Suppress noise about console usage from errors
|
# Suppress noise about console usage from errors
|
||||||
youtube_dl.utils.bug_reports_message = lambda: ''
|
youtube_dl.utils.bug_reports_message = lambda: ''
|
||||||
|
|
||||||
|
@ -134,4 +139,10 @@ async def on_ready():
|
||||||
print('------')
|
print('------')
|
||||||
|
|
||||||
bot.add_cog(Music(bot))
|
bot.add_cog(Music(bot))
|
||||||
bot.run('token')
|
|
||||||
|
token = os.environ.get("BOT_TOKEN", None)
|
||||||
|
if not token:
|
||||||
|
print("No token fouund in BOT_TOKEN")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
bot.run(os.environ["BOT_TOKEN"])
|
||||||
|
|
Loading…
Reference in New Issue