mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-25 04:02:37 +01:00
Minor improvement to nick addressing
This commit is contained in:
parent
320c8a4f92
commit
51735494b3
@ -877,13 +877,16 @@ sub handle_action {
|
|||||||
$action = $self->expand_action_arguments($action, $stuff->{arguments}, $stuff->{nick});
|
$action = $self->expand_action_arguments($action, $stuff->{arguments}, $stuff->{nick});
|
||||||
}
|
}
|
||||||
$stuff->{arguments} = "";
|
$stuff->{arguments} = "";
|
||||||
|
delete $stuff->{nickoverride} unless $stuff->{force_nickoverride};
|
||||||
} else {
|
} else {
|
||||||
if ($self->{factoids}->hash->{$channel}->{$keyword}->{type} eq 'text') {
|
if ($self->{factoids}->hash->{$channel}->{$keyword}->{type} eq 'text') {
|
||||||
my $target = $self->{pbot}->{nicklist}->is_present_similar($stuff->{from}, $stuff->{arguments});
|
my $target = $self->{pbot}->{nicklist}->is_present_similar($stuff->{from}, $stuff->{arguments});
|
||||||
|
|
||||||
|
|
||||||
if ($target and $action !~ /\$(?:nick|args)\b/) {
|
if ($target and $action !~ /\$(?:nick|args)\b/) {
|
||||||
$stuff->{nickoverride} = $target;
|
$stuff->{nickoverride} = $target unless $stuff->{force_nickoverride};
|
||||||
|
} else {
|
||||||
|
delete $stuff->{nickoverride} unless $stuff->{force_nickoverride};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -230,16 +230,18 @@ sub interpret {
|
|||||||
my $similar = $self->{pbot}->{nicklist}->is_present_similar($stuff->{from}, $stuff->{nickoverride});
|
my $similar = $self->{pbot}->{nicklist}->is_present_similar($stuff->{from}, $stuff->{nickoverride});
|
||||||
if ($similar) {
|
if ($similar) {
|
||||||
$stuff->{nickoverride} = $similar;
|
$stuff->{nickoverride} = $similar;
|
||||||
|
$stuff->{force_nickoverride} = 1;
|
||||||
} else {
|
} else {
|
||||||
$stuff->{nickoverride} = undef;
|
delete $stuff->{nickoverride};
|
||||||
}
|
}
|
||||||
} elsif ($stuff->{command} =~ /^tell\s+(\p{PosixGraph}{1,20})\s+about\s+(.*)$/is) {
|
} elsif ($stuff->{command} =~ /^tell\s+(\p{PosixGraph}{1,20})\s+about\s+(.*)$/is) {
|
||||||
($keyword, $stuff->{nickoverride}) = ($2, $1);
|
($keyword, $stuff->{nickoverride}) = ($2, $1);
|
||||||
my $similar = $self->{pbot}->{nicklist}->is_present_similar($stuff->{from}, $stuff->{nickoverride});
|
my $similar = $self->{pbot}->{nicklist}->is_present_similar($stuff->{from}, $stuff->{nickoverride});
|
||||||
if ($similar) {
|
if ($similar) {
|
||||||
$stuff->{nickoverride} = $similar;
|
$stuff->{nickoverride} = $similar;
|
||||||
|
$stuff->{force_nickoverride} = 1;
|
||||||
} else {
|
} else {
|
||||||
$stuff->{nickoverride} = undef;
|
delete $stuff->{nickoverride};
|
||||||
}
|
}
|
||||||
} elsif ($stuff->{command} =~ /^(.*?)\s+(.*)$/s) {
|
} elsif ($stuff->{command} =~ /^(.*?)\s+(.*)$/s) {
|
||||||
($keyword, $arguments) = ($1, $2);
|
($keyword, $arguments) = ($1, $2);
|
||||||
|
Loading…
Reference in New Issue
Block a user