Added in line comments

This commit is contained in:
Derek McDaniel 2017-02-21 18:52:07 -05:00
parent a7bf5c32b0
commit 5dd8a46d20
2 changed files with 40 additions and 10 deletions

View File

@ -22,18 +22,28 @@ class Plugin extends \Mibew\Plugin\AbstractPlugin implements \Mibew\Plugin\Plugi
// Use autoloader for Composer's packages that shipped with the plugin // Use autoloader for Composer's packages that shipped with the plugin
require(__DIR__ . '/vendor/autoload.php'); require(__DIR__ . '/vendor/autoload.php');
} }
/**
* Initializer
* @return boolean
*/
public function initialized() public function initialized()
{ {
return true; return true;
} }
/**
* This creates the listener that listens for new
* threads to send out slack notifications
*/
public function run() public function run()
{ {
$dispatcher = EventDispatcher::getInstance(); $dispatcher = EventDispatcher::getInstance();
$dispatcher->attachListener(Events::THREAD_CREATE, $this, 'sendSlackNotification'); $dispatcher->attachListener(Events::THREAD_CREATE, $this, 'sendSlackNotification');
} }
/**
* Sends notification to slack.
* Sends the date with the username as well
* @return boolean
*/
public function sendSlackNotification(&$args) public function sendSlackNotification(&$args)
{ {
$settings = [ $settings = [
@ -46,6 +56,8 @@ class Plugin extends \Mibew\Plugin\AbstractPlugin implements \Mibew\Plugin\Plugi
$client->send(date('Y-m-d H:i:s') . ' - You have a new user waiting for a response. Username: ' . $args['thread']->userName); $client->send(date('Y-m-d H:i:s') . ' - You have a new user waiting for a response. Username: ' . $args['thread']->userName);
return true;
} }
/** /**

View File

@ -2,15 +2,33 @@
"version": "1.0.0", "version": "1.0.0",
"devDependencies": { "devDependencies": {
"event-stream": "~3.1.7", "event-stream": "~3.1.7",
"gulp": "~3.8.10", "gulp": "^3.9.1",
"gulp-chmod": "~1.2.0", "gulp-chmod": "~1.2.0",
"gulp-composer": "^0.4.0", "gulp-composer": "*",
"gulp-gzip": "~0.0.8", "gulp-gzip": "~0.0.8",
"gulp-rename": "~1.2.0", "gulp-rename": "~1.2.0",
"gulp-tar": "~1.3.1", "gulp-tar": "~1.3.1",
"gulp-zip": "~2.0.2", "gulp-util": "*",
"gulp-composer":"*", "gulp-zip": "~2.0.2"
"gulp-util": "*" },
"name": "mibew_slack",
} "description": "Provides Slack notifications when initiate a chat",
"main": "gulpfile.js",
"dependencies": {
"gulp": "^3.9.1",
"graceful-fs": "^4.1.11"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/dmcdaniel12/mibew_slack.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/dmcdaniel12/mibew_slack/issues"
},
"homepage": "https://github.com/dmcdaniel12/mibew_slack#readme"
} }