3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-19 10:29:30 +01:00

Add $channel special variable for factoids/modules that expands to $from parameter

This commit is contained in:
Pragmatic Software 2014-03-04 21:40:13 +00:00
parent 2a4c1bafd1
commit 921c9917a5
4 changed files with 4 additions and 2 deletions

View File

@ -60,6 +60,7 @@ sub execute_module {
$self->{pbot}->logger->log("(" . (defined $from ? $from : "(undef)") . "): $nick!$user\@$host: Executing module $module $arguments\n");
$arguments =~ s/\$nick/$nick/g;
$arguments =~ s/\$channel/$from/g;
$arguments = quotemeta($arguments);
$arguments =~ s/\\\s/ /g;

View File

@ -455,6 +455,7 @@ sub interpreter {
$self->{pbot}->logger->log("(" . (defined $from ? $from : "(undef)") . "): $nick!$user\@$host): $keyword: Displaying text \"" . $result . "\"\n");
$result =~ s/\$nick/$nick/g;
$result =~ s/\$channel/$from/g;
while ($result =~ /[^\\]\$([a-zA-Z0-9_\-]+)/g) {
#$self->{pbot}->logger->log("adlib: looking for [$1]\n");

View File

@ -135,7 +135,7 @@ sub process_line {
if(defined $has_url) {
$result = $self->{pbot}->factoids->{factoidmodulelauncher}->execute_module($from, undef, $nick, $user, $host, "title", "$nick http://$has_url");
} elsif(defined $has_code) {
$result = $self->{pbot}->factoids->{factoidmodulelauncher}->execute_module($from, undef, $nick, $user, $host, "compiler_block", (defined $nick_override ? $nick_override : $nick) . " $has_code }");
$result = $self->{pbot}->factoids->{factoidmodulelauncher}->execute_module($from, undef, $nick, $user, $host, "compiler_block", (defined $nick_override ? $nick_override : $nick) . " $from $has_code }");
} else {
$result = $self->interpret($from, $nick, $user, $host, 1, $command);
}

View File

@ -13,7 +13,7 @@ use warnings;
# These are set automatically by the build/commit script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 501,
BUILD_REVISION => 502,
BUILD_DATE => "2014-03-04",
};