Skip to content

Add support for dynamic bot tokens #1159

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

vkrms
Copy link

@vkrms vkrms commented Mar 7, 2025

Add support for creating multiple bot instances at runtime with various tokens passed in post messages instead of the .env.

  • src/Api.php

    • Add setAccessToken method to set the token dynamically.
    • Modify the constructor to accept a token parameter.
    • Update validateAccessToken method to check for the token parameter.
  • src/BotsManager.php

    • Add createBotInstance method to create a bot instance with a dynamic token.
    • Modify the bot method to accept a token parameter.
    • Update the makeBot method to use the token parameter.
  • src/Laravel/TelegramServiceProvider.php

    • Modify the registerBindings method to register bot instances with dynamic tokens.
    • Update the register method to accept a token parameter.
  • src/Laravel/config/telegram.php

    • Remove reliance on environment variables for bot tokens.
    • Update the bots array to accept dynamic tokens.

Add support for creating multiple bot instances at runtime with various tokens passed in post messages instead of the `.env`.

* **src/Api.php**
  - Add `setAccessToken` method to set the token dynamically.
  - Modify the constructor to accept a token parameter.
  - Update `validateAccessToken` method to check for the token parameter.

* **src/BotsManager.php**
  - Add `createBotInstance` method to create a bot instance with a dynamic token.
  - Modify the `bot` method to accept a token parameter.
  - Update the `makeBot` method to use the token parameter.

* **src/Laravel/TelegramServiceProvider.php**
  - Modify the `registerBindings` method to register bot instances with dynamic tokens.
  - Update the `register` method to accept a token parameter.

* **src/Laravel/config/telegram.php**
  - Remove reliance on environment variables for bot tokens.
  - Update the `bots` array to accept dynamic tokens.
Copy link

codecov bot commented Mar 7, 2025

Codecov Report

Attention: Patch coverage is 66.66667% with 5 lines in your changes missing coverage. Please review.

Project coverage is 39.97%. Comparing base (0714601) to head (06f181f).
Report is 1 commits behind head on 3.x.

Files with missing lines Patch % Lines
src/BotsManager.php 66.66% 2 Missing ⚠️
src/Laravel/config/telegram.php 0.00% 2 Missing ⚠️
src/Laravel/TelegramServiceProvider.php 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##                3.x    #1159      +/-   ##
============================================
- Coverage     40.19%   39.97%   -0.22%     
- Complexity      630      634       +4     
============================================
  Files           133      133              
  Lines          1821     1826       +5     
============================================
- Hits            732      730       -2     
- Misses         1089     1096       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vkrms
Copy link
Author

vkrms commented Mar 7, 2025

Sorry I'm just playing around with the new copilot features

@vkrms vkrms closed this Mar 7, 2025
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.

None yet

1 participant