1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
import sqlite3 import telebot bot = telebot.TeleBot('6809588189:AAHJSF92zUc1M9q9Hw0mjnyDSXg1nNAmC6I') con = sqlite3.connect("users.db") cur = con.cursor() cur.execute("CREATE TABLE IF NOT EXISTS users(id, name)") @bot.message_handler(commands=['start']) def start(m, res=False): id_us = m.chat.id name_us = m.chat.username data = [ (id_us, name_us) ] cur.executemany("INSERT INTO users VALUES(?, ?)", data) con.commit() for row in cur.execute("SELECT id, name FROM users"): print(row) bot.polling(none_stop=True) |