{"action":"created","comment":{"url":"https://api.github.com/repos/Querijn/BottyMcBotface/pulls/comments/177134694","pull_request_review_id":106955392,"id":177134694,"diff_hunk":"@@ -188,42 +215,46 @@ export default class OfficeHours {\n \n         if (!this.data.lastCloseMessage) return;\n \n-        // Request last close message from Discord\n-        channel.fetchMessage(this.data.lastCloseMessage)\n-            .then(closeMessage => {\n-                // Find all users that raised their hand\n-                const reactions = closeMessage.reactions.get(\"✋\");\n-                if (reactions) {\n-                    const usersToMention = reactions.users.array().filter(user => !user.bot);\n-                    if (usersToMention.length > 0) {\n-                        channel.send(usersToMention.join(\", \") + \"\\n\");\n-                    }\n-                }\n+        try {\n+            // Request last close message from Discord\n+            const closeMessage = await channel.fetchMessage(this.data.lastCloseMessage);\n \n-                this.sendOnThisDayMessage(channel);\n-            })\n-            .catch(reason => {\n-                console.warn(\"Failed getting last close message: \" + reason);\n-                this.sendOnThisDayMessage(channel);\n-            });\n+            // Find all users that raised their hand\n+            const reactions = closeMessage.reactions.get(\"✋\");\n+            if (reactions) {\n+                const usersToMention = reactions.users.array().filter(user => !user.bot);\n+                if (usersToMention.length > 0) {\n+                    channel.send(usersToMention.join(\", \") + \"\\n\");\n+                }\n+            }\n+            this.sendOnThisDayMessage(channel);\n+        } catch (error) {\n+            console.error(`Error occurred while fetching last close message: ${error}`);\n+        }\n     }\n \n     private async close(channel: Discord.TextChannel) {\n         if (!this.data.isOpen) return;\n         this.data.isOpen = false;\n \n-        const everyone = channel.guild.roles.find(\"name\", \"@everyone\");\n-        await channel.overwritePermissions(everyone, { SEND_MESSAGES: false });\n+        try {\n+            const everyone = channel.guild.roles.find(\"name\", \"@everyone\");\n+            await channel.overwritePermissions(everyone, { SEND_MESSAGES: false });\n+        } catch (error) {\n+            console.error(`Error occurred while overwriting permissions: ${error}`);\n+        }\n \n-        channel.send(this.sharedSettings.officehours.closeMessage.replace(/{botty}/g, this.bot.user.toString()))\n-            .then(message => {\n-                if (Array.isArray(message)) {\n-                    message = message[0];\n-                }\n+        try {\n+            let message = await channel.send(this.sharedSettings.officehours.closeMessage.replace(/{botty}/g, this.bot.user.toString()));\n+            if (Array.isArray(message)) {\n+                message = message[0];\n+            }\n \n-                this.data.lastCloseMessage = message.id;\n-                message.react(\"✋\");\n-            });\n+            this.data.lastCloseMessage = message.id;\n+            message.react(\"✋\");\n+        } catch (error) {\n+            console.error(`Error occurred while sending close message: ${error}`);","path":"src/OfficeHours.ts","position":136,"original_position":136,"commit_id":"b8a0bfe0d2252011be9696b8edfabf02427d40a9","original_commit_id":"09e4019888f6fb45ca57f4312aa51e61736df4df","user":{"login":"stelar7","id":940154,"avatar_url":"https://avatars2.githubusercontent.com/u/940154?v=4","gravatar_id":"","url":"https://api.github.com/users/stelar7","html_url":"https://github.com/stelar7","followers_url":"https://api.github.com/users/stelar7/followers","following_url":"https://api.github.com/users/stelar7/following{/other_user}","gists_url":"https://api.github.com/users/stelar7/gists{/gist_id}","starred_url":"https://api.github.com/users/stelar7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stelar7/subscriptions","organizations_url":"https://api.github.com/users/stelar7/orgs","repos_url":"https://api.github.com/users/stelar7/repos","events_url":"https://api.github.com/users/stelar7/events{/privacy}","received_events_url":"https://api.github.com/users/stelar7/received_events","type":"User","site_admin":false},"body":"Fixed, github wont show as outdated for some reason..","created_at":"2018-03-26T15:32:01Z","updated_at":"2018-03-26T15:32:01Z","html_url":"https://github.com/Querijn/BottyMcBotface/pull/33#discussion_r177134694","pull_request_url":"https://api.github.com/repos/Querijn/BottyMcBotface/pulls/33","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/Querijn/BottyMcBotface/pulls/comments/177134694"},"html":{"href":"https://github.com/Querijn/BottyMcBotface/pull/33#discussion_r177134694"},"pull_request":{"href":"https://api.github.com/repos/Querijn/BottyMcBotface/pulls/33"}},"in_reply_to_id":177108140},"pull_request":{"url":"https://api.github.com/repos/Querijn/BottyMcBotface/pulls/33","id":177458328,"html_url":"https://github.com/Querijn/BottyMcBotface/pull/33","diff_url":"https://github.com/Querijn/BottyMcBotface/pull/33.diff","patch_url":"https://github.com/Querijn/BottyMcBotface/pull/33.patch","issue_url":"https://api.github.com/repos/Querijn/BottyMcBotface/issues/33","number":33,"state":"open","locked":false,"title":"add try/catch to all awaits, replace .then with await","user":{"login":"stelar7","id":940154,"avatar_url":"https://avatars2.githubusercontent.com/u/940154?v=4","gravatar_id":"","url":"https://api.github.com/users/stelar7","html_url":"https://github.com/stelar7","followers_url":"https://api.github.com/users/stelar7/followers","following_url":"https://api.github.com/users/stelar7/following{/other_user}","gists_url":"https://api.github.com/users/stelar7/gists{/gist_id}","starred_url":"https://api.github.com/users/stelar7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stelar7/subscriptions","organizations_url":"https://api.github.com/users/stelar7/orgs","repos_url":"https://api.github.com/users/stelar7/repos","events_url":"https://api.github.com/users/stelar7/events{/privacy}","received_events_url":"https://api.github.com/users/stelar7/received_events","type":"User","site_admin":false},"body":"possible fix for #30 ","created_at":"2018-03-26T14:08:55Z","updated_at":"2018-03-26T15:32:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fa8194118b9cc978dab2c166d166ca01fdfa6633","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Querijn/BottyMcBotface/pulls/33/commits","review_comments_url":"https://api.github.com/repos/Querijn/BottyMcBotface/pulls/33/comments","review_comment_url":"https://api.github.com/repos/Querijn/BottyMcBotface/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Querijn/BottyMcBotface/issues/33/comments","statuses_url":"https://api.github.com/repos/Querijn/BottyMcBotface/statuses/b8a0bfe0d2252011be9696b8edfabf02427d40a9","head":{"label":"stelar7:trycatch","ref":"trycatch","sha":"b8a0bfe0d2252011be9696b8edfabf02427d40a9","user":{"login":"stelar7","id":940154,"avatar_url":"https://avatars2.githubusercontent.com/u/940154?v=4","gravatar_id":"","url":"https://api.github.com/users/stelar7","html_url":"https://github.com/stelar7","followers_url":"https://api.github.com/users/stelar7/followers","following_url":"https://api.github.com/users/stelar7/following{/other_user}","gists_url":"https://api.github.com/users/stelar7/gists{/gist_id}","starred_url":"https://api.github.com/users/stelar7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stelar7/subscriptions","organizations_url":"https://api.github.com/users/stelar7/orgs","repos_url":"https://api.github.com/users/stelar7/repos","events_url":"https://api.github.com/users/stelar7/events{/privacy}","received_events_url":"https://api.github.com/users/stelar7/received_events","type":"User","site_admin":false},"repo":{"id":124522241,"name":"BottyMcBotface","full_name":"stelar7/BottyMcBotface","owner":{"login":"stelar7","id":940154,"avatar_url":"https://avatars2.githubusercontent.com/u/940154?v=4","gravatar_id":"","url":"https://api.github.com/users/stelar7","html_url":"https://github.com/stelar7","followers_url":"https://api.github.com/users/stelar7/followers","following_url":"https://api.github.com/users/stelar7/following{/other_user}","gists_url":"https://api.github.com/users/stelar7/gists{/gist_id}","starred_url":"https://api.github.com/users/stelar7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stelar7/subscriptions","organizations_url":"https://api.github.com/users/stelar7/orgs","repos_url":"https://api.github.com/users/stelar7/repos","events_url":"https://api.github.com/users/stelar7/events{/privacy}","received_events_url":"https://api.github.com/users/stelar7/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/stelar7/BottyMcBotface","description":"The Riot Games API Bot","fork":true,"url":"https://api.github.com/repos/stelar7/BottyMcBotface","forks_url":"https://api.github.com/repos/stelar7/BottyMcBotface/forks","keys_url":"https://api.github.com/repos/stelar7/BottyMcBotface/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stelar7/BottyMcBotface/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stelar7/BottyMcBotface/teams","hooks_url":"https://api.github.com/repos/stelar7/BottyMcBotface/hooks","issue_events_url":"https://api.github.com/repos/stelar7/BottyMcBotface/issues/events{/number}","events_url":"https://api.github.com/repos/stelar7/BottyMcBotface/events","assignees_url":"https://api.github.com/repos/stelar7/BottyMcBotface/assignees{/user}","branches_url":"https://api.github.com/repos/stelar7/BottyMcBotface/branches{/branch}","tags_url":"https://api.github.com/repos/stelar7/BottyMcBotface/tags","blobs_url":"https://api.github.com/repos/stelar7/BottyMcBotface/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stelar7/BottyMcBotface/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stelar7/BottyMcBotface/git/refs{/sha}","trees_url":"https://api.github.com/repos/stelar7/BottyMcBotface/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stelar7/BottyMcBotface/statuses/{sha}","languages_url":"https://api.github.com/repos/stelar7/BottyMcBotface/languages","stargazers_url":"https://api.github.com/repos/stelar7/BottyMcBotface/stargazers","contributors_url":"https://api.github.com/repos/stelar7/BottyMcBotface/contributors","subscribers_url":"https://api.github.com/repos/stelar7/BottyMcBotface/subscribers","subscription_url":"https://api.github.com/repos/stelar7/BottyMcBotface/subscription","commits_url":"https://api.github.com/repos/stelar7/BottyMcBotface/commits{/sha}","git_commits_url":"https://api.github.com/repos/stelar7/BottyMcBotface/git/commits{/sha}","comments_url":"https://api.github.com/repos/stelar7/BottyMcBotface/comments{/number}","issue_comment_url":"https://api.github.com/repos/stelar7/BottyMcBotface/issues/comments{/number}","contents_url":"https://api.github.com/repos/stelar7/BottyMcBotface/contents/{+path}","compare_url":"https://api.github.com/repos/stelar7/BottyMcBotface/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stelar7/BottyMcBotface/merges","archive_url":"https://api.github.com/repos/stelar7/BottyMcBotface/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stelar7/BottyMcBotface/downloads","issues_url":"https://api.github.com/repos/stelar7/BottyMcBotface/issues{/number}","pulls_url":"https://api.github.com/repos/stelar7/BottyMcBotface/pulls{/number}","milestones_url":"https://api.github.com/repos/stelar7/BottyMcBotface/milestones{/number}","notifications_url":"https://api.github.com/repos/stelar7/BottyMcBotface/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stelar7/BottyMcBotface/labels{/name}","releases_url":"https://api.github.com/repos/stelar7/BottyMcBotface/releases{/id}","deployments_url":"https://api.github.com/repos/stelar7/BottyMcBotface/deployments","created_at":"2018-03-09T09:56:49Z","updated_at":"2018-03-26T13:20:53Z","pushed_at":"2018-03-26T15:17:03Z","git_url":"git://github.com/stelar7/BottyMcBotface.git","ssh_url":"git@github.com:stelar7/BottyMcBotface.git","clone_url":"https://github.com/stelar7/BottyMcBotface.git","svn_url":"https://github.com/stelar7/BottyMcBotface","homepage":null,"size":277,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","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":"Querijn:master","ref":"master","sha":"b9f89243418f9042a7d7c5e464ee7b383364272e","user":{"login":"Querijn","id":3397066,"avatar_url":"https://avatars2.githubusercontent.com/u/3397066?v=4","gravatar_id":"","url":"https://api.github.com/users/Querijn","html_url":"https://github.com/Querijn","followers_url":"https://api.github.com/users/Querijn/followers","following_url":"https://api.github.com/users/Querijn/following{/other_user}","gists_url":"https://api.github.com/users/Querijn/gists{/gist_id}","starred_url":"https://api.github.com/users/Querijn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Querijn/subscriptions","organizations_url":"https://api.github.com/users/Querijn/orgs","repos_url":"https://api.github.com/users/Querijn/repos","events_url":"https://api.github.com/users/Querijn/events{/privacy}","received_events_url":"https://api.github.com/users/Querijn/received_events","type":"User","site_admin":false},"repo":{"id":99312539,"name":"BottyMcBotface","full_name":"Querijn/BottyMcBotface","owner":{"login":"Querijn","id":3397066,"avatar_url":"https://avatars2.githubusercontent.com/u/3397066?v=4","gravatar_id":"","url":"https://api.github.com/users/Querijn","html_url":"https://github.com/Querijn","followers_url":"https://api.github.com/users/Querijn/followers","following_url":"https://api.github.com/users/Querijn/following{/other_user}","gists_url":"https://api.github.com/users/Querijn/gists{/gist_id}","starred_url":"https://api.github.com/users/Querijn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Querijn/subscriptions","organizations_url":"https://api.github.com/users/Querijn/orgs","repos_url":"https://api.github.com/users/Querijn/repos","events_url":"https://api.github.com/users/Querijn/events{/privacy}","received_events_url":"https://api.github.com/users/Querijn/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Querijn/BottyMcBotface","description":"The Riot Games API Bot","fork":false,"url":"https://api.github.com/repos/Querijn/BottyMcBotface","forks_url":"https://api.github.com/repos/Querijn/BottyMcBotface/forks","keys_url":"https://api.github.com/repos/Querijn/BottyMcBotface/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Querijn/BottyMcBotface/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Querijn/BottyMcBotface/teams","hooks_url":"https://api.github.com/repos/Querijn/BottyMcBotface/hooks","issue_events_url":"https://api.github.com/repos/Querijn/BottyMcBotface/issues/events{/number}","events_url":"https://api.github.com/repos/Querijn/BottyMcBotface/events","assignees_url":"https://api.github.com/repos/Querijn/BottyMcBotface/assignees{/user}","branches_url":"https://api.github.com/repos/Querijn/BottyMcBotface/branches{/branch}","tags_url":"https://api.github.com/repos/Querijn/BottyMcBotface/tags","blobs_url":"https://api.github.com/repos/Querijn/BottyMcBotface/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Querijn/BottyMcBotface/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Querijn/BottyMcBotface/git/refs{/sha}","trees_url":"https://api.github.com/repos/Querijn/BottyMcBotface/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Querijn/BottyMcBotface/statuses/{sha}","languages_url":"https://api.github.com/repos/Querijn/BottyMcBotface/languages","stargazers_url":"https://api.github.com/repos/Querijn/BottyMcBotface/stargazers","contributors_url":"https://api.github.com/repos/Querijn/BottyMcBotface/contributors","subscribers_url":"https://api.github.com/repos/Querijn/BottyMcBotface/subscribers","subscription_url":"https://api.github.com/repos/Querijn/BottyMcBotface/subscription","commits_url":"https://api.github.com/repos/Querijn/BottyMcBotface/commits{/sha}","git_commits_url":"https://api.github.com/repos/Querijn/BottyMcBotface/git/commits{/sha}","comments_url":"https://api.github.com/repos/Querijn/BottyMcBotface/comments{/number}","issue_comment_url":"https://api.github.com/repos/Querijn/BottyMcBotface/issues/comments{/number}","contents_url":"https://api.github.com/repos/Querijn/BottyMcBotface/contents/{+path}","compare_url":"https://api.github.com/repos/Querijn/BottyMcBotface/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Querijn/BottyMcBotface/merges","archive_url":"https://api.github.com/repos/Querijn/BottyMcBotface/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Querijn/BottyMcBotface/downloads","issues_url":"https://api.github.com/repos/Querijn/BottyMcBotface/issues{/number}","pulls_url":"https://api.github.com/repos/Querijn/BottyMcBotface/pulls{/number}","milestones_url":"https://api.github.com/repos/Querijn/BottyMcBotface/milestones{/number}","notifications_url":"https://api.github.com/repos/Querijn/BottyMcBotface/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Querijn/BottyMcBotface/labels{/name}","releases_url":"https://api.github.com/repos/Querijn/BottyMcBotface/releases{/id}","deployments_url":"https://api.github.com/repos/Querijn/BottyMcBotface/deployments","created_at":"2017-08-04T06:47:34Z","updated_at":"2018-03-26T14:54:26Z","pushed_at":"2018-03-26T15:17:05Z","git_url":"git://github.com/Querijn/BottyMcBotface.git","ssh_url":"git@github.com:Querijn/BottyMcBotface.git","clone_url":"https://github.com/Querijn/BottyMcBotface.git","svn_url":"https://github.com/Querijn/BottyMcBotface","homepage":null,"size":257,"stargazers_count":5,"watchers_count":5,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"archived":false,"open_issues_count":8,"license":null,"forks":8,"open_issues":8,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Querijn/BottyMcBotface/pulls/33"},"html":{"href":"https://github.com/Querijn/BottyMcBotface/pull/33"},"issue":{"href":"https://api.github.com/repos/Querijn/BottyMcBotface/issues/33"},"comments":{"href":"https://api.github.com/repos/Querijn/BottyMcBotface/issues/33/comments"},"review_comments":{"href":"https://api.github.com/repos/Querijn/BottyMcBotface/pulls/33/comments"},"review_comment":{"href":"https://api.github.com/repos/Querijn/BottyMcBotface/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Querijn/BottyMcBotface/pulls/33/commits"},"statuses":{"href":"https://api.github.com/repos/Querijn/BottyMcBotface/statuses/b8a0bfe0d2252011be9696b8edfabf02427d40a9"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"stelar7"}}