Plex-Bot-Music/PlexBot/__main__.py

30 lines
723 B
Python
Raw Normal View History

2020-07-23 06:21:41 +02:00
from discord.ext.commands import Bot
from .bot import General
from .bot import Plex
from PlexBot import load_config
2020-07-27 06:08:00 +02:00
from . import FORMAT
2020-07-23 06:21:41 +02:00
2020-07-27 06:08:00 +02:00
import logging
# 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
LOG_LEVEL = config["general"]["log_level"]
# Set appropiate log level
logger = logging.getLogger("PlexBot")
logging.basicConfig(format=FORMAT)
logger.setLevel(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.run(TOKEN)