Example #1
0
def register(user_id):
    connection = get_connection()
    try:
        with connection.cursor() as cursor:
            result = cursor.execute(
                f"SELECT * FROM account WHERE uid={user_id}")
            row = cursor.fetchone()
            if result != 0:
                return '0'
            else:
                ni = nik()
                id = RanID()
                cursor.execute(
                    f"INSERT INTO account(nik, uid, id) VALUES('{ni}', {user_id}, '{id}')"
                )
                connection.commit()
                cursor.execute(f"SELECT * FROM account WHERE uid={user_id}")
                row = cursor.fetchone()
                cursor.execute(
                    f"INSERT INTO limitt(limit1, id, limit2, limit3, limit4, limit5, limit6, limit7) VALUES('0', {row[1]}, '0', '0', '0', '0', '0', '0')"
                )
                connection.commit()
                cursor.execute(f"SELECT * FROM account WHERE uid={user_id}")
                row = cursor.fetchone()
                cursor.execute(
                    f"INSERT INTO UserAnime(id, pros_count, zap_count, pere_count, look_count, brosh_count) VALUES({row[1]}, '0', '0', '0', '0', '0')"
                )
                connection.commit()
    finally:
        connection.close()
Example #2
0
def Anime():
    connection = get_connection()
    try:
        with connection.cursor() as cursor:
            cursor.execute(f"SELECT COUNT(*) FROM Animebd")
            return cursor.fetchone()[0]
    finally:
        connection.close()
Example #3
0
def a(id):
    connection = get_connection()
    try:
        with connection.cursor() as cursor:
            cursor.execute(f"SELECT * FROM Animebd WHERE id = '{int(id) + 1}'")
            row = cursor.fetchone()
            return row
    finally:
        connection.close()
Example #4
0
def nik():
    count = random.randint(1, 99999)
    connction = get_connection()
    try:
        with connction.cursor() as cursor:
            result = cursor.execute(f"SELECT * FROM account WHERE nik={count}")
            if str(count) not in str(result):
                return f"user{count}"
    finally:
        connction.close()
Example #5
0
def ran_anime(count):
    connection = get_connection()
    try:
        with connection.cursor() as cursor:
            ran = random.randint(1, int(count))
            cursor.execute(f"SELECT * FROM Animebd WHERE id = '{ran}'")
            row = cursor.fetchone()
            return row
    finally:
        connection.close()
Example #6
0
def inumimi(text):
    connection = get_connection()
    try:
        with connection.cursor() as cursor:
            cursor.execute(f"SELECT * FROM Untitledd WHERE name = 'Инумими'")
            row = cursor.fetchone()
            two = row[1] + ', ' + text
            cursor.execute(f"UPDATE Untitledd SET text = '{two}' WHERE name = 'Инумими'")
            connection.commit()
    finally:
        connection.close()
Example #7
0
def check_animebd(name):
    connection = get_connection()
    try:
        with connection.cursor() as cursor:
            result = cursor.execute(f"SELECT * FROM Animebd WHERE Поиск = '{name}'")
            cursor.fetchone()
            if result == 1:
                return '1'
            else:
                return '0'
    finally:
        connection.close()
Example #8
0
def add_studia_anime(text, name):
    print(name)
    connection = get_connection()
    try:
        with connection.cursor() as cursor:
            cursor.execute(f"SELECT * FROM Animebd WHERE Названия = '{name}'")
            row = cursor.fetchone()[0]
            cursor.execute(
                f"UPDATE Animebd SET studio = '{text}' WHERE id = '{row}'")
            connection.commit()
    finally:
        connection.close()
Example #9
0
def limit_nik(user_id):
    connection = get_connection()
    try:
        with connection.cursor() as cursor:
            cursor.execute(f"SELECT * FROM limitt WHERE id={user_id}")
            row = cursor.fetchone()[6]
            if int(row) == 1:
                return '1'
            else:
                return '0'
    finally:
        connection.close()
Example #10
0
def RanID():
    while True:
        count = random.randint(1, 999999)
        connection = get_connection()
        try:
            with connection.cursor() as cursor:
                result = cursor.execute(
                    f"SELECT * FROM account WHERE id={count}")
                if count != result:
                    return count
        finally:
            connection.close()
Example #11
0
def name(user_id):
    connection = get_connection()
    try:
        with connection.cursor() as cursor:
            if user_id == str:
                cursor.execute(f"SELECT * FROM account WHERE nik = {user_id}")
                return cursor.fetchone()[0]
            else:
                cursor.execute(f"SELECT * FROM account WHERE id = {user_id}")
                return cursor.fetchone()[0]
    finally:
        connection.close()
