title: Python Telegram Api. How to pick a random image from directory?
body: <p>I figure out how to pick a specific picture in a directory.</p>
  
  <pre><code>bot.send_photo(chat_id=chat_id, photo=open('/Users/Iamawesome/Desktop/test/599d6f972525a.jpg', 'rb'))
  </code></pre>
  
  <p>But how can I pick a random picture? Thank you.</p>
  
  <p>UPDATE
  I figure out a little bit, but i still don't handle any messages or errors</p>
  
  <pre><code>  @BOT.message_handler(commands=['photo'])
    def send_rand_photo(message):
       photo = random.choice([
                                  x for x in os.listdir(PATH)
                                  if os.path.isfile(os.path.join(PATH, x))
                                  ])
  with open (photo, "rb") as file:
      BOT.send_photo(message.chat.id, file)
  </code></pre>