Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mhrubel/2b9e1440cedd97a84e1d8f90f25feec2 to your computer and use it in GitHub Desktop.
Save mhrubel/2b9e1440cedd97a84e1d8f90f25feec2 to your computer and use it in GitHub Desktop.
<?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