Skip to content

Commit

Permalink
Merge pull request dmcdaniel12#11 from faf/master
Browse files Browse the repository at this point in the history
Improve localization
  • Loading branch information
dmcdaniel12 committed Feb 27, 2017
2 parents 701e9a4 + 0dfc8a3 commit 1782bd5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
31 changes: 15 additions & 16 deletions Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,28 @@ public function __construct($config)
// Use autoloader for Composer's packages that shipped with the plugin
require(__DIR__ . '/vendor/autoload.php');
}
/**
* Initializer
* @return boolean
*/
/**
* Initializer
* @return boolean
*/
public function initialized()
{
return true;
}
/**
* This creates the listener that listens for new
* threads to send out slack notifications
*/
/**
* This creates the listener that listens for new
* threads to send out slack notifications
*/
public function run()
{
$dispatcher = EventDispatcher::getInstance();
$dispatcher->attachListener(Events::THREAD_CREATE, $this, 'sendSlackNotification');
}
/**
* Sends notification to slack.
* Sends the date with the username as well
* @return boolean
*/
/**
* Sends notification to slack.
* Sends the date with the username as well
* @return boolean
*/
public function sendSlackNotification(&$args)
{
$settings = [
Expand All @@ -54,10 +54,9 @@ public function sendSlackNotification(&$args)

$client = new Client($this->config['slack_url'], $settings);

$client->send(getlocal('You have a new user waiting for a response. Username: {0}', array($args['thread']->userName)));

$client->send(getlocal('You have a new message waiting for you!'));

return true;
return true;
}

/**
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ Provides Slack notifications when initiate a chat
```yaml
plugins:
"Mibew:Slack": # Plugin's configurations are described below
username: "Username you will post as"
channel: "Channel to post in"
slack_url: "Webhook URL from Setup Instructions in Slack"

username: "Username you will post as"
channel: "Channel to post in"
slack_url: "Webhook URL from Setup Instructions in Slack"
```
Expand Down

0 comments on commit 1782bd5

Please sign in to comment.