import requests import time import telebot import threading remnote_token="" remnote_userid="" remnote_parent="" telegram_token = "" bot = telebot.TeleBot(telegram_token) par={ "apiKey":remnote_token, "userId":remnote_userid, "text":"", "positionAmongstSiblings":0, "parentId":remnote_parent} url="https://api.remnote.io/api/v0/create" def handle_messages(messages): for message in messages: content_type=message.content_type username = message.from_user.username chat_id = message.chat.id user_id = message.from_user.id suser_id = str(user_id) if content_type=="text": msg = message.text print(f"({chat_id}) {username}: {msg}") par["text"]=msg requests.post(url,data=par) def bot_polling(): print("Bot started!") while True: bot.polling(none_stop=True) bot.set_update_listener(handle_messages) polling_thread = threading.Thread(target=bot_polling) polling_thread.daemon = True polling_thread.start() while True: time.sleep(1)