3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-10-01 17:16:39 +02: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') {
# Don't allow user-custom /msg factoids, unless factoid triggered by admin
if ($action =~ m/^\/msg/i) {
my $admin = $self->{pbot}->{users}->loggedin_admin($context->{from}, "$context->{nick}!$context->{user}\@$context->{host}");
if (not $admin) {
$self->{pbot}->{logger}->log("[ABUSE] Bad factoid (contains /msg): $action\n");
return "You must be an admin to use /msg in a factoid.";
if (not $self->{pbot}->{users}->loggedin_admin($context->{from}, $context->{hostmask})) {
$self->{pbot}->{logger}->log("[ABUSE] Bad factoid (starts with /msg): $action\n");
return "You must be an admin to use /msg.";
}
}
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; }
else { return $ref_from . "$trigger_name is $action"; }
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;
} else {
return $ref_from . "$trigger_name is $action";
}
} else {
if ($action =~ m/^\/(?:say|me|msg)/i) { return $action; }
else { return "/say $trigger_name is $action"; }