public function handleChatCommand(Channel $channel, IRCMessage $msg) {
$cmd = explode(' ', ltrim($msg->getText(), '!'), 2);
- if (!isset($channel->chat_commands[$cmd[0]])) return;
- $config = $channel->chat_commands[$cmd[0]];
- $this->getLogger()->info('got command '.$cmd[0].' on channel '.$channel->title);
+ $cmd_name = strtolower($cmd[0]);
+ if (!isset($channel->chat_commands[$cmd_name])) return;
+ $config = $channel->chat_commands[$cmd_name];
+ $this->getLogger()->info('got command '.$cmd_name.' on channel '.$channel->title);
try {
$command = ChatCommand::create($this, $channel, $config);
if ($command->checkAccess($msg)) {
$command->execute($cmd[1] ?? '');
}
} catch (\Exception $e) {
- $this->getLogger()->warning('error executing command '.$cmd[0].' on channel '.$channel->title.': '.$e->getMessage());
+ $this->getLogger()->warning('error executing command '.$cmd_name.' on channel '.$channel->title.': '.$e->getMessage());
}
}