@bot.message_handler(content_types=['document'])
def handle_docs_photo(message):
try:
user_id = message.from_user.id
username = message.from_user.username
file_info = bot.get_file(message.document.file_id)
downloaded_file = bot.download_file(file_info.file_path)
src = 'images' + message.document.file_name;
with open(f"images/{src}", 'wb') as new_file:
new_file.write(downloaded_file)
con = sqlite3.connect("database.db")
cursor = con.cursor()
cursor.execute(f"ALTER TABLE users ADD COLUMN {src} integer")
cursor.execute(f'UPDATE users SET {src} = "images/{src}" WHERE telegram_id = "{user_id}"')
con.commit()
bot.send_message(message.chat.id, f"<b>Ваши обои приняты!Спасибо.</b>\n", parse_mode='html')
img = open(f"images/{src}", 'rb')
bot.send_message(admin_chat, f'User added new wallpaper!\n\ninfo: @{username} / {user_id} file name - {src}')
bot.send_photo(admin_chat, img)
except Exception as e:
print(str(e))
pass
В чем ошибка,я долго искал так и не понял. near ".": syntax error