Class Integration

java.lang.Object
discord4j.core.object.entity.Integration
All Implemented Interfaces:
DiscordObject, Entity

public class Integration extends Object implements Entity
A Discord integration.
See Also:
  • Constructor Details

    • Integration

      public Integration(GatewayDiscordClient gateway, discord4j.discordjson.json.IntegrationData data, long guildId)
      Constructs an Integration 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.
      guildId - The ID of the guild this integration is associated to.
  • 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.
    • getId

      public Snowflake getId()
      Description copied from interface: Entity
      Gets the Snowflake that uniquely identifies this entity.
      Specified by:
      getId in interface Entity
      Returns:
      The Snowflake that uniquely identifies this entity.
    • getGuildId

      public Snowflake getGuildId()
      Gets the ID of the guild this integration is associated to.
      Returns:
      The ID of the guild this integration is associated to.
    • getData

      public discord4j.discordjson.json.IntegrationData getData()
      Gets the data of the integration.
      Returns:
      The data of the integration.
    • getName

      public String getName()
      Gets the integration name.
      Returns:
      The integration name.
    • getType

      public String getType()
      Gets the integration type (twitch, youtube, or discord).
      Returns:
      The integration type (twitch, youtube, or discord).
    • isEnabled

      public boolean isEnabled()
      Gets whether the integration is enabled.
      Returns:
      Whether the integration is enabled.
    • isSyncing

      public boolean isSyncing()
      Gets whether the integration is syncing.
      Returns:
      Whether the integration is syncing.
    • getSubscriberRoleId

      public Optional<Snowflake> getSubscriberRoleId()
      Gets the id that this integration uses for "subscribers".
      Returns:
      The id that this integration uses for "subscribers".
    • getSubscriberRole

      public Mono<Role> getSubscriberRole()
      Requests to retrieve the role that this integration uses for "subscribers".
      Returns:
      A Mono where, upon successful completion, emits the role that this integration uses for "subscribers". If an error is received, it is emitted through the Mono.
    • getSubscriberRole

      public Mono<Role> getSubscriberRole(EntityRetrievalStrategy retrievalStrategy)
      Requests to retrieve the role that this integration uses for "subscribers", using the given retrieval strategy.
      Parameters:
      retrievalStrategy - the strategy to use to get the role
      Returns:
      A Mono where, upon successful completion, emits the role that this integration uses for "subscribers". If an error is received, it is emitted through the Mono.
    • isEnableEmoticons

      public boolean isEnableEmoticons()
      Gets whether emoticons should be synced for this integration (twitch only currently).
      Returns:
      Whether emoticons should be synced for this integration (twitch only currently).
    • getExpireBehavior

      public Optional<Integration.ExpireBehavior> getExpireBehavior()
      Gets the behavior of expiring subscribers, if present.
      Returns:
      The behavior of expiring subscribers, if present.
    • getExpireGracePeriod

      public Optional<Integer> getExpireGracePeriod()
      Gets the grace period (in days) before expiring subscribers, if present.
      Returns:
      The grace period (in days) before expiring subscribers, if present.
    • getUser

      public Optional<User> getUser()
      Gets the user for this integration, if present.
      Returns:
      The user for this integration, if present.
    • getAccount

      public IntegrationAccount getAccount()
      Gets the integration account information.
      Returns:
      The integration account information.
    • getSyncedAt

      public Optional<Instant> getSyncedAt()
      Gets when this integration was last synced, if present.
      Returns:
      When this integration was last synced, if present.
    • getSubscriberCount

      public Optional<Integer> getSubscriberCount()
      Gets how many subscribers this integration has, if present.
      Returns:
      How many subscribers this integration has, if present.
    • isRevoked

      public boolean isRevoked()
      Gets whether integration has been revoked.
      Returns:
      Whether integration has been revoked.
    • getApplication

      public Optional<IntegrationApplication> getApplication()
      Gets the bot/OAuth2 application for discord integrations, if present.
      Returns:
      The bot/OAuth2 application for discord integrations, if present.
    • equals

      public boolean equals(@Nullable Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object