{"action":"created","comment":{"url":"https://api.github.com/repos/halibot-extra/quote/pulls/comments/78817498","id":78817498,"diff_hunk":"@@ -3,48 +3,102 @@\n import random\n from halibot import HalModule\n \n+sr = random.SystemRandom()\n+\n class Quote(HalModule):\n \n-\tquotes = []\n+\t# Configuration defaults\n+\tremove_votes = 3\n+\tmax_history = 10\n \n \tdef init(self):\n-\t\tself.path = self.config['quotes-path']\n+\t\tself.quotes = []\n+\t\tself.path = self.config.get('quotes-path')\n+\t\tself.remove_votes = self.config.get('remote-votes', self.remove_votes)\n+\t\tself.max_history = self.config.get('max-history', self.max_history)\n \t\tprint('using quotes path:', self.path)\n \n-\t\twith open(self.path, 'r') as f:\n-\t\t\tself.quotes = [x.rstrip() for x in f.readlines()]\n+\t\tif self.path is not None:\n+\t\t\ttry:\n+\t\t\t\twith open(self.path, 'r') as f:\n+\t\t\t\t\tself.quotes.extend([x.rstrip() for x in f if x.rstrip()])\n+\t\t\texcept IOError, OSError:\n+\t\t\t\tpass","path":"quote.py","position":28,"original_position":28,"commit_id":"89a462afbc2a7d7f15d867301848434f84e54a73","original_commit_id":"89a462afbc2a7d7f15d867301848434f84e54a73","user":{"login":"sjrct","id":1354804,"avatar_url":"https://avatars.githubusercontent.com/u/1354804?v=3","gravatar_id":"","url":"https://api.github.com/users/sjrct","html_url":"https://github.com/sjrct","followers_url":"https://api.github.com/users/sjrct/followers","following_url":"https://api.github.com/users/sjrct/following{/other_user}","gists_url":"https://api.github.com/users/sjrct/gists{/gist_id}","starred_url":"https://api.github.com/users/sjrct/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sjrct/subscriptions","organizations_url":"https://api.github.com/users/sjrct/orgs","repos_url":"https://api.github.com/users/sjrct/repos","events_url":"https://api.github.com/users/sjrct/events{/privacy}","received_events_url":"https://api.github.com/users/sjrct/received_events","type":"User","site_admin":false},"body":"We should probably log the error message.","created_at":"2016-09-14T19:13:40Z","updated_at":"2016-09-14T19:13:40Z","html_url":"https://github.com/halibot-extra/quote/pull/4#discussion_r78817498","pull_request_url":"https://api.github.com/repos/halibot-extra/quote/pulls/4","_links":{"self":{"href":"https://api.github.com/repos/halibot-extra/quote/pulls/comments/78817498"},"html":{"href":"https://github.com/halibot-extra/quote/pull/4#discussion_r78817498"},"pull_request":{"href":"https://api.github.com/repos/halibot-extra/quote/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/halibot-extra/quote/pulls/4","id":85260859,"html_url":"https://github.com/halibot-extra/quote/pull/4","diff_url":"https://github.com/halibot-extra/quote/pull/4.diff","patch_url":"https://github.com/halibot-extra/quote/pull/4.patch","issue_url":"https://api.github.com/repos/halibot-extra/quote/issues/4","number":4,"state":"open","locked":false,"title":"Features!","user":{"login":"Grissess","id":1500742,"avatar_url":"https://avatars.githubusercontent.com/u/1500742?v=3","gravatar_id":"","url":"https://api.github.com/users/Grissess","html_url":"https://github.com/Grissess","followers_url":"https://api.github.com/users/Grissess/followers","following_url":"https://api.github.com/users/Grissess/following{/other_user}","gists_url":"https://api.github.com/users/Grissess/gists{/gist_id}","starred_url":"https://api.github.com/users/Grissess/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Grissess/subscriptions","organizations_url":"https://api.github.com/users/Grissess/orgs","repos_url":"https://api.github.com/users/Grissess/repos","events_url":"https://api.github.com/users/Grissess/events{/privacy}","received_events_url":"https://api.github.com/users/Grissess/received_events","type":"User","site_admin":false},"body":"- !quotedel to remove quotes\r\n- Safer file I/O, more Pythonic syntax\r\n- Actual shuffling to avoid repeating quotes for specific patterns\r\n- Using SystemRandom for cryptographically random quotes ;)\r\n- Config: remove-votes for voters to do a !quotedel\r\n- Config: max-history for max number of !quote shuffles to remember","created_at":"2016-09-14T16:26:53Z","updated_at":"2016-09-14T19:21:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"675b6261f1246fb54e6727f0cf3976ebb9faa8d2","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/halibot-extra/quote/pulls/4/commits","review_comments_url":"https://api.github.com/repos/halibot-extra/quote/pulls/4/comments","review_comment_url":"https://api.github.com/repos/halibot-extra/quote/pulls/comments{/number}","comments_url":"https://api.github.com/repos/halibot-extra/quote/issues/4/comments","statuses_url":"https://api.github.com/repos/halibot-extra/quote/statuses/89a462afbc2a7d7f15d867301848434f84e54a73","head":{"label":"Grissess:master","ref":"master","sha":"89a462afbc2a7d7f15d867301848434f84e54a73","user":{"login":"Grissess","id":1500742,"avatar_url":"https://avatars.githubusercontent.com/u/1500742?v=3","gravatar_id":"","url":"https://api.github.com/users/Grissess","html_url":"https://github.com/Grissess","followers_url":"https://api.github.com/users/Grissess/followers","following_url":"https://api.github.com/users/Grissess/following{/other_user}","gists_url":"https://api.github.com/users/Grissess/gists{/gist_id}","starred_url":"https://api.github.com/users/Grissess/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Grissess/subscriptions","organizations_url":"https://api.github.com/users/Grissess/orgs","repos_url":"https://api.github.com/users/Grissess/repos","events_url":"https://api.github.com/users/Grissess/events{/privacy}","received_events_url":"https://api.github.com/users/Grissess/received_events","type":"User","site_admin":false},"repo":{"id":68207466,"name":"quote","full_name":"Grissess/quote","owner":{"login":"Grissess","id":1500742,"avatar_url":"https://avatars.githubusercontent.com/u/1500742?v=3","gravatar_id":"","url":"https://api.github.com/users/Grissess","html_url":"https://github.com/Grissess","followers_url":"https://api.github.com/users/Grissess/followers","following_url":"https://api.github.com/users/Grissess/following{/other_user}","gists_url":"https://api.github.com/users/Grissess/gists{/gist_id}","starred_url":"https://api.github.com/users/Grissess/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Grissess/subscriptions","organizations_url":"https://api.github.com/users/Grissess/orgs","repos_url":"https://api.github.com/users/Grissess/repos","events_url":"https://api.github.com/users/Grissess/events{/privacy}","received_events_url":"https://api.github.com/users/Grissess/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Grissess/quote","description":"Replies to commands with random quotes from a source file.","fork":true,"url":"https://api.github.com/repos/Grissess/quote","forks_url":"https://api.github.com/repos/Grissess/quote/forks","keys_url":"https://api.github.com/repos/Grissess/quote/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Grissess/quote/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Grissess/quote/teams","hooks_url":"https://api.github.com/repos/Grissess/quote/hooks","issue_events_url":"https://api.github.com/repos/Grissess/quote/issues/events{/number}","events_url":"https://api.github.com/repos/Grissess/quote/events","assignees_url":"https://api.github.com/repos/Grissess/quote/assignees{/user}","branches_url":"https://api.github.com/repos/Grissess/quote/branches{/branch}","tags_url":"https://api.github.com/repos/Grissess/quote/tags","blobs_url":"https://api.github.com/repos/Grissess/quote/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Grissess/quote/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Grissess/quote/git/refs{/sha}","trees_url":"https://api.github.com/repos/Grissess/quote/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Grissess/quote/statuses/{sha}","languages_url":"https://api.github.com/repos/Grissess/quote/languages","stargazers_url":"https://api.github.com/repos/Grissess/quote/stargazers","contributors_url":"https://api.github.com/repos/Grissess/quote/contributors","subscribers_url":"https://api.github.com/repos/Grissess/quote/subscribers","subscription_url":"https://api.github.com/repos/Grissess/quote/subscription","commits_url":"https://api.github.com/repos/Grissess/quote/commits{/sha}","git_commits_url":"https://api.github.com/repos/Grissess/quote/git/commits{/sha}","comments_url":"https://api.github.com/repos/Grissess/quote/comments{/number}","issue_comment_url":"https://api.github.com/repos/Grissess/quote/issues/comments{/number}","contents_url":"https://api.github.com/repos/Grissess/quote/contents/{+path}","compare_url":"https://api.github.com/repos/Grissess/quote/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Grissess/quote/merges","archive_url":"https://api.github.com/repos/Grissess/quote/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Grissess/quote/downloads","issues_url":"https://api.github.com/repos/Grissess/quote/issues{/number}","pulls_url":"https://api.github.com/repos/Grissess/quote/pulls{/number}","milestones_url":"https://api.github.com/repos/Grissess/quote/milestones{/number}","notifications_url":"https://api.github.com/repos/Grissess/quote/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Grissess/quote/labels{/name}","releases_url":"https://api.github.com/repos/Grissess/quote/releases{/id}","deployments_url":"https://api.github.com/repos/Grissess/quote/deployments","created_at":"2016-09-14T13:11:24Z","updated_at":"2016-09-14T13:11:25Z","pushed_at":"2016-09-14T16:26:13Z","git_url":"git://github.com/Grissess/quote.git","ssh_url":"git@github.com:Grissess/quote.git","clone_url":"https://github.com/Grissess/quote.git","svn_url":"https://github.com/Grissess/quote","homepage":null,"size":7,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"halibot-extra:master","ref":"master","sha":"004e6733760388813d2307909aaefbf18fa6ee28","user":{"login":"halibot-extra","id":15117092,"avatar_url":"https://avatars.githubusercontent.com/u/15117092?v=3","gravatar_id":"","url":"https://api.github.com/users/halibot-extra","html_url":"https://github.com/halibot-extra","followers_url":"https://api.github.com/users/halibot-extra/followers","following_url":"https://api.github.com/users/halibot-extra/following{/other_user}","gists_url":"https://api.github.com/users/halibot-extra/gists{/gist_id}","starred_url":"https://api.github.com/users/halibot-extra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/halibot-extra/subscriptions","organizations_url":"https://api.github.com/users/halibot-extra/orgs","repos_url":"https://api.github.com/users/halibot-extra/repos","events_url":"https://api.github.com/users/halibot-extra/events{/privacy}","received_events_url":"https://api.github.com/users/halibot-extra/received_events","type":"Organization","site_admin":false},"repo":{"id":43931590,"name":"quote","full_name":"halibot-extra/quote","owner":{"login":"halibot-extra","id":15117092,"avatar_url":"https://avatars.githubusercontent.com/u/15117092?v=3","gravatar_id":"","url":"https://api.github.com/users/halibot-extra","html_url":"https://github.com/halibot-extra","followers_url":"https://api.github.com/users/halibot-extra/followers","following_url":"https://api.github.com/users/halibot-extra/following{/other_user}","gists_url":"https://api.github.com/users/halibot-extra/gists{/gist_id}","starred_url":"https://api.github.com/users/halibot-extra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/halibot-extra/subscriptions","organizations_url":"https://api.github.com/users/halibot-extra/orgs","repos_url":"https://api.github.com/users/halibot-extra/repos","events_url":"https://api.github.com/users/halibot-extra/events{/privacy}","received_events_url":"https://api.github.com/users/halibot-extra/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/halibot-extra/quote","description":"Replies to commands with random quotes from a source file.","fork":false,"url":"https://api.github.com/repos/halibot-extra/quote","forks_url":"https://api.github.com/repos/halibot-extra/quote/forks","keys_url":"https://api.github.com/repos/halibot-extra/quote/keys{/key_id}","collaborators_url":"https://api.github.com/repos/halibot-extra/quote/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/halibot-extra/quote/teams","hooks_url":"https://api.github.com/repos/halibot-extra/quote/hooks","issue_events_url":"https://api.github.com/repos/halibot-extra/quote/issues/events{/number}","events_url":"https://api.github.com/repos/halibot-extra/quote/events","assignees_url":"https://api.github.com/repos/halibot-extra/quote/assignees{/user}","branches_url":"https://api.github.com/repos/halibot-extra/quote/branches{/branch}","tags_url":"https://api.github.com/repos/halibot-extra/quote/tags","blobs_url":"https://api.github.com/repos/halibot-extra/quote/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/halibot-extra/quote/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/halibot-extra/quote/git/refs{/sha}","trees_url":"https://api.github.com/repos/halibot-extra/quote/git/trees{/sha}","statuses_url":"https://api.github.com/repos/halibot-extra/quote/statuses/{sha}","languages_url":"https://api.github.com/repos/halibot-extra/quote/languages","stargazers_url":"https://api.github.com/repos/halibot-extra/quote/stargazers","contributors_url":"https://api.github.com/repos/halibot-extra/quote/contributors","subscribers_url":"https://api.github.com/repos/halibot-extra/quote/subscribers","subscription_url":"https://api.github.com/repos/halibot-extra/quote/subscription","commits_url":"https://api.github.com/repos/halibot-extra/quote/commits{/sha}","git_commits_url":"https://api.github.com/repos/halibot-extra/quote/git/commits{/sha}","comments_url":"https://api.github.com/repos/halibot-extra/quote/comments{/number}","issue_comment_url":"https://api.github.com/repos/halibot-extra/quote/issues/comments{/number}","contents_url":"https://api.github.com/repos/halibot-extra/quote/contents/{+path}","compare_url":"https://api.github.com/repos/halibot-extra/quote/compare/{base}...{head}","merges_url":"https://api.github.com/repos/halibot-extra/quote/merges","archive_url":"https://api.github.com/repos/halibot-extra/quote/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/halibot-extra/quote/downloads","issues_url":"https://api.github.com/repos/halibot-extra/quote/issues{/number}","pulls_url":"https://api.github.com/repos/halibot-extra/quote/pulls{/number}","milestones_url":"https://api.github.com/repos/halibot-extra/quote/milestones{/number}","notifications_url":"https://api.github.com/repos/halibot-extra/quote/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/halibot-extra/quote/labels{/name}","releases_url":"https://api.github.com/repos/halibot-extra/quote/releases{/id}","deployments_url":"https://api.github.com/repos/halibot-extra/quote/deployments","created_at":"2015-10-09T03:49:26Z","updated_at":"2016-08-31T01:25:39Z","pushed_at":"2016-09-14T16:26:54Z","git_url":"git://github.com/halibot-extra/quote.git","ssh_url":"git@github.com:halibot-extra/quote.git","clone_url":"https://github.com/halibot-extra/quote.git","svn_url":"https://github.com/halibot-extra/quote","homepage":null,"size":5,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":2,"forks":2,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/halibot-extra/quote/pulls/4"},"html":{"href":"https://github.com/halibot-extra/quote/pull/4"},"issue":{"href":"https://api.github.com/repos/halibot-extra/quote/issues/4"},"comments":{"href":"https://api.github.com/repos/halibot-extra/quote/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/halibot-extra/quote/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/halibot-extra/quote/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/halibot-extra/quote/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/halibot-extra/quote/statuses/89a462afbc2a7d7f15d867301848434f84e54a73"}}}}
{"actor":{"display_login":"sjrct"}}