public class WidgetUtil
extends java.lang.Object
Modifier and Type | Class | Description |
---|---|---|
static class |
WidgetUtil.BannerType |
Represents the available banner types
Each of these has a different appearance: |
static class |
WidgetUtil.Widget |
|
static class |
WidgetUtil.WidgetTheme |
Represents the color scheme of the widget
These color themes match Discord's dark and light themes |
Modifier and Type | Field | Description |
---|---|---|
static java.lang.String |
WIDGET_HTML |
|
static java.lang.String |
WIDGET_PNG |
|
static java.lang.String |
WIDGET_URL |
Constructor | Description |
---|---|
WidgetUtil() |
Modifier and Type | Method | Description |
---|---|---|
static java.lang.String |
getPremadeWidgetHtml(java.lang.String guildId,
WidgetUtil.WidgetTheme theme,
int width,
int height) |
Gets the pre-made HTML Widget for the specified guild using the specified
settings.
|
static java.lang.String |
getPremadeWidgetHtml(Guild guild,
WidgetUtil.WidgetTheme theme,
int width,
int height) |
Gets the pre-made HTML Widget for the specified guild using the specified
settings.
|
static WidgetUtil.Widget |
getWidget(long guildId) |
Makes a GET request to get the information for a Guild's widget.
|
static WidgetUtil.Widget |
getWidget(java.lang.String guildId) |
Makes a GET request to get the information for a Guild's widget.
|
static java.lang.String |
getWidgetBanner(java.lang.String guildId,
WidgetUtil.BannerType type) |
Gets the banner image for the specified guild of the specified type.
|
static java.lang.String |
getWidgetBanner(Guild guild,
WidgetUtil.BannerType type) |
Gets the banner image for the specified guild of the specified type.
|
public static final java.lang.String WIDGET_PNG
public static final java.lang.String WIDGET_URL
public static final java.lang.String WIDGET_HTML
public static java.lang.String getWidgetBanner(Guild guild, WidgetUtil.BannerType type)
guild
- The guildtype
- The type (visual style) of the bannerpublic static java.lang.String getWidgetBanner(java.lang.String guildId, WidgetUtil.BannerType type)
guildId
- the guild IDtype
- The type (visual style) of the bannerpublic static java.lang.String getPremadeWidgetHtml(Guild guild, WidgetUtil.WidgetTheme theme, int width, int height)
guild
- the guildtheme
- the theme, light or darkwidth
- the width of the widgetheight
- the height of the widgetpublic static java.lang.String getPremadeWidgetHtml(java.lang.String guildId, WidgetUtil.WidgetTheme theme, int width, int height)
guildId
- the guild IDtheme
- the theme, light or darkwidth
- the width of the widgetheight
- the height of the widgetpublic static WidgetUtil.Widget getWidget(java.lang.String guildId) throws RateLimitedException
This Widget can be obtained from any valid guild ID that has it enabled; no accounts need to be on the server to access this information.
guildId
- The id of the Guildnull
if the provided guild ID is not a valid Discord guild ID
RateLimitedException
- If the request was rate limited, respect the timeout!java.lang.NumberFormatException
- If the provided guildId
cannot be parsed by Long.parseLong(String)
public static WidgetUtil.Widget getWidget(long guildId) throws RateLimitedException
This Widget can be obtained from any valid guild ID that has it enabled; no accounts need to be on the server to access this information.
guildId
- The id of the Guildnull
if the provided guild ID is not a valid Discord guild ID
RateLimitedException
- If the request was rate limited, respect the timeout!