PageRenderTime 48ms CodeModel.GetById 28ms RepoModel.GetById 0ms app.codeStats 0ms

/lib/DDG/Spice/Drinks.pm

https://github.com/aembleton/zeroclickinfo-spice
Perl | 30 lines | 24 code | 6 blank | 0 comment | 4 complexity | 23b29418feb93846a2089e22444a88c6 MD5 | raw file
  1. package DDG::Spice::Drinks;
  2. use DDG::Spice;
  3. triggers any => "drink", "make", "mix", "recipe", "ingredients";
  4. triggers start => "mixing", "making";
  5. spice to => 'http://drinkproject.com/api/?type=json&name=$1&callback={{callback}}';
  6. primary_example_queries "how to mix a tom collins";
  7. secondary_example_queries "mixing 007", "how to make a 1.21 gigawatts";
  8. description "Bartending info";
  9. name "Drinks";
  10. source "Drink Project";
  11. code_url "https://github.com/duckduckgo/zeroclickinfo-spice/blob/master/lib/DDG/Spice/Drinks.pm";
  12. topics "food_and_drink";
  13. category "entertainment";
  14. attribution github => ['https://github.com/mutilator','mutilator'];
  15. handle query_lc => sub {
  16. if (/^((((making|mixing)+|(how\sto\s(make|mix)+)+)+(\s(a|an|the)*)*)|(mixed\s+)*drink(\s+(recipe|mix))*)+\s+(.+)$/) {
  17. return $12 if $12;
  18. }
  19. if (/^(.+)\s+(drink|mixed)\s(drink|mix|recipe|ingredients)$/) {
  20. return $1 if $1;
  21. }
  22. return;
  23. };
  24. 1;