Class Ban

java.lang.Object
discord4j.core.object.Ban
All Implemented Interfaces:
DiscordObject

public final class Ban extends Object implements DiscordObject
A Discord ban.
See Also:
  • Constructor Details

    • Ban

      public Ban(GatewayDiscordClient gateway, discord4j.discordjson.json.BanData data)
      Constructs a Ban with an associated GatewayDiscordClient and Discord data.
      Parameters:
      gateway - The GatewayDiscordClient associated to this object, must be non-null.
      data - The raw data as represented by Discord, must be non-null.
  • Method Details

    • getClient

      public GatewayDiscordClient getClient()
      Description copied from interface: DiscordObject
      Returns the GatewayDiscordClient that created this object. Methods in it are exclusively based on the entity cache or Store in use. Refer to calling getClient().rest() to access a DiscordClient that is capable of requesting entities directly from the REST API.
      Specified by:
      getClient in interface DiscordObject
      Returns:
      The GatewayDiscordClient associated to this object.
    • getData

      public discord4j.discordjson.json.BanData getData()
      Gets the data of the ban.
      Returns:
      The data of the ban.
    • getReason

      public Optional<String> getReason()
      Gets the reason for the ban.
      Returns:
      The reason for the ban.
    • getUser

      public User getUser()
      Gets the banned user.
      Returns:
      The banned user.
    • toString

      public String toString()
      Overrides:
      toString in class Object