Class RestChannel
-
Method Summary
Modifier and TypeMethodDescriptionaddGroupDMRecipient
(Snowflake userId, discord4j.discordjson.json.GroupAddRecipientRequest request) addPinnedMessage
(Snowflake messageId) Request to pin a message in this channel.bulkDelete
(Publisher<Snowflake> messageIds) Request to bulk delete the supplied message IDs.static RestChannel
create
(RestClient restClient, Snowflake id) Create aRestChannel
with the given parameters.Mono<discord4j.discordjson.json.InviteData>
createInvite
(discord4j.discordjson.json.InviteCreateRequest request, String reason) Request to create an invite.Mono<discord4j.discordjson.json.MessageData>
createMessage
(discord4j.discordjson.json.EmbedData embed) Wrapper forcreateMessage(MessageCreateRequest)
taking an embed only.Mono<discord4j.discordjson.json.MessageData>
createMessage
(discord4j.discordjson.json.MessageCreateRequest request) Request to create a message using a givenMessageCreateRequest
as body.Mono<discord4j.discordjson.json.MessageData>
createMessage
(MultipartRequest<discord4j.discordjson.json.MessageCreateRequest> request) Request to create a message using a givenMultipartRequest
as body.Mono<discord4j.discordjson.json.MessageData>
createMessage
(String content) Wrapper forcreateMessage(MessageCreateRequest)
taking only message content.Request to delete this channel while optionally specifying a reason.deleteChannelPermission
(Snowflake targetId, String reason) Request to delete this permission overwrite while optionally specifying a reason.deleteGroupDMRecipient
(Snowflake userId) deletePinnedMessage
(Snowflake messageId) Request to unpin a message in this channel.editChannelPermissions
(Snowflake targetId, discord4j.discordjson.json.PermissionsEditRequest request, String reason) Request to edit channel permission overwrites for the given member or role while optionally specifying a reason.boolean
Mono<discord4j.discordjson.json.FollowedChannelData>
follow
(discord4j.discordjson.json.NewsChannelFollowRequest request) Requests to follow this channel.Mono<discord4j.discordjson.json.ChannelData>
getData()
Retrieve this channel's data upon subscription.getId()
Returns the ID of this channel.Flux<discord4j.discordjson.json.InviteData>
Request to retrieve this channel's invites.Flux<discord4j.discordjson.json.ListThreadsData>
Flux<discord4j.discordjson.json.MessageData>
getMessagesAfter
(Snowflake messageId) Request to retrieve all messages after the specified ID.Flux<discord4j.discordjson.json.MessageData>
getMessagesBefore
(Snowflake messageId) Request to retrieve all messages before the specified ID.Flux<discord4j.discordjson.json.MessageData>
Request to retrieve all the pinned messages for this channel.Flux<discord4j.discordjson.json.ListThreadsData>
Flux<discord4j.discordjson.json.ListThreadsData>
getRestMessage
(Snowflake messageId) Create aRestMessage
entity for a given ID under this channel.Mono<discord4j.discordjson.json.ThreadMemberData>
getThreadMember
(Snowflake userId) Flux<discord4j.discordjson.json.WebhookData>
int
hashCode()
Flux<discord4j.discordjson.json.ListThreadsData>
listThreads
(Function<Map<String, Object>, Mono<discord4j.discordjson.json.ListThreadsData>> doRequest) Return aRestMessage
belonging to this channel.Mono<discord4j.discordjson.json.ChannelData>
Request to edit this text channel using a givenChannelModifyRequest
as body and optionally, a reason.type()
Request to trigger the typing indicator in this channel.
-
Method Details
-
create
Create aRestChannel
with the given parameters.- Parameters:
restClient
- REST API resourcesid
- the ID of this channel
-
getId
Returns the ID of this channel.- Returns:
- The ID of this channel
-
getData
Retrieve this channel's data upon subscription.- Returns:
- a
Mono
where, upon successful completion, emits theChannelData
belonging to this channel. If an error is received, it is emitted through theMono
. - See Also:
-
message
Return aRestMessage
belonging to this channel. This method does not perform any API request.- Parameters:
messageId
- the message ID under this channel- Returns:
- a
RestMessage
represented by the given parameters.
-
modify
public Mono<discord4j.discordjson.json.ChannelData> modify(discord4j.discordjson.json.ChannelModifyRequest request, @Nullable String reason) Request to edit this text channel using a givenChannelModifyRequest
as body and optionally, a reason.- Parameters:
request
- request body used to create a new messagereason
- a reason for this action, can benull
- Returns:
- a
Mono
where, upon successful completion, emits the editedChannelData
. If an error is received, it is emitted through theMono
. - See Also:
-
delete
Request to delete this channel while optionally specifying a reason.- Parameters:
reason
- a reason for this action, can benull
- Returns:
- A
Mono
where, upon successful completion, emits nothing; indicating the channel has been deleted. If an error is received, it is emitted through theMono
. - See Also:
-
getMessagesBefore
Request to retrieve all messages before the specified ID.The returned
Flux
will emit items in reverse-chronological order (newest to oldest). It is recommended to limit the emitted items by invoking eitherFlux.takeWhile(Predicate)
(to retrieve IDs within a specified range) orFlux.take(long)
(to retrieve a specific amount of IDs).The following example will get all messages from
messageId
tomyOtherMessageId
:getMessagesBefore(messageId).takeWhile(message -> message.getId().compareTo(myOtherMessageId) >= 0)
- Parameters:
messageId
- The ID of the newest message to retrieve.- Returns:
- A
Flux
that continually emits allmessages
before the specified ID. If an error is received, it is emitted through theFlux
. - See Also:
-
getMessagesAfter
Request to retrieve all messages after the specified ID.The returned
Flux
will emit items in chronological order (oldest to newest). It is recommended to limit the emitted items by invoking eitherFlux.takeWhile(Predicate)
(to retrieve IDs within a specified range) orFlux.take(long)
(to retrieve a specific amount of IDs).The following example will get all messages from
messageId
tomyOtherMessageId
:getMessagesAfter(messageId).takeWhile(message -> message.getId().compareTo(myOtherMessageId) <= 0)
- Parameters:
messageId
- the ID of the oldest message to retrieve.- Returns:
- a
Flux
that continually emits allmessages
after the specified ID. If an error is received, it is emitted through theFlux
. - See Also:
-
getRestMessage
Create aRestMessage
entity for a given ID under this channel. This method does not perform any network request.- Parameters:
messageId
- the message's ID- Returns:
- a
RestMessage
facade for the given message under this channel to perform actions on it
-
createMessage
public Mono<discord4j.discordjson.json.MessageData> createMessage(discord4j.discordjson.json.MessageCreateRequest request) Request to create a message using a givenMessageCreateRequest
as body. If you want to include attachments to your message, seecreateMessage(MultipartRequest)
.- Parameters:
request
- request body used to create a new message- Returns:
- a
Mono
where, upon successful completion, emits the createdMessageData
. If an error is received, it is emitted through theMono
. - See Also:
-
createMessage
public Mono<discord4j.discordjson.json.MessageData> createMessage(MultipartRequest<discord4j.discordjson.json.MessageCreateRequest> request) Request to create a message using a givenMultipartRequest
as body. AMultipartRequest
is a custom object allowing you to add attachments to a message.- Parameters:
request
- request body used to create a new message- Returns:
- a
Mono
where, upon successful completion, emits the createdMessageData
. If an error is received, it is emitted through theMono
. - See Also:
-
createMessage
Wrapper forcreateMessage(MessageCreateRequest)
taking only message content.- Parameters:
content
- The content of the message- Returns:
- a
Mono
where, upon successful completion, emits the createdMessageData
. If an error is received, it is emitted through theMono
.
-
createMessage
public Mono<discord4j.discordjson.json.MessageData> createMessage(discord4j.discordjson.json.EmbedData embed) Wrapper forcreateMessage(MessageCreateRequest)
taking an embed only.- Parameters:
embed
- The embed of the message- Returns:
- a
Mono
where, upon successful completion, emits the createdMessageData
. If an error is received, it is emitted through theMono
.
-
bulkDelete
Request to bulk delete the supplied message IDs.- Parameters:
messageIds
- aPublisher
to supply the message IDs to bulk delete.- Returns:
- a
Flux
that continually emitsmessage IDs
that were not bulk deleted (typically if the ID was older than 2 weeks). If an error is received, it is emitted through theFlux
. - See Also:
-
editChannelPermissions
public Mono<Void> editChannelPermissions(Snowflake targetId, discord4j.discordjson.json.PermissionsEditRequest request, @Nullable String reason) Request to edit channel permission overwrites for the given member or role while optionally specifying a reason.- Parameters:
targetId
- the ID of the member or role to add the overwrite forrequest
- the overwrite request to editreason
- the reason, if present- Returns:
- a
Mono
where, upon successful completion, emits nothing; If an error is received, it is emitted through theMono
- See Also:
-
getInvites
Request to retrieve this channel's invites.- Returns:
- a
Flux
that continually emits this channel'sinvites
. If an error is received, it is emitted through theFlux
. - See Also:
-
createInvite
public Mono<discord4j.discordjson.json.InviteData> createInvite(discord4j.discordjson.json.InviteCreateRequest request, @Nullable String reason) Request to create an invite.- Parameters:
request
- request body used to create a new invitereason
- the reason, if present- Returns:
- a
Mono
where, upon successful completion, emits the createdInviteData
. If an error is received, it is emitted through theMono
. - See Also:
-
deleteChannelPermission
Request to delete this permission overwrite while optionally specifying a reason.- Parameters:
reason
- the reason, if present.- Returns:
- a
Mono
where, upon successful completion, emits nothing; indicating the permission overwrite has been deleted. If an error is received, it is emitted through theMono
. - See Also:
-
follow
public Mono<discord4j.discordjson.json.FollowedChannelData> follow(discord4j.discordjson.json.NewsChannelFollowRequest request) Requests to follow this channel. Only works if this channel represents a news channel. Following this channel will create a webhook in a chosen target channel where 'MANAGE_WEBHOOKS' permission is granted.- Parameters:
request
- the request to follow this channel- Returns:
- A
Mono
where, upon successful completion, emits the data indicating that the channel has been followed. If an error is received, it is emitted through theMono
.
-
type
Request to trigger the typing indicator in this channel. A single invocation of this method will trigger the indicator for 10 seconds or until the bot sends a message in this channel.- Returns:
- a
Mono
which completes upon successful triggering of the typing indicator in this channel. If an error is received, it is emitted through theMono
. - See Also:
-
getPinnedMessages
Request to retrieve all the pinned messages for this channel.- Returns:
- a
Flux
that continually emits all the pinned messages for this channel. If an error is received, it is emitted through theFlux
. - See Also:
-
addPinnedMessage
Request to pin a message in this channel.- Returns:
- A
Mono
where, upon successful completion, emits nothing; indicating the messaged was pinned. If an error is received, it is emitted through theMono
.
-
deletePinnedMessage
Request to unpin a message in this channel.- Returns:
- A
Mono
where, upon successful completion, emits nothing; indicating the message was unpinned. If an error is received, it is emitted through theMono
.
-
addGroupDMRecipient
-
deleteGroupDMRecipient
-
getWebhooks
-
getThreadMember
-
listThreads
-
getPublicArchivedThreads
-
getPrivateArchivedThreads
-
getJoinedPrivateArchivedThreads
-
equals
-
hashCode
public int hashCode()
-