Class NewsChannel

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

public final class NewsChannel extends Object implements TopLevelGuildMessageChannel
A Discord news channel.
  • Constructor Details

    • NewsChannel

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

    • edit

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

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

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

      public Mono<FollowedChannel> follow(Snowflake targetChannelId)
      Requests to follow this news channel. Following will create a webhook in the channel which ID is specified. Requires 'MANAGE_WEBHOOKS' permission.
      Parameters:
      targetChannelId - the ID of the channel where to create the follow webhook
      Returns:
      a FollowedChannel object containing a reference to this news channel and allowing to retrieve the webhook created.
    • 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