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()
def ref_get(ref_chid): connection = get_db_connection(DBNAME) cursor = connection.cursor() cursor.execute(queries['referal_get'], (ref_chid,)) return cursor.fetchone()[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]
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()
def max_id(): connection = get_db_connection(DBNAME) cursor = connection.cursor() cursor.execute(queries['max_id']) return cursor.fetchone()[0]
def gl_rate(): connection = get_db_connection(DBNAME) cursor = connection.cursor() cursor.execute(queries['gl_rate']) return cursor.fetchall()
def upd_rating(message, rate): connection = get_db_connection(DBNAME) cursor = connection.cursor() cursor.execute(queries['rating_update'], (rate, message.chat.id)) connection.commit()
def ques_9(): connection = get_db_connection(DBNAME) cursor = connection.cursor() cursor.execute(queries['Rand_q']) return cursor.fetchall()