コード例 #1
0
def random_ques():
    connection = get_db_connection(DBNAME)
    cursor = connection.cursor()
    cursor.execute(queries['max_ques_id'])
    max_ques_id = cursor.fetchone()[0]
    x = random.randrange(1, max_ques_id + 1, 1)
    cursor.execute(queries['random_question'], (x,))
    return cursor.fetchone()
コード例 #2
0
def ref_get(ref_chid):
    connection = get_db_connection(DBNAME)
    cursor = connection.cursor()
    cursor.execute(queries['referal_get'], (ref_chid,))
    return cursor.fetchone()[0]
コード例 #3
0
def get_money(message):
    connection = get_db_connection(DBNAME)
    cursor = connection.cursor()
    cursor.execute(queries['money_get'], (message.chat.id,))
    return cursor.fetchone()[0]
コード例 #4
0
def upd_money(message, money, earn):
    connection = get_db_connection(DBNAME)
    cursor = connection.cursor()
    cash = money + earn
    cursor.execute(queries['money_update'], (cash, message.chat.id))
    connection.commit()
コード例 #5
0
def max_id():
    connection = get_db_connection(DBNAME)
    cursor = connection.cursor()
    cursor.execute(queries['max_id'])
    return cursor.fetchone()[0]
コード例 #6
0
def gl_rate():
    connection = get_db_connection(DBNAME)
    cursor = connection.cursor()
    cursor.execute(queries['gl_rate'])
    return cursor.fetchall()
コード例 #7
0
def upd_rating(message, rate):
    connection = get_db_connection(DBNAME)
    cursor = connection.cursor()
    cursor.execute(queries['rating_update'], (rate, message.chat.id))
    connection.commit()
コード例 #8
0
def ques_9():
    connection = get_db_connection(DBNAME)
    cursor = connection.cursor()
    cursor.execute(queries['Rand_q'])
    return cursor.fetchall()