code: def on_message(msg, server):
      
      text = msg.get("text", "")
      match = re.findall(r"!gif (.*)", text)
      if not match:
          return
  
      res = gif(match[0])
      if not res:
          return
  
      attachment = {
          "fallback": match[0],
          "title": match[0],
          "title_link": res,
          "image_url": res
      }
      server.slack.post_message(
          msg['channel'],
          '',
          as_user=server.slack.username,
          attachments=json.dumps([attachment]))
docs: handle a message and return an gif