Channel, java.lang.Comparable<TextChannel>, java.util.Formattable, IMentionable, ISnowflake, MessageChannelpublic interface TextChannel extends Channel, MessageChannel, java.lang.Comparable<TextChannel>, IMentionable
Channel and
MessageChannel for more information.
Internal implementation of this class is available at
TextChannelImpl.
Note: Internal implementation should not be used directly.
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
canTalk() |
Whether we can send messages in this channel.
|
boolean |
canTalk(Member member) |
Whether the specified
Member
can send messages in this channel. |
default RestAction<java.lang.Void> |
clearReactionsById(long messageId) |
Attempts to remove all reactions from a message with the specified
messageId in this TextChannel
This is useful for moderator commands that wish to remove all reactions at once from a specific message. |
RestAction<java.lang.Void> |
clearReactionsById(java.lang.String messageId) |
Attempts to remove all reactions from a message with the specified
messageId in this TextChannel
This is useful for moderator commands that wish to remove all reactions at once from a specific message. |
WebhookAction |
createWebhook(java.lang.String name) |
Creates a new
Webhook. |
RestAction<java.lang.Void> |
deleteMessages(java.util.Collection<Message> messages) |
Bulk deletes a list of messages.
|
RestAction<java.lang.Void> |
deleteMessagesByIds(java.util.Collection<java.lang.String> messageIds) |
Bulk deletes a list of messages.
|
AuditableRestAction<java.lang.Void> |
deleteWebhookById(java.lang.String id) |
Deletes a
Webhook attached to this channel
by the id specified. |
default void |
formatTo(java.util.Formatter formatter,
int flags,
int width,
int precision) |
|
int |
getSlowmode() |
The slowmode set for this TextChannel.
|
java.lang.String |
getTopic() |
The topic set for this TextChannel.
|
RestAction<java.util.List<Webhook>> |
getWebhooks() |
Retrieves the
Webhooks attached to this TextChannel. |
boolean |
isNSFW() |
Whether or not this channel is considered as "NSFW" (Not-Safe-For-Work)
This will check whether the name of this TextChannel begins with nsfw- or is equal to nsfw! |
default RestAction<java.lang.Void> |
removeReactionById(long messageId,
java.lang.String unicode,
User user) |
Attempts to remove the reaction from a message represented by the specified
messageId
in this MessageChannel. |
default RestAction<java.lang.Void> |
removeReactionById(long messageId,
Emote emote,
User user) |
Attempts to remove the reaction from a message represented by the specified
messageId
in this MessageChannel. |
RestAction<java.lang.Void> |
removeReactionById(java.lang.String messageId,
java.lang.String unicode,
User user) |
Attempts to remove the reaction from a message represented by the specified
messageId
in this MessageChannel. |
default RestAction<java.lang.Void> |
removeReactionById(java.lang.String messageId,
Emote emote,
User user) |
Attempts to remove the reaction from a message represented by the specified
messageId
in this MessageChannel. |
createCopy, createCopy, createInvite, createPermissionOverride, createPermissionOverride, delete, getGuild, getInvites, getJDA, getManager, getMemberPermissionOverrides, getMembers, getName, getParent, getPermissionOverride, getPermissionOverride, getPermissionOverrides, getPosition, getPositionRaw, getRolePermissionOverrides, getType, putPermissionOverride, putPermissionOverridegetAsMentiongetCreationTime, getId, getIdLongaddReactionById, addReactionById, addReactionById, addReactionById, deleteMessageById, deleteMessageById, editMessageById, editMessageById, editMessageById, editMessageById, editMessageById, editMessageById, editMessageFormatById, editMessageFormatById, getHistory, getHistoryAfter, getHistoryAfter, getHistoryAfter, getHistoryAround, getHistoryAround, getHistoryAround, getHistoryBefore, getHistoryBefore, getHistoryBefore, getIterableHistory, getJDA, getLatestMessageId, getLatestMessageIdLong, getMessageById, getMessageById, getName, getPinnedMessages, getType, hasLatestMessage, pinMessageById, pinMessageById, purgeMessages, purgeMessages, purgeMessagesById, purgeMessagesById, purgeMessagesById, removeReactionById, removeReactionById, removeReactionById, removeReactionById, sendFile, sendFile, sendFile, sendFile, sendFile, sendFile, sendFile, sendFile, sendMessage, sendMessage, sendMessage, sendMessageFormat, sendTyping, unpinMessageById, unpinMessageByIdjava.lang.String getTopic()
boolean isNSFW()
nsfw- or is equal to nsfw!int getSlowmode()
int between 1 and 120. If not set this returns 0.
Note that only CLIENT type accounts are
affected by slowmode, and that BOT accounts
are immune to the restrictions.
Having MESSAGE_MANAGE or
MANAGE_CHANNEL permission also
grants immunity to slowmode.
0 if no slowmode is set.@CheckReturnValue RestAction<java.util.List<Webhook>> getWebhooks()
Webhooks attached to this TextChannel.
Possible ErrorResponses include:
UNKNOWN_CHANNEL
MISSING_ACCESS
RestAction - Type: List<Webhook>
@CheckReturnValue WebhookAction createWebhook(java.lang.String name)
Webhook.
Possible ErrorResponses caused by
the returned RestAction include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
name - The default name for the new Webhook.WebhookAction
PermissionException - If you do not hold the permission Manage Webhooksjava.lang.IllegalArgumentException - If the provided name is null, blank or not
between 2-100 characters in length@CheckReturnValue RestAction<java.lang.Void> deleteMessages(java.util.Collection<Message> messages)
Message.delete() in a loop.
Must be at least 2 messages and not be more than 100 messages at a time.
If you only have 1 message, use the Message.delete() method instead.
You must have the Permission MESSAGE_MANAGE in this channel to use
this function.
This method is best used when using MessageHistory to delete a large amount
of messages. If you have a large amount of messages but only their message Ids, please use deleteMessagesByIds(Collection)
Possible ErrorResponses include:
UNKNOWN_CHANNEL
UNKNOWN_MESSAGE
MISSING_ACCESS
MISSING_PERMISSIONS
Permission.MESSAGE_MANAGE in the channel.messages - The collection of messages to delete.AuditableRestActionjava.lang.IllegalArgumentException - If the size of the list less than 2 or more than 100 messages.InsufficientPermissionException - If this account does not have Permission.MESSAGE_MANAGEdeleteMessagesByIds(Collection),
MessageChannel.purgeMessages(List)@CheckReturnValue RestAction<java.lang.Void> deleteMessagesByIds(java.util.Collection<java.lang.String> messageIds)
MessageChannel.deleteMessageById(String) in a loop.
Must be at least 2 messages and not be more than 100 messages at a time.
If you only have 1 message, use the Message.delete() method instead.
You must have Permission.MESSAGE_MANAGE in this channel to use
this function.
This method is best used when you have a large amount of messages but only their message Ids. If you are using
MessageHistory or have Message
objects, it would be easier to use deleteMessages(java.util.Collection).
Possible ErrorResponses include:
UNKNOWN_CHANNEL
UNKNOWN_MESSAGE
MISSING_ACCESS
MISSING_PERMISSIONS
Permission.MESSAGE_MANAGE in the channel.messageIds - The message ids for the messages to delete.AuditableRestActionjava.lang.IllegalArgumentException - If the size of the list less than 2 or more than 100 messages.java.lang.NumberFormatException - If any of the provided ids cannot be parsed by Long.parseLong(String)InsufficientPermissionException - If this account does not have Permission.MESSAGE_MANAGEdeleteMessages(Collection),
MessageChannel.purgeMessagesById(List)@CheckReturnValue AuditableRestAction<java.lang.Void> deleteWebhookById(java.lang.String id)
Webhook attached to this channel
by the id specified.
Possible ErrorResponses include:
ErrorResponse.UNKNOWN_WEBHOOK
UNKNOWN_CHANNEL
MISSING_ACCESS
MISSING_PERMISSIONS
Permission.MANAGE_WEBHOOKS in the channel.id - The not-null id for the target Webhook.AuditableRestActionjava.lang.IllegalArgumentException - If the provided id is null or empty.InsufficientPermissionException - If the currently logged in account does not have
Permission.MANAGE_WEBHOOKS in this channel.@CheckReturnValue RestAction<java.lang.Void> clearReactionsById(java.lang.String messageId)
messageId in this TextChannel
The following ErrorResponses are possible:
MISSING_ACCESS
TextChannel
due to Permission.MESSAGE_READ being revoked, or the
account lost access to the Guild or Group
typically due to being kicked or removed.MISSING_PERMISSIONS
Permission.MESSAGE_MANAGE
in the TextChannel when adding the reaction.UNKNOWN_MESSAGE
The clear-reactions request was attempted after the Message had been deleted.messageId - The not-empty valid message idAuditableRestActionInsufficientPermissionException - If the currently logged in account does not have
Permission.MESSAGE_MANAGE in this channel.java.lang.IllegalArgumentException - If the provided id is null or empty.@CheckReturnValue default RestAction<java.lang.Void> clearReactionsById(long messageId)
messageId in this TextChannel
The following ErrorResponses are possible:
MISSING_ACCESS
TextChannel
due to Permission.MESSAGE_READ being revoked, or the
account lost access to the Guild or Group
typically due to being kicked or removed.MISSING_PERMISSIONS
Permission.MESSAGE_MANAGE
in the TextChannel when adding the reaction.UNKNOWN_MESSAGE
The clear-reactions request was attempted after the Message had been deleted.messageId - The message idAuditableRestActionInsufficientPermissionException - If the currently logged in account does not have
Permission.MESSAGE_MANAGE in this channel.@CheckReturnValue RestAction<java.lang.Void> removeReactionById(java.lang.String messageId, java.lang.String unicode, User user)
messageId
in this MessageChannel.
The unicode provided has to be a unicode representation of the emoji
that is supposed to be represented by the Reaction.
To retrieve the characters needed you can use an api or
the official discord client by escaping the emoji (\:emoji-name:)
and copying the resulting emoji from the sent message.
This method encodes the provided unicode for you. Do not encode the emoji before providing the unicode.
The following ErrorResponses are possible:
MISSING_ACCESS
Guild or Group
typically due to being kicked or removed, or after Permission.MESSAGE_READ
was revoked in the TextChannel
Permission.MESSAGE_HISTORYMISSING_PERMISSIONS
Permission.MESSAGE_ADD_REACTION in the
TextChannel.ErrorResponse.UNKNOWN_EMOJI
UNKNOWN_MESSAGE
messageId is unknown in this MessageChannel, either due to the id being invalid, or
the message it referred to has already been deleted.UNKNOWN_CHANNEL
messageId - The messageId to remove the reaction fromunicode - The unicode characters of the emojiuser - The target user of which to remove fromRestActionjava.lang.IllegalArgumentException - messageId is null or empty.unicode is null or empty.InsufficientPermissionException - If the currently logged in account does not have
Permission.MESSAGE_MANAGE in this channel.@CheckReturnValue default RestAction<java.lang.Void> removeReactionById(long messageId, java.lang.String unicode, User user)
messageId
in this MessageChannel.
The unicode provided has to be a unicode representation of the emoji
that is supposed to be represented by the Reaction.
To retrieve the characters needed you can use an api or
the official discord client by escaping the emoji (\:emoji-name:)
and copying the resulting emoji from the sent message.
This method encodes the provided unicode for you. Do not encode the emoji before providing the unicode.
The following ErrorResponses are possible:
MISSING_ACCESS
Guild or Group
typically due to being kicked or removed, or after Permission.MESSAGE_READ
was revoked in the TextChannel
Permission.MESSAGE_HISTORYMISSING_PERMISSIONS
Permission.MESSAGE_ADD_REACTION in the
TextChannel.ErrorResponse.UNKNOWN_EMOJI
UNKNOWN_MESSAGE
messageId is unknown in this MessageChannel, either due to the id being invalid, or
the message it referred to has already been deleted.UNKNOWN_CHANNEL
messageId - The messageId to remove the reaction fromunicode - The unicode characters of the emojiuser - The target user of which to remove fromRestActionjava.lang.IllegalArgumentException - messageId is null or empty.unicode is null or empty.InsufficientPermissionException - If the currently logged in account does not have
Permission.MESSAGE_MANAGE in this channel.@CheckReturnValue default RestAction<java.lang.Void> removeReactionById(java.lang.String messageId, Emote emote, User user)
messageId
in this MessageChannel.
An Emote is not the same as an emoji!
Emotes are custom guild-specific images unlike global unicode emojis!
The following ErrorResponses are possible:
MISSING_ACCESS
Guild or Group
typically due to being kicked or removed, or after Permission.MESSAGE_READ
was revoked in the TextChannel
Permission.MESSAGE_HISTORYMISSING_PERMISSIONS
Permission.MESSAGE_ADD_REACTION in the
TextChannel.ErrorResponse.UNKNOWN_EMOJI
UNKNOWN_MESSAGE
messageId is unknown in this MessageChannel, either due to the id being invalid, or
the message it referred to has already been deleted.UNKNOWN_CHANNEL
messageId - The messageId to remove the reaction fromemote - The emote to removeuser - The target user of which to remove fromRestActionjava.lang.IllegalArgumentException - messageId is null or empty.emote is null.InsufficientPermissionException - If the currently logged in account does not have
Permission.MESSAGE_MANAGE in this channel.@CheckReturnValue default RestAction<java.lang.Void> removeReactionById(long messageId, Emote emote, User user)
messageId
in this MessageChannel.
An Emote is not the same as an emoji!
Emotes are custom guild-specific images unlike global unicode emojis!
The following ErrorResponses are possible:
MISSING_ACCESS
Guild or Group
typically due to being kicked or removed, or after Permission.MESSAGE_READ
was revoked in the TextChannel
Permission.MESSAGE_HISTORYMISSING_PERMISSIONS
Permission.MESSAGE_ADD_REACTION in the
TextChannel.ErrorResponse.UNKNOWN_EMOJI
UNKNOWN_MESSAGE
messageId is unknown in this MessageChannel, either due to the id being invalid, or
the message it referred to has already been deleted.UNKNOWN_CHANNEL
messageId - The messageId to remove the reaction fromemote - The emote to removeuser - The target user of which to remove fromRestActionjava.lang.IllegalArgumentException - messageId is null or empty.emote is null.InsufficientPermissionException - If the currently logged in account does not have
Permission.MESSAGE_MANAGE in this channel.boolean canTalk()
canTalk(Member) with the SelfMember.
Permission.MESSAGE_READ and
Permission.MESSAGE_WRITE.boolean canTalk(Member member)
Member
can send messages in this channel.
Permission.MESSAGE_READ and
Permission.MESSAGE_WRITE.member - The Member to checkdefault void formatTo(java.util.Formatter formatter,
int flags,
int width,
int precision)
formatTo in interface java.util.FormattableformatTo in interface IMentionableformatTo in interface MessageChannel