Created
September 3, 2012 11:05
-
-
Save KamilaBorowska/3608585 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 JSON::Tiny; | |
class Net::IRC::Modules::Factoids { | |
has $.file; | |
has %!content = try { from-json slurp $.file } // {}; | |
multi method said ( $ev where {.what ~~ / ^ \! add \s+ (\w+) \s* (.+) $ /} ) { | |
%!content{$0} = ~$1; | |
self!save; | |
} | |
multi method said ( $ev where {.what ~~ / ^ \! (\w+) /}) { | |
if %!content{$0} { | |
$ev.msg("{$ev.who}: %!content{$0}") | |
} | |
} | |
method !save { | |
spurt $.file, to-json %!content; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment