add clear-queue CLI command

This commit is contained in:
Lili (Tlapka) 2022-09-26 11:10:48 +02:00
parent ed79404530
commit 4adac38871
1 changed files with 11 additions and 2 deletions

View File

@ -1,7 +1,9 @@
from flask import current_app from flask import current_app
import requests import requests
from sqlite3 import Error from sqlite3 import Error
import click
from flask.cli import with_appcontext
from db import get_db
# # # requests stuff # # # # # # requests stuff # # #
def is_stream_live(): def is_stream_live():
@ -144,4 +146,11 @@ def whole_redeem_queue(db):
) )
return cursor.fetchall() return cursor.fetchall()
except Error as e: except Error as e:
print("Error occured selecting redeem queue:", e.args[0]) 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.')