from os import listdir from discord.ext.commands import Bot from configparser import ConfigParser from peewee import SqliteDatabase # read config at configured location \\ default to 'config.ini' config = ConfigParser() with open('config.ini', 'r') as configfile: config.read_file(configfile) # init db db = SqliteDatabase(config['DATABASE']['path']) db.connect() # spawn discord bot instance # init token from config bot = Bot(command_prefix="~ak ") TOKEN = config['AUTH']['token'] # load extensions for file in listdir("src/ext"): if file.endswith(".py"): name = file[:-3] bot.load_extension(f"src.ext.{name}") if __name__ == "__main__": print("[INFO]: Starting bot...") # use token from config bot.run(TOKEN)