grammyjs / grammY

The Telegram Bot Framework.
https://grammy.dev
MIT License
2.04k stars 106 forks source link

feat: allow cloning `Api` instances #594

Closed KnorpelSenf closed 1 month ago

KnorpelSenf commented 1 month ago

This exposes api.token and api.options. This is useful because it lets us create new Api instances from existing ones, optionally reconfiguring them on the fly.

The main use case for this is the second major version of the conversations plugin which no longer shares the same Api instance across context objects—something that was a big hack that mostly worked for v1.

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 47.75%. Comparing base (d62a142) to head (ec542b5).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #594 +/- ## ========================================== + Coverage 47.74% 47.75% +0.01% ========================================== Files 19 19 Lines 6177 6179 +2 Branches 343 343 ========================================== + Hits 2949 2951 +2 Misses 3224 3224 Partials 4 4 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.