Exemplo n.º 1
0
 def postBackRequestDict(self, dict, data, user_id_token):
     dict["destination"] = "testscript"
     dict["events"] = [
         events.PostbackEvent(
             postback=events.Postback(data),
             reply_token=user_id_token,
             source=sources.SourceUser(user_id=user_id_token)).__dict__
     ]
     for event in dict["events"]:
         event['source'] = event['source'].__dict__
         event["postback"] = event["postback"].__dict__
         event['replyToken'] = event['reply_token']
         event['source']['userId'] = event['source']['user_id']
Exemplo n.º 2
0
 def messageRequestDict(self, dict, text, user_id_token):
     """package是下劃線,json格式應為駝峰"""
     dict["destination"] = "testscript"
     dict["events"] = [
         events.MessageEvent(
             message=messages.TextMessage(text=text),
             reply_token=user_id_token,
             source=sources.SourceUser(user_id=user_id_token)).__dict__
     ]
     for event in dict["events"]:
         event['source'] = event['source'].__dict__
         event['message'] = event['message'].__dict__
         event['replyToken'] = event['reply_token']
         event['source']['userId'] = event['source']['user_id']
     return