/lib/DDG/Spice/DuckSay.pm

https://github.com/pardocz/zeroclickinfo-spice · Perl · 30 lines · 23 code · 6 blank · 1 comment · 1 complexity · c2d7abc1259f9800df3d4bb650488b39 MD5 · raw file

  1. package DDG::Spice::DuckSay;
  2. use DDG::Spice;
  3. name 'DuckSay';
  4. description 'Like cowsay, but with ducks';
  5. primary_example_queries 'ducksay', 'daxsays';
  6. secondary_example_queries 'ducksay quack!', 'daxsays quack!';
  7. source 'Reddit /r/jokes';
  8. category 'entertainment';
  9. topics 'geek', 'words_and_games', 'entertainment';
  10. code_url 'https://github.com/duckduckgo/zeroclickinfo-spice/blob/master/lib/DDG/Spice/DuckSay.pm';
  11. attribution github => ['https://github.com/csytan', 'Chris Tan'];
  12. triggers start => 'ducksay', 'daxsays';
  13. spice is_unsafe => 1;
  14. spice to => 'http://www.reddit.com/r/Jokes/search.json?q=selftext%3Aduck&restrict_sr=on&sort=hot&t=all&jsonp={{callback}}';
  15. handle remainder => sub {
  16. spice call_type => 'include';
  17. if ($_ ne '') {
  18. # Skip calling reddit's API if text is given
  19. spice call_type => 'self';
  20. return call;
  21. }
  22. return $_;
  23. };
  24. 1;