Interface GuildMessageChannel
- All Superinterfaces:
Channel
,Comparable<GuildChannel>
,Formattable
,GuildChannel
,IMentionable
,ISnowflake
,MessageChannel
- All Known Subinterfaces:
GuildMessageChannelUnion
,NewsChannel
,StageChannel
,StandardGuildMessageChannel
,TextChannel
,ThreadChannel
,VoiceChannel
This includes channels that are not included in StandardGuildMessageChannel
, such as ThreadChannel
.
- See Also:
-
Field Summary
Fields inherited from interface net.dv8tion.jda.api.entities.channel.Channel
MAX_NAME_LENGTH
Fields inherited from interface net.dv8tion.jda.api.entities.channel.middleman.GuildChannel
JUMP_URL
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
canTalk()
Whether the currently logged in user can send messages in this channel or not.boolean
Whether the specifiedMember
can send messages in this channel.default RestAction<Void>
clearReactionsById
(long messageId) Attempts to remove all reactions from a message with the specifiedmessageId
in this TextChannel
This is useful for moderator commands that wish to remove all reactions at once from a specific message.default RestAction<Void>
clearReactionsById
(long messageId, Emoji emoji) Removes all reactions for the specified emoji.clearReactionsById
(String messageId) Attempts to remove all reactions from a message with the specifiedmessageId
in this TextChannel
This is useful for moderator commands that wish to remove all reactions at once from a specific message.clearReactionsById
(String messageId, Emoji emoji) Removes all reactions for the specified emoji.default RestAction<Void>
deleteMessages
(Collection<Message> messages) Bulk deletes a list of messages.deleteMessagesByIds
(Collection<String> messageIds) Bulk deletes a list of messages.default RestAction<Void>
removeReactionById
(long messageId, Emoji emoji, User user) Attempts to remove the reaction from a message represented by the specifiedmessageId
in this MessageChannel.removeReactionById
(String messageId, Emoji emoji, User user) Attempts to remove the reaction from a message represented by the specifiedmessageId
in this MessageChannel.sendStickers
(Collection<? extends StickerSnowflake> stickers) Send up to 3 stickers in this channel.default MessageCreateAction
sendStickers
(StickerSnowflake... stickers) Send up to 3 stickers in this channel.Methods inherited from interface net.dv8tion.jda.api.entities.channel.Channel
formatTo, getAsMention, getFlags, getJDA, getName, getType
Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface net.dv8tion.jda.api.entities.channel.middleman.GuildChannel
delete, getGuild, getJumpUrl, getManager, getPermissionContainer
Methods inherited from interface net.dv8tion.jda.api.entities.ISnowflake
getId, getIdLong, getTimeCreated
Methods inherited from interface net.dv8tion.jda.api.entities.channel.middleman.MessageChannel
addReactionById, addReactionById, deleteMessageById, deleteMessageById, editMessageAttachmentsById, editMessageAttachmentsById, editMessageAttachmentsById, editMessageAttachmentsById, editMessageById, editMessageById, editMessageById, editMessageById, editMessageComponentsById, editMessageComponentsById, editMessageComponentsById, editMessageComponentsById, editMessageEmbedsById, editMessageEmbedsById, editMessageEmbedsById, editMessageEmbedsById, editMessageFormatById, editMessageFormatById, endPollById, endPollById, 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, retrievePollVotersById, retrievePollVotersById, retrieveReactionUsersById, retrieveReactionUsersById, sendFiles, sendFiles, sendMessage, sendMessage, sendMessageComponents, sendMessageComponents, sendMessageEmbeds, sendMessageEmbeds, sendMessageFormat, sendMessagePoll, sendTyping, unpinMessageById, unpinMessageById
-
Method Details
-
canTalk
default boolean canTalk()Description copied from interface:MessageChannel
Whether the currently logged in user can send messages in this channel or not.
ForGuildMessageChannel
this method checks for bothPermission.VIEW_CHANNEL
andPermission.MESSAGE_SEND
.
ForThreadChannel
this method checks forPermission.MESSAGE_SEND_IN_THREADS
instead ofPermission.MESSAGE_SEND
.
ForPrivateChannel
this method checks if the user that this PrivateChannel communicates with is not a bot, but it does not check if the said user blocked the currently logged in user or have their DMs disabled.- Specified by:
canTalk
in interfaceMessageChannel
- Returns:
- True, if we are able to read and send messages in this channel
-
canTalk
Whether the specifiedMember
can send messages in this channel.
Checks for bothPermission.VIEW_CHANNEL
andPermission.MESSAGE_SEND
.- Parameters:
member
- The Member to check- Returns:
- True, if the specified member is able to read and send messages in this channel
-
removeReactionById
@Nonnull @CheckReturnValue RestAction<Void> removeReactionById(@Nonnull String messageId, @Nonnull Emoji emoji, @Nonnull User user) Attempts to remove the reaction from a message represented by the specifiedmessageId
in this MessageChannel.The following
ErrorResponses
are possible:MISSING_ACCESS
The request was attempted after the account lost access to theGuild
typically due to being kicked or removed, or afterPermission.VIEW_CHANNEL
was revoked in theTextChannel
Also can happen if the account lost thePermission.MESSAGE_HISTORY
MISSING_PERMISSIONS
The request was attempted after the account lostPermission.MESSAGE_ADD_REACTION
in theTextChannel
.ErrorResponse.UNKNOWN_EMOJI
The provided unicode character does not refer to a known emoji unicode character.
Proper unicode characters for emojis can be found here: Emoji TableUNKNOWN_MESSAGE
The providedmessageId
is 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 remove the reaction fromemoji
- The emoji to removeuser
- The target user of which to remove from- Returns:
RestAction
- Throws:
IllegalArgumentException
-- If provided
messageId
isnull
or empty. - If provided
emoji
isnull
.
- If provided
InsufficientPermissionException
- If the currently logged in account does not havePermission.MESSAGE_MANAGE
in this channel.
-
removeReactionById
@Nonnull @CheckReturnValue default RestAction<Void> removeReactionById(long messageId, @Nonnull Emoji emoji, @Nonnull User user) Attempts to remove the reaction from a message represented by the specifiedmessageId
in this MessageChannel.The following
ErrorResponses
are possible:MISSING_ACCESS
The request was attempted after the account lost access to theGuild
typically due to being kicked or removed, or afterPermission.VIEW_CHANNEL
was revoked in theTextChannel
Also can happen if the account lost thePermission.MESSAGE_HISTORY
MISSING_PERMISSIONS
The request was attempted after the account lostPermission.MESSAGE_ADD_REACTION
in theTextChannel
.ErrorResponse.UNKNOWN_EMOJI
The provided unicode character does not refer to a known emoji unicode character.
Proper unicode characters for emojis can be found here: Emoji TableUNKNOWN_MESSAGE
The providedmessageId
is 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 remove the reaction fromemoji
- The emoji to removeuser
- The target user of which to remove from- Returns:
RestAction
- Throws:
IllegalArgumentException
-- If provided
messageId
isnull
or empty. - If provided
emoji
isnull
.
- If provided
InsufficientPermissionException
- If the currently logged in account does not havePermission.MESSAGE_MANAGE
in this channel.
-
deleteMessages
@Nonnull @CheckReturnValue default RestAction<Void> deleteMessages(@Nonnull Collection<Message> messages) Bulk deletes a list of messages. This is not the same as callingMessage.delete()
in a loop.
This is much more efficient, but it has a different ratelimit. You may call this once per second per Guild.Must be at least 2 messages and not be more than 100 messages at a time.
If you only have 1 message, use theMessage.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 usedeleteMessagesByIds(Collection)
Possible ErrorResponses include:
UNKNOWN_CHANNEL
if this channel was deletedUNKNOWN_MESSAGE
if any of the provided messages does not existMISSING_ACCESS
if we were removed from the guildMISSING_PERMISSIONS
The send request was attempted after the account lostPermission.MESSAGE_MANAGE
in the channel.
- Parameters:
messages
- The collection of messages to delete.- Returns:
AuditableRestAction
- Throws:
IllegalArgumentException
- If the size of the list less than 2 or more than 100 messages.InsufficientPermissionException
- If this account does not havePermission.MESSAGE_MANAGE
- See Also:
-
deleteMessagesByIds
@Nonnull @CheckReturnValue RestAction<Void> deleteMessagesByIds(@Nonnull Collection<String> messageIds) Bulk deletes a list of messages. This is not the same as callingMessageChannel.deleteMessageById(String)
in a loop.
This is much more efficient, but it has a different ratelimit. You may call this once per second per Guild.Must be at least 2 messages and not be more than 100 messages at a time.
If you only have 1 message, use theMessage.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 haveMessage
objects, it would be easier to usedeleteMessages(java.util.Collection)
.Possible ErrorResponses include:
UNKNOWN_CHANNEL
if this channel was deletedUNKNOWN_MESSAGE
if any of the provided messages does not existMISSING_ACCESS
if we were removed from the guildMISSING_PERMISSIONS
The send request was attempted after the account lostPermission.MESSAGE_MANAGE
in the channel.
- Parameters:
messageIds
- The message ids for the messages to delete.- Returns:
AuditableRestAction
- Throws:
IllegalArgumentException
- If the size of the list less than 2 or more than 100 messages.NumberFormatException
- If any of the provided ids cannot be parsed byLong.parseLong(String)
InsufficientPermissionException
- If this account does not havePermission.MESSAGE_MANAGE
- See Also:
-
clearReactionsById
Attempts to remove all reactions from a message with the specifiedmessageId
in this TextChannel
This is useful for moderator commands that wish to remove all reactions at once from a specific message.The following
ErrorResponses
are possible:MISSING_ACCESS
The clear-reactions request was attempted after the account lost access to theTextChannel
due toPermission.VIEW_CHANNEL
being revoked, or the account lost access to theGuild
typically due to being kicked or removed.MISSING_PERMISSIONS
The clear-reactions request was attempted after the account lostPermission.MESSAGE_MANAGE
in theTextChannel
when adding the reaction.UNKNOWN_MESSAGE
The clear-reactions request was attempted after the Message had been deleted.
- Parameters:
messageId
- The not-empty valid message id- Returns:
AuditableRestAction
- Throws:
InsufficientPermissionException
- If the currently logged in account does not havePermission.MESSAGE_MANAGE
in this channel.IllegalArgumentException
- If the providedid
isnull
or empty.
-
clearReactionsById
Attempts to remove all reactions from a message with the specifiedmessageId
in this TextChannel
This is useful for moderator commands that wish to remove all reactions at once from a specific message.The following
ErrorResponses
are possible:MISSING_ACCESS
The clear-reactions request was attempted after the account lost access to theTextChannel
due toPermission.VIEW_CHANNEL
being revoked, or the account lost access to theGuild
typically due to being kicked or removed.MISSING_PERMISSIONS
The clear-reactions request was attempted after the account lostPermission.MESSAGE_MANAGE
in theTextChannel
when adding the reaction.UNKNOWN_MESSAGE
The clear-reactions request was attempted after the Message had been deleted.
- Parameters:
messageId
- The message id- Returns:
AuditableRestAction
- Throws:
InsufficientPermissionException
- If the currently logged in account does not havePermission.MESSAGE_MANAGE
in this channel.
-
clearReactionsById
@Nonnull @CheckReturnValue RestAction<Void> clearReactionsById(@Nonnull String messageId, @Nonnull Emoji emoji) Removes all reactions for the specified emoji.The following
ErrorResponses
are possible:MISSING_ACCESS
The currently logged in account lost access to the channel by either being removed from the guild or losing theVIEW_CHANNEL
permissionUNKNOWN_EMOJI
The providedEmoji
was deleted or doesn't exist.UNKNOWN_MESSAGE
The message was deleted.
- Parameters:
messageId
- The id for the target messageemoji
- TheEmoji
to remove reactions for- Returns:
RestAction
- Throws:
InsufficientPermissionException
- If the currently logged in account does not havePermission.MESSAGE_MANAGE
in the channelIllegalArgumentException
- If provided with null
-
clearReactionsById
@Nonnull @CheckReturnValue default RestAction<Void> clearReactionsById(long messageId, @Nonnull Emoji emoji) Removes all reactions for the specified emoji.The following
ErrorResponses
are possible:MISSING_ACCESS
The currently logged in account lost access to the channel by either being removed from the guild or losing theVIEW_CHANNEL
permissionUNKNOWN_EMOJI
The providedEmoji
was deleted or doesn't exist.UNKNOWN_MESSAGE
The message was deleted.
- Parameters:
messageId
- The id for the target messageemoji
- TheEmoji
to remove reactions for- Returns:
RestAction
- Throws:
InsufficientPermissionException
- If the currently logged in account does not havePermission.MESSAGE_MANAGE
in the channelIllegalArgumentException
- If provided with null
-
sendStickers
@Nonnull @CheckReturnValue MessageCreateAction sendStickers(@Nonnull Collection<? extends StickerSnowflake> stickers) Send up to 3 stickers in this channel.
Bots can only sendGuildStickers
from the sameGuild
. Bots cannot useStandardStickers
.- Parameters:
stickers
- Collection of 1-3 stickers to send- Returns:
MessageCreateAction
- Throws:
MissingAccessException
- If the currently logged in account does not havePermission.VIEW_CHANNEL
in this channelInsufficientPermissionException
-- If this is a
ThreadChannel
and the bot does not havePermission.MESSAGE_SEND_IN_THREADS
- If this is not a
ThreadChannel
and the bot does not havePermission.MESSAGE_SEND
- If this is a
IllegalArgumentException
-- If any of the provided stickers is a
GuildSticker
, which is eitherunavailable
or from a different guild. - If the list is empty or has more than 3 stickers
- If null is provided
- If any of the provided stickers is a
- See Also:
-
sendStickers
@Nonnull @CheckReturnValue default MessageCreateAction sendStickers(@Nonnull StickerSnowflake... stickers) Send up to 3 stickers in this channel.
Bots can only sendGuildStickers
from the sameGuild
. Bots cannot useStandardStickers
.- Parameters:
stickers
- The 1-3 stickers to send- Returns:
MessageCreateAction
- Throws:
MissingAccessException
- If the currently logged in account does not havePermission.VIEW_CHANNEL
in this channelInsufficientPermissionException
-- If this is a
ThreadChannel
and the bot does not havePermission.MESSAGE_SEND_IN_THREADS
- If this is not a
ThreadChannel
and the bot does not havePermission.MESSAGE_SEND
- If this is a
IllegalArgumentException
-- If any of the provided stickers is a
GuildSticker
, which is eitherunavailable
or from a different guild. - If the list is empty or has more than 3 stickers
- If null is provided
- If any of the provided stickers is a
- See Also:
-