title: Telegram Bot not responding after 3rd function call
body: <p>The issue is that the third function never seems to respond.
  I haven't been able to find a reason why this happens in the telegram documentation.
  Please let me know if you have this issue or seen it and know the solution.
  Even a post that references an issue like this would work.
  Thank you so much for the assistance.</p>
  <pre><code>from email import message
  import os
  import re
  import html
  import json
  import telebot
  import requests
  import http.client
  from pytube import *
  from dotenv import load_dotenv
  
  load_dotenv()
  
  # Creating hiding, and using API Keys
  API_KEY = os.getenv(&quot;API_KEY&quot;)
  RAPID_KEY = os.getenv(&quot;RAPID_API&quot;)
  bot = telebot.TeleBot(API_KEY)
  
  @bot.message_handler(commands=&quot;start&quot;)
  
  # Creating a help message for guidance on how to use bot.
  def help(message):
  
      # Trying to send help message, if unable to send, throw an error message for the user.
      try:
          bot.send_message(message.chat.id, &quot;Use \&quot;Youtube\&quot; and the video name to search for a video.\n&quot;)
      except:
          bot.send_message(message.chat.id, &quot;There was an error fetching help, the bot may be offline.\n&quot;)
   
  # Checking data and seeing if the word &quot;YouTube&quot; was used in order to start the search
  def data_validation(message):
      query = message.text.split() 
      if(&quot;youtube&quot; not in query[0].lower()):  # Set flag false if regular text
          return False
      else:
          return True
  
  @bot.message_handler(func=data_validation)
  
  # Searching for youtube videos
  # using RAPID API
  def search(message):
      query = message.text.split()
      
      # Check if data is valid, and change variable to be lowercase for easy use.
      if(data_validation(message) == True and query[0].lower() == &quot;youtube&quot;):
          try:
              if(data_validation(message) == True and query[1].lower() != &quot;-d&quot;):
      
                  # Removing the word &quot;YouTube&quot; and sending the results to the YouTube search engine.
                  for item in query[:]:
                      if(item.lower() == &quot;youtube&quot;):
                          query.remove(item)
                          search_query = ' '.join(query)
                      else:
                          pass #If it's not term we're looking to convert, ignore it.
  
                  # RAPID API for Youtube
                  try:
  
                      url = &quot;https://youtube-search-results.p.rapidapi.com/youtube-search/&quot;
                      querystring = {&quot;q&quot;:search_query}
  
                      headers = {
                          &quot;X-RapidAPI-Key&quot;: RAPID_KEY,
                          &quot;X-RapidAPI-Host&quot;: &quot;youtube-search-results.p.rapidapi.com&quot;
                      }
  
                      response = requests.request(&quot;GET&quot;, url, headers=headers, params=querystring) # Grabbing response information from URL
                      request = json.loads(response.text) # Parsing json string for python use
                      
                      # Testing to see if the RAPID API service responds and is online.
                      if(response.status_code == 503):
  
                          # If the service is not online, let the user know.
                          bot.send_message(message.chat.id, f&quot;The RAPID API service appears to be offline try back later.\n&quot;) 
  
                      if(response.status_code == 429):
  
                          # If the service has reached max quota for the day, let the user know.
                          bot.send_message(message.chat.id, f&quot;Max quota reached, try back in 24 hours.\n&quot;)
  
                      # Grabbing first link from json text and sending direct url and title.
                      first_link = str((request[&quot;items&quot;][0][&quot;url&quot;]))
  
                      bot.send_message(message.chat.id, f&quot;{first_link}\n&quot;) # Sending first link that was queried.
  
                  # If there are no results found for the requested video, sending an error message to alert the user.
                  except:
                      bot.send_message(message.chat.id, &quot;Unable to load video.\n&quot;)
          except:
                  pass #ignoring if not the phrase we're looking for.
  
  def test(message):
      string = message.text.split()
      print(string)
  
      if(string[0] == &quot;test&quot; and data_validation(message) == True):
          print(&quot;This is a test and i should be printed&quot;)   
          bot.send_message(message.chat.id, &quot;Test message&quot;)
  
  # Stay alive function for bot pinging / communication
  bot.infinity_polling(1440)
  </code></pre>