add prefix sanity check to init

tlapbot will throw runtime error if prefix isn't a single character
longer prefixes would break the bot bc of how redeems_handler.py works
This commit is contained in:
Lili (Tlapka) 2023-01-04 12:38:58 +01:00
parent 92a2a77c80
commit 6a3e74cdec
1 changed files with 5 additions and 0 deletions

View File

@ -31,6 +31,11 @@ def create_app(test_config=None):
app.logger.handlers = gunicorn_logger.handlers app.logger.handlers = gunicorn_logger.handlers
app.logger.setLevel(gunicorn_logger.level) app.logger.setLevel(gunicorn_logger.level)
# Check for wrong config that would break Tlapbot
if len(app.config['PREFIX']) != 1:
raise RuntimeError("Prefix is >1 character. "
"Change your config to set 1-character prefix.")
# prepare webhooks and redeem dashboard blueprints # prepare webhooks and redeem dashboard blueprints
from . import owncast_webhooks from . import owncast_webhooks
from . import owncast_redeem_dashboard from . import owncast_redeem_dashboard