3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-10-04 18:38:47 +02:00

Plugins/RemindMe: ensure option -c is in channel format

This commit is contained in:
Pragmatic Software 2021-07-09 13:52:08 -07:00
parent 77420ae20b
commit 1158c36ce1

View File

@ -196,6 +196,11 @@ sub cmd_remindme {
return "Please use -t to specify a time for this reminder." if not $time;
return "Please specify a reminder message." if not $text;
# ensure option -c is a channel
if (defined $channel and $channel !~ /^#/) {
return "Option -c must be a channel.";
}
# option -c was provided; ensure bot is in channel
if ($channel and not $self->{pbot}->{channels}->is_active($channel)) {
return "I'm not active in channel $channel.";
@ -290,7 +295,7 @@ sub do_reminder {
}
# send reminder text to person
my $target = $reminder->{channel} // $nick;
my $target = $reminder->{channel} || $nick;
my $text = $reminder->{text};
# if sending reminder to channel, highlight person being reminded