vervangt ini file met dotenv
continuous-integration/drone/push Build is failing

Maakt het makkelijker om te testen, en is sowieso betere manier denk ik
This commit is contained in:
2022-11-14 16:18:42 +01:00
parent da7262307d
commit 2c69b13f3d
7 changed files with 25 additions and 57 deletions
+5 -21
View File
@@ -7,14 +7,15 @@ import Cryptocoin
import Chatbot
import Points
import logging
import importlib
import configparser
import base64
import dotenv
import os
from discord.ext import commands
logging.basicConfig(level=logging.INFO)
dotenv.load_dotenv()
async def add_cogs(bot):
await bot.add_cog(Shitpost.Shitpost(bot))
await bot.add_cog(General.General(bot))
@@ -28,26 +29,9 @@ intents.members = True
bot = commands.Bot(command_prefix=commands.when_mentioned_or('!'), description='Stroopwafel. Shitpost bot extraordinaire.', pm_help=True, intents=intents)
#Read configuration file:
config = configparser.ConfigParser()
config.read('stroopwafel.ini')
bot.tokens = config["tokens"]
bot.hdChannels = {}
for channel in config["channels"]: #channelIDs must be integers
bot.hdChannels[channel] = int(config["channels"][channel])
#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
async def on_ready():
await add_cogs(bot)
print('Logged in as:\n{0} (ID: {0.id})'.format(bot.user))
bot.run(bot.tokens["discordbot"])
bot.run(os.getenv("STROOP_DISCORD_TOKEN"))