Class D4JWebhookClient

    • Method Detail

      • from

        @NotNull
        public static @NotNull D4JWebhookClient from​(@NotNull
                                                     discord4j.core.object.entity.Webhook webhook)
        Creates a D4JWebhookClient for the provided webhook.

        You can use onThread(long) to target specific threads on the channel.

        Parameters:
        webhook - The webhook
        Returns:
        The D4JWebhookClient
        Throws:
        NullPointerException - If the webhook is null or does not provide a token
      • withId

        @NotNull
        public static @NotNull D4JWebhookClient withId​(long id,
                                                       @NotNull
                                                       @NotNull String token)
        Factory method to create a basic D4JWebhookClient with the provided id and token.

        You can use onThread(long) to target specific threads on the channel.

        Parameters:
        id - The webhook id
        token - The webhook token
        Returns:
        The D4JWebhookClient for the provided id and token
        Throws:
        NullPointerException - If provided with null
      • withUrl

        @NotNull
        public static @NotNull D4JWebhookClient withUrl​(@NotNull
                                                        @NotNull String url)
        Factory method to create a basic D4JWebhookClient with the provided id and token.

        You can use onThread(long) to target specific threads on the channel.

        Parameters:
        url - The url for the webhook
        Returns:
        The D4JWebhookClient for the provided url
        Throws:
        NullPointerException - If provided with null
        NumberFormatException - If no valid id is part o the url
      • onThread

        @NotNull
        public @NotNull D4JWebhookClient onThread​(long threadId)
        Description copied from class: WebhookClient
        Returns a wrapper of this WebhookClient that targets the specified thread.
        The thread should be on the same channel as the webhook.

        The 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.

        Overrides:
        onThread in class WebhookClient
        Parameters:
        threadId - The target thread id, or 0 to send directly to the parent channel
        Returns:
        A new webhook client instance which targets the specified thread
      • edit

        @NotNull
        @CheckReturnValue
        public @NotNull reactor.core.publisher.Mono<ReadonlyMessage> edit​(long messageId,
                                                                          @NotNull
                                                                          @NotNull discord4j.core.spec.MessageEditSpec spec)
        Edits the target message with the provided MessageCreateSpec to the webhook.
        Parameters:
        messageId - The target message id
        spec - The message edit spec used to specify the desired message settings
        Returns:
        Mono
        Throws:
        NullPointerException - If null is provided
        See Also:
        WebhookClient.isWait(), WebhookMessageBuilder.fromD4J(MessageEditSpec)
      • edit

        @NotNull
        @CheckReturnValue
        public @NotNull reactor.core.publisher.Mono<ReadonlyMessage> edit​(@NotNull
                                                                          @NotNull String messageId,
                                                                          @NotNull
                                                                          @NotNull discord4j.core.spec.MessageEditSpec spec)
        Edits the target message with the provided MessageCreateSpec to the webhook.
        Parameters:
        messageId - The target message id
        spec - The message edit spec used to specify the desired message settings
        Returns:
        Mono
        Throws:
        NullPointerException - If null is provided
        See Also:
        WebhookClient.isWait(), WebhookMessageBuilder.fromD4J(MessageEditSpec)