PageRenderTime 3ms CodeModel.GetById 41ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 1ms

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