mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-10-31 14:10:08 +00:00
Fix aliasing
This commit is contained in:
parent
8ccefdb971
commit
38b29303d8
@ -42,8 +42,10 @@ public function __construct($text, \chat\data\room\Room $room = null) {
|
||||
|
||||
$aliases = self::getAliasMap();
|
||||
foreach ($aliases as $search => $replace) {
|
||||
$this->text = \wcf\system\Regex::compile('^'.preg_quote($search))->replace($this->text, $replace);
|
||||
$this->text = \wcf\system\Regex::compile('^'.preg_quote(self::COMMAND_CHAR.$search).'( |$)')->replace($this->text, self::COMMAND_CHAR.$replace.' ');
|
||||
}
|
||||
|
||||
$this->text = \wcf\system\Regex::compile('^//')->replace($this->text, '/plain ');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -107,10 +109,6 @@ public function getParameters() {
|
||||
public function loadCommand() {
|
||||
$parts = explode(' ', StringUtil::substring($this->text, StringUtil::length(static::COMMAND_CHAR)), 2);
|
||||
|
||||
if ($this->isCommand($parts[0])) {
|
||||
return new commands\PlainCommand($this);
|
||||
}
|
||||
|
||||
$class = '\chat\system\command\commands\\'.ucfirst(strtolower($parts[0])).'Command';
|
||||
if (!class_exists($class)) {
|
||||
throw new NotFoundException();
|
||||
|
@ -24,7 +24,7 @@ public function getType() {
|
||||
* @see \chat\system\command\ICommand::getMessage()
|
||||
*/
|
||||
public function getMessage() {
|
||||
return \wcf\system\bbcode\PreParser::getInstance()->parse(\wcf\util\StringUtil::substring($this->commandHandler->getText(), 1), explode(',', \wcf\system\WCF::getSession()->getPermission('user.chat.allowedBBCodes')));
|
||||
return \wcf\system\bbcode\PreParser::getInstance()->parse(\chat\system\command\CommandHandler::COMMAND_CHAR.$this->commandHandler->getParameters(), explode(',', \wcf\system\WCF::getSession()->getPermission('user.chat.allowedBBCodes')));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user