feat: auto_resolved sync + expired card update + DOM step_index

This commit is contained in:
2026-03-10 13:52:27 +09:00
parent 93439d2f1c
commit 048ffd90a3
4 changed files with 49 additions and 7 deletions

29
bot.py
View File

@@ -573,6 +573,35 @@ class GravityBot(commands.Bot):
except (json.JSONDecodeError, OSError):
pass
# ── Check for expired pendings — update Discord card ──
for f in self.bridge.pending_dir.glob("*.json"):
try:
data = json.loads(f.read_text(encoding="utf-8-sig"))
if data.get("status") == "expired":
msg_id = data.get("discord_message_id", 0)
rid = data.get("request_id", "")
project = data.get("project_name", Config.PROJECT_NAME)
if msg_id:
channel = await self._get_channel(project)
if channel:
try:
msg = await channel.fetch_message(msg_id)
embed = discord.Embed(
title="⏰ 만료됨",
description=f"```\n{data.get('command', '')[:500]}\n```",
color=discord.Color.light_grey(),
)
embed.set_footer(text=f"ID: {rid}")
await msg.edit(embed=embed, view=None)
except discord.NotFound:
pass
f.unlink()
self._deferred_ids.pop(rid, None)
self._sent_commands.pop(rid, None)
self._sent_approval_ids.discard(rid)
except (json.JSONDecodeError, OSError):
pass
# ── Check for MERGE updates (step_probe updated command in already-sent pending) ──
for f in self.bridge.pending_dir.glob("*.json"):
try: