Files
stroopwafel/Stroopwafel.py
T
2020-04-02 01:26:34 +02:00

53 lines
1.4 KiB
Python

import asyncio
import discord
#import Music
import Shitpost
import General
import Cryptocoin
import Chatbot
import Points
import logging
import importlib
import configparser
import base64
from discord.ext import commands
logging.basicConfig(level=logging.INFO)
bot = commands.Bot(command_prefix=commands.when_mentioned_or('!'), description='Stroopwafel. Shitpost bot extraordinaire.', pm_help=True)
#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.add_cog(Music.Music(bot))
#TODO: Re-add music functions now that we require a stronger host
bot.add_cog(Shitpost.Shitpost(bot))
bot.add_cog(General.General(bot))
bot.add_cog(Cryptocoin.Cryptocoin(bot))
bot.add_cog(Chatbot.Chatbot(bot))
pointsBot = Points.Points(bot)
bot.add_cog(pointsBot)
@bot.event
@asyncio.coroutine
def on_ready():
print('Logged in as:\n{0} (ID: {0.id})'.format(bot.user))
#TODO: find out how to do this properly:
pointsBot.init()
bot.run(bot.tokens["discordbot"])