Пробовал так:
@bot.message_handler(content_types = ['text'])
def currency(message):
#parsing goolge
full_page = requests.get(url, headers = headers)
soup = BeautifulSoup(full_page.content, 'html.parser')
convert = soup.findAll('span', {'class': 'DFlfde', 'class': 'SwHCTb', 'data-precision': 2})
currency = convert[0].text
#send_message
if message.chat.type == 'private':
if message.text == ' Rate dollar ':
bot.send_message(message.chat.id,' Dollar now: ' + str(currency) + ' ₽ ')
while message.text == ' Track dollar ':
price = str(73.4)
differnce = str(0.1)
full_page = requests.get(url, headers = headers)
soup = BeautifulSoup(full_page.content, 'html.parser')
convert = soup.findAll('span', {'class': 'DFlfde', 'class': 'SwHCTb', 'data-precision': 2})
currency = convert[0].text
if currency >= price + differnce:
bot.send_message(message.chat.id, ' Course increased: ' + str(currency)+' ')
elif currency <= price - differnce:
bot.send_message(message.chat.id, '〽️ Course lowered: ' + str(currency)+' ')
elif message.text == '❗️ Track off ❗️':
break
time.sleep(2)
тоже не останавливает