mmpy_bot icon indicating copy to clipboard operation
mmpy_bot copied to clipboard

LOG_LEVEL never gets set and blocks bot from initiating

Open ghost opened this issue 1 year ago • 0 comments

Describe the bug I cannot set the LOG_LEVEL setting and mmpy_bot will not initiate. I have tried 2.2.0 and the latest master branch.

How To Reproduce This is the code I used to create the bot

def run_mattermost_bot(app, plugins):
    """Initialize and run the Mattermost bot with specified plugins."""
    bot = Bot(
        settings=Settings(
            MATTERMOST_URL=app.config.get("MATTERMOST_API_URL"),
            MATTERMOST_PORT=443,
            BOT_TOKEN=app.config.get("MATTERMOST_BOT_TOKEN"),
            BOT_TEAM=app.config.get("MATTERMOST_TEAM"),
            SSL_VERIFY=True,
            LOG_LEVEL=logging.INFO,
        ),
        plugins=plugins,
    )
  bot.run()

If I want to workaround this, I can add the following check inside mmpy_bot/settings.py (line ~ 124)

        elif f.type in [int, float, str]:  # type: ignore
            if f.name == "LOG_LEVEL":
                value = logging.getLevelName(value)
            value = f.type(value)

Expected behavior I expect the bot to boot up/initiate

Operating Environment (please complete the following information):

  • 2.2.0
  • mattermostdriver/mattermostautodriver Version: 1.3.0
  • Mattermost Server Version: 9.11.1
  • Python Version: 3.13
  • OS: Linux

Additional context This is a flask app.

ghost avatar Nov 29 '24 17:11 ghost