added token input

This commit is contained in:
Kónya Márton 2020-07-21 11:33:45 +02:00
parent dc6bb75922
commit d8fdd74316
3 changed files with 20 additions and 5 deletions

3
.gitignore vendored
View File

@ -103,7 +103,7 @@ celerybeat.pid
*.sage.py
# Environments
.env
*.env
.venv
env/
venv/
@ -137,3 +137,4 @@ dmypy.json
!.vscode/extensions.json
*.code-workspace
token.env

18
bot.py
View File

@ -2,6 +2,24 @@ import os
import discord
from dotenv import load_dotenv
def checkEnv():
print('Checking if token.env exists...')
try:
out_file = open('token.env')
print('Token is ready!')
except IOError:
print('First you have to give us the Discord Token for your bot!')
token = input('token: ')
out_file = open('token.env', 'w')
out_file.write(f'DISCORD_TOKEN={token}')
finally:
out_file.close()
pass
checkEnv()
load_dotenv("token.env")
TOKEN = os.getenv('DISCORD_TOKEN')
GUILD = os.getenv('DISCORD_GUILD')

View File

@ -1,4 +0,0 @@
DISCORD_TOKEN=NzMzNzgwNTIyODEwOTk4OTM0.XxII6A.Gn4zPAvILtjc6RwwklQHOCxXmoY
DISCORD_GUILD=12.C FIZIKA
ZENEKOMMAND_ID=733950770927370250
YEP_ID=733950633291546686