From 863390144bfaaeae445b911b16c862c4da235b62 Mon Sep 17 00:00:00 2001 From: William Phillips Date: Fri, 31 Jul 2020 22:03:00 +0100 Subject: [PATCH] Formatting adjustment. --- README.md | 51 +++++++++++++- .../hooks/WHMCS-Discord-Notifications.php | 69 ++++++++++++------- 2 files changed, 93 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 19661d8..1a4de38 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,49 @@ -# WHMCS-Discord-Notifications -A hook to push WHMCS notifications to a Discord channel. +# WHMCS Discord Notification Hook +Want instant Discord notifications? Need to know when you've received a ticket reply without waiting for emails to give you a notification? This hook will allow just that! It's **free**, open-source and customisable - offering a range of instant notifications within your Discord server. + +# Brought To You For Free By +## PrimeNodes.com - Premium Infrastructure Provider +PrimeNodes offers a range of high-performance **Intel Core** and **AMD Ryzen** bare metal dedicated servers featuring **Corero DDoS mitigation**, ultra-low-latency global networking and remote administration tools as standard! Other service offerings include **CloudLinux** and **LiteSpeed** based web hosting, DDoS protected London colocation and i7 powered hybrid servers. + +[Visit Website Now!](https://www.primenodes.com) + +## Installation Instructions +1. Download a free copy of this github repo or release version; you should end up with a `.zip` file. +2. Extract the file, upload the `includes` folder within the zip to your base WHMCS directory (we'd recommend doing so on a development environment first). +3. Open up the file you have just uploaded, which will be within the `includes/hooks` directory. The full path is `includes/hooks/WHMCS-Discord-Notifications.php` +4. Modify lines `11-41` to enter your Discord configuration. Comments are provided below each option to assist you in understanding what data is needed for each. +5. Modify lines `42-74` to your liking to enable or disable which notifications are sent by the hook to your Discord server. +6. Give it a test! Check to make sure it sends through to the channel configured within your Discord server, if it doesn't work, double check your config options! **Enjoy!** + +## Configuration Options +* Set a specific rank depending on the notification type to get pinged to deal with it. +* Automatically generated link to instantly navigate to the page the notification is relating to. +* Configurable name of the bot sending messages. +* Configurable avatar profile image (allowing the same webhook to be used by multiple installs). +* Configurable message colours. + +## Notification Types +### Ticket Notifications +* New Ticket Opened +* New Ticket Reply Received +* New Ticket Note +* Ticket Flagged To Staff Member + +### Invoice Notifications +* Invoice Payment Received +* Invoice Refunded +* Invoice Late Fee Added + +### Order Notifications +* Order Accepted +* Order Marked As Fraudulent +* Order Cancelled +* Order Cancelled and Refunded + +### Network Issue Notifications +* New Network Issue +* Network Issue Modified +* Network Issue Closed + +### Misc Notifications +* Cancellation Request Received \ No newline at end of file diff --git a/includes/hooks/WHMCS-Discord-Notifications.php b/includes/hooks/WHMCS-Discord-Notifications.php index ea3aaab..3dc27a9 100644 --- a/includes/hooks/WHMCS-Discord-Notifications.php +++ b/includes/hooks/WHMCS-Discord-Notifications.php @@ -1,11 +1,21 @@ +// Discord Avatar Dynamic Image $GLOBALS['discordWebHookAvatar'] = ""; -// (OPTIONAL SETTING) Your desired Webhook Avatar. Please make sure you enter a direct link to the image (E.G. https://example.com/iownpaypal.png). +// (OPTIONAL SETTING) Your desired Webhook Avatar. Please make sure you enter a direct link to the image (E.G. https://example.com/iownpaypal.png ). +/////////////////////////////////////////////////////////////////////// ////////////////////////// Notification Area ////////////////////////// -// Configure the below notification settings to meet the requirements of your team and what you wish to send to the Discord channel. 'true' = enabled, 'false' = disabled - -// Invoice Notifications -$invoicePaid = false; // Invoice Paid Notification -$invoiceRefunded = false; // Invoice Refunded Notification -$invoiceLateFee = false; // Invoice Late Fee Notification - -// Order Notifications -$orderAccepted = false; // Order Accepted Notification -$orderCancelled = false; // Order Cancelled Notification -$orderCancelledRefunded = false; // Order Cancelled & Refunded Notification -$orderFraud = false; // Order Marked As Fraud Notification - -// Network Issue Notifications -$networkIssueAdd = true; // New Network Issue Added Notification -$networkIssueEdit = true; // Network Issue Edited Notification -$networkIssueClosed = true; // Network Issue Closed Notification +/////////////////////////////////////////////////////////////////////// +// Configure the below notification settings to meet the requirements of your team and what you wish to send to the Discord channel. +// true = Notification enabled. +// false = Notification disabled. // Ticket Notifications -$ticketOpened = true; // New Ticket Opened Notification -$ticketUserReply = true; // Ticket User Reply Received Notification -$ticketFlagged = true; // Ticket Flagged To Staff Member Notification -$ticketNewNote = true; // New Note Added To Ticket Notification +$ticketOpened = true; // New Ticket Opened Notification +$ticketUserReply = true; // Ticket User Reply Received Notification +$ticketFlagged = true; // Ticket Flagged To Staff Member Notification +$ticketNewNote = true; // New Note Added To Ticket Notification + +// Invoice Notifications +$invoicePaid = false; // Invoice Paid Notification +$invoiceRefunded = false; // Invoice Refunded Notification +$invoiceLateFee = false; // Invoice Late Fee Notification + +// Order Notifications +$orderAccepted = false; // Order Accepted Notification +$orderCancelled = false; // Order Cancelled Notification +$orderCancelledRefunded = false; // Order Cancelled & Refunded Notification +$orderFraud = false; // Order Marked As Fraud Notification + +// Network Issue Notifications +$networkIssueAdd = true; // New Network Issue Added Notification +$networkIssueEdit = true; // Network Issue Edited Notification +$networkIssueClosed = true; // Network Issue Closed Notification // Miscellaneous Notifications -$cancellationRequest = false; // New Cancellation Request Received Notification +$cancellationRequest = false; // New Cancellation Request Received Notification + + +/////////////////////////////////////////////////////////////////////// +//////// Don't edit below unless you know what you're doing. /////// /////////////////////////////////////////////////////////////////////// if($invoicePaid === true):