yuripeyamashita commited on
Commit
fb4f1a7
1 Parent(s): c915bab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -81,6 +81,8 @@ def api():
81
  else:
82
  message_list[payload.get("msg_id")] = {"user_id": payload.get("user_id"),
83
  "amount": get_amount(payload.get("msg_text"))}
 
 
84
 
85
  for msg_id, data in message_list.items():
86
  quoted_msg_id = data.get("quoted_msg_id")
@@ -94,6 +96,7 @@ def api():
94
  paid += value.get("amount")
95
  print(amount, paid)
96
  if (amount-paid > 1):
 
97
  print("未付清")
98
  break
99
 
@@ -133,13 +136,13 @@ def get_payload_dict(raw_payload) -> dict:
133
  "unsend_msg_id": events.get("unsend", {}).get("messageId")}
134
 
135
 
136
- def send_text(token: str, text: str):
137
  requests.post("https://api.line.me/v2/bot/message/reply", headers={
138
  "Content-Type": "application/json; charset=UTF-8",
139
  "Authorization": "Bearer " + LINE_CHANNEL_ACCESS_TOKEN
140
  }, json={
141
  "replyToken": token,
142
- "messages": [{"type": "text", "text": text}]
143
  })
144
 
145
 
 
81
  else:
82
  message_list[payload.get("msg_id")] = {"user_id": payload.get("user_id"),
83
  "amount": get_amount(payload.get("msg_text"))}
84
+ print(payload.get("token"), "回覆測試", payload.get("quote_token"))
85
+ send_text(payload.get("token"), "回覆測試", payload.get("quote_token"))
86
 
87
  for msg_id, data in message_list.items():
88
  quoted_msg_id = data.get("quoted_msg_id")
 
96
  paid += value.get("amount")
97
  print(amount, paid)
98
  if (amount-paid > 1):
99
+ data.get("quote_token")
100
  print("未付清")
101
  break
102
 
 
136
  "unsend_msg_id": events.get("unsend", {}).get("messageId")}
137
 
138
 
139
+ def send_text(token: str, text: str, quote_token: str | None = None):
140
  requests.post("https://api.line.me/v2/bot/message/reply", headers={
141
  "Content-Type": "application/json; charset=UTF-8",
142
  "Authorization": "Bearer " + LINE_CHANNEL_ACCESS_TOKEN
143
  }, json={
144
  "replyToken": token,
145
+ "messages": [{"type": "text", "text": text, "quoteToken": quote_token}]
146
  })
147
 
148