Allow negative chat ID for Telegram#7688
Closed
olafz wants to merge 2 commits into
Closed
Conversation
Contributor
azogue
requested changes
May 21, 2017
Member
azogue
left a comment
There was a problem hiding this comment.
You missed another in line 87:
BASE_SERVICE_SCHEMA = vol.Schema({
vol.Optional(ATTR_TARGET): vol.All(cv.ensure_list, [cv.positive_int]),I didn't know about the negative chat_ids for groups...
Apart from that, you will have to make some changes to allow communication with groups:
- When getting the message data (in the
_get_message_datamethod), where theuser_idis added, thechat_idshould also be added, in order to be able to respond to the group instead of the user. And change the condition to something like('text' not in msg_data and 'data' not in msg_data and 'chat' not in msg_data). - In
process_message, when receiving anew_chat_participantmessage, there will be an unhandled KeyError when trying to get the non-existent 'text' field.
1 task
Merged
Contributor
Author
|
Superseded by #7689 apparently? |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Description:
The latest version of HASS requires a positive integer for
CHAT_IDin Telegram:However, this breaks group chats within Telegram: if the chat is a group, the chat id is negative. If it is a single person, the chat id is positive. This PR allows for group chats again.