From 9cf1f44a8bfa984b23777aef70a9344eb1fc5c61 Mon Sep 17 00:00:00 2001 From: JOUNGWOOK KWON Date: Mon, 30 Mar 2026 11:42:28 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20/collect,=20/topics=20=EA=B2=B0=EA=B3=BC?= =?UTF-8?q?=EC=97=90=20=EA=B8=80=20=EB=B2=88=ED=98=B8=20=ED=91=9C=EC=8B=9C?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 수집 완료 후 바로 번호 포함 목록을 보여줘서 /write [번호]로 바로 글 작성할 수 있도록 개선 Co-Authored-By: Claude Opus 4.6 --- bots/scheduler.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/bots/scheduler.py b/bots/scheduler.py index 41fa7d3..065fae8 100644 --- a/bots/scheduler.py +++ b/bots/scheduler.py @@ -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))