public class D4JWebhookClient extends WebhookClient
WebhookClient.BucketallowedMentions, bucket, client, defaultTimeout, id, isQueued, isShutdown, parent, parseMessage, pool, queue, threadId, url, USER_AGENT, WEBHOOK_URL| Modifier | Constructor and Description |
|---|---|
protected |
D4JWebhookClient(D4JWebhookClient parent,
long threadId) |
|
D4JWebhookClient(long id,
java.lang.String token,
boolean parseMessage,
okhttp3.OkHttpClient client,
java.util.concurrent.ScheduledExecutorService pool,
AllowedMentions mentions) |
|
D4JWebhookClient(long id,
java.lang.String token,
boolean parseMessage,
okhttp3.OkHttpClient client,
java.util.concurrent.ScheduledExecutorService pool,
AllowedMentions mentions,
long threadId) |
| Modifier and Type | Method and Description |
|---|---|
@NotNull reactor.core.publisher.Mono<ReadonlyMessage> |
edit(long messageId,
@NotNull java.util.function.Consumer<? super discord4j.core.spec.MessageCreateSpec> callback)
Deprecated.
Replace with
edit(long, MessageEditSpec) |
@NotNull reactor.core.publisher.Mono<ReadonlyMessage> |
edit(long messageId,
@NotNull discord4j.core.spec.MessageEditSpec spec)
Edits the target message with the provided
MessageCreateSpec to the webhook. |
@NotNull reactor.core.publisher.Mono<ReadonlyMessage> |
edit(@NotNull java.lang.String messageId,
@NotNull java.util.function.Consumer<? super discord4j.core.spec.MessageCreateSpec> callback)
Deprecated.
Replace with
edit(long, MessageEditSpec) |
@NotNull reactor.core.publisher.Mono<ReadonlyMessage> |
edit(@NotNull java.lang.String messageId,
@NotNull discord4j.core.spec.MessageEditSpec spec)
Edits the target message with the provided
MessageCreateSpec to the webhook. |
static @NotNull D4JWebhookClient |
from(discord4j.core.object.entity.Webhook webhook)
Creates a D4JWebhookClient for the provided webhook.
|
@NotNull D4JWebhookClient |
onThread(long threadId)
Returns a wrapper of this WebhookClient that targets the specified thread.
|
@NotNull reactor.core.publisher.Mono<ReadonlyMessage> |
send(@NotNull java.util.function.Consumer<? super discord4j.core.spec.MessageCreateSpec> callback)
Deprecated.
Replace wth
send(MessageCreateSpec) |
@NotNull reactor.core.publisher.Mono<ReadonlyMessage> |
send(@NotNull discord4j.core.spec.MessageCreateSpec spec)
Sends the provided
MessageCreateSpec to the webhook. |
static @NotNull D4JWebhookClient |
withId(long id,
@NotNull java.lang.String token)
Factory method to create a basic D4JWebhookClient with the provided id and token.
|
static @NotNull D4JWebhookClient |
withUrl(@NotNull java.lang.String url)
Factory method to create a basic D4JWebhookClient with the provided id and token.
|
backoffQueue, checkShutdown, close, delete, delete, drainQueue, edit, edit, edit, edit, edit, edit, edit, edit, execute, execute, failure, get, get, getId, getThreadId, getTimeout, getUrl, isShutdown, isWait, newBody, newRequest, queueRequest, schedule, send, send, send, send, send, send, send, send, setTimeoutpublic D4JWebhookClient(long id,
java.lang.String token,
boolean parseMessage,
okhttp3.OkHttpClient client,
java.util.concurrent.ScheduledExecutorService pool,
AllowedMentions mentions)
public D4JWebhookClient(long id,
java.lang.String token,
boolean parseMessage,
okhttp3.OkHttpClient client,
java.util.concurrent.ScheduledExecutorService pool,
AllowedMentions mentions,
long threadId)
protected D4JWebhookClient(D4JWebhookClient parent, long threadId)
@NotNull public static @NotNull D4JWebhookClient from(@NotNull discord4j.core.object.entity.Webhook webhook)
You can use onThread(long) to target specific threads on the channel.
webhook - The webhookjava.lang.NullPointerException - If the webhook is null or does not provide a token@NotNull public static @NotNull D4JWebhookClient withId(long id, @NotNull @NotNull java.lang.String token)
You can use onThread(long) to target specific threads on the channel.
id - The webhook idtoken - The webhook tokenjava.lang.NullPointerException - If provided with null@NotNull public static @NotNull D4JWebhookClient withUrl(@NotNull @NotNull java.lang.String url)
You can use onThread(long) to target specific threads on the channel.
url - The url for the webhookjava.lang.NullPointerException - If provided with nulljava.lang.NumberFormatException - If no valid id is part o the url@NotNull public @NotNull D4JWebhookClient onThread(long threadId)
WebhookClientThe returned webhook client inherits all the settings (including the thread pool) from this client instance. If either of the clients is shutdown/closed, the other instance will no longer send any messages.
onThread in class WebhookClientthreadId - The target thread id, or 0 to send directly to the parent channel@NotNull @Deprecated @CheckReturnValue public @NotNull reactor.core.publisher.Mono<ReadonlyMessage> send(@NotNull @NotNull java.util.function.Consumer<? super discord4j.core.spec.MessageCreateSpec> callback)
send(MessageCreateSpec)MessageCreateSpec to the webhook.callback - The callback used to specify the desired message settingsMonojava.lang.NullPointerException - If null is providedWebhookClient.isWait(),
WebhookMessageBuilder.fromD4J(Consumer)@NotNull @Deprecated @CheckReturnValue public @NotNull reactor.core.publisher.Mono<ReadonlyMessage> edit(long messageId, @NotNull @NotNull java.util.function.Consumer<? super discord4j.core.spec.MessageCreateSpec> callback)
edit(long, MessageEditSpec)MessageCreateSpec to the webhook.messageId - The target message idcallback - The callback used to specify the desired message settingsMonojava.lang.NullPointerException - If null is providedWebhookClient.isWait(),
WebhookMessageBuilder.fromD4J(Consumer)@NotNull @Deprecated @CheckReturnValue public @NotNull reactor.core.publisher.Mono<ReadonlyMessage> edit(@NotNull @NotNull java.lang.String messageId, @NotNull @NotNull java.util.function.Consumer<? super discord4j.core.spec.MessageCreateSpec> callback)
edit(long, MessageEditSpec)MessageCreateSpec to the webhook.messageId - The target message idcallback - The callback used to specify the desired message settingsMonojava.lang.NullPointerException - If null is providedWebhookClient.isWait(),
WebhookMessageBuilder.fromD4J(Consumer)@NotNull @CheckReturnValue public @NotNull reactor.core.publisher.Mono<ReadonlyMessage> send(@NotNull @NotNull discord4j.core.spec.MessageCreateSpec spec)
MessageCreateSpec to the webhook.spec - The message create spec used to specify the desired message settingsMonojava.lang.NullPointerException - If null is providedWebhookClient.isWait(),
WebhookMessageBuilder.fromD4J(MessageCreateSpec)@NotNull @CheckReturnValue public @NotNull reactor.core.publisher.Mono<ReadonlyMessage> edit(long messageId, @NotNull @NotNull discord4j.core.spec.MessageEditSpec spec)
MessageCreateSpec to the webhook.messageId - The target message idspec - The message edit spec used to specify the desired message settingsMonojava.lang.NullPointerException - If null is providedWebhookClient.isWait(),
WebhookMessageBuilder.fromD4J(MessageEditSpec)@NotNull @CheckReturnValue public @NotNull reactor.core.publisher.Mono<ReadonlyMessage> edit(@NotNull @NotNull java.lang.String messageId, @NotNull @NotNull discord4j.core.spec.MessageEditSpec spec)
MessageCreateSpec to the webhook.messageId - The target message idspec - The message edit spec used to specify the desired message settingsMonojava.lang.NullPointerException - If null is providedWebhookClient.isWait(),
WebhookMessageBuilder.fromD4J(MessageEditSpec)