2020-11-13 01:49:39 +01:00
|
|
|
import sys
|
2020-11-13 15:51:12 +01:00
|
|
|
from os import listdir
|
|
|
|
from discord.ext.commands import Bot
|
|
|
|
from src.utils.config import build_config
|
2020-11-13 01:49:39 +01:00
|
|
|
|
2020-11-13 15:51:12 +01:00
|
|
|
# read config at configured location \\ default to 'config.ini'
|
|
|
|
config = build_config()
|
|
|
|
|
|
|
|
# spawn discord bot instance
|
2020-11-13 01:49:39 +01:00
|
|
|
# init token from config
|
2020-11-13 15:51:12 +01:00
|
|
|
bot = Bot(command_prefix="~ak ")
|
2020-11-15 01:37:27 +01:00
|
|
|
TOKEN = config['AUTH']['token']
|
2020-11-13 01:49:39 +01:00
|
|
|
|
2020-11-13 15:51:12 +01:00
|
|
|
# load extensions
|
2020-11-15 15:44:03 +01:00
|
|
|
for file in listdir("src/ext"):
|
2020-11-13 15:51:12 +01:00
|
|
|
if file.endswith(".py"):
|
|
|
|
name = file[:-3]
|
2020-11-15 15:44:03 +01:00
|
|
|
bot.load_extension(f"src.ext.{name}")
|
2020-11-13 15:51:12 +01:00
|
|
|
|
2020-11-13 01:49:39 +01:00
|
|
|
if __name__ == "__main__":
|
2020-11-15 15:44:03 +01:00
|
|
|
print("[INFO]: Starting bot...")
|
2020-11-15 01:37:27 +01:00
|
|
|
# use token from config
|
|
|
|
bot.run(TOKEN)
|