import telebot
import config
bot = telebot.TeleBot(config.TOKEN)
@bot.message_handler(commands=['start'])
def main(message):
msg = bot.send_message(message.chat.id, 'Введите ваше имя...')
bot.register_next_step_handler(msg, Data_User)
def Data_User(message):
pass
bot.polling()
from colorama import init, Fore
import sqlite3
import config
init()
db = sqlite3.connect(config.BD)
sql = db.cursor()
sql.execute("""
CREATE TABLE IF NOT EXISTS names(
name TEXT
);
""")
db.commit()
sql.execute('SELECT name FROM names')
if sql.fetchone() is None:
sql.execute(f'INSERT INTO names VALUES ("{None}")')
print(Fore.GREEN + 'Зарегистрировано')
db.commit()
else:
print(Fore.RED + 'Уже зарегистрировано')