{"action":"created","comment":{"url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/pulls/comments/194664189","pull_request_review_id":127874573,"id":194664189,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NDY2NDE4OQ==","diff_hunk":"@@ -0,0 +1,89 @@\n+from uqcsbot import bot, Command\n+from requests import get\n+from requests.exceptions import RequestException\n+from contextlib import closing\n+from bs4 import BeautifulSoup\n+\n+DEFAULT_RESULT_LENGTH = 5\n+\n+NO_QUERY_MESSAGE = \"You can't look for nothing. `!umart <QUERY>`\"\n+NO_RESULTS_MESSAGE = \"I can't find anything. Try `!umart <SOMETHING NOT AS SPECIFIC>`\"\n+ERROR_MESSAGE = \"I tried to get the things but alas I could not. Error with HTTP Request.\"\n+\n+UMART_SEARCH_URL = \"https://www.umart.com.au/umart1/pro/products_list_searchnew_min.phtml\"\n+UMART_PRODUCT_URL = \"https://www.umart.com.au/umart1/pro/\"\n+\n+\n+@bot.on_command('umart')\n+def handle_umart(command: Command):\n+    '''\n+    `!umart <QUERY>` - Returns up to 5 top results for products from umart matching the search query.\n+    '''\n+    # Makes sure the query is not empty\n+    if not command.has_arg():\n+        bot.post_message(command.channel, NO_QUERY_MESSAGE)\n+        return\n+    search_query = command.arg.strip()\n+    if 'SOMETHING NOT AS SPECIFIC' in search_query:\n+        bot.post_message(command.channel, 'Not literally...')\n+        return\n+    search_results = get_umart_results(DEFAULT_RESULT_LENGTH, search_query)\n+    if not search_results:\n+        bot.post_message(command.channel, ERROR_MESSAGE)\n+        return\n+    if not len(search_results):\n+        bot.post_message(command.channel, NO_RESULTS_MESSAGE)\n+        return\n+    message = '```'\n+    for result in search_results:\n+        message += f'Name: <{UMART_PRODUCT_URL}{result[\"link\"]}|{result[\"name\"]}>\\nPrice: {result[\"price\"]}\\n'\n+    message += '```'\n+    bot.post_message(command.channel, message)\n+\n+def get_umart_results(limit, search_query):","path":"uqcsbot/scripts/umart.py","position":null,"original_position":43,"commit_id":"2c5f2f88770a0b82727ce2ae22946fb2aa708a39","original_commit_id":"ec3a03dfc7a33a5ff92d85bfb6618a76f83da16d","user":{"login":"mitchmcdee","id":10495244,"node_id":"MDQ6VXNlcjEwNDk1MjQ0","avatar_url":"https://avatars1.githubusercontent.com/u/10495244?v=4","gravatar_id":"","url":"https://api.github.com/users/mitchmcdee","html_url":"https://github.com/mitchmcdee","followers_url":"https://api.github.com/users/mitchmcdee/followers","following_url":"https://api.github.com/users/mitchmcdee/following{/other_user}","gists_url":"https://api.github.com/users/mitchmcdee/gists{/gist_id}","starred_url":"https://api.github.com/users/mitchmcdee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mitchmcdee/subscriptions","organizations_url":"https://api.github.com/users/mitchmcdee/orgs","repos_url":"https://api.github.com/users/mitchmcdee/repos","events_url":"https://api.github.com/users/mitchmcdee/events{/privacy}","received_events_url":"https://api.github.com/users/mitchmcdee/received_events","type":"User","site_admin":false},"body":"is limit used? also, i'd probably swap the order of arguments","created_at":"2018-06-12T09:02:37Z","updated_at":"2018-06-12T09:09:36Z","html_url":"https://github.com/UQComputingSociety/uqcsbot/pull/308#discussion_r194664189","pull_request_url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/pulls/308","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/UQComputingSociety/uqcsbot/pulls/comments/194664189"},"html":{"href":"https://github.com/UQComputingSociety/uqcsbot/pull/308#discussion_r194664189"},"pull_request":{"href":"https://api.github.com/repos/UQComputingSociety/uqcsbot/pulls/308"}}},"pull_request":{"url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/pulls/308","id":193817473,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkzODE3NDcz","html_url":"https://github.com/UQComputingSociety/uqcsbot/pull/308","diff_url":"https://github.com/UQComputingSociety/uqcsbot/pull/308.diff","patch_url":"https://github.com/UQComputingSociety/uqcsbot/pull/308.patch","issue_url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/issues/308","number":308,"state":"open","locked":false,"title":"Port Umart","user":{"login":"jdcaperon","id":30421879,"node_id":"MDQ6VXNlcjMwNDIxODc5","avatar_url":"https://avatars0.githubusercontent.com/u/30421879?v=4","gravatar_id":"","url":"https://api.github.com/users/jdcaperon","html_url":"https://github.com/jdcaperon","followers_url":"https://api.github.com/users/jdcaperon/followers","following_url":"https://api.github.com/users/jdcaperon/following{/other_user}","gists_url":"https://api.github.com/users/jdcaperon/gists{/gist_id}","starred_url":"https://api.github.com/users/jdcaperon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdcaperon/subscriptions","organizations_url":"https://api.github.com/users/jdcaperon/orgs","repos_url":"https://api.github.com/users/jdcaperon/repos","events_url":"https://api.github.com/users/jdcaperon/events{/privacy}","received_events_url":"https://api.github.com/users/jdcaperon/received_events","type":"User","site_admin":false},"body":"Normal functionality for umart implemented with basic tests. Normal functionality takes a query and returns up to 5 top search results for umart milton.\r\n\r\nFixes #306","created_at":"2018-06-10T09:40:36Z","updated_at":"2018-06-12T09:09:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ac501e1ea2e6587078b496cc993c938d1d14a506","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/pulls/308/commits","review_comments_url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/pulls/308/comments","review_comment_url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/pulls/comments{/number}","comments_url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/issues/308/comments","statuses_url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/statuses/2c5f2f88770a0b82727ce2ae22946fb2aa708a39","head":{"label":"jdcaperon:umart-dev","ref":"umart-dev","sha":"2c5f2f88770a0b82727ce2ae22946fb2aa708a39","user":{"login":"jdcaperon","id":30421879,"node_id":"MDQ6VXNlcjMwNDIxODc5","avatar_url":"https://avatars0.githubusercontent.com/u/30421879?v=4","gravatar_id":"","url":"https://api.github.com/users/jdcaperon","html_url":"https://github.com/jdcaperon","followers_url":"https://api.github.com/users/jdcaperon/followers","following_url":"https://api.github.com/users/jdcaperon/following{/other_user}","gists_url":"https://api.github.com/users/jdcaperon/gists{/gist_id}","starred_url":"https://api.github.com/users/jdcaperon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdcaperon/subscriptions","organizations_url":"https://api.github.com/users/jdcaperon/orgs","repos_url":"https://api.github.com/users/jdcaperon/repos","events_url":"https://api.github.com/users/jdcaperon/events{/privacy}","received_events_url":"https://api.github.com/users/jdcaperon/received_events","type":"User","site_admin":false},"repo":{"id":136589817,"node_id":"MDEwOlJlcG9zaXRvcnkxMzY1ODk4MTc=","name":"uqcsbot","full_name":"jdcaperon/uqcsbot","owner":{"login":"jdcaperon","id":30421879,"node_id":"MDQ6VXNlcjMwNDIxODc5","avatar_url":"https://avatars0.githubusercontent.com/u/30421879?v=4","gravatar_id":"","url":"https://api.github.com/users/jdcaperon","html_url":"https://github.com/jdcaperon","followers_url":"https://api.github.com/users/jdcaperon/followers","following_url":"https://api.github.com/users/jdcaperon/following{/other_user}","gists_url":"https://api.github.com/users/jdcaperon/gists{/gist_id}","starred_url":"https://api.github.com/users/jdcaperon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdcaperon/subscriptions","organizations_url":"https://api.github.com/users/jdcaperon/orgs","repos_url":"https://api.github.com/users/jdcaperon/repos","events_url":"https://api.github.com/users/jdcaperon/events{/privacy}","received_events_url":"https://api.github.com/users/jdcaperon/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jdcaperon/uqcsbot","description":"UQCSbot: our friendly little Slack bot","fork":true,"url":"https://api.github.com/repos/jdcaperon/uqcsbot","forks_url":"https://api.github.com/repos/jdcaperon/uqcsbot/forks","keys_url":"https://api.github.com/repos/jdcaperon/uqcsbot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jdcaperon/uqcsbot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jdcaperon/uqcsbot/teams","hooks_url":"https://api.github.com/repos/jdcaperon/uqcsbot/hooks","issue_events_url":"https://api.github.com/repos/jdcaperon/uqcsbot/issues/events{/number}","events_url":"https://api.github.com/repos/jdcaperon/uqcsbot/events","assignees_url":"https://api.github.com/repos/jdcaperon/uqcsbot/assignees{/user}","branches_url":"https://api.github.com/repos/jdcaperon/uqcsbot/branches{/branch}","tags_url":"https://api.github.com/repos/jdcaperon/uqcsbot/tags","blobs_url":"https://api.github.com/repos/jdcaperon/uqcsbot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jdcaperon/uqcsbot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jdcaperon/uqcsbot/git/refs{/sha}","trees_url":"https://api.github.com/repos/jdcaperon/uqcsbot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jdcaperon/uqcsbot/statuses/{sha}","languages_url":"https://api.github.com/repos/jdcaperon/uqcsbot/languages","stargazers_url":"https://api.github.com/repos/jdcaperon/uqcsbot/stargazers","contributors_url":"https://api.github.com/repos/jdcaperon/uqcsbot/contributors","subscribers_url":"https://api.github.com/repos/jdcaperon/uqcsbot/subscribers","subscription_url":"https://api.github.com/repos/jdcaperon/uqcsbot/subscription","commits_url":"https://api.github.com/repos/jdcaperon/uqcsbot/commits{/sha}","git_commits_url":"https://api.github.com/repos/jdcaperon/uqcsbot/git/commits{/sha}","comments_url":"https://api.github.com/repos/jdcaperon/uqcsbot/comments{/number}","issue_comment_url":"https://api.github.com/repos/jdcaperon/uqcsbot/issues/comments{/number}","contents_url":"https://api.github.com/repos/jdcaperon/uqcsbot/contents/{+path}","compare_url":"https://api.github.com/repos/jdcaperon/uqcsbot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jdcaperon/uqcsbot/merges","archive_url":"https://api.github.com/repos/jdcaperon/uqcsbot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jdcaperon/uqcsbot/downloads","issues_url":"https://api.github.com/repos/jdcaperon/uqcsbot/issues{/number}","pulls_url":"https://api.github.com/repos/jdcaperon/uqcsbot/pulls{/number}","milestones_url":"https://api.github.com/repos/jdcaperon/uqcsbot/milestones{/number}","notifications_url":"https://api.github.com/repos/jdcaperon/uqcsbot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jdcaperon/uqcsbot/labels{/name}","releases_url":"https://api.github.com/repos/jdcaperon/uqcsbot/releases{/id}","deployments_url":"https://api.github.com/repos/jdcaperon/uqcsbot/deployments","created_at":"2018-06-08T08:25:09Z","updated_at":"2018-06-10T06:12:21Z","pushed_at":"2018-06-12T09:04:15Z","git_url":"git://github.com/jdcaperon/uqcsbot.git","ssh_url":"git@github.com:jdcaperon/uqcsbot.git","clone_url":"https://github.com/jdcaperon/uqcsbot.git","svn_url":"https://github.com/jdcaperon/uqcsbot","homepage":"https://slack.uqcs.org.au","size":559,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"python-rewrite"}},"base":{"label":"UQComputingSociety:python-rewrite","ref":"python-rewrite","sha":"07d0b7071bd68711b13f1577fdbcf07e8ebc0114","user":{"login":"UQComputingSociety","id":639595,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYzOTU5NQ==","avatar_url":"https://avatars1.githubusercontent.com/u/639595?v=4","gravatar_id":"","url":"https://api.github.com/users/UQComputingSociety","html_url":"https://github.com/UQComputingSociety","followers_url":"https://api.github.com/users/UQComputingSociety/followers","following_url":"https://api.github.com/users/UQComputingSociety/following{/other_user}","gists_url":"https://api.github.com/users/UQComputingSociety/gists{/gist_id}","starred_url":"https://api.github.com/users/UQComputingSociety/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UQComputingSociety/subscriptions","organizations_url":"https://api.github.com/users/UQComputingSociety/orgs","repos_url":"https://api.github.com/users/UQComputingSociety/repos","events_url":"https://api.github.com/users/UQComputingSociety/events{/privacy}","received_events_url":"https://api.github.com/users/UQComputingSociety/received_events","type":"Organization","site_admin":false},"repo":{"id":46210727,"node_id":"MDEwOlJlcG9zaXRvcnk0NjIxMDcyNw==","name":"uqcsbot","full_name":"UQComputingSociety/uqcsbot","owner":{"login":"UQComputingSociety","id":639595,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYzOTU5NQ==","avatar_url":"https://avatars1.githubusercontent.com/u/639595?v=4","gravatar_id":"","url":"https://api.github.com/users/UQComputingSociety","html_url":"https://github.com/UQComputingSociety","followers_url":"https://api.github.com/users/UQComputingSociety/followers","following_url":"https://api.github.com/users/UQComputingSociety/following{/other_user}","gists_url":"https://api.github.com/users/UQComputingSociety/gists{/gist_id}","starred_url":"https://api.github.com/users/UQComputingSociety/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UQComputingSociety/subscriptions","organizations_url":"https://api.github.com/users/UQComputingSociety/orgs","repos_url":"https://api.github.com/users/UQComputingSociety/repos","events_url":"https://api.github.com/users/UQComputingSociety/events{/privacy}","received_events_url":"https://api.github.com/users/UQComputingSociety/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/UQComputingSociety/uqcsbot","description":"UQCSbot: our friendly little Slack bot","fork":false,"url":"https://api.github.com/repos/UQComputingSociety/uqcsbot","forks_url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/forks","keys_url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/teams","hooks_url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/hooks","issue_events_url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/issues/events{/number}","events_url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/events","assignees_url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/assignees{/user}","branches_url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/branches{/branch}","tags_url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/tags","blobs_url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/git/refs{/sha}","trees_url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/statuses/{sha}","languages_url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/languages","stargazers_url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/stargazers","contributors_url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/contributors","subscribers_url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/subscribers","subscription_url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/subscription","commits_url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/commits{/sha}","git_commits_url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/git/commits{/sha}","comments_url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/comments{/number}","issue_comment_url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/issues/comments{/number}","contents_url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/contents/{+path}","compare_url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/merges","archive_url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/downloads","issues_url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/issues{/number}","pulls_url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/pulls{/number}","milestones_url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/milestones{/number}","notifications_url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/labels{/name}","releases_url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/releases{/id}","deployments_url":"https://api.github.com/repos/UQComputingSociety/uqcsbot/deployments","created_at":"2015-11-15T08:49:04Z","updated_at":"2018-06-12T06:11:53Z","pushed_at":"2018-06-12T09:04:16Z","git_url":"git://github.com/UQComputingSociety/uqcsbot.git","ssh_url":"git@github.com:UQComputingSociety/uqcsbot.git","clone_url":"https://github.com/UQComputingSociety/uqcsbot.git","svn_url":"https://github.com/UQComputingSociety/uqcsbot","homepage":"https://slack.uqcs.org.au","size":554,"stargazers_count":28,"watchers_count":28,"language":"Python","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":30,"mirror_url":null,"archived":false,"open_issues_count":43,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":30,"open_issues":43,"watchers":28,"default_branch":"python-rewrite"}},"_links":{"self":{"href":"https://api.github.com/repos/UQComputingSociety/uqcsbot/pulls/308"},"html":{"href":"https://github.com/UQComputingSociety/uqcsbot/pull/308"},"issue":{"href":"https://api.github.com/repos/UQComputingSociety/uqcsbot/issues/308"},"comments":{"href":"https://api.github.com/repos/UQComputingSociety/uqcsbot/issues/308/comments"},"review_comments":{"href":"https://api.github.com/repos/UQComputingSociety/uqcsbot/pulls/308/comments"},"review_comment":{"href":"https://api.github.com/repos/UQComputingSociety/uqcsbot/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/UQComputingSociety/uqcsbot/pulls/308/commits"},"statuses":{"href":"https://api.github.com/repos/UQComputingSociety/uqcsbot/statuses/2c5f2f88770a0b82727ce2ae22946fb2aa708a39"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"mitchmcdee"}}