feat(email): add digest and forward commands to WhatsApp

Digest summarizes unread emails via Claude CLI; forward sends raw
content (split to 4096 chars). Wired as /email digest and
/email forward slash commands, plus instant per-guild sync on ready.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-21 05:45:02 +00:00
parent 9d447b9ff1
commit 9314d63aa0
5 changed files with 394 additions and 3 deletions

View File

@@ -464,6 +464,18 @@ def create_bot(config: Config) -> discord.Client:
result = await asyncio.to_thread(fast_dispatch, "email", ["save"])
await interaction.followup.send(result)
@email_group.command(name="digest", description="Procesează emailuri necitite și trimite rezumate pe WhatsApp")
async def email_digest(interaction: discord.Interaction) -> None:
await interaction.response.defer()
result = await asyncio.to_thread(fast_dispatch, "email", ["digest"])
await interaction.followup.send(result)
@email_group.command(name="forward", description="Forwardează emailuri necitite direct pe WhatsApp fără rezumat")
async def email_forward(interaction: discord.Interaction) -> None:
await interaction.response.defer()
result = await asyncio.to_thread(fast_dispatch, "email", ["forward"])
await interaction.followup.send(result)
tree.add_command(email_group)
# --- Calendar commands ---
@@ -878,6 +890,10 @@ def create_bot(config: Config) -> discord.Client:
@client.event
async def on_ready() -> None:
# Sync to each guild instantly, then global (global can take up to 1h)
for guild in client.guilds:
tree.copy_global_to(guild=guild)
await tree.sync(guild=guild)
await tree.sync()
scheduler = getattr(client, "scheduler", None)
if scheduler is not None: