{"action":"created","comment":{"url":"https://api.github.com/repos/carpedm20/fbchat/pulls/comments/185806641","pull_request_review_id":117252709,"id":185806641,"diff_hunk":"@@ -0,0 +1,182 @@\n+# -*- coding: UTF-8 -*-\n+\n+from __future__ import unicode_literals\n+from .listener import Listener\n+\n+\n+class ThreadInterraction(Listener):\n+    \"\"\"Enables the client to interract with and listen on threads\"\"\"\n+\n+    def set_image(self, thread, image):\n+        \"\"\"Set a group's image\n+\n+        Args:\n+            thread (`Thread`): Group whose image to change\n+            image (`Image`): New image\n+        \"\"\"\n+\n+    def on_image_set(self, thread, actor, old_image):","path":"fbchat/thread_interraction.py","position":18,"original_position":18,"commit_id":"312133bae7d814ace32480b7f3c4bdee44940c5d","original_commit_id":"312133bae7d814ace32480b7f3c4bdee44940c5d","user":{"login":"madsmtm","id":10577181,"avatar_url":"https://avatars2.githubusercontent.com/u/10577181?v=4","gravatar_id":"","url":"https://api.github.com/users/madsmtm","html_url":"https://github.com/madsmtm","followers_url":"https://api.github.com/users/madsmtm/followers","following_url":"https://api.github.com/users/madsmtm/following{/other_user}","gists_url":"https://api.github.com/users/madsmtm/gists{/gist_id}","starred_url":"https://api.github.com/users/madsmtm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/madsmtm/subscriptions","organizations_url":"https://api.github.com/users/madsmtm/orgs","repos_url":"https://api.github.com/users/madsmtm/repos","events_url":"https://api.github.com/users/madsmtm/events{/privacy}","received_events_url":"https://api.github.com/users/madsmtm/received_events","type":"User","site_admin":false},"body":"Also notice how I've changed it from the way it was before, so that the passed `thread` object automatically contains the updated information","created_at":"2018-05-03T13:58:21Z","updated_at":"2018-05-03T14:01:55Z","html_url":"https://github.com/carpedm20/fbchat/pull/285#discussion_r185806641","pull_request_url":"https://api.github.com/repos/carpedm20/fbchat/pulls/285","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/carpedm20/fbchat/pulls/comments/185806641"},"html":{"href":"https://github.com/carpedm20/fbchat/pull/285#discussion_r185806641"},"pull_request":{"href":"https://api.github.com/repos/carpedm20/fbchat/pulls/285"}},"in_reply_to_id":185806225},"pull_request":{"url":"https://api.github.com/repos/carpedm20/fbchat/pulls/285","id":185711296,"html_url":"https://github.com/carpedm20/fbchat/pull/285","diff_url":"https://github.com/carpedm20/fbchat/pull/285.diff","patch_url":"https://github.com/carpedm20/fbchat/pull/285.patch","issue_url":"https://api.github.com/repos/carpedm20/fbchat/issues/285","number":285,"state":"open","locked":false,"title":"v2.0.0 - Api Reformat","user":{"login":"madsmtm","id":10577181,"avatar_url":"https://avatars2.githubusercontent.com/u/10577181?v=4","gravatar_id":"","url":"https://api.github.com/users/madsmtm","html_url":"https://github.com/madsmtm","followers_url":"https://api.github.com/users/madsmtm/followers","following_url":"https://api.github.com/users/madsmtm/following{/other_user}","gists_url":"https://api.github.com/users/madsmtm/gists{/gist_id}","starred_url":"https://api.github.com/users/madsmtm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/madsmtm/subscriptions","organizations_url":"https://api.github.com/users/madsmtm/orgs","repos_url":"https://api.github.com/users/madsmtm/repos","events_url":"https://api.github.com/users/madsmtm/events{/privacy}","received_events_url":"https://api.github.com/users/madsmtm/received_events","type":"User","site_admin":false},"body":"# Tl;dr:\r\nThis PR contains several different improvements and changes to the API.\r\n- Caching system, `get` instead of `fetch`\r\n- PEP 8 Style Guide, aka. `on_message` instead of `onMessage`\r\n- `thread` instead of `thread_id` and `thread_type`\r\n- `Client` has been split into several files\r\nThese improvements are, however, only an attempt at giving an overview of how I envision the new API, so most of the actual implementation code has been removed for now.\r\nMake sure to take a look in the `examples` folder, to get a feel for how I want the API to look like.\r\n\r\n# Motivation\r\nI've been working on reformatting the entire API, and I have quite a lot of small things I want to change. But the big thing, I want it to \"just work\". That means no more returning an ID of a message, or having `Group` contain a list of user IDs. I want to make a system that's easy to work with, a system where we just return the `Message` object or return a list of `User` objects.\r\n\r\nAnd one of the most tedious things is working with the `fetch_X` methods, where some use the `before` parameter, and some use `offset` parameter. There are very few cases where a `get_X` method with a single `limit` parameter, and where it would just automatically send multiple requests as needed, wouldn't suffice. And imagine, recieving `Thread` objects in `on_X` methods instead of `thread_id` and `thread_type`, `user_id`, `author_id`, and so on.\r\n\r\n# Caching\r\nThe most important aspect of all of this is making a caching system, where the client would store `Thread` objects, and when needed by a method, just use those. And when updated, eg. when listening, and someone changes a thread's emoji, the `Thread` object could be globally updated, and all places using that `Thread` object would instantly be able to use the new information.\r\n\r\nAn important factor here is that we need to use the `on_X` calls, so that we can update the `Thread`s, when new information arrives. This could be done (i think) in two ways:\r\nJust override the methods, and then *require* people to make a `super` call before anything else, or, and this is the way I've currently decided on, make private `_on_X` methods, that receive the data first, has a chance to update the cached objects, and then sends the data onwards to `on_X`\r\n\r\n# PEP 8 & Split Client\r\nI've also decided to change all method names to lowercase, following the [PEP 8 Style Guide](https://www.python.org/dev/peps/pep-0008/), mostly just to follow *a* style guide. This'll allow us to later use tools like `pycodestyle`, and get a cleaner codebase. Following the \"cleaner codebase\", I've tried to split the `Client` up into components, so it'll be easier to understand what's going on, and write higher level code.\r\n\r\nI know it's a lot of changes, but if you have the time, I'd really like your input on this. Have a nice day! ;)","created_at":"2018-05-03T13:10:22Z","updated_at":"2018-05-03T14:01:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"11e107e52419be48a9b21be1f84eb11c193b4b75","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":201173754,"url":"https://api.github.com/repos/carpedm20/fbchat/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"milestone":null,"commits_url":"https://api.github.com/repos/carpedm20/fbchat/pulls/285/commits","review_comments_url":"https://api.github.com/repos/carpedm20/fbchat/pulls/285/comments","review_comment_url":"https://api.github.com/repos/carpedm20/fbchat/pulls/comments{/number}","comments_url":"https://api.github.com/repos/carpedm20/fbchat/issues/285/comments","statuses_url":"https://api.github.com/repos/carpedm20/fbchat/statuses/312133bae7d814ace32480b7f3c4bdee44940c5d","head":{"label":"carpedm20:feature/api_reformat","ref":"feature/api_reformat","sha":"312133bae7d814ace32480b7f3c4bdee44940c5d","user":{"login":"carpedm20","id":3346407,"avatar_url":"https://avatars1.githubusercontent.com/u/3346407?v=4","gravatar_id":"","url":"https://api.github.com/users/carpedm20","html_url":"https://github.com/carpedm20","followers_url":"https://api.github.com/users/carpedm20/followers","following_url":"https://api.github.com/users/carpedm20/following{/other_user}","gists_url":"https://api.github.com/users/carpedm20/gists{/gist_id}","starred_url":"https://api.github.com/users/carpedm20/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carpedm20/subscriptions","organizations_url":"https://api.github.com/users/carpedm20/orgs","repos_url":"https://api.github.com/users/carpedm20/repos","events_url":"https://api.github.com/users/carpedm20/events{/privacy}","received_events_url":"https://api.github.com/users/carpedm20/received_events","type":"User","site_admin":false},"repo":{"id":34165498,"name":"fbchat","full_name":"carpedm20/fbchat","owner":{"login":"carpedm20","id":3346407,"avatar_url":"https://avatars1.githubusercontent.com/u/3346407?v=4","gravatar_id":"","url":"https://api.github.com/users/carpedm20","html_url":"https://github.com/carpedm20","followers_url":"https://api.github.com/users/carpedm20/followers","following_url":"https://api.github.com/users/carpedm20/following{/other_user}","gists_url":"https://api.github.com/users/carpedm20/gists{/gist_id}","starred_url":"https://api.github.com/users/carpedm20/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carpedm20/subscriptions","organizations_url":"https://api.github.com/users/carpedm20/orgs","repos_url":"https://api.github.com/users/carpedm20/repos","events_url":"https://api.github.com/users/carpedm20/events{/privacy}","received_events_url":"https://api.github.com/users/carpedm20/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/carpedm20/fbchat","description":"Facebook Chat (Messenger) for Python","fork":false,"url":"https://api.github.com/repos/carpedm20/fbchat","forks_url":"https://api.github.com/repos/carpedm20/fbchat/forks","keys_url":"https://api.github.com/repos/carpedm20/fbchat/keys{/key_id}","collaborators_url":"https://api.github.com/repos/carpedm20/fbchat/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/carpedm20/fbchat/teams","hooks_url":"https://api.github.com/repos/carpedm20/fbchat/hooks","issue_events_url":"https://api.github.com/repos/carpedm20/fbchat/issues/events{/number}","events_url":"https://api.github.com/repos/carpedm20/fbchat/events","assignees_url":"https://api.github.com/repos/carpedm20/fbchat/assignees{/user}","branches_url":"https://api.github.com/repos/carpedm20/fbchat/branches{/branch}","tags_url":"https://api.github.com/repos/carpedm20/fbchat/tags","blobs_url":"https://api.github.com/repos/carpedm20/fbchat/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/carpedm20/fbchat/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/carpedm20/fbchat/git/refs{/sha}","trees_url":"https://api.github.com/repos/carpedm20/fbchat/git/trees{/sha}","statuses_url":"https://api.github.com/repos/carpedm20/fbchat/statuses/{sha}","languages_url":"https://api.github.com/repos/carpedm20/fbchat/languages","stargazers_url":"https://api.github.com/repos/carpedm20/fbchat/stargazers","contributors_url":"https://api.github.com/repos/carpedm20/fbchat/contributors","subscribers_url":"https://api.github.com/repos/carpedm20/fbchat/subscribers","subscription_url":"https://api.github.com/repos/carpedm20/fbchat/subscription","commits_url":"https://api.github.com/repos/carpedm20/fbchat/commits{/sha}","git_commits_url":"https://api.github.com/repos/carpedm20/fbchat/git/commits{/sha}","comments_url":"https://api.github.com/repos/carpedm20/fbchat/comments{/number}","issue_comment_url":"https://api.github.com/repos/carpedm20/fbchat/issues/comments{/number}","contents_url":"https://api.github.com/repos/carpedm20/fbchat/contents/{+path}","compare_url":"https://api.github.com/repos/carpedm20/fbchat/compare/{base}...{head}","merges_url":"https://api.github.com/repos/carpedm20/fbchat/merges","archive_url":"https://api.github.com/repos/carpedm20/fbchat/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/carpedm20/fbchat/downloads","issues_url":"https://api.github.com/repos/carpedm20/fbchat/issues{/number}","pulls_url":"https://api.github.com/repos/carpedm20/fbchat/pulls{/number}","milestones_url":"https://api.github.com/repos/carpedm20/fbchat/milestones{/number}","notifications_url":"https://api.github.com/repos/carpedm20/fbchat/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/carpedm20/fbchat/labels{/name}","releases_url":"https://api.github.com/repos/carpedm20/fbchat/releases{/id}","deployments_url":"https://api.github.com/repos/carpedm20/fbchat/deployments","created_at":"2015-04-18T12:44:06Z","updated_at":"2018-05-03T12:17:45Z","pushed_at":"2018-05-03T13:10:22Z","git_url":"git://github.com/carpedm20/fbchat.git","ssh_url":"git@github.com:carpedm20/fbchat.git","clone_url":"https://github.com/carpedm20/fbchat.git","svn_url":"https://github.com/carpedm20/fbchat","homepage":"https://fbchat.readthedocs.io","size":506,"stargazers_count":457,"watchers_count":457,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":183,"mirror_url":null,"archived":false,"open_issues_count":38,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":183,"open_issues":38,"watchers":457,"default_branch":"master"}},"base":{"label":"carpedm20:2.0.0-dev","ref":"2.0.0-dev","sha":"884af482707cdf93c609c59a804438fdbe9a8ed2","user":{"login":"carpedm20","id":3346407,"avatar_url":"https://avatars1.githubusercontent.com/u/3346407?v=4","gravatar_id":"","url":"https://api.github.com/users/carpedm20","html_url":"https://github.com/carpedm20","followers_url":"https://api.github.com/users/carpedm20/followers","following_url":"https://api.github.com/users/carpedm20/following{/other_user}","gists_url":"https://api.github.com/users/carpedm20/gists{/gist_id}","starred_url":"https://api.github.com/users/carpedm20/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carpedm20/subscriptions","organizations_url":"https://api.github.com/users/carpedm20/orgs","repos_url":"https://api.github.com/users/carpedm20/repos","events_url":"https://api.github.com/users/carpedm20/events{/privacy}","received_events_url":"https://api.github.com/users/carpedm20/received_events","type":"User","site_admin":false},"repo":{"id":34165498,"name":"fbchat","full_name":"carpedm20/fbchat","owner":{"login":"carpedm20","id":3346407,"avatar_url":"https://avatars1.githubusercontent.com/u/3346407?v=4","gravatar_id":"","url":"https://api.github.com/users/carpedm20","html_url":"https://github.com/carpedm20","followers_url":"https://api.github.com/users/carpedm20/followers","following_url":"https://api.github.com/users/carpedm20/following{/other_user}","gists_url":"https://api.github.com/users/carpedm20/gists{/gist_id}","starred_url":"https://api.github.com/users/carpedm20/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carpedm20/subscriptions","organizations_url":"https://api.github.com/users/carpedm20/orgs","repos_url":"https://api.github.com/users/carpedm20/repos","events_url":"https://api.github.com/users/carpedm20/events{/privacy}","received_events_url":"https://api.github.com/users/carpedm20/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/carpedm20/fbchat","description":"Facebook Chat (Messenger) for Python","fork":false,"url":"https://api.github.com/repos/carpedm20/fbchat","forks_url":"https://api.github.com/repos/carpedm20/fbchat/forks","keys_url":"https://api.github.com/repos/carpedm20/fbchat/keys{/key_id}","collaborators_url":"https://api.github.com/repos/carpedm20/fbchat/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/carpedm20/fbchat/teams","hooks_url":"https://api.github.com/repos/carpedm20/fbchat/hooks","issue_events_url":"https://api.github.com/repos/carpedm20/fbchat/issues/events{/number}","events_url":"https://api.github.com/repos/carpedm20/fbchat/events","assignees_url":"https://api.github.com/repos/carpedm20/fbchat/assignees{/user}","branches_url":"https://api.github.com/repos/carpedm20/fbchat/branches{/branch}","tags_url":"https://api.github.com/repos/carpedm20/fbchat/tags","blobs_url":"https://api.github.com/repos/carpedm20/fbchat/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/carpedm20/fbchat/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/carpedm20/fbchat/git/refs{/sha}","trees_url":"https://api.github.com/repos/carpedm20/fbchat/git/trees{/sha}","statuses_url":"https://api.github.com/repos/carpedm20/fbchat/statuses/{sha}","languages_url":"https://api.github.com/repos/carpedm20/fbchat/languages","stargazers_url":"https://api.github.com/repos/carpedm20/fbchat/stargazers","contributors_url":"https://api.github.com/repos/carpedm20/fbchat/contributors","subscribers_url":"https://api.github.com/repos/carpedm20/fbchat/subscribers","subscription_url":"https://api.github.com/repos/carpedm20/fbchat/subscription","commits_url":"https://api.github.com/repos/carpedm20/fbchat/commits{/sha}","git_commits_url":"https://api.github.com/repos/carpedm20/fbchat/git/commits{/sha}","comments_url":"https://api.github.com/repos/carpedm20/fbchat/comments{/number}","issue_comment_url":"https://api.github.com/repos/carpedm20/fbchat/issues/comments{/number}","contents_url":"https://api.github.com/repos/carpedm20/fbchat/contents/{+path}","compare_url":"https://api.github.com/repos/carpedm20/fbchat/compare/{base}...{head}","merges_url":"https://api.github.com/repos/carpedm20/fbchat/merges","archive_url":"https://api.github.com/repos/carpedm20/fbchat/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/carpedm20/fbchat/downloads","issues_url":"https://api.github.com/repos/carpedm20/fbchat/issues{/number}","pulls_url":"https://api.github.com/repos/carpedm20/fbchat/pulls{/number}","milestones_url":"https://api.github.com/repos/carpedm20/fbchat/milestones{/number}","notifications_url":"https://api.github.com/repos/carpedm20/fbchat/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/carpedm20/fbchat/labels{/name}","releases_url":"https://api.github.com/repos/carpedm20/fbchat/releases{/id}","deployments_url":"https://api.github.com/repos/carpedm20/fbchat/deployments","created_at":"2015-04-18T12:44:06Z","updated_at":"2018-05-03T12:17:45Z","pushed_at":"2018-05-03T13:10:22Z","git_url":"git://github.com/carpedm20/fbchat.git","ssh_url":"git@github.com:carpedm20/fbchat.git","clone_url":"https://github.com/carpedm20/fbchat.git","svn_url":"https://github.com/carpedm20/fbchat","homepage":"https://fbchat.readthedocs.io","size":506,"stargazers_count":457,"watchers_count":457,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":183,"mirror_url":null,"archived":false,"open_issues_count":38,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":183,"open_issues":38,"watchers":457,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/carpedm20/fbchat/pulls/285"},"html":{"href":"https://github.com/carpedm20/fbchat/pull/285"},"issue":{"href":"https://api.github.com/repos/carpedm20/fbchat/issues/285"},"comments":{"href":"https://api.github.com/repos/carpedm20/fbchat/issues/285/comments"},"review_comments":{"href":"https://api.github.com/repos/carpedm20/fbchat/pulls/285/comments"},"review_comment":{"href":"https://api.github.com/repos/carpedm20/fbchat/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/carpedm20/fbchat/pulls/285/commits"},"statuses":{"href":"https://api.github.com/repos/carpedm20/fbchat/statuses/312133bae7d814ace32480b7f3c4bdee44940c5d"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"madsmtm"}}