Interface Widget

All Superinterfaces:
ISnowflake

public interface Widget extends ISnowflake
Represents a guild's widget
See Also:
  • Method Details

    • isAvailable

      boolean isAvailable()
      Shows whether or not the widget for a guild is available. If this method returns false, all other values will be null
      Returns:
      True, if the widget is available, false otherwise
    • getName

      @Nonnull String getName()
      Gets the name of the guild
      Returns:
      the name of the guild
      Throws:
      IllegalStateException - If the widget is not available
    • getInviteCode

      @Nullable String getInviteCode()
      Gets an invite code for the guild, or null if no invite channel is enabled in the widget
      Returns:
      an invite code for the guild, if widget invites are enabled
      Throws:
      IllegalStateException - If the widget is not available
    • getVoiceChannels

      @Nonnull List<Widget.VoiceChannel> getVoiceChannels()
      Gets the list of voice channels in the guild
      Returns:
      the list of voice channels in the guild
      Throws:
      IllegalStateException - If the widget is not available
    • getVoiceChannelById

      @Nullable Widget.VoiceChannel getVoiceChannelById(@Nonnull String id)
      Gets a voice channel with the given ID, or null if the voice channel is not found
      Parameters:
      id - the ID of the voice channel
      Returns:
      possibly-null VoiceChannel with the given ID.
      Throws:
      IllegalStateException - If the widget is not available
      NumberFormatException - If the provided id cannot be parsed by Long.parseLong(String)
    • getVoiceChannelById

      @Nullable Widget.VoiceChannel getVoiceChannelById(long id)
      Gets a voice channel with the given ID, or null if the voice channel is not found
      Parameters:
      id - the ID of the voice channel
      Returns:
      possibly-null VoiceChannel with the given ID.
      Throws:
      IllegalStateException - If the widget is not available
    • getMembers

      @Nonnull List<Widget.Member> getMembers()
      Gets a list of online members in the guild
      Returns:
      the list of members
      Throws:
      IllegalStateException - If the widget is not available
    • getMemberById

      @Nullable Widget.Member getMemberById(@Nonnull String id)
      Gets a member with the given ID, or null if the member is not found
      Parameters:
      id - the ID of the member
      Returns:
      possibly-null Member with the given ID.
      Throws:
      NumberFormatException - If the provided id cannot be parsed by Long.parseLong(String)
      IllegalStateException - If the widget is not available
    • getMemberById

      @Nullable Widget.Member getMemberById(long id)
      Gets a member with the given ID, or null if the member is not found
      Parameters:
      id - the ID of the member
      Returns:
      possibly-null Member with the given ID.
      Throws:
      IllegalStateException - If the widget is not available