* added service validation for send file
* update strings
* Apply suggestions from code review
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* updated exception in tests
* removed TypeError since it is not thrown
---------
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* added config flow for telegram integration
* added chat id in config entry title and added config flow tests
* fix import issue when there are no notifiers in configuration.yaml
* Revert "fix import issue when there are no notifiers in configuration.yaml"
This reverts commit b5b83e2a9a.
* Revert "added chat id in config entry title and added config flow tests"
This reverts commit 30c2bb4ae4.
* Revert "added config flow for telegram integration"
This reverts commit 1f44afcd45.
* added config and subentry flows
* added options flow to configure webhooks
* refactor module setup so it only load once
* moved service registration from async_setup_entry to async_setup
* Apply suggestions from code review
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* import only last yaml config
* import only last yaml config
* reduced scope of try-block
* create issue when importing from yaml
* Apply suggestions from code review
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* handle options update by reloading telegram bot
* handle import errors for create issue
* include bot's platform when creating issues
* handle options reload without needing HA restart
* moved url and trusted_networks inputs from options to new config flow step
* Apply suggestions from code review
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* minor fixes
* refactor config flow
* moved constants to const.py
* Apply suggestions from code review
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update homeassistant/components/telegram_bot/config_flow.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update homeassistant/components/telegram_bot/config_flow.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update homeassistant/components/telegram_bot/config_flow.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* added options flow tests
* Update homeassistant/components/telegram_bot/__init__.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update homeassistant/components/telegram_bot/__init__.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update homeassistant/components/telegram_bot/__init__.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update homeassistant/components/telegram_bot/config_flow.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update homeassistant/components/telegram_bot/config_flow.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* added reconfigure flow
* added reauth flow
* added tests for reconfigure flow
* added tests for reauth
* added tests for subentry flow
* added tests for user and webhooks flow with error scenarios
* added import flow tests
* handle webhook deregister exception
* added config entry id to all services
* fix leave chat bug
* Update homeassistant/components/telegram_bot/__init__.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* removed leave chat bug fixes
* Update homeassistant/components/telegram_bot/strings.json
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* handle other error types for import
* reuse translations
* added test for duplicated config entry for user step
* added tests
---------
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Add support for sending telegram messages to topics
Based on original PR #104059 by [jgresty](https://github.com/jgresty).
Did not manage to merge conflicts, so I remade the changes from scratch, including suggestions from previous PR reviews.
Topics were added to telegram groups in November 2022, and to the
telegram-bot library in version 20.0. They are a purely additive change
that is exposed by a single parameter `message_thread_id`. Not passing
this parameter will not change the behaviour from current.
This same parameter is used to send messages to threads and messages to
topics inside groups.
https://telegram.org/blog/topics-in-groups-collectible-usernames/it?setln=en#topics-in-groupsFixes#81888Fixes#91750
* telegram_bot: add tests for threads feature.
* telegram_bot: fixed tests for threads.
* telegram_bot: fixed wrong line.
* Update test_telegram_bot.py
---------
Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Bump python-telegram-bot package version to the latest.
* PySocks is no longer required as python-telegram-bot doesn't use urllib3 anymore.
* Fix moved ParseMode import
* Update filters import to new structure.
* Refactor removed Request objects to HTTPXRequest objects.
* Update to support asyncc functions
* Update timeout to new kwarg
connect_timeout is the most obvious option based on current param description, but this may need changing.
* Compatibility typo.
* Make methods async and use Bot client async natively
* Type needs to be Optional
That's what the source types are from the library
Also handle new possibility of None value
* Add socks support version of the library
* Refactor load_data function
Update to be async friendly
Refactor to use httpx instead of requests.
* Refactor Dispatcher references to Application
This is the newer model of the same class.
* Make more stuff async-friendly.
* Update tests to refactor Dispatcher usage out.
* Remove import and reference directly
* Refactor typing method
* Use async_fire now we have async support
* Fix some over complicate inheritance.
* Add the polling test telegram_text event fired back in.
* Add extra context to comment
* Handler should also be async
* Use underscores instead of camelCase
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Renamed kwarg.
* Refactor current timeout param to be read timeout
Reading the old version of the library code I believe this matches the existing functionality best
* Combine unload methods into one listener
* Fix test by stopping HA as part of fixture
* Add new fixture to mock stop_polling call
Use this in all polling tests.
* No longer need to check if application is running
It was to stop a test failing.
* Make sure the updater is started in tests
Mock external call methods
Remove stop_polling mock.
* Use cleaner references to patched methods
* Improve test by letting the library create the Update object
* Mock component tear down methods to be async
* Bump mypy cache version
* Update dependency to install from git
Allows use as a custom component in 2024.3
Allows us to track mypy issue resolution.
* Update manifest and requirements for new python-telegram-bot release.
* Remove pytest filterwarnings entry for old version of python-telegram-bot library.
---------
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Support secret_token for setWebHook api
* Revert configuration YAML changes; generate and store secret token instead
* Reformat codes
* Revert storage of secret token; use ephemeral secret token instead
* Reformat
* Update homeassistant/components/telegram_bot/webhooks.py
* Fix when header is not present
* Check for non-empty token
* Fix tests to support secret token
* Add tests for invalid secret token
* Minor: remove comment
* Revert back to 401
* ... and for tests
* Change patching method for the generation of secret tokens
---------
Co-authored-by: Erik Montnemery <erik@montnemery.com>