{"action":"created","issue":{"url":"https://api.github.com/repos/irazasyed/telegram-bot-sdk/issues/177","repository_url":"https://api.github.com/repos/irazasyed/telegram-bot-sdk","labels_url":"https://api.github.com/repos/irazasyed/telegram-bot-sdk/issues/177/labels{/name}","comments_url":"https://api.github.com/repos/irazasyed/telegram-bot-sdk/issues/177/comments","events_url":"https://api.github.com/repos/irazasyed/telegram-bot-sdk/issues/177/events","html_url":"https://github.com/irazasyed/telegram-bot-sdk/pull/177","id":152191050,"number":177,"title":"Move type detection from Api class to Message and Update.","user":{"login":"Sloothword","id":7378822,"avatar_url":"https://avatars.githubusercontent.com/u/7378822?v=3","gravatar_id":"","url":"https://api.github.com/users/Sloothword","html_url":"https://github.com/Sloothword","followers_url":"https://api.github.com/users/Sloothword/followers","following_url":"https://api.github.com/users/Sloothword/following{/other_user}","gists_url":"https://api.github.com/users/Sloothword/gists{/gist_id}","starred_url":"https://api.github.com/users/Sloothword/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sloothword/subscriptions","organizations_url":"https://api.github.com/users/Sloothword/orgs","repos_url":"https://api.github.com/users/Sloothword/repos","events_url":"https://api.github.com/users/Sloothword/events{/privacy}","received_events_url":"https://api.github.com/users/Sloothword/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-05-01T09:40:48Z","updated_at":"2016-05-01T13:21:07Z","closed_at":"2016-05-01T13:17:52Z","pull_request":{"url":"https://api.github.com/repos/irazasyed/telegram-bot-sdk/pulls/177","html_url":"https://github.com/irazasyed/telegram-bot-sdk/pull/177","diff_url":"https://github.com/irazasyed/telegram-bot-sdk/pull/177.diff","patch_url":"https://github.com/irazasyed/telegram-bot-sdk/pull/177.patch"},"body":"In line with our chat discussion:\r\n- Detection of message type should be concern of Message object --> Moved there\r\n- Detection of Update object added\r\n- Made Api methods more robust against error or updates without message\r\n- Deprecated Api methods\r\n\r\n\r\nAm i doing this right? (first time github)\r\n\r\nQuestions:\r\n- Why is `$message->isType` not just an alias for `$message->has`. What does the extra `return $this->detectType() === $type;` add?\r\n- `Api->detectMessageType` was (and is) untested. I honestly do not really know how to test, cause in the end you only test if $update->keys() is implemented correctly. Maybe we need some recorded(?) telegram updates to use as test input."},"comment":{"url":"https://api.github.com/repos/irazasyed/telegram-bot-sdk/issues/comments/216041796","html_url":"https://github.com/irazasyed/telegram-bot-sdk/pull/177#issuecomment-216041796","issue_url":"https://api.github.com/repos/irazasyed/telegram-bot-sdk/issues/177","id":216041796,"user":{"login":"irazasyed","id":1915268,"avatar_url":"https://avatars.githubusercontent.com/u/1915268?v=3","gravatar_id":"","url":"https://api.github.com/users/irazasyed","html_url":"https://github.com/irazasyed","followers_url":"https://api.github.com/users/irazasyed/followers","following_url":"https://api.github.com/users/irazasyed/following{/other_user}","gists_url":"https://api.github.com/users/irazasyed/gists{/gist_id}","starred_url":"https://api.github.com/users/irazasyed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/irazasyed/subscriptions","organizations_url":"https://api.github.com/users/irazasyed/orgs","repos_url":"https://api.github.com/users/irazasyed/repos","events_url":"https://api.github.com/users/irazasyed/events{/privacy}","received_events_url":"https://api.github.com/users/irazasyed/received_events","type":"User","site_admin":false},"created_at":"2016-05-01T13:21:07Z","updated_at":"2016-05-01T13:21:07Z","body":"Thanks for your contribution :)\r\n\r\nYou're doing it right.\r\n\r\nAnswer to your questions:\r\n1. It helps to guess what type of message it is. There was a requirement sometime ago by a user of this project and it made sense back then to create like that. Apart from that, I don't remember why i had gone with that method TBH. But I'm sure I had added for a valid reason.\r\n2. Yes, It's untested. In fact a lot of tests are missing, Since we're decoupling the project, I'm not writing any tests right now. Will be looking at it at the end."}}