import sqlite3


def countFailures(username: str, filename: str='/sqlite/AutoTriageBotDB.sqlite3') -> int:
    """ Count the number of times the bot has failed for the given username """
    con = sqlite3.connect(filename)
    cur = con.cursor()
    cur.execute('SELECT COUNT(*) FROM Failures WHERE Username=?', (username.lower(),))
    ret = cur.fetchone()[0]
    con.commit()
    con.close()
    assert isinstance(ret, int)
    return ret