Update webhooktool.php
This commit is contained in:
parent
2559c9097a
commit
c85de7f257
|
@ -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")),
|
||||
),
|
||||
|
|
Loading…
Reference in New Issue
Block a user