Created
February 2, 2019 11:08
-
-
Save azharimad/d330022c6eacbcf00db62b4d2e32692c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!defined("WHMCS")) | |
die("This file cannot be accessed directly"); | |
function sendTelegramMessage($pm) { | |
global $vars; | |
//$chat_id = (""); //Group | |
$chat_id = (""); //Channel | |
$tokenbot = (""); | |
$data = array( | |
'chat_id' => $chat_id, | |
'text' => $pm . "\n\n-------------------------------------------- \n" | |
); | |
$curl = curl_init(); | |
curl_setopt($curl, CURLOPT_URL, "https://api.telegram.org/bot$tokenbot/sendMessage"); | |
curl_setopt($curl, CURLOPT_POSTFIELDS, $data); | |
curl_setopt($curl, CURLOPT_TIMEOUT, 10); | |
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); | |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); | |
curl_exec($curl); | |
curl_close($curl); | |
} | |
function wt_note_TicketOpen($vars) { | |
global $customadminpath, $CONFIG; | |
sendTelegramMessage("Ada tiket baru \n-------------------------------------------- \n\n Ticket ID: $vars[ticketid] \n Department : $vars[deptname] \n Subject : $vars[subject] \n Message : $vars[message] \n\n". $CONFIG['SystemURL'].'/'.$customadminpath.'/supporttickets.php?action=viewticket&id='.$vars['ticketid']); | |
} | |
function wt_note_TicketUserReply($vars) { | |
global $customadminpath, $CONFIG; | |
sendTelegramMessage("Ada balasan tiket \n----------------------------------------- \n\n Ticket ID : $vars[ticketid] \n Department : $vars[deptname] \n Subject : $vars[subject] \n Message : $vars[message] \n\n ". $CONFIG['SystemURL'].'/'.$customadminpath.'/supporttickets.php?action=viewticket&id='.$vars['ticketid']); | |
} | |
function wt_note_OrderPaid($vars) { | |
global $customadminpath, $CONFIG; | |
sendTelegramMessage("Ada Order Baru Telah Dibayarkan, Cek Pending Order. \n\n ". $CONFIG['SystemURL'].'/'.$customadminpath.'/orders.php?action=view&id='.$vars['orderId']); | |
} | |
add_hook("TicketOpen",1,"wt_note_TicketOpen"); | |
add_hook("TicketUserReply",1,"wt_note_TicketUserReply"); | |
add_hook("OrderPaid",1,"wt_note_OrderPaid"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment