izuemon commited on
Commit
dc4b507
·
verified ·
1 Parent(s): 548d87d

Update v2_gpt.py

Browse files
Files changed (1) hide show
  1. v2_gpt.py +1 -6
v2_gpt.py CHANGED
@@ -48,7 +48,7 @@ LOG_LEVEL = ChannelWorksClient.LOG_ERROR
48
  # ロガー
49
  # ---------------------------------------------------------------------------
50
  def log(tag: str, msg: str) -> None:
51
- ts = datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f")[:-3]
52
  print(f"[{ts}] [{tag}] {msg}", flush=True)
53
 
54
 
@@ -187,7 +187,6 @@ def main() -> None:
187
  if chat_id != TARGET_CHAT_ID:
188
  return
189
  if person_id and my_account_id and person_id == my_account_id:
190
- log("PUSH-SKIP", "自分のメッセージのため無視")
191
  return
192
 
193
  if msg_id:
@@ -201,11 +200,8 @@ def main() -> None:
201
  if not plain.strip():
202
  return
203
 
204
- log("PUSH", f"受信: {plain!r}")
205
-
206
  # 「じゃんけん」系ワード + 手の絵文字が含まれているか判定
207
  if not has_trigger_word(plain):
208
- log("PUSH-SKIP", "じゃんけんワードなし")
209
  return
210
  user_hand = detect_user_hand(plain)
211
  if user_hand is None:
@@ -218,7 +214,6 @@ def main() -> None:
218
  try:
219
  resp = send_channel_message(client, reply)
220
  if 200 <= resp.status_code < 300:
221
- log("SEND-OK", f"status={resp.status_code}")
222
  else:
223
  log("SEND-NG", f"status={resp.status_code} body={resp.text[:300]}")
224
  except Exception as exc:
 
48
  # ロガー
49
  # ---------------------------------------------------------------------------
50
  def log(tag: str, msg: str) -> None:
51
+ ts = datetime.now().strftime("%m-%d %H:%M:%S.%f")[:-3]
52
  print(f"[{ts}] [{tag}] {msg}", flush=True)
53
 
54
 
 
187
  if chat_id != TARGET_CHAT_ID:
188
  return
189
  if person_id and my_account_id and person_id == my_account_id:
 
190
  return
191
 
192
  if msg_id:
 
200
  if not plain.strip():
201
  return
202
 
 
 
203
  # 「じゃんけん」系ワード + 手の絵文字が含まれているか判定
204
  if not has_trigger_word(plain):
 
205
  return
206
  user_hand = detect_user_hand(plain)
207
  if user_hand is None:
 
214
  try:
215
  resp = send_channel_message(client, reply)
216
  if 200 <= resp.status_code < 300:
 
217
  else:
218
  log("SEND-NG", f"status={resp.status_code} body={resp.text[:300]}")
219
  except Exception as exc: