1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-12-22 21:40:08 +00:00

Adding /me

This commit is contained in:
Tim Düsterhus 2011-12-27 14:32:28 +01:00
parent cfa7ce79a9
commit 6046e40cc2
3 changed files with 47 additions and 7 deletions

View File

@ -32,6 +32,17 @@ public function isCommand($text = null) {
return StringUtil::substring($text, 0, StringUtil::length(static::COMMAND_CHAR)) == static::COMMAND_CHAR;
}
/**
* Returns the parameter-string.
*
* @return string
*/
public function getParameters() {
$parts = explode(' ', StringUtil::substring($this->text, StringUtil::length(static::COMMAND_CHAR)), 2);
return $parts[1];
}
/**
* Loads the command.
*/

View File

@ -10,14 +10,13 @@
* @package timwolla.wcf.chat
* @subpackage system.chat.commands.commands
*/
class Free extends \wcf\system\chat\commands\AbstractCommand {
const ENABLE_SMILIES = \wcf\system\chat\commands\ICommand::SMILEY_USER;
public function getType() {
return \wcf\data\chat\message\ChatMessage::TYPE_ME;
}
class Free extends Me {
const ENABLE_SMILIES = \wcf\system\chat\commands\ICommand::SMILEY_OFF;
/**
* @see \wcf\system\chat\commands\ICommand::getMessage()
*/
public function getMessage() {
return 'freed the fish';
return 'freed the fish. OH A NOEZ';
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace wcf\system\chat\commands\commands;
use \wcf\util\StringUtil;
/**
* Indicates an action. The message is shown without the colon.
*
* @author Tim Düsterhus
* @copyright 2010-2011 Tim Düsterhus
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
* @package timwolla.wcf.chat
* @subpackage system.chat.commands.commands
*/
class Me extends \wcf\system\chat\commands\AbstractCommand {
const ENABLE_SMILIES = \wcf\system\chat\commands\ICommand::SMILEY_USER;
/**
* @see \wcf\system\chat\commands\ICommand::getType()
*/
public function getType() {
return \wcf\data\chat\message\ChatMessage::TYPE_ME;
}
/**
* @see \wcf\system\chat\commands\ICommand::getMessage()
*/
public function getMessage() {
return$this->commandHandler->getParameters();
}
}