{"action":"created","comment":{"url":"https://api.github.com/repos/mosbth/irc2phpbb/pulls/comments/219619276","pull_request_review_id":157848490,"id":219619276,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxOTYxOTI3Ng==","diff_hunk":"@@ -0,0 +1,91 @@\n+#! /usr/bin/env python3\n+# -*- coding: utf-8 -*-\n+\n+\"\"\"\n+Make general actions for Marvin, one function for each action.\n+\"\"\"\n+import time\n+import datetime\n+import json\n+import random\n+\n+# Load all strings from file\n+with open(\"marvin_strings.json\", encoding=\"utf-8\") as f:\n+    STRINGS = json.load(f)\n+\n+# Configuration loaded\n+CONFIG = None\n+\n+def setConfig(config):\n+    \"\"\"\n+    Keep reference to the loaded configuration.\n+    \"\"\"\n+    global CONFIG\n+    CONFIG = config\n+\n+\n+def getString(key, key1=None):\n+    \"\"\"\n+    Get a string from the string database.\n+    \"\"\"\n+    data = STRINGS[key]\n+    if isinstance(data, list):\n+        res = data[random.randint(0, len(data) - 1)]\n+    elif isinstance(data, dict):\n+        if key1 is None:\n+            res = data\n+        else:\n+            res = data[key1]\n+            if isinstance(res, list):\n+                res = res[random.randint(0, len(res) - 1)]\n+    elif isinstance(data, str):\n+        res = data\n+\n+    return res\n+\n+\n+def getAllGeneralActions():\n+    \"\"\"\n+    Return all general actions as an array.\n+    \"\"\"\n+    return [\n+        marvinMorning\n+    ]\n+\n+\n+def marvinMorning(row, asList=None, asStr=None):\n+    \"\"\"\n+    Marvin says Good morning after someone else says it\n+    \"\"\"\n+    phrases = [\n+        \"morgon\",\n+        \"godmorgon\",\n+        \"god morgon\",\n+        \"morrn\",\n+        \"morn\"\n+    ]\n+\n+    morning_phrases = [\n+        \"Godmorgon! :-)\",\n+        \"Morgon allesammans\",\n+        \"Morgon gott folk\",\n+        \"Guten morgen\",\n+        \"Morgon\"\n+    ]\n+\n+    for phrase in phrases:\n+        if phrase in row:\n+            msg = random.choice(morning_phrases)\n+\n+            try:\n+                file = open('data/marvinMorning_date.txt', 'r+')\n+                file_data = file.read()\n+\n+                if not file_data == str(datetime.date.today()):\n+                    f = open('data/marvinMorning_date.txt', 'w')","path":"marvin_general_actions.py","position":85,"original_position":85,"commit_id":"8f42fcfabb99ef8af4e9371a13bab550f3d57f22","original_commit_id":"8f42fcfabb99ef8af4e9371a13bab550f3d57f22","user":{"login":"AuroraBTH","id":11875601,"node_id":"MDQ6VXNlcjExODc1NjAx","avatar_url":"https://avatars0.githubusercontent.com/u/11875601?v=4","gravatar_id":"","url":"https://api.github.com/users/AuroraBTH","html_url":"https://github.com/AuroraBTH","followers_url":"https://api.github.com/users/AuroraBTH/followers","following_url":"https://api.github.com/users/AuroraBTH/following{/other_user}","gists_url":"https://api.github.com/users/AuroraBTH/gists{/gist_id}","starred_url":"https://api.github.com/users/AuroraBTH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AuroraBTH/subscriptions","organizations_url":"https://api.github.com/users/AuroraBTH/orgs","repos_url":"https://api.github.com/users/AuroraBTH/repos","events_url":"https://api.github.com/users/AuroraBTH/events{/privacy}","received_events_url":"https://api.github.com/users/AuroraBTH/received_events","type":"User","site_admin":false},"body":"I will check if it's possible to reduce this to one open, but the reason that comes to mind is that the first one only check if it's today date, but I see that I changed it to 'r+' so that's not true.\r\n\r\nBoth these files should be closed, I was using \"with\"  from the start but changed, unsure why.","created_at":"2018-09-21T20:31:41Z","updated_at":"2018-09-21T20:31:41Z","html_url":"https://github.com/mosbth/irc2phpbb/pull/46#discussion_r219619276","pull_request_url":"https://api.github.com/repos/mosbth/irc2phpbb/pulls/46","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/mosbth/irc2phpbb/pulls/comments/219619276"},"html":{"href":"https://github.com/mosbth/irc2phpbb/pull/46#discussion_r219619276"},"pull_request":{"href":"https://api.github.com/repos/mosbth/irc2phpbb/pulls/46"}},"in_reply_to_id":219613798},"pull_request":{"url":"https://api.github.com/repos/mosbth/irc2phpbb/pulls/46","id":217290944,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE3MjkwOTQ0","html_url":"https://github.com/mosbth/irc2phpbb/pull/46","diff_url":"https://github.com/mosbth/irc2phpbb/pull/46.diff","patch_url":"https://github.com/mosbth/irc2phpbb/pull/46.patch","issue_url":"https://api.github.com/repos/mosbth/irc2phpbb/issues/46","number":46,"state":"open","locked":false,"title":"Version 1 of general actions","user":{"login":"AuroraBTH","id":11875601,"node_id":"MDQ6VXNlcjExODc1NjAx","avatar_url":"https://avatars0.githubusercontent.com/u/11875601?v=4","gravatar_id":"","url":"https://api.github.com/users/AuroraBTH","html_url":"https://github.com/AuroraBTH","followers_url":"https://api.github.com/users/AuroraBTH/followers","following_url":"https://api.github.com/users/AuroraBTH/following{/other_user}","gists_url":"https://api.github.com/users/AuroraBTH/gists{/gist_id}","starred_url":"https://api.github.com/users/AuroraBTH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AuroraBTH/subscriptions","organizations_url":"https://api.github.com/users/AuroraBTH/orgs","repos_url":"https://api.github.com/users/AuroraBTH/repos","events_url":"https://api.github.com/users/AuroraBTH/events{/privacy}","received_events_url":"https://api.github.com/users/AuroraBTH/received_events","type":"User","site_admin":false},"body":"* Creates a base for actions which are not bound to asking Marvin\r\n* Marvin Good Morning v1 implemented (delay to be added)","created_at":"2018-09-21T13:51:12Z","updated_at":"2018-09-21T20:31:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"95a03f24ea088672626d18a1f8c5a28db789b020","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/mosbth/irc2phpbb/pulls/46/commits","review_comments_url":"https://api.github.com/repos/mosbth/irc2phpbb/pulls/46/comments","review_comment_url":"https://api.github.com/repos/mosbth/irc2phpbb/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mosbth/irc2phpbb/issues/46/comments","statuses_url":"https://api.github.com/repos/mosbth/irc2phpbb/statuses/8f42fcfabb99ef8af4e9371a13bab550f3d57f22","head":{"label":"AuroraBTH:master","ref":"master","sha":"8f42fcfabb99ef8af4e9371a13bab550f3d57f22","user":{"login":"AuroraBTH","id":11875601,"node_id":"MDQ6VXNlcjExODc1NjAx","avatar_url":"https://avatars0.githubusercontent.com/u/11875601?v=4","gravatar_id":"","url":"https://api.github.com/users/AuroraBTH","html_url":"https://github.com/AuroraBTH","followers_url":"https://api.github.com/users/AuroraBTH/followers","following_url":"https://api.github.com/users/AuroraBTH/following{/other_user}","gists_url":"https://api.github.com/users/AuroraBTH/gists{/gist_id}","starred_url":"https://api.github.com/users/AuroraBTH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AuroraBTH/subscriptions","organizations_url":"https://api.github.com/users/AuroraBTH/orgs","repos_url":"https://api.github.com/users/AuroraBTH/repos","events_url":"https://api.github.com/users/AuroraBTH/events{/privacy}","received_events_url":"https://api.github.com/users/AuroraBTH/received_events","type":"User","site_admin":false},"repo":{"id":149768979,"node_id":"MDEwOlJlcG9zaXRvcnkxNDk3Njg5Nzk=","name":"irc2phpbb","full_name":"AuroraBTH/irc2phpbb","private":false,"owner":{"login":"AuroraBTH","id":11875601,"node_id":"MDQ6VXNlcjExODc1NjAx","avatar_url":"https://avatars0.githubusercontent.com/u/11875601?v=4","gravatar_id":"","url":"https://api.github.com/users/AuroraBTH","html_url":"https://github.com/AuroraBTH","followers_url":"https://api.github.com/users/AuroraBTH/followers","following_url":"https://api.github.com/users/AuroraBTH/following{/other_user}","gists_url":"https://api.github.com/users/AuroraBTH/gists{/gist_id}","starred_url":"https://api.github.com/users/AuroraBTH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AuroraBTH/subscriptions","organizations_url":"https://api.github.com/users/AuroraBTH/orgs","repos_url":"https://api.github.com/users/AuroraBTH/repos","events_url":"https://api.github.com/users/AuroraBTH/events{/privacy}","received_events_url":"https://api.github.com/users/AuroraBTH/received_events","type":"User","site_admin":false},"html_url":"https://github.com/AuroraBTH/irc2phpbb","description":"IRC bot monitoring phpBB forum","fork":true,"url":"https://api.github.com/repos/AuroraBTH/irc2phpbb","forks_url":"https://api.github.com/repos/AuroraBTH/irc2phpbb/forks","keys_url":"https://api.github.com/repos/AuroraBTH/irc2phpbb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AuroraBTH/irc2phpbb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AuroraBTH/irc2phpbb/teams","hooks_url":"https://api.github.com/repos/AuroraBTH/irc2phpbb/hooks","issue_events_url":"https://api.github.com/repos/AuroraBTH/irc2phpbb/issues/events{/number}","events_url":"https://api.github.com/repos/AuroraBTH/irc2phpbb/events","assignees_url":"https://api.github.com/repos/AuroraBTH/irc2phpbb/assignees{/user}","branches_url":"https://api.github.com/repos/AuroraBTH/irc2phpbb/branches{/branch}","tags_url":"https://api.github.com/repos/AuroraBTH/irc2phpbb/tags","blobs_url":"https://api.github.com/repos/AuroraBTH/irc2phpbb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AuroraBTH/irc2phpbb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AuroraBTH/irc2phpbb/git/refs{/sha}","trees_url":"https://api.github.com/repos/AuroraBTH/irc2phpbb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AuroraBTH/irc2phpbb/statuses/{sha}","languages_url":"https://api.github.com/repos/AuroraBTH/irc2phpbb/languages","stargazers_url":"https://api.github.com/repos/AuroraBTH/irc2phpbb/stargazers","contributors_url":"https://api.github.com/repos/AuroraBTH/irc2phpbb/contributors","subscribers_url":"https://api.github.com/repos/AuroraBTH/irc2phpbb/subscribers","subscription_url":"https://api.github.com/repos/AuroraBTH/irc2phpbb/subscription","commits_url":"https://api.github.com/repos/AuroraBTH/irc2phpbb/commits{/sha}","git_commits_url":"https://api.github.com/repos/AuroraBTH/irc2phpbb/git/commits{/sha}","comments_url":"https://api.github.com/repos/AuroraBTH/irc2phpbb/comments{/number}","issue_comment_url":"https://api.github.com/repos/AuroraBTH/irc2phpbb/issues/comments{/number}","contents_url":"https://api.github.com/repos/AuroraBTH/irc2phpbb/contents/{+path}","compare_url":"https://api.github.com/repos/AuroraBTH/irc2phpbb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AuroraBTH/irc2phpbb/merges","archive_url":"https://api.github.com/repos/AuroraBTH/irc2phpbb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AuroraBTH/irc2phpbb/downloads","issues_url":"https://api.github.com/repos/AuroraBTH/irc2phpbb/issues{/number}","pulls_url":"https://api.github.com/repos/AuroraBTH/irc2phpbb/pulls{/number}","milestones_url":"https://api.github.com/repos/AuroraBTH/irc2phpbb/milestones{/number}","notifications_url":"https://api.github.com/repos/AuroraBTH/irc2phpbb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AuroraBTH/irc2phpbb/labels{/name}","releases_url":"https://api.github.com/repos/AuroraBTH/irc2phpbb/releases{/id}","deployments_url":"https://api.github.com/repos/AuroraBTH/irc2phpbb/deployments","created_at":"2018-09-21T13:42:21Z","updated_at":"2018-09-21T13:48:03Z","pushed_at":"2018-09-21T13:48:01Z","git_url":"git://github.com/AuroraBTH/irc2phpbb.git","ssh_url":"git@github.com:AuroraBTH/irc2phpbb.git","clone_url":"https://github.com/AuroraBTH/irc2phpbb.git","svn_url":"https://github.com/AuroraBTH/irc2phpbb","homepage":"","size":206,"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":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mosbth:master","ref":"master","sha":"9fa3ece4bb033b1ca810b0f577fd0c4db1f7d080","user":{"login":"mosbth","id":169550,"node_id":"MDQ6VXNlcjE2OTU1MA==","avatar_url":"https://avatars0.githubusercontent.com/u/169550?v=4","gravatar_id":"","url":"https://api.github.com/users/mosbth","html_url":"https://github.com/mosbth","followers_url":"https://api.github.com/users/mosbth/followers","following_url":"https://api.github.com/users/mosbth/following{/other_user}","gists_url":"https://api.github.com/users/mosbth/gists{/gist_id}","starred_url":"https://api.github.com/users/mosbth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mosbth/subscriptions","organizations_url":"https://api.github.com/users/mosbth/orgs","repos_url":"https://api.github.com/users/mosbth/repos","events_url":"https://api.github.com/users/mosbth/events{/privacy}","received_events_url":"https://api.github.com/users/mosbth/received_events","type":"User","site_admin":false},"repo":{"id":2788487,"node_id":"MDEwOlJlcG9zaXRvcnkyNzg4NDg3","name":"irc2phpbb","full_name":"mosbth/irc2phpbb","private":false,"owner":{"login":"mosbth","id":169550,"node_id":"MDQ6VXNlcjE2OTU1MA==","avatar_url":"https://avatars0.githubusercontent.com/u/169550?v=4","gravatar_id":"","url":"https://api.github.com/users/mosbth","html_url":"https://github.com/mosbth","followers_url":"https://api.github.com/users/mosbth/followers","following_url":"https://api.github.com/users/mosbth/following{/other_user}","gists_url":"https://api.github.com/users/mosbth/gists{/gist_id}","starred_url":"https://api.github.com/users/mosbth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mosbth/subscriptions","organizations_url":"https://api.github.com/users/mosbth/orgs","repos_url":"https://api.github.com/users/mosbth/repos","events_url":"https://api.github.com/users/mosbth/events{/privacy}","received_events_url":"https://api.github.com/users/mosbth/received_events","type":"User","site_admin":false},"html_url":"https://github.com/mosbth/irc2phpbb","description":"IRC bot monitoring phpBB forum","fork":false,"url":"https://api.github.com/repos/mosbth/irc2phpbb","forks_url":"https://api.github.com/repos/mosbth/irc2phpbb/forks","keys_url":"https://api.github.com/repos/mosbth/irc2phpbb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mosbth/irc2phpbb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mosbth/irc2phpbb/teams","hooks_url":"https://api.github.com/repos/mosbth/irc2phpbb/hooks","issue_events_url":"https://api.github.com/repos/mosbth/irc2phpbb/issues/events{/number}","events_url":"https://api.github.com/repos/mosbth/irc2phpbb/events","assignees_url":"https://api.github.com/repos/mosbth/irc2phpbb/assignees{/user}","branches_url":"https://api.github.com/repos/mosbth/irc2phpbb/branches{/branch}","tags_url":"https://api.github.com/repos/mosbth/irc2phpbb/tags","blobs_url":"https://api.github.com/repos/mosbth/irc2phpbb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mosbth/irc2phpbb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mosbth/irc2phpbb/git/refs{/sha}","trees_url":"https://api.github.com/repos/mosbth/irc2phpbb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mosbth/irc2phpbb/statuses/{sha}","languages_url":"https://api.github.com/repos/mosbth/irc2phpbb/languages","stargazers_url":"https://api.github.com/repos/mosbth/irc2phpbb/stargazers","contributors_url":"https://api.github.com/repos/mosbth/irc2phpbb/contributors","subscribers_url":"https://api.github.com/repos/mosbth/irc2phpbb/subscribers","subscription_url":"https://api.github.com/repos/mosbth/irc2phpbb/subscription","commits_url":"https://api.github.com/repos/mosbth/irc2phpbb/commits{/sha}","git_commits_url":"https://api.github.com/repos/mosbth/irc2phpbb/git/commits{/sha}","comments_url":"https://api.github.com/repos/mosbth/irc2phpbb/comments{/number}","issue_comment_url":"https://api.github.com/repos/mosbth/irc2phpbb/issues/comments{/number}","contents_url":"https://api.github.com/repos/mosbth/irc2phpbb/contents/{+path}","compare_url":"https://api.github.com/repos/mosbth/irc2phpbb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mosbth/irc2phpbb/merges","archive_url":"https://api.github.com/repos/mosbth/irc2phpbb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mosbth/irc2phpbb/downloads","issues_url":"https://api.github.com/repos/mosbth/irc2phpbb/issues{/number}","pulls_url":"https://api.github.com/repos/mosbth/irc2phpbb/pulls{/number}","milestones_url":"https://api.github.com/repos/mosbth/irc2phpbb/milestones{/number}","notifications_url":"https://api.github.com/repos/mosbth/irc2phpbb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mosbth/irc2phpbb/labels{/name}","releases_url":"https://api.github.com/repos/mosbth/irc2phpbb/releases{/id}","deployments_url":"https://api.github.com/repos/mosbth/irc2phpbb/deployments","created_at":"2011-11-16T15:00:12Z","updated_at":"2018-09-20T10:09:47Z","pushed_at":"2018-09-21T13:51:13Z","git_url":"git://github.com/mosbth/irc2phpbb.git","ssh_url":"git@github.com:mosbth/irc2phpbb.git","clone_url":"https://github.com/mosbth/irc2phpbb.git","svn_url":"https://github.com/mosbth/irc2phpbb","homepage":"","size":200,"stargazers_count":10,"watchers_count":10,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":17,"mirror_url":null,"archived":false,"open_issues_count":4,"license":null,"forks":17,"open_issues":4,"watchers":10,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mosbth/irc2phpbb/pulls/46"},"html":{"href":"https://github.com/mosbth/irc2phpbb/pull/46"},"issue":{"href":"https://api.github.com/repos/mosbth/irc2phpbb/issues/46"},"comments":{"href":"https://api.github.com/repos/mosbth/irc2phpbb/issues/46/comments"},"review_comments":{"href":"https://api.github.com/repos/mosbth/irc2phpbb/pulls/46/comments"},"review_comment":{"href":"https://api.github.com/repos/mosbth/irc2phpbb/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mosbth/irc2phpbb/pulls/46/commits"},"statuses":{"href":"https://api.github.com/repos/mosbth/irc2phpbb/statuses/8f42fcfabb99ef8af4e9371a13bab550f3d57f22"}},"author_association":"NONE"}}
{"actor":{"display_login":"AuroraBTH"}}