import sqlite3
class Database:
def __init__(self, db_file):
self.connection = sqlite3.connect(db_file)
self.cursor = self.connection.cursor()
def add_user(self, user_id):
with self.connection:
return self.cursor.execute("INSERT OR IGNORE INTO `users` (`user_id`) VALUES (?)", (user_id,))
db.add_user(message.from_user.id)
from db import Database
db = Database('database.db')
isLiked1 = False
for i in ank:
while stop == False:
print(i) #проверка наличия анкет /debug
idCh = db.get_name(i) # получаем id пользоватаелей с анкетами (имя)
await bot.send_message(message.chat.id, idCh, reply_markup=markupreact) # выводим имя
db.add_i(message.chat.id, i)
stop = True
#await Form.find.set()
if message.text == 'лайк':
print("like")
isLiked1 = True
if isLiked1 == True:
stop = False
@dp.message_handler(state=Form.find)
async def process_name(message: types.Message, state: FSMContext):
async with state.proxy() as data:
if message.text == 'лайк':
id = db.get_i(message.chat.id)
await bot.send_message(id, "лайкнул вас")
#print("like")
isLiked1 = True