{"action":"created","comment":{"url":"https://api.github.com/repos/DV8FromTheWorld/JDA/pulls/comments/89686419","pull_request_review_id":10227690,"id":89686419,"diff_hunk":"@@ -0,0 +1,685 @@\n+/*\n+ *     Copyright 2015-2016 Austin Keener & Michael Ritter\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *     http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package net.dv8tion.jda.core.utils;\n+\n+import com.mashape.unirest.http.HttpResponse;\n+import com.mashape.unirest.http.JsonNode;\n+import com.mashape.unirest.http.Unirest;\n+import com.mashape.unirest.http.exceptions.UnirestException;\n+import java.util.ArrayList;\n+import java.util.HashMap;\n+import java.util.List;\n+import net.dv8tion.jda.core.OnlineStatus;\n+import net.dv8tion.jda.core.entities.Game;\n+import net.dv8tion.jda.core.entities.Guild;\n+import net.dv8tion.jda.core.entities.IMentionable;\n+import net.dv8tion.jda.core.entities.ISnowflake;\n+import net.dv8tion.jda.core.entities.impl.UserImpl;\n+import net.dv8tion.jda.core.utils.WidgetUtil.Widget.Channel;\n+import net.dv8tion.jda.core.utils.WidgetUtil.Widget.Member;\n+import org.apache.http.util.Args;\n+import org.json.JSONArray;\n+import org.json.JSONObject;\n+\n+/**\n+ * The WidgetUtil is a class for interacting with various facets of Discord's\n+ * guild widgets\n+ */\n+public class WidgetUtil {\n+    \n+    public static final String WIDGET_PNG = \"https://discordapp.com/api/guilds/%s/widget.png?style=%s\";\n+    public static final String WIDGET_URL = \"https://discordapp.com/api/guilds/%s/widget.json\";\n+    public static final String WIDGET_HTML = \"<iframe src=\\\"https://discordapp.com/widget?id=%s&theme=%s\\\" width=\\\"%d\\\" height=\\\"%d\\\" allowtransparency=\\\"true\\\" frameborder=\\\"0\\\"></iframe>\";\n+    \n+    /**\n+     * Gets the banner image for the specified guild of the specified type.\n+     * This banner will only be available if the guild in question has the\n+     * Widget enabled.\n+     * \n+     * @param guild The guild\n+     * @param type The type (visual style) of the banner\n+     * @return A String containing the URL of the banner image\n+     */\n+    public static String getWidgetBanner(Guild guild, BannerType type)\n+    {\n+        Args.notNull(guild, \"Guild\");\n+        return getWidgetBanner(guild.getId(), type);\n+    }\n+    \n+    /**\n+     * Gets the banner image for the specified guild of the specified type.\n+     * This banner will only be available if the guild in question has the\n+     * Widget enabled. Additionally, this method can be used independently of\n+     * being on the guild in question.\n+     * \n+     * @param guildId the guild ID\n+     * @param type The type (visual style) of the banner\n+     * @return A String containing the URL of the banner image\n+     */\n+    public static String getWidgetBanner(String guildId, BannerType type)\n+    {\n+        Args.notNull(guildId, \"GuildId\");\n+        Args.notNull(type, \"BannerType\");\n+        return String.format(WIDGET_PNG, guildId, type.name().toLowerCase());\n+    }\n+    \n+    /**\n+     * Represents the available banner types\n+     * Each of these has a different appearance:\n+     * \n+     * Shield - tiny, only contains Discord logo and online count\n+     * \n+     * Banner1 - medium, contains server name, icon, and online count, and a \n+     * \"Powered by Discord\" bar on the bottom\n+     * \n+     * Banner2 - small, contains server name, icon, and online count, and a \n+     * Discord logo on the side\n+     * \n+     * Banner3 - medium, contains server name, icon, and online count, and a \n+     * Discord logo with a \"Chat Now\" bar on the bottom\n+     * \n+     * Banner4 - large, contains a very big Discord logo, server name, icon, and \n+     * online count, and a big \"Join My Server\" button\n+     */\n+    public enum BannerType\n+    {\n+        SHIELD, BANNER1, BANNER2, BANNER3, BANNER4\n+    }\n+    \n+    \n+    /**\n+     * Gets the pre-made HTML Widget for the specified guild using the specified\n+     * settings. The widget will only display correctly if the guild in question\n+     * has the Widget enabled.\n+     * \n+     * @param guild the guild\n+     * @param theme the theme, light or dark\n+     * @param width the width of the widget\n+     * @param height the height of the widget\n+     * @return a String containing the pre-made widget with the supplied settings\n+     */\n+    public static String getPremadeWidgetHtml(Guild guild, WidgetTheme theme, int width, int height)\n+    {\n+        Args.notNull(guild, \"Guild\");\n+        return getPremadeWidgetHtml(guild.getId(), theme, width, height);\n+    }\n+    \n+    /**\n+     * Gets the pre-made HTML Widget for the specified guild using the specified\n+     * settings. The widget will only display correctly if the guild in question\n+     * has the Widget enabled. Additionally, this method can be used independently\n+     * of being on the guild in question.\n+     * \n+     * @param guildId the guild ID\n+     * @param theme the theme, light or dark\n+     * @param width the width of the widget\n+     * @param height the height of the widget\n+     * @return a String containing the pre-made widget with the supplied settings\n+     */\n+    public static String getPremadeWidgetHtml(String guildId, WidgetTheme theme, int width, int height)\n+    {\n+        Args.notNull(guildId, \"GuildId\");\n+        Args.notNull(theme, \"WidgetTheme\");\n+        Args.notNegative(width, \"Width\");\n+        Args.notNegative(height, \"Height\");\n+        return String.format(WIDGET_HTML, guildId, theme.name().toLowerCase(), width, height);\n+    }\n+    \n+    /**\n+     * Represents the color scheme of the widget\n+     * \n+     * These color themes match Discord's dark and light themes\n+     */\n+    public enum WidgetTheme","path":"src/main/java/net/dv8tion/jda/core/utils/WidgetUtil.java","position":146,"original_position":146,"commit_id":"f56534042a8a696eed0a7594a24dfaed0aea7bdf","original_commit_id":"f56534042a8a696eed0a7594a24dfaed0aea7bdf","user":{"login":"DV8FromTheWorld","id":1479909,"avatar_url":"https://avatars.githubusercontent.com/u/1479909?v=3","gravatar_id":"","url":"https://api.github.com/users/DV8FromTheWorld","html_url":"https://github.com/DV8FromTheWorld","followers_url":"https://api.github.com/users/DV8FromTheWorld/followers","following_url":"https://api.github.com/users/DV8FromTheWorld/following{/other_user}","gists_url":"https://api.github.com/users/DV8FromTheWorld/gists{/gist_id}","starred_url":"https://api.github.com/users/DV8FromTheWorld/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DV8FromTheWorld/subscriptions","organizations_url":"https://api.github.com/users/DV8FromTheWorld/orgs","repos_url":"https://api.github.com/users/DV8FromTheWorld/repos","events_url":"https://api.github.com/users/DV8FromTheWorld/events{/privacy}","received_events_url":"https://api.github.com/users/DV8FromTheWorld/received_events","type":"User","site_admin":false},"body":"Group all enums together.","created_at":"2016-11-27T09:50:22Z","updated_at":"2016-11-27T09:56:16Z","html_url":"https://github.com/DV8FromTheWorld/JDA/pull/192#discussion_r89686419","pull_request_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/pulls/192","_links":{"self":{"href":"https://api.github.com/repos/DV8FromTheWorld/JDA/pulls/comments/89686419"},"html":{"href":"https://github.com/DV8FromTheWorld/JDA/pull/192#discussion_r89686419"},"pull_request":{"href":"https://api.github.com/repos/DV8FromTheWorld/JDA/pulls/192"}}},"pull_request":{"url":"https://api.github.com/repos/DV8FromTheWorld/JDA/pulls/192","id":95370446,"html_url":"https://github.com/DV8FromTheWorld/JDA/pull/192","diff_url":"https://github.com/DV8FromTheWorld/JDA/pull/192.diff","patch_url":"https://github.com/DV8FromTheWorld/JDA/pull/192.patch","issue_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/issues/192","number":192,"state":"open","locked":false,"title":"Widget Util","user":{"login":"jagrosh","id":12754382,"avatar_url":"https://avatars.githubusercontent.com/u/12754382?v=3","gravatar_id":"","url":"https://api.github.com/users/jagrosh","html_url":"https://github.com/jagrosh","followers_url":"https://api.github.com/users/jagrosh/followers","following_url":"https://api.github.com/users/jagrosh/following{/other_user}","gists_url":"https://api.github.com/users/jagrosh/gists{/gist_id}","starred_url":"https://api.github.com/users/jagrosh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jagrosh/subscriptions","organizations_url":"https://api.github.com/users/jagrosh/orgs","repos_url":"https://api.github.com/users/jagrosh/repos","events_url":"https://api.github.com/users/jagrosh/events{/privacy}","received_events_url":"https://api.github.com/users/jagrosh/received_events","type":"User","site_admin":false},"body":"first pass on WidgetUtil\r\nadded getEffectiveAvatarUrl to User and UserImpl","created_at":"2016-11-26T12:34:08Z","updated_at":"2016-11-27T09:56:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0eb61dfa3466b062e871d86bcef680c72f118bef","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/pulls/192/commits","review_comments_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/pulls/192/comments","review_comment_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/issues/192/comments","statuses_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/statuses/f56534042a8a696eed0a7594a24dfaed0aea7bdf","head":{"label":"jagrosh:widget-util","ref":"widget-util","sha":"f56534042a8a696eed0a7594a24dfaed0aea7bdf","user":{"login":"jagrosh","id":12754382,"avatar_url":"https://avatars.githubusercontent.com/u/12754382?v=3","gravatar_id":"","url":"https://api.github.com/users/jagrosh","html_url":"https://github.com/jagrosh","followers_url":"https://api.github.com/users/jagrosh/followers","following_url":"https://api.github.com/users/jagrosh/following{/other_user}","gists_url":"https://api.github.com/users/jagrosh/gists{/gist_id}","starred_url":"https://api.github.com/users/jagrosh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jagrosh/subscriptions","organizations_url":"https://api.github.com/users/jagrosh/orgs","repos_url":"https://api.github.com/users/jagrosh/repos","events_url":"https://api.github.com/users/jagrosh/events{/privacy}","received_events_url":"https://api.github.com/users/jagrosh/received_events","type":"User","site_admin":false},"repo":{"id":68458979,"name":"JDA","full_name":"jagrosh/JDA","owner":{"login":"jagrosh","id":12754382,"avatar_url":"https://avatars.githubusercontent.com/u/12754382?v=3","gravatar_id":"","url":"https://api.github.com/users/jagrosh","html_url":"https://github.com/jagrosh","followers_url":"https://api.github.com/users/jagrosh/followers","following_url":"https://api.github.com/users/jagrosh/following{/other_user}","gists_url":"https://api.github.com/users/jagrosh/gists{/gist_id}","starred_url":"https://api.github.com/users/jagrosh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jagrosh/subscriptions","organizations_url":"https://api.github.com/users/jagrosh/orgs","repos_url":"https://api.github.com/users/jagrosh/repos","events_url":"https://api.github.com/users/jagrosh/events{/privacy}","received_events_url":"https://api.github.com/users/jagrosh/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jagrosh/JDA","description":"Java REST wrapper for the popular chat & VOIP service: Discord. https://discordapp.com/","fork":true,"url":"https://api.github.com/repos/jagrosh/JDA","forks_url":"https://api.github.com/repos/jagrosh/JDA/forks","keys_url":"https://api.github.com/repos/jagrosh/JDA/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jagrosh/JDA/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jagrosh/JDA/teams","hooks_url":"https://api.github.com/repos/jagrosh/JDA/hooks","issue_events_url":"https://api.github.com/repos/jagrosh/JDA/issues/events{/number}","events_url":"https://api.github.com/repos/jagrosh/JDA/events","assignees_url":"https://api.github.com/repos/jagrosh/JDA/assignees{/user}","branches_url":"https://api.github.com/repos/jagrosh/JDA/branches{/branch}","tags_url":"https://api.github.com/repos/jagrosh/JDA/tags","blobs_url":"https://api.github.com/repos/jagrosh/JDA/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jagrosh/JDA/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jagrosh/JDA/git/refs{/sha}","trees_url":"https://api.github.com/repos/jagrosh/JDA/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jagrosh/JDA/statuses/{sha}","languages_url":"https://api.github.com/repos/jagrosh/JDA/languages","stargazers_url":"https://api.github.com/repos/jagrosh/JDA/stargazers","contributors_url":"https://api.github.com/repos/jagrosh/JDA/contributors","subscribers_url":"https://api.github.com/repos/jagrosh/JDA/subscribers","subscription_url":"https://api.github.com/repos/jagrosh/JDA/subscription","commits_url":"https://api.github.com/repos/jagrosh/JDA/commits{/sha}","git_commits_url":"https://api.github.com/repos/jagrosh/JDA/git/commits{/sha}","comments_url":"https://api.github.com/repos/jagrosh/JDA/comments{/number}","issue_comment_url":"https://api.github.com/repos/jagrosh/JDA/issues/comments{/number}","contents_url":"https://api.github.com/repos/jagrosh/JDA/contents/{+path}","compare_url":"https://api.github.com/repos/jagrosh/JDA/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jagrosh/JDA/merges","archive_url":"https://api.github.com/repos/jagrosh/JDA/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jagrosh/JDA/downloads","issues_url":"https://api.github.com/repos/jagrosh/JDA/issues{/number}","pulls_url":"https://api.github.com/repos/jagrosh/JDA/pulls{/number}","milestones_url":"https://api.github.com/repos/jagrosh/JDA/milestones{/number}","notifications_url":"https://api.github.com/repos/jagrosh/JDA/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jagrosh/JDA/labels{/name}","releases_url":"https://api.github.com/repos/jagrosh/JDA/releases{/id}","deployments_url":"https://api.github.com/repos/jagrosh/JDA/deployments","created_at":"2016-09-17T15:01:57Z","updated_at":"2016-10-14T05:45:46Z","pushed_at":"2016-11-26T22:23:16Z","git_url":"git://github.com/jagrosh/JDA.git","ssh_url":"git@github.com:jagrosh/JDA.git","clone_url":"https://github.com/jagrosh/JDA.git","svn_url":"https://github.com/jagrosh/JDA","homepage":"","size":21420,"stargazers_count":1,"watchers_count":1,"language":"Java","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":1,"default_branch":"master"}},"base":{"label":"DV8FromTheWorld:development","ref":"development","sha":"4c00b5599d3e35dc91a97e1a78f2d29212df5cc8","user":{"login":"DV8FromTheWorld","id":1479909,"avatar_url":"https://avatars.githubusercontent.com/u/1479909?v=3","gravatar_id":"","url":"https://api.github.com/users/DV8FromTheWorld","html_url":"https://github.com/DV8FromTheWorld","followers_url":"https://api.github.com/users/DV8FromTheWorld/followers","following_url":"https://api.github.com/users/DV8FromTheWorld/following{/other_user}","gists_url":"https://api.github.com/users/DV8FromTheWorld/gists{/gist_id}","starred_url":"https://api.github.com/users/DV8FromTheWorld/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DV8FromTheWorld/subscriptions","organizations_url":"https://api.github.com/users/DV8FromTheWorld/orgs","repos_url":"https://api.github.com/users/DV8FromTheWorld/repos","events_url":"https://api.github.com/users/DV8FromTheWorld/events{/privacy}","received_events_url":"https://api.github.com/users/DV8FromTheWorld/received_events","type":"User","site_admin":false},"repo":{"id":47880207,"name":"JDA","full_name":"DV8FromTheWorld/JDA","owner":{"login":"DV8FromTheWorld","id":1479909,"avatar_url":"https://avatars.githubusercontent.com/u/1479909?v=3","gravatar_id":"","url":"https://api.github.com/users/DV8FromTheWorld","html_url":"https://github.com/DV8FromTheWorld","followers_url":"https://api.github.com/users/DV8FromTheWorld/followers","following_url":"https://api.github.com/users/DV8FromTheWorld/following{/other_user}","gists_url":"https://api.github.com/users/DV8FromTheWorld/gists{/gist_id}","starred_url":"https://api.github.com/users/DV8FromTheWorld/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DV8FromTheWorld/subscriptions","organizations_url":"https://api.github.com/users/DV8FromTheWorld/orgs","repos_url":"https://api.github.com/users/DV8FromTheWorld/repos","events_url":"https://api.github.com/users/DV8FromTheWorld/events{/privacy}","received_events_url":"https://api.github.com/users/DV8FromTheWorld/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/DV8FromTheWorld/JDA","description":"Java REST wrapper for the popular chat & VOIP service: Discord. https://discordapp.com/","fork":false,"url":"https://api.github.com/repos/DV8FromTheWorld/JDA","forks_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/forks","keys_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/teams","hooks_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/hooks","issue_events_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/issues/events{/number}","events_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/events","assignees_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/assignees{/user}","branches_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/branches{/branch}","tags_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/tags","blobs_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/git/refs{/sha}","trees_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/statuses/{sha}","languages_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/languages","stargazers_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/stargazers","contributors_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/contributors","subscribers_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/subscribers","subscription_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/subscription","commits_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/commits{/sha}","git_commits_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/git/commits{/sha}","comments_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/comments{/number}","issue_comment_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/issues/comments{/number}","contents_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/contents/{+path}","compare_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/merges","archive_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/downloads","issues_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/issues{/number}","pulls_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/pulls{/number}","milestones_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/milestones{/number}","notifications_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/labels{/name}","releases_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/releases{/id}","deployments_url":"https://api.github.com/repos/DV8FromTheWorld/JDA/deployments","created_at":"2015-12-12T13:57:32Z","updated_at":"2016-11-23T13:41:23Z","pushed_at":"2016-11-27T09:43:55Z","git_url":"git://github.com/DV8FromTheWorld/JDA.git","ssh_url":"git@github.com:DV8FromTheWorld/JDA.git","clone_url":"https://github.com/DV8FromTheWorld/JDA.git","svn_url":"https://github.com/DV8FromTheWorld/JDA","homepage":"","size":21676,"stargazers_count":103,"watchers_count":103,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":41,"mirror_url":null,"open_issues_count":9,"forks":41,"open_issues":9,"watchers":103,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/DV8FromTheWorld/JDA/pulls/192"},"html":{"href":"https://github.com/DV8FromTheWorld/JDA/pull/192"},"issue":{"href":"https://api.github.com/repos/DV8FromTheWorld/JDA/issues/192"},"comments":{"href":"https://api.github.com/repos/DV8FromTheWorld/JDA/issues/192/comments"},"review_comments":{"href":"https://api.github.com/repos/DV8FromTheWorld/JDA/pulls/192/comments"},"review_comment":{"href":"https://api.github.com/repos/DV8FromTheWorld/JDA/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DV8FromTheWorld/JDA/pulls/192/commits"},"statuses":{"href":"https://api.github.com/repos/DV8FromTheWorld/JDA/statuses/f56534042a8a696eed0a7594a24dfaed0aea7bdf"}}}}
{"actor":{"display_login":"DV8FromTheWorld"}}