Package discord4j.rest.entity
Class RestMessage
java.lang.Object
discord4j.rest.entity.RestMessage
Represents a message within Discord.
-
Method Summary
Modifier and TypeMethodDescriptionchannel()
static RestMessage
create
(RestClient restClient, Snowflake channelId, Snowflake id) Create aRestMessage
with the given parameters.createReaction
(String emoji) Requests to add a reaction on this message.Requests to delete this message while optionally specifying a reason.Requests to remove all the reactions on this message.deleteOwnReaction
(String emoji) Requests to remove a reaction from the current user on this message.deleteReactions
(String emoji) Requests to remove a specified reaction on this message.deleteUserReaction
(String emoji, Snowflake userId) Requests to remove a reaction from a specified user on this message.Mono<discord4j.discordjson.json.MessageData>
edit
(discord4j.discordjson.json.MessageEditRequest request) Requests to edit this message.boolean
Returns the ID of the channel this message belongs to.Mono<discord4j.discordjson.json.MessageData>
getData()
Retrieve this messages' data upon subscription.getId()
Returns the ID of this message.int
hashCode()
Mono<discord4j.discordjson.json.MessageData>
publish()
Requests to publish (crosspost) this message if thechannel
is of type 'news'.
-
Method Details
-
create
Create aRestMessage
with the given parameters. This method does not perform any API request.- Parameters:
restClient
- REST API resourceschannelId
- the ID of the channel this messages belongs toid
- the ID of this message- Returns:
- a
RestMessage
represented by the given parameters.
-
getChannelId
Returns the ID of the channel this message belongs to.- Returns:
- The ID of the channel this message belongs to
-
getId
Returns the ID of this message.- Returns:
- The ID of this message
-
channel
-
getData
Retrieve this messages' data upon subscription.- Returns:
- a
Mono
where, upon successful completion, emits theMessageData
belonging to this channel. If an error is received, it is emitted through theMono
. - See Also:
-
createReaction
Requests to add a reaction on this message.- Parameters:
emoji
- The reaction to add on this message. emoji takes the form of name:id for custom guild emoji, or Unicode characters.- Returns:
- A
Mono
where, upon successful completion, emits nothing; indicating the reaction was added on this message. If an error is received, it is emitted through theMono
. - See Also:
-
deleteOwnReaction
Requests to remove a reaction from the current user on this message.- Parameters:
emoji
- The reaction to remove on this message.- Returns:
- A
Mono
where, upon successful completion, emits nothing; indicating the reaction from the current user was removed on this message. If an error is received, it is emitted through theMono
. - See Also:
-
deleteUserReaction
Requests to remove a reaction from a specified user on this message.- Parameters:
emoji
- The reaction to remove on this message.userId
- The user to remove the reaction on this message.- Returns:
- A
Mono
where, upon successful completion, emits nothing; indicating the reaction from the specified user was removed on this message. If an error is received, it is emitted through theMono
. - See Also:
-
deleteAllReactions
Requests to remove all the reactions on this message.- Returns:
- A
Mono
where, upon successful completion, emits nothing; indicating all the reactions on this message were removed. If an error is received, it is emitted through theMono
. - See Also:
-
deleteReactions
Requests to remove a specified reaction on this message.- Parameters:
emoji
- The reaction to remove on this message.- Returns:
- A
Mono
where, upon successful completion, emits nothing; indicating the reaction from the specified user was removed on this message. If an error is received, it is emitted through theMono
. - See Also:
-
edit
public Mono<discord4j.discordjson.json.MessageData> edit(discord4j.discordjson.json.MessageEditRequest request) Requests to edit this message.- Parameters:
request
- The request body used to create a new message.- Returns:
- A
Mono
where, upon successful completion, emits the editedMessageData
. If an error is received, it is emitted through theMono
. - See Also:
-
delete
Requests to delete this message while optionally specifying a reason.- Parameters:
reason
- The reason, if present.- Returns:
- A
Mono
where, upon successful completion, emits nothing; indicating the message has been deleted. If an error is received, it is emitted through theMono
. - See Also:
-
publish
Requests to publish (crosspost) this message if thechannel
is of type 'news'. Requires 'SEND_MESSAGES' permission if the current user sent the message, or additionally the 'MANAGE_MESSAGES' permission, for all other messages, to be present for the current user.- Returns:
- A
Mono
where, upon successful completion, emits the publishedMessageData
(crossposted) in the guilds. If an error is received, it is emitted through theMono
. - See Also:
-
equals
-
hashCode
public int hashCode()
-