From c85de7f2577d6304395b2b348fcea2f42acaca0c Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Sat, 25 May 2019 16:18:25 +0900 Subject: [PATCH] Update webhooktool.php --- helper/webhooktool.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/helper/webhooktool.php b/helper/webhooktool.php index b0c41fc..f335fcb 100644 --- a/helper/webhooktool.php +++ b/helper/webhooktool.php @@ -10,10 +10,11 @@ * * `Slack` is trademark of Slack Technologies Inc. */ -if(check_function_exists("send_web_hook")) { +if(!check_function_exists("send_web_hook")) { function send_web_hook($message, $networkid, $options=array()) { $response = false; $id = get_value_in_array("id", $options, ""); + $username = get_value_in_array("username", $options, "ReasonableFramework Bot"); switch($networkid) { case "nateon": @@ -34,6 +35,7 @@ if(check_function_exists("send_web_hook")) { case "discord": $request_url = sprintf("https://discordapp.com/api/webhooks/%s", $id); + if(loadHelper("webpagetool")) { $response = get_web_json($request_url, "jsondata", array( "headers" => array( @@ -41,7 +43,7 @@ if(check_function_exists("send_web_hook")) { ), "data" => array( "content" => $message, - "username" => get_value_in_array("username", $options, "anonymous"), + "username" => $username, ), )); } @@ -56,7 +58,7 @@ if(check_function_exists("send_web_hook")) { ), "data" => array( "channel" => sprintf("#%s", get_value_in_array("channel", $options, "general")), - "username" => get_value_in_array("username", $options, "anonymous"), + "username" => $username, "text" => $message, "icon_emoji" => sprintf(":%s:", get_value_in_array("emoji", $options, "ghost")), ),