51 lines
1.4 KiB
Python
51 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)
|
|
|
|
async def add_cogs(bot):
|
|
await bot.add_cog(Shitpost.Shitpost(bot))
|
|
await bot.add_cog(General.General(bot))
|
|
await bot.add_cog(Cryptocoin.Cryptocoin(bot))
|
|
await bot.add_cog(Chatbot.Chatbot(bot))
|
|
await bot.add_cog(Points.Points(bot))
|
|
|
|
|
|
bot = commands.Bot(command_prefix=commands.when_mentioned_or('!'), description='Stroopwafel. Shitpost bot extraordinaire.', pm_help=True, intents=discord.Intents.default())
|
|
|
|
#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"])
|