method for success message to admins

This commit is contained in:
Steffen Schröder 2014-07-25 15:16:41 +02:00
parent e402dcdd87
commit fba9258377

View File

@ -116,15 +116,16 @@ class Chat {
} }
/** /**
* Sends a Message to all Connected Admins * Send a Message to all connected Admins
* *
* @param string $message * @param string $message
* @param int $minLevel * @param int $minLevel
* @param bool|string $prefix * @param bool|string $prefix
* @return bool
*/ */
public function sendMessageToAdmins($message, $minLevel = AuthenticationManager::AUTH_LEVEL_MODERATOR, $prefix = true) { public function sendMessageToAdmins($message, $minLevel = AuthenticationManager::AUTH_LEVEL_MODERATOR, $prefix = true) {
$admins = $this->maniaControl->authenticationManager->getConnectedAdmins($minLevel); $admins = $this->maniaControl->authenticationManager->getConnectedAdmins($minLevel);
$this->sendChat($message, $admins, $prefix); return $this->sendChat($message, $admins, $prefix);
} }
/** /**
@ -140,6 +141,19 @@ class Chat {
return $this->sendChat($format . $message, $login, $prefix); return $this->sendChat($format . $message, $login, $prefix);
} }
/**
* Sends a Success Message to all connected Admins
*
* @param string $message
* @param int $minLevel
* @param bool|string $prefix
* @return bool
*/
public function sendSuccessToAdmins($message, $minLevel = AuthenticationManager::AUTH_LEVEL_MODERATOR, $prefix = true) {
$format = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_FORMAT_SUCCESS);
return $this->sendMessageToAdmins($format . $message, $minLevel, $prefix);
}
/** /**
* Send the Exception Information to the Chat * Send the Exception Information to the Chat
* *
@ -172,7 +186,8 @@ class Chat {
* @param int $minLevel * @param int $minLevel
* @param bool|string $prefix * @param bool|string $prefix
*/ */
public function sendExceptionToAdmins(\Exception $exception, $minLevel = AuthenticationManager::AUTH_LEVEL_MODERATOR, $prefix = true) { public function sendExceptionToAdmins(\Exception $exception, $minLevel = AuthenticationManager::AUTH_LEVEL_MODERATOR,
$prefix = true) {
$format = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_FORMAT_ERROR); $format = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_FORMAT_ERROR);
$message = $format . "Exception: '{$exception->getMessage()}' ({$exception->getCode()})"; $message = $format . "Exception: '{$exception->getMessage()}' ({$exception->getCode()})";
$this->sendMessageToAdmins($message, $minLevel, $prefix); $this->sendMessageToAdmins($message, $minLevel, $prefix);