keyboard_bar_inline_tarif_buy_status = InlineKeyboardMarkup(row_width=1)
keyboard_bar_inline_tarif_buy_status_btn1 = InlineKeyboardButton(text='1', callback_data='pay1')
keyboard_bar_inline_tarif_buy_status_btn2 = InlineKeyboardButton(text='2', callback_data='pay2')
keyboard_bar_inline_tarif_buy_status_btn3 = InlineKeyboardButton(text='3', callback_data='pay3')
keyboard_bar_inline_tarif_buy_status_btn4 = InlineKeyboardButton(text='4', callback_data='pay4')
keyboard_bar_inline_tarif_buy_status_btn5 = InlineKeyboardButton(text='5', callback_data='pay5')
keyboard_bar_inline_tarif_buy_status_btn6 = InlineKeyboardButton(text='6', callback_data='pay6')
@dp.message_handler(lambda message: message.text == ' Мои покупки')
async def buy_status(message : types.Message):
cur.execute('SELECT TARIF1 FROM users')
data_total = cur.fetchone()
if data_total[0] == 'PAID':
keyboard_bar_inline_tarif_buy_status.add(keyboard_bar_inline_tarif_buy_status_btn1)
cur.execute('SELECT TARIF2 FROM users')
data_total = cur.fetchone()
if data_total[0] == 'PAID':
keyboard_bar_inline_tarif_buy_status.add(keyboard_bar_inline_tarif_buy_status_btn2)
cur.execute('SELECT TARIF3 FROM users')
data_total = cur.fetchone()
if data_total[0] == 'PAID':
keyboard_bar_inline_tarif_buy_status.add(keyboard_bar_inline_tarif_buy_status_btn3)
cur.execute('SELECT TARIF4 FROM users')
data_total = cur.fetchone()
if data_total[0] == 'PAID':
keyboard_bar_inline_tarif_buy_status.add(keyboard_bar_inline_tarif_buy_status_btn4)
cur.execute('SELECT TARIF5 FROM users')
data_total = cur.fetchone()
if data_total[0] == 'PAID':
keyboard_bar_inline_tarif_buy_status.add(keyboard_bar_inline_tarif_buy_status_btn5)
cur.execute('SELECT TARIF6 FROM users')
data_total = cur.fetchone()
if data_total[0] == 'PAID':
keyboard_bar_inline_tarif_buy_status.add(keyboard_bar_inline_tarif_buy_status_btn6)
await bot.send_message(message.from_user.id, f' Ваши купленные паки:', reply_markup=keyboard_bar_inline_tarif_buy_status, parse_mode='Markdown')
await bot.send_message(message.from_user.id, f' Ваши купленные паки:', reply_markup=keyboard_bar_inline_tarif_buy_status, parse_mode='Markdown')
keyboard_bar_inline_tarif_buy_status
у вас глобальная переменная@dp.message_handler(lambda message: message.text == ' Мои покупки')
async def buy_status(message : types.Message):
await bot.send_message(message.from_user.id, f' Ваши купленные паки:', reply_markup=keyboard_bar_inline_tarif_buy_status(), parse_mode='Markdown')
def keyboard_bar_inline_tarif_buy_status():
kb = InlineKeyboardMarkup(row_width=1)
for i in range(1, 7):
cur.execute(f'SELECT TARIF{i} FROM users')
data_total = cur.fetchone()
if data_total[0] == 'PAID':
kb.add(InlineKeyboardButton(text=f'{i}', callback_data=f'pay{i}'))
return kb