From adc4d252ac31fcb2b610991ff7d91bec7eea3ba8 Mon Sep 17 00:00:00 2001 From: JOUNGWOOK KWON Date: Mon, 30 Mar 2026 13:17:04 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20/write=20=EB=AA=85=EB=A0=B9=EC=97=90=20?= =?UTF-8?q?=EC=B9=B4=ED=85=8C=EA=B3=A0=EB=A6=AC=20=EC=98=A4=EB=B2=84?= =?UTF-8?q?=EB=9D=BC=EC=9D=B4=EB=93=9C=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit /write 7 AI인사이트 형태로 카테고리를 변경하여 발행 가능. 두 번째 인자가 유효한 카테고리명이면 corner 오버라이드, 아니면 기존 direction으로 처리. Co-Authored-By: Claude Opus 4.6 --- bots/scheduler.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/bots/scheduler.py b/bots/scheduler.py index 5158cae..c524fb3 100644 --- a/bots/scheduler.py +++ b/bots/scheduler.py @@ -648,7 +648,8 @@ async def cmd_write(update: Update, context: ContextTypes.DEFAULT_TYPE): lines.append(f" {i}. [{data.get('corner','')}] {data.get('topic','')[:50]}") except Exception: pass - lines.append("\n사용법: /write [번호] [방향(선택)]") + lines.append("\n사용법: /write [번호] [카테고리(선택)] [방향(선택)]") + lines.append("예: /write 7 AI인사이트 ← 카테고리 변경 발행") await update.message.reply_text('\n'.join(lines)) return try: @@ -661,11 +662,25 @@ async def cmd_write(update: Update, context: ContextTypes.DEFAULT_TYPE): return topic_file = files[idx] topic_data = json.loads(topic_file.read_text(encoding='utf-8')) - direction = ' '.join(args[1:]) if len(args) > 1 else '' + # 두 번째 인자: 유효한 카테고리명이면 corner 오버라이드, 아니면 direction + VALID_CORNERS = {"AI인사이트", "여행맛집", "스타트업", "TV로보는세상", "제품리뷰", "생활꿀팁", "건강정보", "재테크", "팩트체크"} + override_corner = '' + direction = '' + if len(args) > 1: + candidate = args[1] + if candidate in VALID_CORNERS: + override_corner = candidate + direction = ' '.join(args[2:]) if len(args) > 2 else '' + else: + direction = ' '.join(args[1:]) + if override_corner: + topic_data['corner'] = override_corner draft_path = DATA_DIR / 'originals' / topic_file.name (DATA_DIR / 'originals').mkdir(exist_ok=True) + corner_msg = f"\n카테고리: {override_corner} (변경됨)" if override_corner else "" await update.message.reply_text( f"✍️ 글 작성 중...\n주제: {topic_data.get('topic','')[:50]}" + + corner_msg + (f"\n방향: {direction}" if direction else "") ) loop = asyncio.get_event_loop()