From 4adac3887120ca2463b3b5745ad71b5c60803dc2 Mon Sep 17 00:00:00 2001 From: Lili Date: Mon, 26 Sep 2022 11:10:48 +0200 Subject: [PATCH] add clear-queue CLI command --- tlapbot/owncast_helpers.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tlapbot/owncast_helpers.py b/tlapbot/owncast_helpers.py index b684b3f..9da62be 100644 --- a/tlapbot/owncast_helpers.py +++ b/tlapbot/owncast_helpers.py @@ -1,7 +1,9 @@ from flask import current_app import requests from sqlite3 import Error - +import click +from flask.cli import with_appcontext +from db import get_db # # # requests stuff # # # def is_stream_live(): @@ -144,4 +146,11 @@ def whole_redeem_queue(db): ) return cursor.fetchall() except Error as e: - print("Error occured selecting redeem queue:", e.args[0]) \ No newline at end of file + print("Error occured selecting redeem queue:", e.args[0]) + +@click.command('clear-queue') +@with_appcontext +def clear_queue_command(): + """Remove all redeems from the redeem queue.""" + clear_redeem_queue(get_db()) + click.echo('Cleared redeem queue.')