Skip to content

Contribution: Three New Features - Proxy Support, Server Auth, and Subsession Filtering #1

@shiquda

Description

@shiquda

First of all, thank you! 🙏

Thank you so much for creating this amazing Telegram bot for OpenCode! This is exactly what I was looking for - a simple, clean, and effective way to interact with OpenCode from my phone. The bot works great and the codebase is well-organized. Really appreciate your work on this!

Overview

I've been using this bot extensively and added three new features that I believe would benefit other users as well. I've prepared three separate PRs for each feature to make review easier.

Proposed Features

1. Telegram Proxy Support (PR #2)

Feature: Add support for connecting to Telegram API through proxy servers (SOCKS5, SOCKS4, HTTP, HTTPS).

Why: In some network environments (corporate networks, certain countries), direct connection to Telegram API may be blocked or unreliable. Proxy support allows users in these situations to still use the bot.

Changes:

  • Add socks-proxy-agent and https-proxy-agent dependencies
  • Add TELEGRAM_PROXY_URL environment variable
  • Configure proxy agent in Bot constructor when proxy URL is set
  • Update documentation with examples

Usage:

TELEGRAM_PROXY_URL=socks5://user:password@proxy.example.com:1080

2. OpenCode Server Authentication Wizard (PR #3)

Feature: Add OpenCode server username and password configuration to the interactive setup wizard.

Why: When OpenCode server is configured with authentication (username/password), the bot needs to provide credentials to connect. Currently, users have to manually edit the .env file. This feature adds prompts during the initial setup wizard for server credentials, making it more user-friendly.

Changes:

  • Add prompts for server username (default: opencode)
  • Add prompt for server password when authentication is required
  • Add OPENCODE_SERVER_USERNAME and OPENCODE_SERVER_PASSWORD environment variables
  • Add i18n strings for wizard prompts (English and Russian)
  • Update documentation

Usage: During npx opencode-telegram-bot first-run wizard, users will be prompted for server credentials.


3. Hide Subsessions Option (PR #4)

Feature: Add option to hide child sessions (subsessions) from the /sessions command list.

Why: When using subagents or at-mentions in OpenCode, many child sessions are created. These can clutter the session list and make it harder to find main/top-level sessions. This feature allows users to filter out subsessions and show only parent sessions.

Changes:

  • Add HIDE_SUBSESSIONS environment variable
  • Filter sessions with parentID when option is enabled
  • Add debug logging for filtered subsessions
  • Update documentation

Usage:

HIDE_SUBSESSIONS=true  # Hide child sessions, show only top-level sessions

Implementation Details

All three features are:

  • Backward compatible - All new features are opt-in via environment variables
  • Well-documented - Updated README.md and AGENTS.md with new env vars
  • Type-safe - Full TypeScript support with proper type definitions
  • Tested - Each feature builds successfully with npm run build

Branch Structure

I've created three separate feature branches:

  1. feature/telegram-proxy-support
  2. feature/server-auth-wizard
  3. feature/hide-subsessions

Each branch contains only the changes relevant to that feature, making review and testing easier.

Next Steps

If you're interested in these features, I can submit the PRs in any order you prefer. The features are independent and can be merged separately.

Looking forward to your feedback!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions