Package net.dv8tion.jda.api.entities
Interface NewsChannel
- All Superinterfaces:
Channel,Comparable<GuildChannel>,Formattable,GuildChannel,GuildMessageChannel,IAgeRestrictedChannel,ICategorizableChannel,ICopyableChannel,IInviteContainer,IMemberContainer,IMentionable,IPermissionContainer,IPositionableChannel,ISnowflake,IThreadContainer,IWebhookContainer,MessageChannel,StandardGuildChannel,StandardGuildMessageChannel
Represents
StandardGuildMessageChannel that are News Channels.
The Discord client may refer to these as Announcement Channels.
Members can subscribe channels in their own guilds to receive messages crossposted from this channel.
This is referred to as following this channel.
Messages sent in this channel can be crossposted, at which point they will be sent (via webhook) to all subscribed channels.-
Field Summary
Fields inherited from interface net.dv8tion.jda.api.entities.GuildChannel
JUMP_URL -
Method Summary
Modifier and TypeMethodDescriptiondefault ChannelAction<NewsChannel>Creates a copy of the specifiedGuildChannel.createCopy(Guild guild) Creates a copy of the specifiedGuildChannelin the specifiedGuild.default RestAction<Message>crosspostMessageById(long messageId) Attempts to crosspost the provided message.default RestAction<Message>crosspostMessageById(String messageId) Attempts to crosspost the provided message.default RestAction<Webhook.WebhookReference>follow(long targetChannelId) Subscribes to the crossposted messages in this channel.Subscribes to the crossposted messages in this channel.default RestAction<Webhook.WebhookReference>follow(TextChannel targetChannel) Subscribes to the crossposted messages in this channel.Returns theChannelManagerfor this GuildChannel.Methods inherited from interface net.dv8tion.jda.api.entities.Channel
formatTo, getAsMention, getJDA, getName, getTypeMethods inherited from interface java.lang.Comparable
compareToMethods inherited from interface net.dv8tion.jda.api.entities.GuildChannel
delete, getGuild, getJumpUrl, getPermissionContainerMethods inherited from interface net.dv8tion.jda.api.entities.GuildMessageChannel
canTalk, canTalk, clearReactionsById, clearReactionsById, clearReactionsById, clearReactionsById, deleteMessages, deleteMessagesByIds, removeReactionById, removeReactionById, sendStickers, sendStickersMethods inherited from interface net.dv8tion.jda.api.entities.channel.attribute.IAgeRestrictedChannel
isNSFWMethods inherited from interface net.dv8tion.jda.api.entities.ICategorizableChannel
getParentCategory, getParentCategoryId, getParentCategoryIdLong, isSyncedMethods inherited from interface net.dv8tion.jda.api.entities.IInviteContainer
createInvite, retrieveInvitesMethods inherited from interface net.dv8tion.jda.api.entities.IMemberContainer
getMembersMethods inherited from interface net.dv8tion.jda.api.entities.IPermissionContainer
getMemberPermissionOverrides, getPermissionOverride, getPermissionOverrides, getRolePermissionOverrides, upsertPermissionOverrideMethods inherited from interface net.dv8tion.jda.api.entities.IPositionableChannel
getPosition, getPositionRawMethods inherited from interface net.dv8tion.jda.api.entities.ISnowflake
getId, getIdLong, getTimeCreatedMethods inherited from interface net.dv8tion.jda.api.entities.IThreadContainer
createThreadChannel, createThreadChannel, createThreadChannel, createThreadChannel, getThreadChannels, retrieveArchivedPrivateJoinedThreadChannels, retrieveArchivedPrivateThreadChannels, retrieveArchivedPublicThreadChannelsMethods inherited from interface net.dv8tion.jda.api.entities.IWebhookContainer
createWebhook, deleteWebhookById, retrieveWebhooksMethods inherited from interface net.dv8tion.jda.api.entities.MessageChannel
addReactionById, addReactionById, deleteMessageById, deleteMessageById, editMessageAttachmentsById, editMessageAttachmentsById, editMessageAttachmentsById, editMessageAttachmentsById, editMessageById, editMessageById, editMessageById, editMessageById, editMessageComponentsById, editMessageComponentsById, editMessageComponentsById, editMessageComponentsById, editMessageEmbedsById, editMessageEmbedsById, editMessageEmbedsById, editMessageEmbedsById, editMessageFormatById, editMessageFormatById, getHistory, getHistoryAfter, getHistoryAfter, getHistoryAfter, getHistoryAround, getHistoryAround, getHistoryAround, getHistoryBefore, getHistoryBefore, getHistoryBefore, getHistoryFromBeginning, getIterableHistory, getLatestMessageId, getLatestMessageIdLong, pinMessageById, pinMessageById, purgeMessages, purgeMessages, purgeMessagesById, purgeMessagesById, purgeMessagesById, removeReactionById, removeReactionById, retrieveMessageById, retrieveMessageById, retrievePinnedMessages, retrieveReactionUsersById, retrieveReactionUsersById, sendFiles, sendFiles, sendMessage, sendMessage, sendMessageComponents, sendMessageComponents, sendMessageEmbeds, sendMessageEmbeds, sendMessageFormat, sendTyping, unpinMessageById, unpinMessageByIdMethods inherited from interface net.dv8tion.jda.api.entities.StandardGuildMessageChannel
getTopic
-
Method Details
-
follow
@Nonnull @CheckReturnValue RestAction<Webhook.WebhookReference> follow(@Nonnull String targetChannelId) Subscribes to the crossposted messages in this channel.
This will create aWebhookof typeFOLLOWERin the target channel.Possible
ErrorResponsesinclude:UNKNOWN_CHANNEL
If the target channel doesn't exist or is not visible to the currently logged in accountMISSING_PERMISSIONS
If the currently logged in account does not havePermission.MANAGE_WEBHOOKSin the target channelMAX_WEBHOOKS
If the target channel already has reached the maximum capacity for webhooks
- Parameters:
targetChannelId- The target channel id- Returns:
RestAction- Throws:
IllegalArgumentException- If null is provided- Since:
- 4.2.1
-
follow
@Nonnull @CheckReturnValue default RestAction<Webhook.WebhookReference> follow(long targetChannelId) Subscribes to the crossposted messages in this channel.
This will create aWebhookof typeFOLLOWERin the target channel.Possible
ErrorResponsesinclude:UNKNOWN_CHANNEL
If the target channel doesn't exist or not visible to the currently logged in accountMISSING_PERMISSIONS
If the currently logged in account does not havePermission.MANAGE_WEBHOOKSin the target channelMAX_WEBHOOKS
If the target channel already has reached the maximum capacity for webhooks
- Parameters:
targetChannelId- The target channel id- Returns:
RestAction- Since:
- 4.2.1
-
follow
@Nonnull @CheckReturnValue default RestAction<Webhook.WebhookReference> follow(@Nonnull TextChannel targetChannel) Subscribes to the crossposted messages in this channel.
This will create aWebhookof typeFOLLOWERin the target channel.Possible
ErrorResponsesinclude:UNKNOWN_CHANNEL
If the target channel doesn't exist or not visible to the currently logged in accountMISSING_PERMISSIONS
If the currently logged in account does not havePermission.MANAGE_WEBHOOKSin the target channelMAX_WEBHOOKS
If the target channel already has reached the maximum capacity for webhooks
- Parameters:
targetChannel- The target channel- Returns:
RestAction- Throws:
MissingAccessException- If the currently logged in account does not haveaccessin the target channel.InsufficientPermissionException- If the currently logged in account does not havePermission.MANAGE_WEBHOOKSin the target channel.IllegalArgumentException- If null is provided- Since:
- 4.2.1
-
crosspostMessageById
@Nonnull @CheckReturnValue default RestAction<Message> crosspostMessageById(@Nonnull String messageId) Attempts to crosspost the provided message.The following
ErrorResponsesare possible:ALREADY_CROSSPOSTED
The target message has already been crossposted.MISSING_ACCESS
The request was attempted after the account lost access to theGuildtypically due to being kicked or removed, or afterPermission.VIEW_CHANNELwas revoked in theTextChannelMISSING_PERMISSIONS
The request was attempted after the account lostPermission.MESSAGE_MANAGEin the TextChannel.UNKNOWN_MESSAGE
The providedmessageIdis unknown in this MessageChannel, either due to the id being invalid, or the message it referred to has already been deleted.UNKNOWN_CHANNEL
The request was attempted after the channel was deleted.
- Parameters:
messageId- The messageId to crosspost- Returns:
RestAction- Type:Message- Throws:
IllegalArgumentException- If providedmessageIdisnullor empty.MissingAccessException- If the currently logged in account does not haveaccessin this channel.InsufficientPermissionException- If the currently logged in account does not havePermission.VIEW_CHANNELin this channel.- Since:
- 4.2.1
-
crosspostMessageById
Attempts to crosspost the provided message.The following
ErrorResponsesare possible:ALREADY_CROSSPOSTED
The target message has already been crossposted.MISSING_ACCESS
The request was attempted after the account lost access to theGuildtypically due to being kicked or removed, or afterPermission.VIEW_CHANNELwas revoked in theTextChannelMISSING_PERMISSIONS
The request was attempted after the account lostPermission.MESSAGE_MANAGEin the TextChannel.UNKNOWN_MESSAGE
The providedmessageIdis unknown in this MessageChannel, either due to the id being invalid, or the message it referred to has already been deleted.UNKNOWN_CHANNEL
The request was attempted after the channel was deleted.
- Parameters:
messageId- The messageId to crosspost- Returns:
RestAction- Type:Message- Throws:
InsufficientPermissionException- If the currently logged in account does not havePermission.VIEW_CHANNELin this channel.- Since:
- 4.2.1
-
createCopy
Description copied from interface:ICopyableChannelCreates a copy of the specifiedGuildChannelin the specifiedGuild.
If the provided target guild is not the same Guild this channel is in then the parent category and permissions will not be copied due to technical difficulty and ambiguity.This copies the following elements:
- Name
- Parent Category (if present)
- Voice Elements (Bitrate, Userlimit)
- Text Elements (Topic, NSFW, Slowmode)
- All permission overrides for Members/Roles
Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The channel could not be created due to a permission discrepancyMISSING_ACCESS
TheVIEW_CHANNELpermission was removed
- Specified by:
createCopyin interfaceICopyableChannel- Specified by:
createCopyin interfaceStandardGuildChannel- Specified by:
createCopyin interfaceStandardGuildMessageChannel- Parameters:
guild- TheGuildto create the channel in- Returns:
- A specific
ChannelAction
This action allows to set fields for the new GuildChannel before creating it!
-
createCopy
Description copied from interface:ICopyableChannelCreates a copy of the specifiedGuildChannel.This copies the following elements:
- Name
- Parent Category (if present)
- Voice Elements (Bitrate, Userlimit)
- Text Elements (Topic, NSFW, Slowmode)
- All permission overrides for Members/Roles
Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The channel could not be created due to a permission discrepancyMISSING_ACCESS
TheVIEW_CHANNELpermission was removed
- Specified by:
createCopyin interfaceICopyableChannel- Specified by:
createCopyin interfaceStandardGuildChannel- Specified by:
createCopyin interfaceStandardGuildMessageChannel- Returns:
- A specific
ChannelAction
This action allows to set fields for the new GuildChannel before creating it!
-
getManager
Description copied from interface:GuildChannelReturns theChannelManagerfor this GuildChannel.
In the ChannelManager, you can modify the name, topic and position of this GuildChannel. You modify multiple fields in one request by chaining setters before callingRestAction.queue().This is a lazy idempotent getter. The manager is retained after the first call. This getter is not thread-safe and would require guards by the user.
- Specified by:
getManagerin interfaceGuildChannel- Specified by:
getManagerin interfaceICategorizableChannel- Specified by:
getManagerin interfaceIPermissionContainer- Specified by:
getManagerin interfaceIPositionableChannel- Specified by:
getManagerin interfaceStandardGuildChannel- Specified by:
getManagerin interfaceStandardGuildMessageChannel- Returns:
- The ChannelManager of this GuildChannel
-