Plex-Bot-Music/PlexBot/__main__.py
Joshua Arulsamy 1a8ec5f21f ♻️ Helpful documentation
Add docstrings and other useful comments.

Extended variable names to be more descriptive.
2020-08-09 14:47:00 -06:00

36 lines
837 B
Python

"""Main entrypoint for bot
Sets up loggers and initiates bot.
"""
import logging
from discord.ext.commands import Bot
from . import load_config
from .bot import General
from .bot import Plex
# Load config from file
config = load_config("config.yaml")
BOT_PREFIX = config["discord"]["prefix"]
TOKEN = config["discord"]["token"]
BASE_URL = config["plex"]["base_url"]
PLEX_TOKEN = config["plex"]["token"]
LIBRARY_NAME = config["plex"]["library_name"]
# Set appropiate log level
root_log = logging.getLogger()
plex_log = logging.getLogger("Plex")
bot_log = logging.getLogger("Bot")
plex_log.setLevel(config["plex"]["log_level"])
bot_log.setLevel(config["discord"]["log_level"])
bot = Bot(command_prefix=BOT_PREFIX)
bot.add_cog(General(bot))
bot.add_cog(Plex(bot, BASE_URL, PLEX_TOKEN, LIBRARY_NAME, BOT_PREFIX))
bot.run(TOKEN)