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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user