diff --git a/bot.py b/bot.py index 9b246b8..9ffeb17 100644 --- a/bot.py +++ b/bot.py @@ -272,9 +272,15 @@ class GravityBot(commands.Bot): ): progress = parse_task_progress(event.content) + # Full task content (truncated to embed limit) + full_content = event.content.strip() + description = format_task_embed_text(progress) + "\n\n" + full_content + if len(description) > 4000: + description = description[:4000] + "\n…(truncated)" + embed = discord.Embed( title="πŸ“‹ Task μ§„ν–‰ ν˜„ν™©", - description=format_task_embed_text(progress), + description=description, color=discord.Color.gold() if progress.in_progress > 0 else discord.Color.green() if progress.done == progress.total else discord.Color.greyple(), @@ -304,20 +310,37 @@ class GravityBot(commands.Bot): label = labels.get(event.file_name, f"πŸ“„ {event.file_name}") event_label = "생성" if event.event_type == EventType.FILE_CREATED else "μ—…λ°μ΄νŠΈ" - lines = event.content.strip().splitlines() - preview = "\n".join(l for l in lines[:6] if l.strip()) - if len(lines) > 6: - preview += f"\n... (+{len(lines) - 6} lines)" + full_content = event.content.strip() + CHUNK_SIZE = 4000 # Discord embed desc limit is 4096 + # Split into chunks for long content + chunks = [] + while full_content: + chunks.append(full_content[:CHUNK_SIZE]) + full_content = full_content[CHUNK_SIZE:] + + if not chunks: + chunks = ["(빈 파일)"] + + # First chunk with title embed = discord.Embed( title=f"{label} ({event_label}됨)", - description=preview[:1000], + description=chunks[0], color=discord.Color.blue(), timestamp=datetime.now(timezone.utc), ) embed.set_footer(text=f"Session: {event.conversation_id[:8]}") await channel.send(embed=embed) + # Additional chunks if content is long + for i, chunk in enumerate(chunks[1:], 2): + embed = discord.Embed( + title=f"{label} (계속 {i}/{len(chunks)})", + description=chunk, + color=discord.Color.blue(), + ) + await channel.send(embed=embed) + # ─── Approval Scanner ──────────────────────────────────────────── @tasks.loop(seconds=3)