コード例 #1
0
def check_data_base_heal_th():
    # https://stackoverflow.com/a/41961968
    is_database_working = False
    output = "No Database is set"
    if not Config.DB_URI:
        return is_database_working, output
    from userbot.modules.sql_helper import SESSION

    try:
        # to check database we will execute raw query
        SESSION.execute("SELECT 1")
    except Exception as e:
        output = f"❌ {str(e)}"
        is_database_working = False
    else:
        output = "Functioning Normally"
        is_database_working = True
    return is_database_working, output
コード例 #2
0
def del_blacklist_all():
    SESSION.execute("""TRUNCATE TABLE blacklist""")
    SESSION.commit()
コード例 #3
0
def del_flist_all():
    SESSION.execute("""TRUNCATE TABLE fban""")
    SESSION.commit()