Class TextChannel

java.lang.Object
discord4j.core.object.entity.channel.TextChannel
All Implemented Interfaces:
DiscordObject, CategorizableChannel, Channel, GuildChannel, GuildMessageChannel, MessageChannel, TopLevelGuildChannel, TopLevelGuildMessageChannel, Entity

public final class TextChannel extends Object implements TopLevelGuildMessageChannel
A Discord text channel.
  • Constructor Details

    • TextChannel

      public TextChannel(GatewayDiscordClient gateway, discord4j.discordjson.json.ChannelData data)
      Constructs an TextChannel 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

    • isNsfw

      public boolean isNsfw()
      Gets whether this channel is considered NSFW (Not Safe For Work).
      Returns:
      true if this channel is considered NSFW (Not Safe For Work), false otherwise.
    • edit

      Deprecated.
      use edit(TextChannelEditSpec) or edit() which offer an immutable approach to build specs
      Requests to edit this text channel.
      Parameters:
      spec - A Consumer that provides a "blank" LegacyTextChannelEditSpec to be operated on.
      Returns:
      A Mono where, upon successful completion, emits the edited TextChannel. If an error is received, it is emitted through the Mono.
    • edit

      public discord4j.core.spec.TextChannelEditMono edit()
      Requests to edit this text channel. Properties specifying how to edit this channel can be set via the withXxx methods of the returned TextChannelEditMono.
      Returns:
      A TextChannelEditMono where, upon successful completion, emits the edited TextChannel. If an error is received, it is emitted through the TextChannelEditMono.
    • edit

      public Mono<TextChannel> edit(discord4j.core.spec.TextChannelEditSpec spec)
      Requests to edit this text channel.
      Parameters:
      spec - an immutable object that specifies how to edit this text channel
      Returns:
      A Mono where, upon successful completion, emits the edited TextChannel. If an error is received, it is emitted through the Mono.
    • toString

      public String toString()
    • getEffectivePermissions

      public Mono<PermissionSet> getEffectivePermissions(Snowflake memberId)
      Description copied from interface: GuildChannel
      Gets the permissions for the given member, taking into account permission overwrites in this channel.
      Specified by:
      getEffectivePermissions in interface GuildChannel
      Parameters:
      memberId - The ID of the member to get permissions for.
      Returns:
      The permissions for the given member.
    • getEffectivePermissions

      public Mono<PermissionSet> getEffectivePermissions(Member member)
      Description copied from interface: GuildChannel
      Gets the permissions for the given member, taking into account permission overwrites in this channel.
      Specified by:
      getEffectivePermissions in interface GuildChannel
      Parameters:
      member - The member to get permissions for.
      Returns:
      The permissions for the given member.
    • getClient

      public final 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.
    • getRestChannel

      public final RestChannel getRestChannel()
      Description copied from interface: Channel
      Return a RestChannel handle to execute REST API operations on this entity.
      Specified by:
      getRestChannel in interface Channel
    • getData

      public final discord4j.discordjson.json.ChannelData getData()
      Description copied from interface: Channel
      Gets the raw data as represented by Discord.
      Specified by:
      getData in interface Channel
      Returns:
      The raw data as represented by Discord.
    • equals

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

      public final int hashCode()
      Overrides:
      hashCode in class Object