Plex-Bot-Music/PlexBot/__main__.py

36 lines
837 B
Python
Raw Normal View History

"""Main entrypoint for bot
Sets up loggers and initiates bot.
"""
import logging
2020-07-23 06:21:41 +02:00
from discord.ext.commands import Bot
from . import load_config
2020-07-23 06:21:41 +02:00
from .bot import General
from .bot import Plex
2020-07-27 06:08:00 +02:00
# Load config from file
2020-07-23 06:21:41 +02:00
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"]
2020-07-27 06:08:00 +02:00
# 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"])
2020-07-23 06:21:41 +02:00
bot = Bot(command_prefix=BOT_PREFIX)
bot.add_cog(General(bot))
bot.add_cog(Plex(bot, BASE_URL, PLEX_TOKEN, LIBRARY_NAME, BOT_PREFIX))
2020-07-23 06:21:41 +02:00
bot.run(TOKEN)