Make Discord messages non-blocking outside debug mode

This commit is contained in:
Tetrakern 2024-09-10 12:36:39 +02:00
parent ffaf30e10c
commit c5b73165f5

View File

@ -14,7 +14,8 @@ if ( ! function_exists( 'fictioneer_discord_send_message' ) ) {
* @param string $webhook The webhook for the Discord channel.
* @param array $message The message to be sent.
*
* @return array|WP_Error The response or WP_Error on failure.
* @return array|WP_Error|null Null if not in debug mode, otherwise
* the response or WP_Error on failure.
*/
function fictioneer_discord_send_message( $webhook, $message ) {
@ -30,7 +31,8 @@ if ( ! function_exists( 'fictioneer_discord_send_message' ) ) {
),
'body' => json_encode( $message, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ),
'method' => 'POST',
'data_format' => 'body'
'data_format' => 'body',
'blocking' => ! WP_DEBUG
)
);
}