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

Factoids: minor formatting clean-up

This commit is contained in:
Pragmatic Software 2020-06-20 21:37:21 -07:00
parent 20a6485c5d
commit bbbfcbb25a

View File

@ -1387,16 +1387,21 @@ sub handle_action {
} elsif ($self->{factoids}->get_data($channel, $keyword, 'type') eq 'text') { } elsif ($self->{factoids}->get_data($channel, $keyword, 'type') eq 'text') {
# Don't allow user-custom /msg factoids, unless factoid triggered by admin # Don't allow user-custom /msg factoids, unless factoid triggered by admin
if ($action =~ m/^\/msg/i) { if ($action =~ m/^\/msg/i) {
my $admin = $self->{pbot}->{users}->loggedin_admin($context->{from}, "$context->{nick}!$context->{user}\@$context->{host}"); if (not $self->{pbot}->{users}->loggedin_admin($context->{from}, $context->{hostmask})) {
if (not $admin) { $self->{pbot}->{logger}->log("[ABUSE] Bad factoid (starts with /msg): $action\n");
$self->{pbot}->{logger}->log("[ABUSE] Bad factoid (contains /msg): $action\n"); return "You must be an admin to use /msg.";
return "You must be an admin to use /msg in a factoid.";
} }
} }
if ($ref_from) { if ($ref_from) {
if ($action =~ s/^\/say\s+/$ref_from/i || $action =~ s/^\/me\s+(.*)/\/me $1 $ref_from/i || $action =~ s/^\/msg\s+([^ ]+)/\/msg $1 $ref_from/i) { return $action; } if ( $action =~ s/^\/say\s+/$ref_from/i
else { return $ref_from . "$trigger_name is $action"; } || $action =~ s/^\/me\s+(.*)/\/me $1 $ref_from/i
|| $action =~ s/^\/msg\s+([^ ]+)/\/msg $1 $ref_from/i
) {
return $action;
} else {
return $ref_from . "$trigger_name is $action";
}
} else { } else {
if ($action =~ m/^\/(?:say|me|msg)/i) { return $action; } if ($action =~ m/^\/(?:say|me|msg)/i) { return $action; }
else { return "/say $trigger_name is $action"; } else { return "/say $trigger_name is $action"; }