import telebot
import config
import sqlite3
bot = telebot.TeleBot(config.TOKEN)
db = sqlite3.connect('bot_db')
cursor = sqlite3.cursor()
cursor.execute("""CREATE TABLE IF NOT EXISTS users(
login text,
password text
)""")
db.commit()
@bot.message_handler(commands=['start'])
def get_login(message):
sent = bot.send_message(message.chat.id, "Введите логин: ")
bot.register_next_step_handler(sent, login)
def login(message):
login = message.text
def get_password(message):
mess = bot.send_message(message.chat.id, "Введите пароль: ")
bot.register_next_step_handler(mess, password)
def password(message):
password = message.text
def reg(message):
cursor.execute(f"SELECT login FROM users WHEN login = '{login}'")
if cursor.fetchone() is None:
cursor.execute("INSERT INTO users VALUES (?, ?)", (login, password))
db.commit()
bot.send_message(message.chat.id, 'Вы успешно зарегистрированы!')
else:
bot.send_message(message.chat.id, 'Такой пользователь уже существует!')
bot.polling(none_stop=True)
File "C:\Users\1\Desktop\other_projects\test_login_bot\bot.py", line 20
bot.register_next_step_handler(sent, login)
^
IndentationError: unindent does not match any outer indentation level
PS C:\Users\1\Desktop\other_projects\test_login_bot>