Interface PrivateChannel

All Superinterfaces:
Channel, Formattable, IMentionable, ISnowflake, MessageChannel

public interface PrivateChannel extends MessageChannel
Represents the connection used for direct messaging.
See Also:
  • Method Details

    • getUser

      @Nullable User getUser()
      The User that this PrivateChannel communicates with.

      This user is only null if this channel is currently uncached, and one the following occur:

      • A reaction is removed
      • A reaction is added
      • A message is deleted
      • This account sends a message to a user from another shard (not shard 0)
      The consequence of this is that for any message this bot receives from a guild or from other users, the user will not be null.
      In order to retrieve a user that is null, use retrieveUser()
      Possibly-null User.
      See Also:
    • retrieveUser

      Retrieves the User that this PrivateChannel communicates with.
      This method fetches the channel from the API and retrieves the User from that.
      A RestAction to retrieve the User that this PrivateChannel communicates with.
    • getName

      @Nonnull String getName()
      The human-readable name of this channel.

      If getUser returns null, this method will return an empty String. This happens when JDA does not have enough information to populate the channel name.

      This will occur only when getUser() is null, and the reasons are given in getUser()

      If the channel name is important, retrieveUser() should be used, instead.

      Specified by:
      getName in interface Channel
      The name of this channel
      See Also: