Update telegram connector to accept first_name and username #841
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
This is a fix for the issue with Telegram, I've also added the suggestion by @iobreaker so this connector should now work with private messages, groups and chats.
I have also decided to include a warning message when the result didn't contain
message
andtext
in its fields.On the test side, I have removed the unused opsdroid mock.
--EDIT--
I decided to follow the Matrix connector logic by setting
self.session
toaiohttp.ClientSession
on connect and use that same session when calling different api methods. I would like to know if this is a good way to do it instead of usingwith
- this definitely kept the line numbers shorterI have refactored the telegram methods, added changes suggested by @iobreaker. Changed the whitelist method to include userIDs to try and address the issue raised by Cadair about people bypassing this by changing their name.
I have also implemented a disconnect method - this was suggested by another contributor (I dont remember the name sorry) and was implemented to the shell connector. I have tested the disconnect method extensively without cancelling pending tasks and everything seems to be working okay.
In order to get this disconnect method I had to move the while loop to another method - this probably could be done in a different way.
Overall, I am happy with these changes and ready for the review 😄👍
Fixes #839 and #840
Status
READY |
UNDER DEVELOPMENT|ON HOLDType of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration.
tasks.cancel()
commented out in core - connector disconnected property without raising an exceptionChecklist: