def start(bot, update):
message = update.message
base_work.user_init(message.chat.id, message.chat.username, message.chat.first_name)
def post_sql_query(sql_query):
with sqlite3.connect(database) as connection:
cursor = connection.cursor()
try:
cursor.execute(sql_query)
except Error:
print(Error)
result = cursor.fetchall()
return result
def delete_user(user_id):
del_user_query = f'DELETE FROM users WHERE user_id = {user_id};'
post_sql_query(del_user_query)
try:
bot.send_message(user_id, text)
except telebot.apihelper.ApiException:
delete_user(user_id)