public class RestChannel extends Object
| Modifier and Type | Method and Description |
|---|---|
Mono<Void> |
addGroupDMRecipient(Snowflake userId,
discord4j.discordjson.json.GroupAddRecipientRequest request) |
Mono<Void> |
addPinnedMessage(Snowflake messageId)
Request to pin a message in this channel.
|
Flux<Snowflake> |
bulkDelete(Publisher<Snowflake> messageIds)
Request to bulk delete the supplied message IDs.
|
static RestChannel |
create(RestClient restClient,
Snowflake id)
Create a
RestChannel 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 for
createMessage(MessageCreateRequest) taking an embed only. |
Mono<discord4j.discordjson.json.MessageData> |
createMessage(discord4j.discordjson.json.MessageCreateRequest request)
Request to create a message using a given
MessageCreateRequest as body. |
Mono<discord4j.discordjson.json.MessageData> |
createMessage(MultipartRequest request)
Request to create a message using a given
MultipartRequest as body. |
Mono<discord4j.discordjson.json.MessageData> |
createMessage(String content)
Wrapper for
createMessage(MessageCreateRequest) taking only message content. |
Mono<Void> |
delete(String reason)
Request to delete this channel while optionally specifying a reason.
|
Mono<Void> |
deleteChannelPermission(Snowflake targetId,
String reason)
Request to delete this permission overwrite while optionally specifying a reason.
|
Mono<Void> |
deleteGroupDMRecipient(Snowflake userId) |
Mono<Void> |
deletePinnedMessage(Snowflake messageId)
Request to unpin a message in this channel.
|
Mono<Void> |
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.
|
Mono<discord4j.discordjson.json.ChannelData> |
getData()
Retrieve this channel's data upon subscription.
|
Flux<discord4j.discordjson.json.InviteData> |
getInvites()
Request to retrieve this channel's invites.
|
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> |
getPinnedMessages()
Request to retrieve all the pinned messages for this channel.
|
RestMessage |
getRestMessage(Snowflake messageId)
Create a
RestMessage entity for a given ID under this channel. |
Flux<discord4j.discordjson.json.WebhookData> |
getWebhooks() |
RestMessage |
message(Snowflake messageId)
Return a
RestMessage belonging to this channel. |
Mono<discord4j.discordjson.json.ChannelData> |
modify(discord4j.discordjson.json.ChannelModifyRequest request,
String reason)
Request to edit this text channel using a given
ChannelModifyRequest as body and optionally, a reason. |
Mono<Void> |
type()
Request to trigger the typing indicator in this channel.
|
public static RestChannel create(RestClient restClient, Snowflake id)
RestChannel with the given parameters.restClient - REST API resourcesid - the ID of this channelpublic Mono<discord4j.discordjson.json.ChannelData> getData()
Mono where, upon successful completion, emits the ChannelData belonging to this
channel. If an error is received, it is emitted through the Mono.public RestMessage message(Snowflake messageId)
RestMessage belonging to this channel. This method does not perform any API request.messageId - the message ID under this channelRestMessage represented by the given parameters.public Mono<discord4j.discordjson.json.ChannelData> modify(discord4j.discordjson.json.ChannelModifyRequest request, @Nullable String reason)
ChannelModifyRequest as body and optionally, a reason.request - request body used to create a new messagereason - a reason for this action, can be nullMono where, upon successful completion, emits the edited ChannelData. If an error is
received, it is emitted through the Mono.public Mono<Void> delete(@Nullable String reason)
reason - a reason for this action, can be nullMono where, upon successful completion, emits nothing; indicating the channel has been deleted.
If an error is received, it is emitted through the Mono.public Flux<discord4j.discordjson.json.MessageData> getMessagesBefore(Snowflake messageId)
The returned Flux will emit items in reverse-chronological order (newest to oldest). It is
recommended to limit the emitted items by invoking either Flux.takeWhile(Predicate) (to retrieve IDs
within a specified range) or Flux.take(long) (to retrieve a specific amount of IDs).
The following example will get all messages from messageId to myOtherMessageId:
getMessagesBefore(messageId).takeWhile(message -> message.getId().compareTo(myOtherMessageId) >= 0)
messageId - The ID of the newest message to retrieve.Flux that continually emits all messages before the
specified ID. If an error is received, it is emitted through the Flux.public Flux<discord4j.discordjson.json.MessageData> getMessagesAfter(Snowflake messageId)
The returned Flux will emit items in chronological order (oldest to newest). It is recommended to limit
the emitted items by invoking either Flux.takeWhile(Predicate) (to retrieve IDs within a specified range)
or Flux.take(long) (to retrieve a specific amount of IDs).
The following example will get all messages from messageId to myOtherMessageId:
getMessagesAfter(messageId).takeWhile(message -> message.getId().compareTo(myOtherMessageId) <= 0)
messageId - the ID of the oldest message to retrieve.Flux that continually emits all messages after the
specified ID. If an error is received, it is emitted through the Flux.public RestMessage getRestMessage(Snowflake messageId)
RestMessage entity for a given ID under this channel. This method does not perform any
network request.messageId - the message's IDRestMessage facade for the given message under this channel to perform actions on itpublic Mono<discord4j.discordjson.json.MessageData> createMessage(discord4j.discordjson.json.MessageCreateRequest request)
MessageCreateRequest as body. If you want to include
attachments to your message, see createMessage(MultipartRequest).request - request body used to create a new messageMono where, upon successful completion, emits the created MessageData. If an
error is received, it is emitted through the Mono.public Mono<discord4j.discordjson.json.MessageData> createMessage(MultipartRequest request)
MultipartRequest as body. A MultipartRequest is a
custom object allowing you to add attachments to a message.request - request body used to create a new messageMono where, upon successful completion, emits the created MessageData. If an
error is received, it is emitted through the Mono.public Mono<discord4j.discordjson.json.MessageData> createMessage(String content)
createMessage(MessageCreateRequest) taking only message content.content - The content of the messageMono where, upon successful completion, emits the created MessageData. If an
error is received, it is emitted through the Mono.public Mono<discord4j.discordjson.json.MessageData> createMessage(discord4j.discordjson.json.EmbedData embed)
createMessage(MessageCreateRequest) taking an embed only.embed - The embed of the messageMono where, upon successful completion, emits the created MessageData. If an
error is received, it is emitted through the Mono.public Flux<Snowflake> bulkDelete(Publisher<Snowflake> messageIds)
messageIds - a Publisher to supply the message IDs to bulk delete.Flux that continually emits message IDs that were not bulk deleted
(typically if the ID was older than 2 weeks). If an error is received, it is emitted through the Flux.public Mono<Void> editChannelPermissions(Snowflake targetId, discord4j.discordjson.json.PermissionsEditRequest request, @Nullable String reason)
targetId - the ID of the member or role to add the overwrite forrequest - the overwrite request to editreason - the reason, if presentMono where, upon successful completion, emits nothing; If an error is received, it is emitted
through the Monopublic Flux<discord4j.discordjson.json.InviteData> getInvites()
Flux that continually emits this channel's invites. If an error is
received, it is emitted through the Flux.public Mono<discord4j.discordjson.json.InviteData> createInvite(discord4j.discordjson.json.InviteCreateRequest request, @Nullable String reason)
request - request body used to create a new invitereason - the reason, if presentMono where, upon successful completion, emits the created InviteData. If an error
is received, it is emitted through the Mono.public Mono<Void> deleteChannelPermission(Snowflake targetId, @Nullable String reason)
reason - the reason, if present.Mono where, upon successful completion, emits nothing; indicating the permission overwrite has
been deleted. If an error is received, it is emitted through the Mono.public Mono<Void> type()
Mono which completes upon successful triggering of the typing indicator in this channel. If
an error is received, it is emitted through the Mono.public Flux<discord4j.discordjson.json.MessageData> getPinnedMessages()
Flux that continually emits all the pinned messages for this channel. If an error is received,
it is emitted through the Flux.public Mono<Void> addPinnedMessage(Snowflake messageId)
Mono where, upon successful completion, emits nothing; indicating the messaged was pinned. If
an error is received, it is emitted through the Mono.public Mono<Void> deletePinnedMessage(Snowflake messageId)
Mono where, upon successful completion, emits nothing; indicating the message was unpinned. If
an error is received, it is emitted through the Mono.public Mono<Void> addGroupDMRecipient(Snowflake userId, discord4j.discordjson.json.GroupAddRecipientRequest request)
public Flux<discord4j.discordjson.json.WebhookData> getWebhooks()