The big security update.

This commit is contained in:
JP
2018-10-21 15:39:17 +02:00
parent 5193489dc9
commit 6a28173ce4
3 changed files with 26 additions and 11 deletions
+19 -3
View File
@@ -7,6 +7,8 @@ import Cryptocoin
import Chatbot
import logging
import importlib
import configparser
import base64
from discord.ext import commands
@@ -20,11 +22,25 @@ bot.add_cog(General.General(bot))
bot.add_cog(Cryptocoin.Cryptocoin(bot))
bot.add_cog(Chatbot.Chatbot(bot))
tokenfile = open("stroopwafel.token","r")
token = tokenfile.readline().strip()
#tokenfile = open("stroopwafel.token","r")
#token = tokenfile.readline().strip()
config = configparser.ConfigParser()
config.read('stroopwafel.ini')
bot.tokens = config["tokens"]
bot.hdChannels = config["channels"]
#passwords are base64 encoded, which makes it like 1% safer
bot.passwords = {}
for pw in config["passwords"]:
try:
bot.passwords[pw] = (base64.standard_b64decode(config["passwords"][pw])).decode()
except:
print("Problem with decoding password!")
bot.passwords[pw] = config["passwords"][pw]
@bot.event
@asyncio.coroutine
def on_ready():
print('Logged in as:\n{0} (ID: {0.id})'.format(bot.user))
bot.run(token)
bot.run(bot.tokens["discordbot"])