title: Telegram Python chatbot - replying with an animated gif
body: <p>complete Python newbie, sorry!</p>
  
  <p>I'm using the Telebot starter kit (<a href="https://github.com/yukuku/telebot" rel="nofollow">https://github.com/yukuku/telebot</a>) which handles replies as:</p>
  
  <pre><code>elif 'who are you' in text:
          reply('telebot starter kit, created by yukuku: https://github.com/yukuku/telebot')
  </code></pre>
  
  <p>I was able to get it to reply with an image with:</p>
  
  <pre><code>elif 'Test1' in text:
             reply(img=urllib2.urlopen('https://i.ytimg.com/vi/VC8H5B2YVCY/maxresdefault.jpg').read())
  </code></pre>
  
  <p>But cannot send animated gifs. Sending as an img per above uses sendPhoto which is static</p>
  
  <p>I'm sure it has to be a case of adding the InlineQueryResultGif class and calling it inside a reply() but I've tried lots and lots of ways of doing that but I'm not making any progress</p>
  
  <p>Help!</p>
  
  <p>EDIT to show some attempts:</p>
  
  <p>Firstly I tried editing the elif argument that was already in place for sending the img:</p>
  
  <pre><code>elif gif:
              gif = multipart.post_multipart(BASE_URL + 'InlineQueryResultGif', [
                  ('chat_id', str(chat_id)),
                  ('reply_to_message_id', str(message_id)),
              ], [
                  ('gif', 'image.gif', gif),
              ])
  </code></pre>
  
  <p>and then simply changing the reply to be:</p>
  
  <pre><code>elif 'Test4' in text:
          reply(gif=urllib2.urlopen('http://www.reactiongifs.us/wp-content/uploads/2014/08/popcorn_indiana_jones.gif').read())
  </code></pre>
  
  <p>Then I've tried adding the InlineQueryResultGif class itself:</p>
  
  <pre><code>class InlineQueryResult:
  pass
  
  class InlineQueryResultGif(InlineQueryResult):
  """ Represents a link to an animated GIF file. By default, this animated GIF file will be sent by the user with
  optional caption. Alternatively, you can provide message_text to send it instead of the animation.
  Attributes:
      id                          (str)    :Unique identifier of this result
      gif_url                     (str)    :A valid URL for the GIF file. File size must not exceed 1MB
      gif_width                   (int)    :*Optional.* Width of the GIF
      gif_height                  (int)    :*Optional.* Height of the GIF
      thumb_url                   (str)    :*Optional.* URL of a static thumbnail for the result (jpeg or gif)
      title                       (str)    :*Optional.* Title for the result
      caption                     (str)    :*Optional.* Caption of the GIF file to be sent
      message_text                (str)    :*Optional.* Text of a message to be sent instead of the animation
      parse_mode                  (str)    :*Optional.* Send “Markdown”, if you want Telegram apps to show bold,
                                                        italic and inline URLs in your bot's message.
      disable_web_page_preview    (bool)   :*Optional.* Disables link previews for links in the sent message
  """
  
  def __init__(self, id, gif_url,
               gif_width=None, gif_height=None, thumb_url=None, title=None,
               caption=None, message_text=None, parse_mode=None, disable_web_page_preview=None):
      self.type = 'gif'
      self.id = id
      self.gif_url = gif_url
      self.gif_width = gif_width
      self.gif_height = gif_height
      self.thumb_url = thumb_url
      self.title = title
      self.caption = caption
      self.message_text = message_text
      self.parse_mode = parse_mode
      self.disable_web_page_preview = disable_web_page_preview
  </code></pre>
  
  <p>And tried to call it inside the reply:</p>
  
  <pre><code>elif 'Test2' in text:
          reply(InlineQueryResultGif('http://www.reactiongifs.us/wp-content/uploads/2014/08/popcorn_indiana_jones.gif'))
  </code></pre>
  
  <p>And lots of different versions of the above. Not getting anything to work</p>