Skip to content

Add /ping and /uptime bot health-check commands #39

Description

@Kingvic300

Summary

Add /ping and /uptime Telegram commands mirroring the health information already exposed over HTTP at /healthz, so the team can check the bot's liveness from inside the chat instead of curling the deployed URL.

Background

src/index.ts already exposes app.get("/healthz", (_req, res) => res.status(200).send("ok")). There is no equivalent inside Telegram — src/telegram/client.ts only registers a new_chat_members handler. This is the cheapest possible extension of existing, already-verified functionality.

Proposed Solution

Add bot.command("ping", ...) returning a simple "pong" plus response latency, and bot.command("uptime", ...) returning process uptime since last start (process.uptime()), reusing the existing sendMessage helper.

Technical Scope

  • src/telegram/client.ts — two new bot.command(...) handlers
  • No new dependencies, no new config
  • Tests: command handler output format

Acceptance Criteria

  • /ping responds with a liveness confirmation and round-trip latency
  • /uptime responds with process uptime in a human-readable format
  • Both work in the group and in DM
  • Unit tests added
  • /help (once issue Add release published notifications #4 lands) lists both commands
  • CI passes
  • Code follows project conventions

Edge Cases

  • Bot restarted moments before the command runs — uptime should read as near-zero, not error
  • Command issued by a non-member in a group the bot isn't actually in (not applicable here, but worth a sanity check that command handlers don't assume group membership)

Risks

  • None of significance — purely additive, no external dependencies, mirrors already-tested logic

Deliverables

  • Feature implementation
  • Unit tests

Labels

enhancement, backend, good first issue

Priority

Medium — trivial to build, directly useful once the bot has more moving parts (scheduler, commands) to worry about.


Estimated Completion: 96 hours

Telegram: https://t.me/txioCommunity


Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26Third CampaignCampaign: Third Campaign

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions