Support Bot API 9.6#2092
Open
Leask wants to merge 22 commits into
Open
Conversation
BREAKING! thumbnail is now required, even if it's undefined
…`reply_parameters` fix telegraf#1970
- Return 405 Method Not Allowed for non-POST requests - Return 404 Not Found for webhook path mismatches - Return 403 Forbidden for secret token mismatches (unchanged) Previously all rejection scenarios returned 403, which confused clients into thinking there was an authentication issue when the problem was actually a method or path mismatch. Fixes telegraf#2065
Snyk has created this PR to upgrade debug from 4.3.5 to 4.4.0. See this package in npm: debug See this project in Snyk: https://app.snyk.io/org/mkrhere/project/ed7a22df-dd63-45d9-a5e4-363f448cb5dc?utm_source=github&utm_medium=referral&page=upgrade-pr
There was a problem hiding this comment.
Pull request overview
Updates Telegraf to a v6.0.0 release line aligned with Telegram Bot API 9.6, adding runtime coverage for newly typed API methods and modernizing Node.js/tooling requirements (Node >= 20).
Changes:
- Added runtime wrappers for newer/typed Bot API methods (plus supporting
Contexthelpers) and expanded multipart handling to support nestedInputFilevalues. - Modernized runtime/tooling dependencies and CI (node-fetch v3, p-timeout v7, ESLint 9 flat config, TS 6, AVA 8, updated workflows).
- Added/updated tests and docs/release notes for the v6 line.
Reviewed changes
Copilot reviewed 31 out of 37 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.json | Updates TypeDoc configuration (notably removing media). |
| test/telegraf.js | Updates AVA import style and adds webhook status-code tests. |
| test/scenes.js | Updates AVA import style. |
| test/markup.js | Updates AVA import style. |
| test/format.js | Updates AVA import style. |
| test/compactOptions.js | Updates AVA import style. |
| test/api.js | Adds API/type sync tests and nested multipart serialization test coverage. |
| src/telegram.ts | Adds Bot API 9.6 wrappers and expands poll option input support. |
| src/telegram-types.ts | Adds ExtraPaidMedia helper type. |
| src/telegraf.ts | Adjusts webhook callback integration and updates p-timeout usage. |
| src/scenes/wizard/index.ts | Formatting/type-parameter layout adjustments. |
| src/scenes/wizard/context.ts | Formatting/type-parameter layout adjustments. |
| src/scenes/context.ts | Formatting/type-parameter layout adjustments. |
| src/reactions.ts | Adds support for new reaction types (e.g., paid). |
| src/filters.ts | Formatting/type layout adjustments. |
| src/core/types/typegram.ts | Adds InputPaidMedia alias. |
| src/core/network/webhook.ts | Adds options for more specific webhook rejection status codes. |
| src/core/network/polling.ts | Removes AbortController dependency (Node 20+ globals). |
| src/core/network/client.ts | Migrates to node-fetch v3 patterns, adds request timeouts, improves multipart recursion. |
| src/core/helpers/util.ts | Removes ESLint disables; keeps existing helper types. |
| src/core/helpers/formatting.ts | Formatting/type-parameter layout adjustments. |
| src/core/helpers/args.ts | Refactors for clearer control flow. |
| src/context.ts | Adds business update accessors and propagates business connection IDs in send helpers. |
| src/composer.ts | Formatting/type layout adjustments. |
| src/cli.mts | Minor catch syntax update. |
| release-notes/6.0.0.md | Adds v6.0.0 release notes. |
| README.md | Updates docs to describe v6 and Bot API 9.6 support; refreshes links/features. |
| package.json | Bumps to v6.0.0, raises Node engine requirement, updates dependencies/devDeps. |
| eslint.config.mjs | Adds ESLint 9 flat config. |
| build/expose.ts | Stops generating .eslintignore as part of build tooling. |
| .npmignore | Ignores local env/config files from npm package. |
| .gitignore | Ignores local env/config files from git. |
| .github/workflows/release.yml | Updates release workflow for v6 and refreshed actions/steps. |
| .github/workflows/node.js.yml | Updates CI Node matrix and actions/steps. |
| .github/workflows/lock.yml | Updates lock-threads action version. |
| .eslintignore | Removes legacy ignore file (replaced by flat config ignores). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced May 5, 2026
This was referenced May 5, 2026
Draft
Author
|
Issue/PR sweep follow-up pushed in commit 327d7d3. Covered in this follow-up:
Validation after the commit:
|
|
telegraf mainteners are inactive for over a year already, will be really happy to see your PRs ported to fork @telegraf-hardened |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR updates Telegraf for Telegram Bot API 9.6 and uses v6 as the forward-looking migration point: keep the v4 programming model where it still fits, align the runtime with the official Bot API surface, and modernize the infrastructure around current Node.js.
release-notes/6.0.0.md@telegraf/types: npm:@leask/types@9.6.0for the Bot API 9.6 declarations until Support Bot API 9.6 types types#14 is merged or published upstream@telegraf/typesAPI declarations as the source of truth for future Bot API sync work@telegraf/typesandTelegramInputFilemultipart support for newer media payloadsglobalThis.fetchby default, no hardnode-fetchdependency,p-timeout7, ESLint 9 flat config, TypeScript 6, AVA 8, and current GitHub Actionstelegram.fetchfor proxy agents, custom TLS, compression, or other non-standard fetch behaviorlaunchcallback timing, default empty sessions, and scene typing exports/inferenceFuture direction
The intended maintenance path after this PR is to make future Telegram Bot API updates mostly mechanical: update the official type declarations, let the API coverage tests identify missing runtime wrappers or request shapes, and keep Telegraf close to Telegram's canonical API definitions.
The infrastructure direction is similarly conservative and modern: prefer platform standards available in supported Node.js releases, avoid bundling compatibility shims by default, and keep advanced behavior injectable instead of hard-wired. For networking, that means native fetch for the common path and user-supplied
telegram.fetchfor specialized deployments.Validation
npm cinpm test(181 passing)npm run lintnpm run build:docs(passes with existing TypeDoc warnings)npm audit(0 vulnerabilities)git diff --checknpm pack --dry-runduplex: 'half'propagation, request timeout aborts, getter-only native error redaction, andglobalThis.fetchtypingnode-fetchdependency is removed; remainingnode-fetchin the lockfile is only transitive through unrelated toolingNotes
The companion types PR is telegraf/types#14. Until the upstream types release lands, this branch uses the published temporary registry alias
@telegraf/types: npm:@leask/types@9.6.0, so installs resolve from npm packages only. Before this PR is merged upstream, that alias should be replaced with the accepted upstream branch or the official published@telegraf/typesrelease.Recent issue-sweep follow-up is commit 327d7d3. PR review follow-up is commit e1a42d7. Native fetch cleanup is commit 15c5531; docs/test completeness follow-up is commit 07a9ef3. Temporary npm alias follow-up is commit 41ee6c9. Native error redaction fix is commit 088144f.