Conversation
|
@codex review this pr |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
src/telegram/client.ts
Outdated
| const requestedToken = token || readEnv(runtime).telegramBotToken; | ||
| if (!requestedToken) { | ||
| throw new Error( | ||
| "TELEGRAM_BOT_TOKEN not found. Set it in .env or pass as argument.", |
There was a problem hiding this comment.
Allow Telegram bot creation without Twilio env
Using the Telegram provider currently fails if the environment only supplies TELEGRAM_BOT_TOKEN. createTelegramBot always calls readEnv to fetch the token (src/telegram/client.ts lines 13-16), but readEnv enforces required Twilio credentials via its schema and exits when they’re missing (src/env.ts lines 18-51). As a result, warelay send --provider telegram or relay --provider telegram terminates before starting the bot unless all Twilio variables are set, which blocks Telegram-only usage; load the Telegram token without validating Twilio config.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
To use Codex here, create an environment for this repo.
There was a problem hiding this comment.
Summary
- Added a Telegram-specific environment parser so bots can load
TELEGRAM_BOT_TOKENwithout enforcing Twilio credentials and surface validation errors cleanly. src/env.tsL53-L110 - Updated Telegram bot creation to use the standalone token loader while still logging a clear error when the token is absent. src/telegram/client.tsL1-L31
- Expanded tests to cover Telegram-only environments and bot creation behavior when the token is missing. src/env.test.tsL50-L66 src/telegram/client.test.tsL33-L48
Testing
⚠️ pnpm test(failed to download pnpm due to restricted network in the environment)
c2516d3 to
49f435c
Compare
- Add Telegram bot integration using grammY library - Support sending and receiving messages via Telegram Bot API - Add --provider option to send and relay commands - Update login to handle Telegram bot token - Store Telegram credentials at ~/.clawdis/telegram/ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
49f435c to
9a66b54
Compare
Pi-agent-core's Agent.prompt() expects a plain string, not a structured
message object. The RPC handler passes input.message directly to
agent.prompt(), so sending { role: "user", content: [...] } caused
"(command produced no output)" errors.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds Telegram bot support as a third messaging provider alongside Twilio WhatsApp and WhatsApp Web, using the grammY framework for long-polling message delivery.
Implementation
Provider Structure
src/telegram/- Core bot client, send/receive, media handling, error formattingsrc/providers/telegram/- Barrel exports following existing provider patternIntegration Points
Providertype:"twilio" | "web" | "telegram"TELEGRAM_BOT_TOKENenvironment variablesendandrelaycommands with--provider telegramoptionMedia Support
.jpg→ photo,.mp4→ video, etc.@username)Usage
Testing
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.