Created my first Goodie
parent
7bf4db01d6
commit
ed8b4ba70f
|
@ -0,0 +1,34 @@
|
|||
package DDG::Goodie::ChessManual;
|
||||
# ABSTRACT: Write an abstract here
|
||||
# Start at https://duck.co/duckduckhack/goodie_overview if you are new
|
||||
# to instant answer development
|
||||
|
||||
use DDG::Goodie;
|
||||
|
||||
zci answer_type => "chess_manual";
|
||||
zci is_cached => 1;
|
||||
|
||||
# Metadata. See https://duck.co/duckduckhack/metadata for help in filling out this section.
|
||||
name "ChessManual";
|
||||
description "Succinct explanation of what this instant answer does";
|
||||
primary_example_queries "first example query", "second example query";
|
||||
secondary_example_queries "optional -- demonstrate any additional triggers";
|
||||
# Uncomment and complete: https://duck.co/duckduckhack/metadata#category
|
||||
# category "";
|
||||
# Uncomment and complete: https://duck.co/duckduckhack/metadata#topics
|
||||
# topics "";
|
||||
code_url "https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/ChessManual.pm";
|
||||
attribution github => ["GitHubAccount", "Friendly Name"],
|
||||
twitter => "twitterhandle";
|
||||
|
||||
# Triggers
|
||||
triggers any => "pawn", "pawn chess", "pawn chess piece";
|
||||
|
||||
# Handle statement
|
||||
handle remainder => sub {
|
||||
return if $_;
|
||||
return "P: The pawn (♙♟) is the most numerous piece in the game of chess, and in most circumstances, also the weakest. Unlike other pieces, the pawn does not capture in the same direction as it otherwise moves. A pawn captures diagonally, one square forward and to the left or right.";
|
||||
};
|
||||
|
||||
|
||||
1;
|
|
@ -0,0 +1,25 @@
|
|||
package DDG::Goodie::IsAwesome::redwavestudios;
|
||||
# ABSTRACT: redwavestudios' first Goodie
|
||||
|
||||
use DDG::Goodie;
|
||||
|
||||
zci answer_type => "is_awesome_redwavestudios";
|
||||
zci is_cached => 1;
|
||||
|
||||
name "IsAwesome redwavestudios";
|
||||
description "My first Goodie, it let's the world know that redwavestudios is awesome";
|
||||
primary_example_queries "duckduckhack redwavestudios";
|
||||
category "special";
|
||||
topics "special_interest", "geek";
|
||||
code_url "https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/IsAwesome/redwavestudios.pm";
|
||||
attribution github => ["https://github.com/redwavestudios", "redwavestudios"],
|
||||
twitter => "redwavestudios";
|
||||
|
||||
triggers start => "duckduckhack redwavestudios";
|
||||
|
||||
handle remainder => sub {
|
||||
return if $_;
|
||||
return "redwavestudios is awesome and has successfully completed the DuckDuckHack Goodie tutorial!";
|
||||
};
|
||||
|
||||
1;
|
|
@ -0,0 +1,38 @@
|
|||
package DDG::Goodie::IsAwesome:redwavestudios;
|
||||
# ABSTRACT: Write an abstract here
|
||||
# Start at https://duck.co/duckduckhack/goodie_overview if you are new
|
||||
# to instant answer development
|
||||
|
||||
use DDG::Goodie;
|
||||
|
||||
zci answer_type => "is_awesome:redwavestudios";
|
||||
zci is_cached => 1;
|
||||
|
||||
# Metadata. See https://duck.co/duckduckhack/metadata for help in filling out this section.
|
||||
name "IsAwesome:redwavestudios";
|
||||
description "Succinct explanation of what this instant answer does";
|
||||
primary_example_queries "first example query", "second example query";
|
||||
secondary_example_queries "optional -- demonstrate any additional triggers";
|
||||
# Uncomment and complete: https://duck.co/duckduckhack/metadata#category
|
||||
# category "";
|
||||
# Uncomment and complete: https://duck.co/duckduckhack/metadata#topics
|
||||
# topics "";
|
||||
code_url "https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/IsAwesome:redwavestudios.pm";
|
||||
attribution github => ["GitHubAccount", "Friendly Name"],
|
||||
twitter => "twitterhandle";
|
||||
|
||||
# Triggers
|
||||
triggers any => "triggerWord", "trigger phrase";
|
||||
|
||||
# Handle statement
|
||||
handle remainder => sub {
|
||||
|
||||
# optional - regex guard
|
||||
# return unless qr/^\w+/;
|
||||
|
||||
return unless $_; # Guard against "no answer"
|
||||
|
||||
return $_;
|
||||
};
|
||||
|
||||
1;
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More;
|
||||
use DDG::Test::Goodie;
|
||||
|
||||
zci answer_type => "chess_manual";
|
||||
zci is_cached => 1;
|
||||
|
||||
ddg_goodie_test(
|
||||
[qw( DDG::Goodie::ChessManual )],
|
||||
# At a minimum, be sure to include tests for all:
|
||||
# - primary_example_queries
|
||||
# - secondary_example_queries
|
||||
'example query' => test_zci('query'),
|
||||
# Try to include some examples of queries on which it might
|
||||
# appear that your answer will trigger, but does not.
|
||||
'bad example query' => undef,
|
||||
);
|
||||
|
||||
done_testing;
|
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More;
|
||||
use DDG::Test::Goodie;
|
||||
|
||||
zci answer_type => "is_awesome_redwavestudios";
|
||||
zci is_cached => 1;
|
||||
|
||||
ddg_goodie_test(
|
||||
[qw(
|
||||
DDG::Goodie::IsAwesome::redwavestudios
|
||||
)],
|
||||
'duckduckhack redwavestudios' => test_zci('redwavestudios is awesome and has successfully completed the DuckDuckHack Goodie tutorial!'),
|
||||
'duckduckhack redwavestudios is awesome' => undef,
|
||||
);
|
||||
|
||||
done_testing;
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More;
|
||||
use DDG::Test::Goodie;
|
||||
|
||||
zci answer_type => "is_awesome:redwavestudios";
|
||||
zci is_cached => 1;
|
||||
|
||||
ddg_goodie_test(
|
||||
[qw( DDG::Goodie::IsAwesome:redwavestudios )],
|
||||
# At a minimum, be sure to include tests for all:
|
||||
# - primary_example_queries
|
||||
# - secondary_example_queries
|
||||
'example query' => test_zci('query'),
|
||||
# Try to include some examples of queries on which it might
|
||||
# appear that your answer will trigger, but does not.
|
||||
'bad example query' => undef,
|
||||
);
|
||||
|
||||
done_testing;
|
Loading…
Reference in New Issue