Не работают ответы на команды

После нажатия /start реакции никакой. Код:

import telebot
import schedule
import time
import telegram_send

bot = telebot.TeleBot("код есть")


@bot.message_handler(commands=["start"])
def reply_to(message):
    bot.reply_to(message, text="Howdy, how are you doing?")

    bot.infinity_poling()


def goodnight():
    telegram_send.send(messages=["текст!!"])


def airalarm():
    telegram_send.send(messages=["текст"])


schedule.every().day.at("22:23").do(goodnight)
schedule.every().day.at("17:50").do(airalarm)

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


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

Автор решения: oleksandrigo

Вытащите из хендлера bot.infinity_poling()

import telebot
import schedule
import time
import telegram_send

bot = telebot.TeleBot("код есть")


@bot.message_handler(commands=["start"])
def reply_to(message):
    bot.reply_to(message, text="Howdy, how are you doing?")


def goodnight():
    telegram_send.send(messages=["текст!!"])


def airalarm():
    telegram_send.send(messages=["текст"])


schedule.every().day.at("22:23").do(goodnight)
schedule.every().day.at("17:50").do(airalarm)

bot.infinity_poling()

while True:
    schedule.run_pending()
    time.sleep(1)
→ Ссылка
Автор решения: Gnifajio

Я мог бы решить Вашу проблему, но я просто посоветую Вам:

  1. Не пишите на telebot.
  2. Используйте aiogram (Статья для новичков).
  3. Почитать данные материалы.

С уважением, Gnifajio None

→ Ссылка