mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-10-31 14:10:08 +00:00
parent
c5102d63a9
commit
098f048e29
@ -146,6 +146,9 @@ public function readCommands() {
|
||||
if ($command == 'Plain') continue;
|
||||
$this->commands[] = \wcf\util\StringUtil::toLowerCase($command);
|
||||
}
|
||||
|
||||
$this->commands = array_merge($this->commands, array_keys(\chat\system\command\CommandHandler::getAliasMap()));
|
||||
sort($this->commands);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -41,6 +41,22 @@ public function __construct($text, \chat\data\room\Room $room = null) {
|
||||
$this->room = $room;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the alias map. Key is the alias, value is the target.
|
||||
*
|
||||
* @return array<string>
|
||||
*/
|
||||
public static function getAliasMap() {
|
||||
$result = array();
|
||||
foreach (explode("\n", StringUtil::unifyNewlines(StringUtil::toLowerCase(CHAT_COMMAND_ALIASES))) as $line) {
|
||||
list($key, $val) = explode(':', $line, 2);
|
||||
|
||||
$result[$key] = $val;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the given text is a command.
|
||||
*/
|
||||
@ -90,6 +106,9 @@ public function loadCommand() {
|
||||
return new commands\PlainCommand($this);
|
||||
}
|
||||
|
||||
$aliases = self::getAliasMap();
|
||||
if (isset($aliases[$parts[0]])) $parts[0] = $aliases[$parts[0]];
|
||||
|
||||
$class = '\chat\system\command\commands\\'.ucfirst(strtolower($parts[0])).'Command';
|
||||
if (!class_exists($class)) {
|
||||
throw new NotFoundException();
|
||||
|
@ -44,10 +44,12 @@
|
||||
<minvalue>1</minvalue>
|
||||
<maxvalue>5000</maxvalue>
|
||||
</option>
|
||||
<option name="chat_show_version">
|
||||
<option name="chat_command_aliases">
|
||||
<categoryname>chat.general</categoryname>
|
||||
<optiontype>boolean</optiontype>
|
||||
<defaultvalue>1</defaultvalue>
|
||||
<optiontype>textarea</optiontype>
|
||||
<defaultvalue>afk:away
|
||||
col:color
|
||||
msg:whisper</defaultvalue>
|
||||
</option>
|
||||
<!-- general chat options end -->
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<packagedescription><![CDATA[Chat for WoltLab Community Framework™.]]></packagedescription>
|
||||
<packagedescription language="de"><![CDATA[Chat für WoltLab Community Framework™.]]></packagedescription>
|
||||
<isapplication>1</isapplication>
|
||||
<version>3.0.0 Alpha 56</version><!-- Codename: Codenames are overrated -->
|
||||
<version>3.0.0 Alpha 58</version><!-- Codename: Codenames are overrated -->
|
||||
<date>2011-11-26</date>
|
||||
<license><![CDATA[Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>]]></license>
|
||||
</packageinformation>
|
||||
|
Loading…
Reference in New Issue
Block a user