# looks like a command, at least started with a question mark
# find out if it really is one
-
if (is_valid_command($command)) {
return ($command, $string);
}
# try to translate the command
# find the channel language
my $channel_language = config_get_key3('channels', $channel, 'language');
- # not defined channel language leads to a full search across all languages
+ # not defined channel language triggers a full search across all languages
# this is just fine
my $translation = find_translation($channel_language, $command);
}
}
+ if (!is_a_channel($channel)) {
+ # go the extra mile and identify commands in private messages to the bot
+ if ($msg =~ /^\s*([a-z]+)\s*(.*)/) {
+ $command = lc($1);
+ $string = defined($2) ? $2 : '';
+
+ # find out if it a command
+ if (is_valid_command($command)) {
+ return ($command, $string);
+ }
+
+ # not defined channel language triggers a full search across all languages
+ # this is just fine
+ my $translation = find_translation(undef, $command);
+ if (defined($translation) and is_valid_command($translation)) {
+ return ($translation, $string);
+ }
+ }
+ }
+
if ($msg =~ /^\s*\?\?(.+)/) {
# a valid search
return ('search', $1);