{"action":"created","comment":{"url":"https://api.github.com/repos/FlexLabs/Dyno-fun/pulls/comments/172061397","pull_request_review_id":101016254,"id":172061397,"diff_hunk":"@@ -0,0 +1,142 @@\n+const { Command } = require('@dyno.gg/dyno-core');\n+const superagent = require('superagent');\n+const math = require('mathjs');\n+//\n+\n+function hasTypes(i) {\n+\treturn /[+-/*^%]/.test(i);\n+};\t\n+async function request(i) {\n+   \treturn await superagent.get(`http://numbersapi.com/${i}?json`);\n+};  \n+//\n+\n+class Math extends Command {\n+\tconstructor(...args) {\n+\t\tsuper(...args);\n+\t\t\n+\t\tthis.aliases      = ['math'];\n+\t\tthis.module       = 'Fun';\n+\t\tthis.description  = 'Math command';\n+\t\tthis.usage        = 'math [math expression]';\n+\t\tthis.example      = 'math 152 + 37';\n+\t\tthis.cooldown     = 3000;\n+\t\tthis.expectedArgs = 1;\n+\t}\n+\n+\tasync execute({ message, args }) {\n+\t\tconst input = args.join(' ');\n+        const errmsg = {\n+            exp: 'Couldn\\'t evaluate the given expression',\n+            err: 'An Error Occured',\n+            fact: 'Couldn\\'t get any facts for that number'\n+        };\n+        let res; // Used to get number facts\n+        let output; // Output from mathjs \n+        let result = {}; // Sends the result message\n+            result.embed = {};\n+            result.embed.fields = [];\n+            result.embed.color = 0x41dae2;\n+\n+        if(args.length > 1) { // If args is more than 1 word, example: 1 + 1\n+            try {\n+                output = math.eval(input).toString();\n+\n+                result.embed.fields.push({\n+                    name: 'Input',\n+                    value: input,\n+                    inline: false\n+                });\n+\n+                result.embed.fields.push({\n+                    name: 'Output',\n+                    value: output,\n+                    inline: false\n+                });\n+\n+            } catch (e) {\n+                result = errmsg.exp;\n+            };\n+        } else if(args.length == 1 && hasTypes(args[0])) { // If args is a math expression in 1 word, example: 1+1\n+            try {\n+                output = math.eval(input).toString();\n+\n+                result.embed.fields.push({\n+                    name: 'Input',\n+                    value: input,\n+                    inline: false\n+                });\n+\n+                result.embed.fields.push({\n+                    name: 'Output',\n+                    value: output,\n+                    inline: false\n+                });\n+\n+            } catch (e) {\n+                result = errmsg.exp;\n+            };\n+        } else if(args[0] == 'fact') { // Get a fact about a random number\n+            try {\n+\n+                res = await request('random/math');\n+\n+                if(res.body.found) {\n+                    result.embed.fields.push({\n+                        name: `Fact about ${res.body.number}`,\n+                        value: res.body.text,\n+                        inline: false\n+                    });\n+                }\n+            } catch (e) {\n+                result = errmsg.err;\n+            };\n+        } else if(args.length == 1 && isNaN(args[0])) { // If args is 1 word and NaN, example: pi \n+            try {\n+                output = math.eval(input).toString();\n+                \n+                result.embed.fields.push({\n+                    name: 'Input',\n+                    value: input,\n+                    inline: false\n+                });\n+\n+                result.embed.fields.push({\n+                    name: 'Output',\n+                    value: output,\n+                    inline: false\n+                });\n+\n+                res = await request(`${output.split('.')[0]}/math`);\n+\n+                if(res.body.found) {\n+                    result.embed.fields.push({\n+                        name: `Fact about ${res.body.number}`,\n+                        value: res.body.text,\n+                        inline: false\n+                    });\n+                }\n+            } catch (e) {\n+                result = errmsg.exp;\n+            };\n+        } else { // If args is just a number, not an experssion, example: 123\n+            output = math.eval(input).toString();\n+\n+            res = await request(`${output.split('.')[0]}/math`);\n+\n+            if(res.body.found) {\n+                result.embed.fields.push({\n+                    name: `Fact about ${res.body.number}`,\n+                    value: res.body.text,\n+                    inline: false\n+                });\n+            } else {\n+            result = errmsg.fact;","path":"src/commands/Math.js","position":134,"original_position":134,"commit_id":"ef3a45171f57bc621bd585b76a34967988411c52","original_commit_id":"ef3a45171f57bc621bd585b76a34967988411c52","user":{"login":"germanoeich","id":17045274,"avatar_url":"https://avatars1.githubusercontent.com/u/17045274?v=4","gravatar_id":"","url":"https://api.github.com/users/germanoeich","html_url":"https://github.com/germanoeich","followers_url":"https://api.github.com/users/germanoeich/followers","following_url":"https://api.github.com/users/germanoeich/following{/other_user}","gists_url":"https://api.github.com/users/germanoeich/gists{/gist_id}","starred_url":"https://api.github.com/users/germanoeich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/germanoeich/subscriptions","organizations_url":"https://api.github.com/users/germanoeich/orgs","repos_url":"https://api.github.com/users/germanoeich/repos","events_url":"https://api.github.com/users/germanoeich/events{/privacy}","received_events_url":"https://api.github.com/users/germanoeich/received_events","type":"User","site_admin":false},"body":"Line is not identated","created_at":"2018-03-04T19:40:52Z","updated_at":"2018-03-04T19:43:57Z","html_url":"https://github.com/FlexLabs/Dyno-fun/pull/18#discussion_r172061397","pull_request_url":"https://api.github.com/repos/FlexLabs/Dyno-fun/pulls/18","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/FlexLabs/Dyno-fun/pulls/comments/172061397"},"html":{"href":"https://github.com/FlexLabs/Dyno-fun/pull/18#discussion_r172061397"},"pull_request":{"href":"https://api.github.com/repos/FlexLabs/Dyno-fun/pulls/18"}}},"pull_request":{"url":"https://api.github.com/repos/FlexLabs/Dyno-fun/pulls/18","id":169832887,"html_url":"https://github.com/FlexLabs/Dyno-fun/pull/18","diff_url":"https://github.com/FlexLabs/Dyno-fun/pull/18.diff","patch_url":"https://github.com/FlexLabs/Dyno-fun/pull/18.patch","issue_url":"https://api.github.com/repos/FlexLabs/Dyno-fun/issues/18","number":18,"state":"open","locked":false,"title":"Math command","user":{"login":"bjornmorten","id":31214445,"avatar_url":"https://avatars1.githubusercontent.com/u/31214445?v=4","gravatar_id":"","url":"https://api.github.com/users/bjornmorten","html_url":"https://github.com/bjornmorten","followers_url":"https://api.github.com/users/bjornmorten/followers","following_url":"https://api.github.com/users/bjornmorten/following{/other_user}","gists_url":"https://api.github.com/users/bjornmorten/gists{/gist_id}","starred_url":"https://api.github.com/users/bjornmorten/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bjornmorten/subscriptions","organizations_url":"https://api.github.com/users/bjornmorten/orgs","repos_url":"https://api.github.com/users/bjornmorten/repos","events_url":"https://api.github.com/users/bjornmorten/events{/privacy}","received_events_url":"https://api.github.com/users/bjornmorten/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-02-18T14:31:57Z","updated_at":"2018-03-04T19:43:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fee7be706d1b05c1f462fb7ba53ed73374d16f9d","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/FlexLabs/Dyno-fun/pulls/18/commits","review_comments_url":"https://api.github.com/repos/FlexLabs/Dyno-fun/pulls/18/comments","review_comment_url":"https://api.github.com/repos/FlexLabs/Dyno-fun/pulls/comments{/number}","comments_url":"https://api.github.com/repos/FlexLabs/Dyno-fun/issues/18/comments","statuses_url":"https://api.github.com/repos/FlexLabs/Dyno-fun/statuses/ef3a45171f57bc621bd585b76a34967988411c52","head":{"label":"bjornmorten:develop","ref":"develop","sha":"ef3a45171f57bc621bd585b76a34967988411c52","user":{"login":"bjornmorten","id":31214445,"avatar_url":"https://avatars1.githubusercontent.com/u/31214445?v=4","gravatar_id":"","url":"https://api.github.com/users/bjornmorten","html_url":"https://github.com/bjornmorten","followers_url":"https://api.github.com/users/bjornmorten/followers","following_url":"https://api.github.com/users/bjornmorten/following{/other_user}","gists_url":"https://api.github.com/users/bjornmorten/gists{/gist_id}","starred_url":"https://api.github.com/users/bjornmorten/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bjornmorten/subscriptions","organizations_url":"https://api.github.com/users/bjornmorten/orgs","repos_url":"https://api.github.com/users/bjornmorten/repos","events_url":"https://api.github.com/users/bjornmorten/events{/privacy}","received_events_url":"https://api.github.com/users/bjornmorten/received_events","type":"User","site_admin":false},"repo":{"id":121957051,"name":"Dyno-fun","full_name":"bjornmorten/Dyno-fun","owner":{"login":"bjornmorten","id":31214445,"avatar_url":"https://avatars1.githubusercontent.com/u/31214445?v=4","gravatar_id":"","url":"https://api.github.com/users/bjornmorten","html_url":"https://github.com/bjornmorten","followers_url":"https://api.github.com/users/bjornmorten/followers","following_url":"https://api.github.com/users/bjornmorten/following{/other_user}","gists_url":"https://api.github.com/users/bjornmorten/gists{/gist_id}","starred_url":"https://api.github.com/users/bjornmorten/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bjornmorten/subscriptions","organizations_url":"https://api.github.com/users/bjornmorten/orgs","repos_url":"https://api.github.com/users/bjornmorten/repos","events_url":"https://api.github.com/users/bjornmorten/events{/privacy}","received_events_url":"https://api.github.com/users/bjornmorten/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bjornmorten/Dyno-fun","description":null,"fork":true,"url":"https://api.github.com/repos/bjornmorten/Dyno-fun","forks_url":"https://api.github.com/repos/bjornmorten/Dyno-fun/forks","keys_url":"https://api.github.com/repos/bjornmorten/Dyno-fun/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bjornmorten/Dyno-fun/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bjornmorten/Dyno-fun/teams","hooks_url":"https://api.github.com/repos/bjornmorten/Dyno-fun/hooks","issue_events_url":"https://api.github.com/repos/bjornmorten/Dyno-fun/issues/events{/number}","events_url":"https://api.github.com/repos/bjornmorten/Dyno-fun/events","assignees_url":"https://api.github.com/repos/bjornmorten/Dyno-fun/assignees{/user}","branches_url":"https://api.github.com/repos/bjornmorten/Dyno-fun/branches{/branch}","tags_url":"https://api.github.com/repos/bjornmorten/Dyno-fun/tags","blobs_url":"https://api.github.com/repos/bjornmorten/Dyno-fun/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bjornmorten/Dyno-fun/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bjornmorten/Dyno-fun/git/refs{/sha}","trees_url":"https://api.github.com/repos/bjornmorten/Dyno-fun/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bjornmorten/Dyno-fun/statuses/{sha}","languages_url":"https://api.github.com/repos/bjornmorten/Dyno-fun/languages","stargazers_url":"https://api.github.com/repos/bjornmorten/Dyno-fun/stargazers","contributors_url":"https://api.github.com/repos/bjornmorten/Dyno-fun/contributors","subscribers_url":"https://api.github.com/repos/bjornmorten/Dyno-fun/subscribers","subscription_url":"https://api.github.com/repos/bjornmorten/Dyno-fun/subscription","commits_url":"https://api.github.com/repos/bjornmorten/Dyno-fun/commits{/sha}","git_commits_url":"https://api.github.com/repos/bjornmorten/Dyno-fun/git/commits{/sha}","comments_url":"https://api.github.com/repos/bjornmorten/Dyno-fun/comments{/number}","issue_comment_url":"https://api.github.com/repos/bjornmorten/Dyno-fun/issues/comments{/number}","contents_url":"https://api.github.com/repos/bjornmorten/Dyno-fun/contents/{+path}","compare_url":"https://api.github.com/repos/bjornmorten/Dyno-fun/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bjornmorten/Dyno-fun/merges","archive_url":"https://api.github.com/repos/bjornmorten/Dyno-fun/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bjornmorten/Dyno-fun/downloads","issues_url":"https://api.github.com/repos/bjornmorten/Dyno-fun/issues{/number}","pulls_url":"https://api.github.com/repos/bjornmorten/Dyno-fun/pulls{/number}","milestones_url":"https://api.github.com/repos/bjornmorten/Dyno-fun/milestones{/number}","notifications_url":"https://api.github.com/repos/bjornmorten/Dyno-fun/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bjornmorten/Dyno-fun/labels{/name}","releases_url":"https://api.github.com/repos/bjornmorten/Dyno-fun/releases{/id}","deployments_url":"https://api.github.com/repos/bjornmorten/Dyno-fun/deployments","created_at":"2018-02-18T14:02:40Z","updated_at":"2018-02-18T14:02:42Z","pushed_at":"2018-02-18T21:25:30Z","git_url":"git://github.com/bjornmorten/Dyno-fun.git","ssh_url":"git@github.com:bjornmorten/Dyno-fun.git","clone_url":"https://github.com/bjornmorten/Dyno-fun.git","svn_url":"https://github.com/bjornmorten/Dyno-fun","homepage":null,"size":33,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"develop"}},"base":{"label":"FlexLabs:develop","ref":"develop","sha":"5a53bf2748ad5ca96516c1d2460ab80902d2783a","user":{"login":"FlexLabs","id":30397801,"avatar_url":"https://avatars2.githubusercontent.com/u/30397801?v=4","gravatar_id":"","url":"https://api.github.com/users/FlexLabs","html_url":"https://github.com/FlexLabs","followers_url":"https://api.github.com/users/FlexLabs/followers","following_url":"https://api.github.com/users/FlexLabs/following{/other_user}","gists_url":"https://api.github.com/users/FlexLabs/gists{/gist_id}","starred_url":"https://api.github.com/users/FlexLabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FlexLabs/subscriptions","organizations_url":"https://api.github.com/users/FlexLabs/orgs","repos_url":"https://api.github.com/users/FlexLabs/repos","events_url":"https://api.github.com/users/FlexLabs/events{/privacy}","received_events_url":"https://api.github.com/users/FlexLabs/received_events","type":"Organization","site_admin":false},"repo":{"id":121061829,"name":"Dyno-fun","full_name":"FlexLabs/Dyno-fun","owner":{"login":"FlexLabs","id":30397801,"avatar_url":"https://avatars2.githubusercontent.com/u/30397801?v=4","gravatar_id":"","url":"https://api.github.com/users/FlexLabs","html_url":"https://github.com/FlexLabs","followers_url":"https://api.github.com/users/FlexLabs/followers","following_url":"https://api.github.com/users/FlexLabs/following{/other_user}","gists_url":"https://api.github.com/users/FlexLabs/gists{/gist_id}","starred_url":"https://api.github.com/users/FlexLabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FlexLabs/subscriptions","organizations_url":"https://api.github.com/users/FlexLabs/orgs","repos_url":"https://api.github.com/users/FlexLabs/repos","events_url":"https://api.github.com/users/FlexLabs/events{/privacy}","received_events_url":"https://api.github.com/users/FlexLabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/FlexLabs/Dyno-fun","description":null,"fork":false,"url":"https://api.github.com/repos/FlexLabs/Dyno-fun","forks_url":"https://api.github.com/repos/FlexLabs/Dyno-fun/forks","keys_url":"https://api.github.com/repos/FlexLabs/Dyno-fun/keys{/key_id}","collaborators_url":"https://api.github.com/repos/FlexLabs/Dyno-fun/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/FlexLabs/Dyno-fun/teams","hooks_url":"https://api.github.com/repos/FlexLabs/Dyno-fun/hooks","issue_events_url":"https://api.github.com/repos/FlexLabs/Dyno-fun/issues/events{/number}","events_url":"https://api.github.com/repos/FlexLabs/Dyno-fun/events","assignees_url":"https://api.github.com/repos/FlexLabs/Dyno-fun/assignees{/user}","branches_url":"https://api.github.com/repos/FlexLabs/Dyno-fun/branches{/branch}","tags_url":"https://api.github.com/repos/FlexLabs/Dyno-fun/tags","blobs_url":"https://api.github.com/repos/FlexLabs/Dyno-fun/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/FlexLabs/Dyno-fun/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/FlexLabs/Dyno-fun/git/refs{/sha}","trees_url":"https://api.github.com/repos/FlexLabs/Dyno-fun/git/trees{/sha}","statuses_url":"https://api.github.com/repos/FlexLabs/Dyno-fun/statuses/{sha}","languages_url":"https://api.github.com/repos/FlexLabs/Dyno-fun/languages","stargazers_url":"https://api.github.com/repos/FlexLabs/Dyno-fun/stargazers","contributors_url":"https://api.github.com/repos/FlexLabs/Dyno-fun/contributors","subscribers_url":"https://api.github.com/repos/FlexLabs/Dyno-fun/subscribers","subscription_url":"https://api.github.com/repos/FlexLabs/Dyno-fun/subscription","commits_url":"https://api.github.com/repos/FlexLabs/Dyno-fun/commits{/sha}","git_commits_url":"https://api.github.com/repos/FlexLabs/Dyno-fun/git/commits{/sha}","comments_url":"https://api.github.com/repos/FlexLabs/Dyno-fun/comments{/number}","issue_comment_url":"https://api.github.com/repos/FlexLabs/Dyno-fun/issues/comments{/number}","contents_url":"https://api.github.com/repos/FlexLabs/Dyno-fun/contents/{+path}","compare_url":"https://api.github.com/repos/FlexLabs/Dyno-fun/compare/{base}...{head}","merges_url":"https://api.github.com/repos/FlexLabs/Dyno-fun/merges","archive_url":"https://api.github.com/repos/FlexLabs/Dyno-fun/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/FlexLabs/Dyno-fun/downloads","issues_url":"https://api.github.com/repos/FlexLabs/Dyno-fun/issues{/number}","pulls_url":"https://api.github.com/repos/FlexLabs/Dyno-fun/pulls{/number}","milestones_url":"https://api.github.com/repos/FlexLabs/Dyno-fun/milestones{/number}","notifications_url":"https://api.github.com/repos/FlexLabs/Dyno-fun/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/FlexLabs/Dyno-fun/labels{/name}","releases_url":"https://api.github.com/repos/FlexLabs/Dyno-fun/releases{/id}","deployments_url":"https://api.github.com/repos/FlexLabs/Dyno-fun/deployments","created_at":"2018-02-10T22:59:15Z","updated_at":"2018-02-23T15:27:07Z","pushed_at":"2018-03-04T19:14:18Z","git_url":"git://github.com/FlexLabs/Dyno-fun.git","ssh_url":"git@github.com:FlexLabs/Dyno-fun.git","clone_url":"https://github.com/FlexLabs/Dyno-fun.git","svn_url":"https://github.com/FlexLabs/Dyno-fun","homepage":null,"size":40,"stargazers_count":12,"watchers_count":12,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"archived":false,"open_issues_count":5,"license":null,"forks":9,"open_issues":5,"watchers":12,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/FlexLabs/Dyno-fun/pulls/18"},"html":{"href":"https://github.com/FlexLabs/Dyno-fun/pull/18"},"issue":{"href":"https://api.github.com/repos/FlexLabs/Dyno-fun/issues/18"},"comments":{"href":"https://api.github.com/repos/FlexLabs/Dyno-fun/issues/18/comments"},"review_comments":{"href":"https://api.github.com/repos/FlexLabs/Dyno-fun/pulls/18/comments"},"review_comment":{"href":"https://api.github.com/repos/FlexLabs/Dyno-fun/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/FlexLabs/Dyno-fun/pulls/18/commits"},"statuses":{"href":"https://api.github.com/repos/FlexLabs/Dyno-fun/statuses/ef3a45171f57bc621bd585b76a34967988411c52"}},"author_association":"NONE"}}
{"actor":{"display_login":"germanoeich"}}