yuripeyamashita commited on
Commit
2ba3143
1 Parent(s): fd33f7a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -3
app.py CHANGED
@@ -29,10 +29,18 @@ def api():
29
  if payload.get("unsend_msg_id"):
30
  unsend_msg_id = payload.get("unsend_msg_id")
31
  message_list.pop(unsend_msg_id, None)
32
- filtered_data = {key: value for key, value in message_list.items() if value.get("quoted_msg_id") != unsend_msg_id}
33
- print(filtered_data)
34
  raise ValueError("Unsend Success")
35
 
 
 
 
 
 
 
 
 
 
36
  if "$" not in payload.get("msg_text"):
37
  raise ValueError("Keyword not Found")
38
 
@@ -91,7 +99,7 @@ def get_username(user_id: str):
91
  return "Unknow"
92
 
93
 
94
- def get_username() -> list:
95
  url = f"https://api.line.me/v2/bot/group/{GROUP_ID}/members/ids"
96
  try:
97
  res_json = requests.get(url, headers={"Authorization": "Bearer " + LINE_CHANNEL_ACCESS_TOKEN}).json()
 
29
  if payload.get("unsend_msg_id"):
30
  unsend_msg_id = payload.get("unsend_msg_id")
31
  message_list.pop(unsend_msg_id, None)
32
+ message_list = {key: value for key, value in message_list.items() if value.get("quoted_msg_id") != unsend_msg_id}
 
33
  raise ValueError("Unsend Success")
34
 
35
+ if "$$$" in payload.get("msg_text"):
36
+ if "計算" in payload.get("msg_text"):
37
+ username_list = get_username_list()
38
+ print(username_list)
39
+ for user_id in username_list:
40
+ print(get_username(user_id))
41
+
42
+ raise ValueError("Action Success")
43
+
44
  if "$" not in payload.get("msg_text"):
45
  raise ValueError("Keyword not Found")
46
 
 
99
  return "Unknow"
100
 
101
 
102
+ def get_username_list() -> list:
103
  url = f"https://api.line.me/v2/bot/group/{GROUP_ID}/members/ids"
104
  try:
105
  res_json = requests.get(url, headers={"Authorization": "Bearer " + LINE_CHANNEL_ACCESS_TOKEN}).json()