Answer the question
In order to leave comments, you need to log in
How to specify the correct ID of the last SMS?
Hello, my code collects information from the site and sends SMS to the channel, after which it is updated and the new data is already entered into the same SMS, simply by editing it using (bot.edit_message_text('55555555', chat_id=-00000, message_id=15 ) After finishing work, it closes and reopens and sends SMS again, already new and the same system, but there is such a problem that with each new SMS id changes, the previous one was 15, and the next one will be 16, then 17 and so on, How can I write a code so that it just changes the last SMS?
from selenium import webdriver
import time
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import TimeoutException
import telegram
browser = webdriver.Chrome()
browser.maximize_window()
browser.get('****************************')
def CC():
BOT_TOKEN = '******************************'
bot = telegram.Bot(token=BOT_TOKEN)
bot.edit_message_text('55555555', chat_id=*************, message_id=15)
Answer the question
In order to leave comments, you need to log in
I don't see the message being sent, only editing.
When sending the first message, save the reply:
response = bot.send_message(chat_id=chat_id, text=answer)
message_id = response.message_id
bot.edit_message_text('55555555', chat_id=*************, message_id=message_id)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question