mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
eagerToHelp and ridiculouslyEagerToHelp modes. See bug 142371.
This commit is contained in:
parent
e1d6df8147
commit
fd1fb4e679
@ -63,6 +63,8 @@ sub RegisterConfig {
|
||||
['neverLearn', 1, 1, []], # the never* variables override the auto* variables
|
||||
['neverHelp', 1, 1, []],
|
||||
['neverEdit', 1, 1, []],
|
||||
['eagerToHelp', 1, 1, 1], # whether to even need the "?" on questions
|
||||
['ridiculouslyEagerToHelp', 1, 1, 0], # whether to consider everything direct
|
||||
['autoIgnore', 1, 1, []], # list of nicks for which to always turn off auto*
|
||||
['teachers', 1, 1, []], # list of users who may teach, leave blank to allow anyone to teach
|
||||
['factoidPositions', 0, 0, {'is' => {}, 'are' => {}}],
|
||||
@ -166,31 +168,31 @@ sub DoFactoidCheck {
|
||||
$self->GiveFactoid($event,
|
||||
undef, # database
|
||||
$event->{'from'}, # what
|
||||
$direct,
|
||||
$direct or $self->{'ridiculouslyEagerToHelp'},
|
||||
$1); # who
|
||||
} elsif ($message =~ /^\s*tell\s+(\S+)\s+about\s+(.+?)(?:[,\s]+please)?[\s!?.]*$/osi) {
|
||||
$self->GiveFactoid($event,
|
||||
undef, # database
|
||||
$2, # what
|
||||
$direct,
|
||||
$direct or $self->{'ridiculouslyEagerToHelp'},
|
||||
$1); # who
|
||||
} elsif ($message =~ /^\s*tell\s+(\S+)\s+(?:what|who|where)\s+(?:am\s+I|I\s+am)(?:[,\s]+please)?[\s!?.]*$/osi) {
|
||||
$self->GiveFactoid($event,
|
||||
'is', # database
|
||||
$event->{'from'}, # what
|
||||
$direct,
|
||||
$direct or $self->{'ridiculouslyEagerToHelp'},
|
||||
$1); # who
|
||||
} elsif ($message =~ /^\s*tell\s+(\S+)\s+(?:what|who|where)\s+(is|are)\s+(.+?)(?:[,\s]+please)?[\s!?.]*$/osi) {
|
||||
$self->GiveFactoid($event,
|
||||
lc($2), # database
|
||||
$3, # what
|
||||
$direct,
|
||||
$direct or $self->{'ridiculouslyEagerToHelp'},
|
||||
$1); # who
|
||||
} elsif ($message =~ /^\s*tell\s+(\S+)\s+(?:what|who|where)\s+(.+?)\s+(is|are)(?:[,\s]+please)?[\s!?.]*$/osi) {
|
||||
$self->GiveFactoid($event,
|
||||
lc($3), # database
|
||||
$2, # what
|
||||
$direct,
|
||||
$direct or $self->{'ridiculouslyEagerToHelp'},
|
||||
$1); # who
|
||||
} elsif ($message =~ /^\s*(.+?)\s*=~\s*s?\/(.+?)\/(.*?)\/(i)?(g)?(i)?\s*$/osi) {
|
||||
$self->EditFactoid($event,
|
||||
@ -208,22 +210,22 @@ sub DoFactoidCheck {
|
||||
$self->GiveFactoid($event,
|
||||
lc($1), # is/are (optional)
|
||||
$2, # subject
|
||||
$direct);
|
||||
$direct or $self->{'ridiculouslyEagerToHelp'});
|
||||
} elsif ($shortMessage =~ /^(?:(?:where|how)\s+can\s+(?:i|one|s?he|we)\s+(?:find|learn|read)(?:\s+about)? | how\s+about | what\'?s) \s+ (.+?) [?\s]* $/osix) {
|
||||
$self->GiveFactoid($event,
|
||||
undef, # is/are (optional)
|
||||
$1, # subject
|
||||
$direct);
|
||||
$direct or $self->{'ridiculouslyEagerToHelp'});
|
||||
} elsif ($shortMessage =~ /^(?:what|where|who)\s+ (.+?) (is|are) [?\s]* $/osix) {
|
||||
$self->GiveFactoid($event,
|
||||
lc($2), # is/are (optional)
|
||||
$1, # subject
|
||||
$direct);
|
||||
$direct or $self->{'ridiculouslyEagerToHelp'});
|
||||
} elsif ($shortMessage =~ /^(?:what|where|who) \s+ (?:am\s+I|I\s+am) [?\s]* $/osix) {
|
||||
$self->GiveFactoid($event,
|
||||
'is', # am => is
|
||||
$event->{'from'}, # subject
|
||||
$direct);
|
||||
$direct or $self->{'ridiculouslyEagerToHelp'});
|
||||
} elsif ($shortMessage =~ /^(no\s*, (?:\s*\Q$event->{'nick'}\E\s*,)? \s+)? (?:remember\s*:\s+)? (.+?) \s+ (is|are) \s+ (also\s+)? (.+?) $/six) {
|
||||
# the "remember:" prefix can be used to delimit the start of the actual content, if necessary.
|
||||
$self->SetFactoid($event,
|
||||
@ -232,7 +234,7 @@ sub DoFactoidCheck {
|
||||
lc($3), # is/are
|
||||
defined($4), # add to existing answer?
|
||||
$5, # object
|
||||
($direct or defined($2)));
|
||||
($direct or $self->{'ridiculouslyEagerToHelp'} or defined($1)));
|
||||
} elsif ($shortMessage =~ /^(no\s*, (?:\s*\Q$event->{'nick'}\E\s*,)? \s+)? (?:remember\s*:\s+)? I \s+ am \s+ (also\s+)? (.+?) $/osix) {
|
||||
# the "remember:" prefix can be used to delimit the start of the actual content, if necessary.
|
||||
$self->SetFactoid($event,
|
||||
@ -241,17 +243,19 @@ sub DoFactoidCheck {
|
||||
'is', # I am = Foo is
|
||||
defined($2), # add to existing answer?
|
||||
$3, # object
|
||||
$direct);
|
||||
} elsif ((not $direct or $direct == 2) and $shortMessage =~ /^(.+?)\s+(is|are)[?\s]*\?[?\s]*$/osi) {
|
||||
$direct or $self->{'ridiculouslyEagerToHelp'});
|
||||
} elsif ((not $direct or $direct == 2) and $shortMessage =~ /^(.+?)\s+(is|are)[?\s]*(\?)?[?\s]*$/osi) {
|
||||
$self->GiveFactoid($event,
|
||||
lc($2), # is/are (optional)
|
||||
$1, # subject
|
||||
$direct);
|
||||
} elsif ((not $direct or $direct == 2) and $shortMessage =~ /^(.+?)[?\s]*\?[?\s]*$/osi) {
|
||||
$direct or $self->{'ridiculouslyEagerToHelp'})
|
||||
if $3 or ($direct == 2 and $self->{'eagerToHelp'});
|
||||
} elsif ((not $direct or $direct == 2) and $shortMessage =~ /^(.+?)[?\s]*(\?)?[?\s]*$/osi) {
|
||||
$self->GiveFactoid($event,
|
||||
undef, # is/are (optional)
|
||||
$1, # subject
|
||||
$direct);
|
||||
$direct or $self->{'ridiculouslyEagerToHelp'})
|
||||
if $2 or ($direct == 2 and $self->{'eagerToHelp'});
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user