Ничего не засчитываеться, почему-то не начисляються ириски за нажатие на инлайн кнопки просто и супер клика, не добавляються простой и супер клик. Ничего не увеличиваеться.

import sqlite3
import datetime

def init_database():
    conn = sqlite3.connect('clicker.db')
    cursor = conn.cursor()

    cursor.execute('''
    CREATE TABLE IF NOT EXISTS users (
        user_id INTEGER PRIMARY KEY,
        simple_clicks INTEGER DEFAULT 0,
        super_clicks INTEGER DEFAULT 0,
        balance REAL DEFAULT 0.0,
        last_super_click TEXT,
        referred INTEGER DEFAULT 0,
        referral_count INTEGER DEFAULT 0,
        is_new INTEGER DEFAULT 1 
    )''')

    conn.commit()
    conn.close()

def user_exists(user_id):
    conn = sqlite3.connect('clicker.db')
    cursor = conn.cursor()
    cursor.execute('SELECT 1 FROM users WHERE user_id = ?', (user_id,))
    exists = cursor.fetchone() is not None
    conn.close()
    return exists

def is_new_user(user_id):
    conn = sqlite3.connect('clicker.db')
    cursor = conn.cursor()
    cursor.execute('SELECT is_new FROM users WHERE user_id = ?', (user_id,))
    result = cursor.fetchone()
    conn.close()
    return result[0] == 1 if result else False

def mark_user_as_existing(user_id):
    conn = sqlite3.connect('clicker.db')
    cursor = conn.cursor()
    cursor.execute('UPDATE users SET is_new = 0 WHERE user_id = ?', (user_id,))
    conn.commit()
    conn.close()

def update_user_to_existing(user_id):
    conn = sqlite3.connect('clicker.db')
    cursor = conn.cursor()
    cursor.execute('UPDATE users SET is_new = 0 WHERE user_id = ?', (user_id,))
    conn.commit()
    conn.close()

def register_new_user(user_id, referred=False):
    conn = sqlite3.connect('clicker.db')
    cursor = conn.cursor()

    cursor.execute('INSERT INTO users (user_id, referred) VALUES (?, ?)', (user_id, int(referred)))
    conn.commit()
    conn.close()

def increment_referrals_count(user_id):
    conn = sqlite3.connect('clicker.db')
    cursor = conn.cursor()

    cursor.execute('UPDATE users SET referral_count = referral_count + 1 WHERE user_id = ?', (user_id,))
    conn.commit()
    conn.close()

def get_user_data(user_id):
    conn = sqlite3.connect('clicker.db')
    cursor = conn.cursor()

    cursor.execute('SELECT simple_clicks, super_clicks, balance, last_super_click, referral_count FROM users WHERE user_id = ?', (user_id,))
    result = cursor.fetchone()

    if not result:
        cursor.execute('INSERT INTO users (user_id) VALUES (?)', (user_id,))
        conn.commit()
        return (0, 0, 0.0, None, 0)
    else:
        return result
    
def get_simple_clicks(user_id):
    conn = sqlite3.connect('clicker.db')
    cursor = conn.cursor()
    cursor.execute('SELECT simple_clicks FROM users WHERE user_id = ?', (user_id,))
    result = cursor.fetchone()
    conn.close()
    return result[0] if result else 0

def get_super_clicks(user_id):
    conn = sqlite3.connect('clicker.db')
    cursor = conn.cursor()
    cursor.execute('SELECT super_clicks FROM users WHERE user_id = ?', (user_id,))
    result = cursor.fetchone()
    conn.close()
    return result[0] if result else 0

def get_balance(user_id):
    conn = sqlite3.connect('clicker.db')
    cursor = conn.cursor()
    cursor.execute('SELECT balance FROM users WHERE user_id = ?', (user_id,))
    result = cursor.fetchone()
    conn.close()
    return result[0] if result else 0.0

def get_referral_count(user_id):
    conn = sqlite3.connect('clicker.db')
    cursor = conn.cursor()
    cursor.execute('SELECT referral_count FROM users WHERE user_id = ?', (user_id,))
    result = cursor.fetchone()
    conn.close()
    return result[0] if result else 0
    
def get_last_super_click(user_id):
    conn = sqlite3.connect('clicker.db')
    cursor = conn.cursor()
    cursor.execute('SELECT last_super_click FROM users WHERE user_id = ?', (user_id,))
    result = cursor.fetchone()
    conn.close()
    return result[0] if result else None

def update_click_data(user_id, click_type, value):
    conn = sqlite3.connect('clicker.db')
    cursor = conn.cursor()

    if click_type == 'simple':
        cursor.execute('UPDATE users SET simple_clicks = simple_clicks + 1, balance = balance + ? WHERE user_id = ?', (value, user_id))
    elif click_type == 'super':
        now = datetime.datetime.now().isoformat()
        cursor.execute('UPDATE users SET super_clicks = super_clicks + 1, balance = balance + ?, last_super_click = ? WHERE user_id = ?', (value, now, user_id))

    conn.commit()
    conn.close()

def can_super_click(last_super_click):
    if last_super_click is None:
        return True

    last_click_time = datetime.datetime.fromisoformat(last_super_click)
    now = datetime.datetime.now()

    return (now - last_click_time).days >= 1

