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.addPinnedMessage(Snowflake messageId, String reason) Request to pin a message in this channel.bulkDelete(Publisher<Snowflake> messageIds) Request to bulk delete the supplied message IDs.static RestChannelcreate(RestClient restClient, Snowflake id) Create aRestChannelwith 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 givenMessageCreateRequestas body.Mono<discord4j.discordjson.json.MessageData>createMessage(MultipartRequest<discord4j.discordjson.json.MessageCreateRequest> request) Request to create a message using a givenMultipartRequestas 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.deletePinnedMessage(Snowflake messageId, String reason) 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.booleanMono<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.Mono<discord4j.discordjson.json.PinnedMessagesResponseData>Request to retrieve all the pinned messages for this channel.Flux<discord4j.discordjson.json.ListThreadsData>Flux<discord4j.discordjson.json.ListThreadsData>getRestMessage(Snowflake messageId) Create aRestMessageentity for a given ID under this channel.Mono<discord4j.discordjson.json.ThreadMemberData>getThreadMember(Snowflake userId) Flux<discord4j.discordjson.json.WebhookData>inthashCode()Flux<discord4j.discordjson.json.ListThreadsData>listThreads(Function<Map<String, Object>, Mono<discord4j.discordjson.json.ListThreadsData>> doRequest) Return aRestMessagebelonging to this channel.Mono<discord4j.discordjson.json.ChannelData>Request to edit this text channel using a givenChannelModifyRequestas body and optionally, a reason.Mono<discord4j.discordjson.json.ChannelData>startThreadFromMessage(long messageId, discord4j.discordjson.json.StartThreadFromMessageRequest request) Mono<discord4j.discordjson.json.ChannelData>startThreadWithoutMessage(discord4j.discordjson.json.StartThreadWithoutMessageRequest request) type()Request to trigger the typing indicator in this channel.
-
Method Details
-
create
Create aRestChannelwith 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
Monowhere, upon successful completion, emits theChannelDatabelonging to this channel. If an error is received, it is emitted through theMono. - See Also:
-
message
Return aRestMessagebelonging to this channel. This method does not perform any API request.- Parameters:
messageId- the message ID under this channel- Returns:
- a
RestMessagerepresented 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 givenChannelModifyRequestas body and optionally, a reason.- Parameters:
request- request body used to create a new messagereason- a reason for this action, can benull- Returns:
- a
Monowhere, 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
Monowhere, 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
Fluxwill 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
messageIdtomyOtherMessageId:getMessagesBefore(messageId).takeWhile(message -> message.getId().compareTo(myOtherMessageId) >= 0)- Parameters:
messageId- The ID of the newest message to retrieve.- Returns:
- A
Fluxthat continually emits allmessagesbefore 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
Fluxwill 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
messageIdtomyOtherMessageId:getMessagesAfter(messageId).takeWhile(message -> message.getId().compareTo(myOtherMessageId) <= 0)- Parameters:
messageId- the ID of the oldest message to retrieve.- Returns:
- a
Fluxthat continually emits allmessagesafter the specified ID. If an error is received, it is emitted through theFlux. - See Also:
-
getRestMessage
Create aRestMessageentity for a given ID under this channel. This method does not perform any network request.- Parameters:
messageId- the message's ID- Returns:
- a
RestMessagefacade 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 givenMessageCreateRequestas body. If you want to include attachments to your message, seecreateMessage(MultipartRequest).- Parameters:
request- request body used to create a new message- Returns:
- a
Monowhere, upon successful completion, emits the createdMessageData. If an error is received, it is emitted through theMono. - See Also:
- API Note:
- if the request comes from a
Specclass can be different from a rawImmutableMessageCreateRequest.Builder#build()for flags and another internal behaviours
-
createMessage
public Mono<discord4j.discordjson.json.MessageData> createMessage(MultipartRequest<discord4j.discordjson.json.MessageCreateRequest> request) Request to create a message using a givenMultipartRequestas body. AMultipartRequestis a custom object allowing you to add attachments to a message.- Parameters:
request- request body used to create a new message- Returns:
- a
Monowhere, 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
Monowhere, 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
Monowhere, 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- aPublisherto supply the message IDs to bulk delete.- Returns:
- a
Fluxthat continually emitsmessage IDsthat 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
Monowhere, 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
Fluxthat 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
Monowhere, 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
Monowhere, 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
Monowhere, 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
Monowhich 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
Fluxthat 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.- Parameters:
messageId- The ID of the message to pinreason- The reason for pinning the message- Returns:
- A
Monowhere, upon successful completion, emits nothing; indicating the messaged was pinned. If an error is received, it is emitted through theMono.
-
addPinnedMessage
Request to pin a message in this channel.- Returns:
- A
Monowhere, 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.- Parameters:
messageId- The ID of the message to unpinreason- The reason for unpinning the message- Returns:
- A
Monowhere, upon successful completion, emits nothing; indicating the message was unpinned. If an error is received, it is emitted through theMono.
-
deletePinnedMessage
Request to unpin a message in this channel.- Returns:
- A
Monowhere, 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
-
startThreadWithoutMessage
public Mono<discord4j.discordjson.json.ChannelData> startThreadWithoutMessage(discord4j.discordjson.json.StartThreadWithoutMessageRequest request) -
startThreadFromMessage
public Mono<discord4j.discordjson.json.ChannelData> startThreadFromMessage(long messageId, discord4j.discordjson.json.StartThreadFromMessageRequest request) -
equals
-
hashCode
public int hashCode()
-