-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Class methods #362
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
Merged
Merged
Class methods #362
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
1b5806c
bot.py: add create_references method
jh0ker d8211ec
create bot reference in webhook handler, use create_references on new…
jh0ker be508f1
message.py: implement reply_text
jh0ker 6696a15
echobot2.py: use Message.reply_text
jh0ker 02c0a75
fix create_references in webhook handler
jh0ker e071bc8
add some more instance methods
jh0ker b54ae67
Chat.kick_member and unban_member
jh0ker b491315
Merge branch 'master' into class-methods
jh0ker dbea806
bot.py: Create bot references in outgoing messages
jh0ker 0394a94
add tests for everything testable
jh0ker c03e746
test_updater.py: add create_references method to MockBot
jh0ker 1547a1f
remove Bot.create_references and refactor TelegramObject.de_json to t…
jh0ker 8cf9dfe
List bot as named kwarg where used
jh0ker df3d05b
file.py: Use Bot.request property instead of Bot._request attr
jh0ker 3d07a83
Merge branch 'master' into class-methods
jh0ker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jh0ker
I'm conflicted here.
I know it's pretty the way you currently implemented it (explicit and self explanatory). However, on busy bots, you actually run twice on 100 updates each time this code is called. so it can actually have performance impact.
Suggestion for discussion:
Instead of having
create_referencesmethod, the variousde_jsonmethods will acceptbotas a second parameter (similar to what I've done withFile.de_jsonfor therequestobject)then you can do:
return [Update.de_json(u, self) for u in result]A similar comment goes for the Webhook below