import telebot
from telebot.types import InlineKeyboardMarkup, InlineKeyboardButton
from tnik import TOKEN
from message import (
    WELCOME_MESSAGE, EARN_BUTTON_TEXT, PROFILE_BUTTON_TEXT, REFERRAL_BUTTON_TEXT,
    NORMAL_CLICK_BUTTON, SUPER_CLICK_BUTTON,
    REFRESH_STATS_BUTTON, MAX_SUPER_CLICKS_MESSAGE, REFERRAL_REWARD, REFERRAL_MESSAGE
)
from database import (
    init_database, get_simple_clicks, get_super_clicks, get_balance,
    get_referral_count, get_last_super_click, update_click_data, 
    can_super_click, register_new_user, increment_referrals_count, user_exists, is_new_user, mark_user_as_existing
)
from button_job import create_earn_button
from profile_button import handle_profile

bot = telebot.TeleBot(TOKEN)

init_database()

def create_inline_buttons():
    markup = InlineKeyboardMarkup()
    normal_click_button = InlineKeyboardButton(NORMAL_CLICK_BUTTON, callback_data='normal_click')
    super_click_button = InlineKeyboardButton(SUPER_CLICK_BUTTON, callback_data='super_click')
    markup.row(normal_click_button, super_click_button)

    refresh_button = InlineKeyboardButton(REFRESH_STATS_BUTTON, callback_data='refresh')
    markup.add(refresh_button)

    return markup

@bot.message_handler(commands=['start'])
def send_welcome(message):
    parts = message.text.split()
    referred_by = int(parts[1]) if len(parts) > 1 else None
    user_id = message.from_user.id

    if referred_by and user_id != referred_by and not user_exists(user_id):
        register_new_user(user_id, referred=True)

        if user_exists(referred_by):
            update_click_data(referred_by, 'balance', REFERRAL_REWARD)
            increment_referrals_count(referred_by)
            bot.send_message(referred_by, "*Вы пригласили друга и заработали 3 Ирис 🍬!*", parse_mode='Markdown')

    elif user_exists(user_id) and is_new_user(user_id):
        update_click_data(user_id, 'balance', REFERRAL_REWARD)  
        mark_user_as_existing(user_id)
        bot.send_message(message.chat.id, "Вы успешно зарегистрировались!")

    bot.send_message(
        message.chat.id,
        f"*{WELCOME_MESSAGE}*",
        parse_mode='Markdown',
        reply_markup=create_earn_button()
    )

@bot.message_handler(func=lambda m: m.text == EARN_BUTTON_TEXT)
def send_earn_message(message):
    user_id = message.from_user.id
    simple_clicks = get_simple_clicks(user_id)
    super_clicks = get_super_clicks(user_id)
    balance = get_balance(user_id)

    earn_message = (
        f"За каждый простой клик вы получите: 0.005 Ириса 🍬 🟢\n"
        f"За каждый супер клик вы получите: 0.2 Ириса 🍬 🔴\n\n"
        f"*Всего простых кликов: {simple_clicks} 🟢*\n"
        f"*Всего супер кликов: {super_clicks} 🔴*"
    )

    bot.send_message(
        message.chat.id,
        earn_message,
        parse_mode='Markdown',
        reply_markup=create_inline_buttons()
    )

@bot.message_handler(func=lambda m: m.text == PROFILE_BUTTON_TEXT)
def show_profile(message):
    handle_profile(bot, message)

@bot.message_handler(func=lambda m: m.text == REFERRAL_BUTTON_TEXT)
def show_referral(message):
    user_id = message.from_user.id
    username = bot.get_me().username
    referral_link = f"https://t\\.me/{username}\\?start={user_id}"

    referral_message = (
        f"*👥 Пригласите друзей и получайте по 3 Ирис 🍬*\n\n"
        f"*🔗 Ваша ссылка:* `{referral_link}`"
    )

    try:
        bot.send_message(
            message.chat.id,
            referral_message,
            parse_mode='MarkdownV2'
        )
    except telebot.apihelper.ApiTelegramException as e:
        print(f"Error occurred when sending referral message: {e}")

@bot.callback_query_handler(func=lambda call: True)
def callback_inline(call):
    user_id = call.from_user.id

    if call.data == 'normal_click':
        update_click_data(user_id, 'simple', 0.005)
        bot.answer_callback_query(call.id, "Добавлено 0.005 Ириса")

    elif call.data == 'super_click':
        last_super_click = get_last_super_click(user_id)
        super_clicks = get_super_clicks(user_id)
        
        if super_clicks >= 5 and not can_super_click(last_super_click):
            bot.answer_callback_query(call.id, MAX_SUPER_CLICKS_MESSAGE, show_alert=True)
        else:
            update_click_data(user_id, 'super', 0.2)
            bot.answer_callback_query(call.id, "Добавлено 0.2 Ириса")

    elif call.data == 'refresh':
        simple_clicks = get_simple_clicks(user_id)
        super_clicks = get_super_clicks(user_id)
        balance = get_balance(user_id)
        
        new_earn_message = (
            f"За каждый простой клик вы получите: 0.005 Ириса 🍬 🟢\n"
            f"За каждый супер клик вы получите: 0.2 Ириса 🍬 🔴\n\n"
            f"*Всего простых кликов: {simple_clicks} 🟢*\n"
            f"*Всего супер кликов: {super_clicks} 🔴*"
        )

        try:
            bot.edit_message_text(
                chat_id=call.message.chat.id,
                message_id=call.message.message_id,
                text=new_earn_message,
                parse_mode='Markdown',
                reply_markup=create_inline_buttons()
            )
        except telebot.apihelper.ApiTelegramException as e:
            if "message is not modified" in str(e):
                pass
            else:
                raise

if __name__ == '__main__':
    bot.polling(none_stop=True)