телеграм бот не обрабатывает сообщения
import telebot
import sqlite3
import os
from data.token import TOKEN
bot = telebot.TeleBot(TOKEN)
bot.message_handler(commands=["reg"])
def reg(message):
print("проходит регестрация")
conn = sqlite3.connect(os.path.realpath("home/orekhin/PvZ_World/data/users.db"))
cur = conn.cursor()
cur.execute("CREATE TABLE IF NOT EXISTS users (id, username, password, name, money, credits, brilliants, location, cards_count, home, money_in_bank, money_for_sell, last_opened, priv, rank, bonus, all_power, tactic)")
conn.commit()
cur.close()
conn.close()
bot.send_message(message.chat.id, "введи свой ник")
bot.register_next_step_handler(message, enter_name)
def enter_name(message):
name = message.text
bot.send_message(message.chat.id, "и наконец введи пароль")
bot.register_next_step_handler(message, enter_password)
return name
def enter_password(message):
password = message.text
conn = sqlite3.connect(os.path.realpath("home/orekhin/PvZ_World/data/users.db"))
cur = conn.cursor()
cur.execute("INSERT INTO users(id, username, password, name, money, credits, brilliants, location, home, money_in_bank, money_for_sell, last_opened, priv, rank, bonus, all_power, tactic) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", (message.from_user.id, message.from_user.user_name, password, name, 0, 0, 0, 18, 0, 0, 0, None, "player", "player", False, 0, "default"))
conn.commit()
cur.close()
conn.close()
bot.send_message(message.chat.id, "регистрация успешно окончена")
if __name__ == "__main__":
print("бот онлайн")
bot.delete_webhook()
bot.infinity_polling()
бот не реагирует на сообщение /reg