fix: /collect, /topics 결과에 글 번호 표시 추가

수집 완료 후 바로 번호 포함 목록을 보여줘서
/write [번호]로 바로 글 작성할 수 있도록 개선

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
JOUNGWOOK KWON
2026-03-30 11:42:28 +09:00
parent 9f68133217
commit 9cf1f44a8b

View File

@@ -608,8 +608,19 @@ async def cmd_collect(update: Update, context: ContextTypes.DEFAULT_TYPE):
await loop.run_in_executor(None, job_collector)
topics_dir = DATA_DIR / 'topics'
today = datetime.now().strftime('%Y%m%d')
count = len(list(topics_dir.glob(f'{today}_*.json')))
await update.message.reply_text(f"✅ 수집 완료! 오늘 글감: {count}\n/topics 로 확인하세요.")
files = sorted(topics_dir.glob(f'{today}_*.json'))
if not files:
await update.message.reply_text("✅ 수집 완료! 오늘 수집된 글감이 없습니다.")
return
lines = [f"✅ 수집 완료! 오늘 글감 {len(files)}개:"]
for i, f in enumerate(files[:15], 1):
try:
data = json.loads(f.read_text(encoding='utf-8'))
lines.append(f" {i}. [{data.get('corner','')}] {data.get('topic','')[:50]}")
except Exception:
pass
lines.append("\n✍️ /write [번호] 로 글 작성")
await update.message.reply_text('\n'.join(lines))
except Exception as e:
await update.message.reply_text(f"❌ 수집 오류: {e}")
@@ -668,12 +679,13 @@ async def cmd_show_topics(update: Update, context: ContextTypes.DEFAULT_TYPE):
await update.message.reply_text("오늘 수집된 글감이 없습니다.")
return
lines = [f"📋 오늘 수집된 글감 ({len(files)}개):"]
for f in files[:10]:
for i, f in enumerate(files[:15], 1):
try:
data = json.loads(f.read_text(encoding='utf-8'))
lines.append(f" [{data.get('quality_score',0)}점][{data.get('corner','')}] {data.get('topic','')[:50]}")
lines.append(f" {i}. [{data.get('quality_score',0)}점][{data.get('corner','')}] {data.get('topic','')[:50]}")
except Exception:
pass
lines.append("\n✍️ /write [번호] 로 글 작성")
await update.message.reply_text('\n'.join(lines))