Example #12
0
def register(user_id):
    connection = get_connection()
    try:
        with connection.cursor() as cursor:
            result = cursor.execute(f"SELECT * FROM admins WHERE uid={user_id}")
            row = cursor.fetchone()
            if result != 0:
                return row
            else:
                cursor.execute(f"INSERT INTO admins(admin_name, uid) VALUES('{nik()}', {user_id})")
                connection.commit()
    finally:
        connection.close()
Example #13
0
def nekomimi():
    connection = get_connection()
    try:
        with connection.cursor() as cursor:
            cursor.execute(f"SELECT * FROM Untitledd WHERE name = 'Некомими'")
            row = cursor.fetchone()[1]
            print(row)
            one = row.split(', ')
            print(one)
            ran = random.choice(one)
            return ran
    finally:
        connection.close()
Example #14
0
def check_two(text):
    connection = get_connection()
    try:
        with connection.cursor() as cursor:
            result = cursor.execute(
                f"SELECT * FROM Animebd WHERE Поиск = '{text}'")
            row = cursor.fetchone()
            print(row)
            if result == 1:
                return row
            else:
                return '0'
    finally:
        connection.close()
Example #15
0
def check_player_to_in_the_bd(user_id):
    connection = get_connection()
    try:
        with connection.cursor() as cursor:
            cursor.execute(f"SELECT * FROM account WHERE uid={user_id}")
            id = cursor.fetchone()
            print(id)
            if user_id in id:
                return '1'
            else:
                return '0'

    finally:
        connection.close()
Example #16
0
def add_box_text_anime(text, name):
    print(name)
    connection = get_connection()
    try:
        with connection.cursor() as cursor:
            print("+", text)
            cursor.execute(f"SELECT * FROM Animebd WHERE Названия = '{name}'")
            row = cursor.fetchone()
            cursor.execute(
                f"UPDATE Animebd SET box_text = '{text}' WHERE id = '{row[0]}'"
            )
            connection.commit()
    finally:
        connection.close()
Example #17
0
def add_name_anime(text):
    connection = get_connection()
    try:
        with connection.cursor() as cursor:
            cursor.execute(f"SELECT COUNT(*) FROM Animebd")
            count = cursor.fetchone()
            print(count)
            count = int(count[0]) + 1
            print(count)
            cursor.execute(
                f"INSERT INTO Animebd(Названия, id) VALUES('{text}', '{count}')"
            )
            connection.commit()
    finally:
        connection.close()
Example #18
0
def add_aniback_limit(user, count):
    connection = get_connection()
    try:
        with connection.cursor() as cursor:
            cursor.execute(f"SELECT * FROM account WHERE nik = '{user}'")
            row = cursor.fetchone()
            print(row)
            nam = row[2]
            num = row[3]
            print(nam, num)
            num += int(count)
            print(nam)
            cursor.execute(f"UPDATE account SET money = '{num}' WHERE uid    = {nam}")
            connection.commit()
    finally:
        connection.close()
Example #19
0
def check_anime(text):
    connection = get_connection()
    try:
        with connection.cursor() as cursor:
            result = cursor.execute(f"SELECT COUNT(id) FROM Animebd")
            row = cursor.fetchone()
            print(result)
            print(*row)
            for i in range(int(*row)):
                print(i)
                cursor.execute(f"SELECT Поиск FROM Animebd WHERE id = {i + 1}")
                anim = cursor.fetchone()
                print(anim)
                if text in str(anim).split(', '):
                    return f"1, {i}"
            return '0'
    finally:
        connection.close()
Example #20
0
def set_name(user_id, name):
    connection = get_connection()
    try:
        with connection.cursor() as cursor:
            cursor.execute(f"SELECT * FROM account WHERE uid={user_id}")
            ro = cursor.fetchone()[1]

            cursor.execute(
                f"UPDATE account SET nik = '{name}' WHERE uid = {user_id}")
            connection.commit()

            cursor.execute(f"UPDATE limitt SET limit6 = '1' WHERE id = {ro}")
            connection.commit()

            cursor.execute(f"SELECT * FROM account WHERE uid={user_id}")
            row = cursor.fetchone()
            return row[0]

    finally:
        connection.close()
Example #21
0
def id_2(user_id):
    connection = get_connection()
    try:
        with connection.cursor() as cursor:
            name_titul = "Тлько начало"
            cursor.execute(f"SELECT name_titul FROM Titul WHERE id={user_id}")
            tituls = cursor.fetchone()
            if name_titul not in str(*tituls):
                if tituls != None:
                    tit = str(*tituls) + ', ' + name_titul
                    print(tit)
                    cursor.execute(
                        f"UPDATE Titul SET name_titul = '{tit}' WHERE id = {user_id}"
                    )
                    connection.commit()
                else:
                    cursor.execute(
                        f"UPDATE Titul SET name_titul = '{name_titul}' WHERE id = {user_id}"
                    )
                    connection.commit()
            else:
                return '0'
    finally:
        connection.close()
Example #22
0
def reset_limit():
    connction = get_connection()