mirror of
https://github.com/pragma-/pbot.git
synced 2025-02-16 21:40:46 +01:00
eventqueue
command now accepts -repeat
flag
This commit is contained in:
parent
e193fc734f
commit
d69682efc1
@ -958,7 +958,7 @@ sub add_message_to_output_queue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub add_to_command_queue {
|
sub add_to_command_queue {
|
||||||
my ($self, $channel, $command, $delay) = @_;
|
my ($self, $channel, $command, $delay, $repeating) = @_;
|
||||||
|
|
||||||
$self->{pbot}->{timer}->enqueue_event(
|
$self->{pbot}->{timer}->enqueue_event(
|
||||||
sub {
|
sub {
|
||||||
@ -982,7 +982,7 @@ sub add_to_command_queue {
|
|||||||
$stuff->{result} = $result;
|
$stuff->{result} = $result;
|
||||||
$self->handle_result($stuff, $result);
|
$self->handle_result($stuff, $result);
|
||||||
},
|
},
|
||||||
$delay, "command $channel $command->{command}"
|
$delay, "command $channel $command->{command}", $repeating
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,6 +100,9 @@ sub event_queue_cmd {
|
|||||||
my ($delay, $error) = $self->{pbot}->{parsedate}->parsedate($duration);
|
my ($delay, $error) = $self->{pbot}->{parsedate}->parsedate($duration);
|
||||||
return $error if defined $error;
|
return $error if defined $error;
|
||||||
|
|
||||||
|
my $repeating = 0;
|
||||||
|
$repeating = 1 if $command =~ s/^-repeat\s+|\s+-repeat$//g;
|
||||||
|
|
||||||
my $cmd = {
|
my $cmd = {
|
||||||
nick => $nick,
|
nick => $nick,
|
||||||
user => $user,
|
user => $user,
|
||||||
@ -107,7 +110,7 @@ sub event_queue_cmd {
|
|||||||
command => $command,
|
command => $command,
|
||||||
};
|
};
|
||||||
|
|
||||||
$self->{pbot}->{interpreter}->add_to_command_queue($from, $cmd, $delay);
|
$self->{pbot}->{interpreter}->add_to_command_queue($from, $cmd, $delay, $repeating);
|
||||||
return "Command added to event queue.";
|
return "Command added to event queue.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -549,7 +549,7 @@ Name | Description
|
|||||||
PBot uses an event queue to schedule future tasks or commands. The `eventqueue` command can
|
PBot uses an event queue to schedule future tasks or commands. The `eventqueue` command can
|
||||||
be used to list or remove upcoming events. It can also be used to schedule a command.
|
be used to list or remove upcoming events. It can also be used to schedule a command.
|
||||||
|
|
||||||
Usage: `eventqueue list [filter regex] | add <relative time> <command> | remove <event>`
|
Usage: `eventqueue list [filter regex] | add <relative time> <command> [-repeat] | remove <event>`
|
||||||
|
|
||||||
For example, to schedule a command to run 1 hour from now:
|
For example, to schedule a command to run 1 hour from now:
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user