Answer the question
In order to leave comments, you need to log in
Why is the database not populated?
There is this code:
import sqlite3 as sq
conn = sq.connect("main.db", check_same_thread=False)
cur = conn.cursor()
cur.execute("""CREATE TABLE IF NOT EXISTS users(
username TEXT,
id_tele TEXT,
user_id INTEGER PRIMARY KEY
)""")
@bot.message_handler(commands=['start'])
def welc(message):
idUser = message.from_user.id
userName = message.from_user.first_name
bot.send_message(message.chat.id, "Что хотите узнать?")
cur.execute("INSERT INTO users(username, id_tele) VALUES(:name, :id)", {'name': userName, 'id': idUser})
cur.close()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question