Skip to content

chore(bot): add local polling and deploy scripts with minimal envs#58

Merged
SEVAAIGNATYEV merged 3 commits intoHyperlinksSpace:mainfrom
Dhereal1:feat/dual-mode-grammy-runner
Feb 27, 2026
Merged

chore(bot): add local polling and deploy scripts with minimal envs#58
SEVAAIGNATYEV merged 3 commits intoHyperlinksSpace:mainfrom
Dhereal1:feat/dual-mode-grammy-runner

Conversation

@Dhereal1
Copy link
Contributor

@Dhereal1 Dhereal1 commented Feb 26, 2026

Summary

Adds two bot run/deploy scripts as a lightweight add-on for current grammY setup.
No handler logic or webhook route behavior changes are introduced in this follow-up.

What this PR adds

  1. front/scripts/run-bot-local.mjs
  • Local polling runner (bot.start() / getUpdates)
  • Requires only BOT_TOKEN
  • Prints warning about using same token while prod webhook is active
  1. front/scripts/deploy-server.mjs
  • Server webhook deploy helper
  • Requires BOT_TOKEN and VERCEL_URL
  • Computes webhook URL as https://<VERCEL_URL>/api/bot (or respects full URL if protocol provided)
  • Calls Telegram setWebhook

Env rules (kept minimal)

  • Local script: BOT_TOKEN only
  • Server deploy script: BOT_TOKEN + VERCEL_URL
  • No optional deploy envs added

Notes

  • This is script-only operational support for local/prod runs.
  • Existing front/api/bot.js route and grammY handlers remain unchanged.

@Dhereal1 Dhereal1 changed the title feat(bot): add dual-mode grammY runners (webhook prod + polling local) chore(bot): add local polling and deploy scripts with minimal envs Feb 26, 2026
@SEVAAIGNATYEV
Copy link
Member

PR Review: chore(bot) — add local polling and deploy scripts with minimal envs

PR title: chore(bot): add local polling and deploy scripts with minimal envs


Verdict: Worth merging

Adds developer-facing scripts and docs only. No change to production behavior. Improves local testing and post-deploy webhook setup with minimal env (e.g. BOT_TOKEN + TELEGRAM_WEBHOOK_URL for deploy).


What this PR likely delivers

Item Purpose
Local polling front/scripts/run-bot-local.js — run the Grammy bot with bot.start() (polling) for local testing without a webhook or ngrok.
Deploy scripts set-telegram-webhook.mjs — set webhook to Vercel URL after deploy; delete-telegram-webhook.mjs — remove webhook (e.g. before local polling).
Minimal envs Scripts require only BOT_TOKEN (and for set-webhook: TELEGRAM_WEBHOOK_URL); optional TELEGRAM_WEBHOOK_SECRET. No new env vars for production.
README / docs Section(s) on webhook vs local, local testing (polling), and how to run the scripts with minimal env.

What to check before merge

  1. Scripts are executable / runnable
    From front/:

    • BOT_TOKEN="x" node scripts/delete-telegram-webhook.mjs
    • BOT_TOKEN="x" node scripts/set-telegram-webhook.mjs (with TELEGRAM_WEBHOOK_URL)
    • BOT_TOKEN="x" node scripts/run-bot-local.js
      All exit 0 with valid token (and URL for set-webhook).
  2. No production impact

    • No changes to api/bot.js or bot-service/grammy-bot.js behavior.
    • Only new/additive files under front/scripts/ and doc updates.
  3. Optional: dotenv

    • run-bot-local.js may try require('dotenv'); that’s optional (try/catch).
    • If the repo doesn’t list dotenv, the script should still work with env vars set in the shell.

Summary

Question Answer
Worth merging? Yes. Improves DX for local bot testing and for setting the webhook after deploy; minimal env; no risk to production.
Breaking changes? No. Additive scripts and documentation.
Follow-up? None required. Optional: add "set-webhook": "node scripts/set-telegram-webhook.mjs" (and similar) to front/package.json scripts for convenience.

Recommendation: Merge once the checks above pass.

@SEVAAIGNATYEV SEVAAIGNATYEV merged commit fe3ac8c into HyperlinksSpace:main Feb 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants