public class Webhook extends Object
Text messages can be sent directly through the send() methods, while embed
messages can be created and added using the register() method.
To send a message, the send() methods can be used. The message can be either
provided as a parameter or set in the configuration section. If the message is not
set in the configuration section and is not provided as a parameter, an empty message
will be sent.
sendAsync() can be used to send asynchronously using CompletableFuture.
| Constructor and Description |
|---|
Webhook(@NotNull org.bukkit.configuration.ConfigurationSection sec)
Create a Discord webhook setup using a default configuration section with no message to display.
|
Webhook(@NotNull org.bukkit.configuration.ConfigurationSection sec,
String message)
Create a Discord webhook setup using a default configuration section and a default token "{message}".
|
Webhook(@NotNull org.bukkit.configuration.ConfigurationSection sec,
String token,
String message)
Create a Discord webhook setup using a default configuration section.
|
| Modifier and Type | Method and Description |
|---|---|
void |
send()
Sends the webhook.
|
void |
send(String message)
Sends the webhook.
|
void |
send(String token,
String message)
Sends the webhook.
|
void |
sendAsync()
Sends the webhook asynchronously.
|
void |
sendAsync(String message)
Sends the webhook asynchronously.
|
void |
sendAsync(String token,
String message)
Sends the webhook asynchronously.
|
public Webhook(@NotNull
@NotNull org.bukkit.configuration.ConfigurationSection sec,
String token,
String message)
Make sure the section looks something like this: webhook.yml
sec - a valid configuration sectiontoken - a token to replacemessage - a basic message to showpublic Webhook(@NotNull
@NotNull org.bukkit.configuration.ConfigurationSection sec,
String message)
Make sure the section looks something like this: webhook.yml
sec - a valid configuration sectionmessage - a basic message to showpublic Webhook(@NotNull
@NotNull org.bukkit.configuration.ConfigurationSection sec)
Make sure the section looks something like this: webhook.yml
sec - a valid configuration sectionpublic void send(String token, String message)
If any error happens when connecting to its url, will print an error in the console.
token - a tokenmessage - a message if no message was declared in the constructorpublic void send(String message)
If any error happens when connecting to its url, will print an error in the console.
message - a message if no message was declared in the constructorpublic void send()
If any error happens when connecting to its url, will print an error in the console.
public void sendAsync(String token, String message)
send(String, String) for more info.token - a tokenmessage - a message if no message was declared in the constructorpublic void sendAsync(String message)
send(String) for more info.message - a message if no message was declared in the constructorpublic void sendAsync()
send() for more info.Copyright © 2023. All rights reserved.