Не срабатывает schedule / Python Telegram Bot на канале

Доброго дня) Начал программировать не так давно, но к сожалению, на этот вопрос ответ не смог найти. От бота требуется, чтобы он утром на канал присылал температуру, курсы валют. Не могу настроить задачу по расписанию, мозгов не хватает. Помогите пожалуйста, что нужно дописать?

import config
import telebot
import requests
import schedule
import time
from my_parser import parse
from bs4 import BeautifulSoup as BS
bot = telebot.TeleBot(config.token)

r = requests.get('https://example')
html = BS(r.content, 'html.parser')

for el in html.select('#content'):
    t_min = el.select('.temperature .min')[0].text
    t_max = el.select('.temperature .max')[0].text
    min_text = el.select('.wDescription .description')[0].text
    t_test = el.select('.wDescription .description')[0].text

response = requests.get(url='https://example')
data = response.json()
btc_price = f"B: {round(data.get('btc_usd').get('last'), 2)}$"

@bot.message_handler(commands=['start', 'help'])
def main(message):
    bot.send_message(
        message.chat.id, t_min + ', ' + t_max + '\n' + min_text + '\n' + parse() + '\n' + btc_price)


if __name__ == '__main__':
    bot.polling(none_stop=True, interval=0)
    schedule.every(1).seconds.do(main)

    while True:
        schedule.run_pending()
        time.sleep(1)

Сам бот по команде отрабатывает, как требуется дописать, чтобы бот на канал писал сам после запуска на хостинге?


Ответы (0 шт):