class_docstr: Base class for a person on messenger that can act in a ParlAI world.
class_docstr_tok: ["Base","class","for","a","person","on","messenger","that","can","act","in","a","ParlAI","world","."]
docstr: Put data into the message queue if it hasn't already been seen.
docstr_tok: ["Put","data","into","the","message","queue","if","it","has","n't","already","been","seen","."]
code: def put_data(self, messenger_data):
      """
      Put data into the message queue if it hasn't already been seen.
      """
      mid = messenger_data["message"]["mid"]
      seq = messenger_data["message"].get("seq", None)
      message = messenger_data["message"]
      if "text" not in message:
          print(
              "Msg: {} could not be extracted to text format".format(
                  message
              )
          )
      text = message.get("text", None)
      img_attempt = self._is_image_attempt(message)
      if mid not in self.acted_packets:
          self.acted_packets[mid] = {
              "mid": mid,
              "seq": seq,
              "text": text,
          }
          # the fields 'report_sender' and 'sticker_sender' below are
          # internal features
          action = {
              "episode_done": False,
              "text": text,
              "id": self.disp_id,
              "report_sender": message.get("report_sender", None),
              "sticker_sender": messenger_data.get(
                  "sticker_sender", None
              ),
              "img_attempt": img_attempt,
          }
          if img_attempt and self.data.get("allow_images", False):
              action["image_url"] = message.get("image_url")
              action["attachment_url"] = message.get("attachment_url")
              if action["image_url"] is None:
                  payload = message["attachments"][0].get("payload", {})
                  action["image_url"] = payload.get("url")
              action["image"] = (
                  action["image_url"] or action["attachment_url"]
              )
          self.msg_queue.put(action)
  
file_path: ParlAI/parlai/chat_service/services/messenger/agents.py
imports: import time
  from parlai.chat_service.core.agents import ChatServiceAgent
label_desc: Use image node_id 5 for calling the MessengerAgent obj's underlying member method code with example usage: obj.put_data(messenger_data) without return types