From 395e8945376a2aec393b52dd0f8661f231ee62ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Forr=C3=B3?= Date: Wed, 9 Sep 2020 10:27:41 +0200 Subject: [PATCH] Add debug mode --- bot.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bot.py b/bot.py index c3554ce..d8833f2 100644 --- a/bot.py +++ b/bot.py @@ -29,16 +29,12 @@ TWITTER_COLOR = 0x1da1f2 YOUTUBE_COLOR = 0xff0000 -logger = logging.getLogger('discord') -logger.addHandler(logging.StreamHandler()) -logger.setLevel(logging.INFO) - - config = configparser.ConfigParser() config.read(os.getenv('CHEDDAR_KNIGHT_CONFIG', 'settings.cfg')) staging = config.getboolean('General', 'staging', fallback=False) +debug = config.getboolean('General', 'debug', fallback=False) storage_path = config.get('General', 'storage_path') token = config.get('Discord', 'token') @@ -53,6 +49,11 @@ yt_api_key = config.get('YouTube', 'api_key') yt_channel_id = config.get('YouTube', 'channel_id') +logger = logging.getLogger('discord') +logger.addHandler(logging.StreamHandler()) +logger.setLevel(logging.DEBUG if debug else logging.INFO) + + class Bot(discord.Client): def __init__(self): self.commands = (