-
-
Save zoffixznet/9238fc5e80b421d7534bbae3b77e4463 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use lib < | |
/home/zoffix/CPANPRC/IRC-Client/lib | |
/home/zoffix/services/lib/IRC-Client/lib | |
lib | |
>; | |
use IRC::Client; | |
use IRC::Client::Plugin::HNY; | |
.run with IRC::Client.new: | |
:host(%*ENV<HNY_HOST> // 'irc.freenode.net') | |
:nick<HNYBot> | |
:channels<#perl6 #zofbot> | |
:debug | |
:plugins[ | |
IRC::Client::Plugin::HNY.new, | |
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use IRC::Client; | |
unit class IRC::Client::Plugin::HNY is IRC::Client::Plugin; | |
my \term:<☃> = DateTime.new(year => .year + (1 if .month >= 6)).utc.Instant | |
given DateTime.new(:year(2016), :month(12)).utc; | |
use WWW::Google::Time; | |
use Number::Denominate; | |
method irc-to-me ($ where /:i ^\s* 'hny' \s+ $<where>=.+ /) { | |
my %info = google-time-in ~$<where> | |
or return 'Never heard of that place…'; | |
my \Δ = round ☃ - %info<DateTime>.Instant; | |
Δ <= 0 | |
?? "New Year already happened in %info<where> &denominate(Δ) ago" | |
!! "New Year will happen in %info<where> in &denominate(Δ)"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment