aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorZoffix Znet <cpan@zoffix.com>2016-01-03 14:43:40 -0500
committerZoffix Znet <cpan@zoffix.com>2016-01-03 14:43:40 -0500
commit9fd5da692c91ce1faceef70344fc900689098d68 (patch)
tree434720abd0a3ba46efffbd255abfc0be8507e890 /lib
parent0dc32d88908bbbe29d47316281fe66c2529f1afe (diff)
Add $when argument to .respond
Diffstat (limited to 'lib')
-rw-r--r--lib/IRC/Client.pm610
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/IRC/Client.pm6 b/lib/IRC/Client.pm6
index 41bb45d..63a7e98 100644
--- a/lib/IRC/Client.pm6
+++ b/lib/IRC/Client.pm6
@@ -91,13 +91,21 @@ method respond (
Str:D :$where is required,
Str:D :$what is required is copy,
Str:D :$who,
+ :$when where Dateish|Instant;
) {
$what = "$who, $what" if $who and $where ~~ /^<[#&]>/;
my $method = $how.fc eq 'PRIVMSG'.fc ?? 'privmsg'
!! $how.fc eq 'NOTICE'.fc ?? 'notice'
!! fail 'Unknown :$how specified. Use PRIVMSG or NOTICE';
- self."$method"($where, $what);
+ if $when {
+ Promise.at($when).then: { self."$method"($where, $what) };
+ CATCH { warn .backtrace }
+ }
+ else {
+ self."$method"($where, $what);
+ }
+ self;
}
method run {