зеркало из https://github.com/mozilla/pjs.git
Ok, we don't really need ridiculouslyEagerToHelp, just use the autoHelp variable which is per channel.
This commit is contained in:
Родитель
071605bb04
Коммит
2125cd4ed4
|
@ -58,13 +58,12 @@ sub RegisterConfig {
|
|||
$self->registerVariables(
|
||||
# [ name, save?, settable? ]
|
||||
['autoLearn', 1, 1, ['*']], # in the auto* variables, '*' means 'all channels'
|
||||
['autoHelp', 1, 1, ['*']],
|
||||
['autoHelp', 1, 1, []],
|
||||
['autoEdit', 1, 1, []],
|
||||
['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' => {}}],
|
||||
|
@ -173,31 +172,31 @@ sub DoFactoidCheck {
|
|||
$self->GiveFactoid($event,
|
||||
undef, # database
|
||||
$event->{'from'}, # what
|
||||
$direct || $self->{'ridiculouslyEagerToHelp'},
|
||||
$direct,
|
||||
$1); # who
|
||||
} elsif ($message =~ /^\s*tell\s+(\S+)\s+about\s+(.+?)(?:[,\s]+please)?[\s!?.]*$/osi) {
|
||||
$self->GiveFactoid($event,
|
||||
undef, # database
|
||||
$2, # what
|
||||
$direct || $self->{'ridiculouslyEagerToHelp'},
|
||||
$direct,
|
||||
$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 || $self->{'ridiculouslyEagerToHelp'},
|
||||
$direct,
|
||||
$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 || $self->{'ridiculouslyEagerToHelp'},
|
||||
$direct,
|
||||
$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 || $self->{'ridiculouslyEagerToHelp'},
|
||||
$direct,
|
||||
$1); # who
|
||||
} elsif ($message =~ /^\s*(.+?)\s*=~\s*s?\/(.+?)\/(.*?)\/(i)?(g)?(i)?\s*$/osi) {
|
||||
$self->EditFactoid($event,
|
||||
|
@ -217,7 +216,7 @@ sub DoFactoidCheck {
|
|||
$self->GiveFactoid($event,
|
||||
lc($1), # is/are (optional)
|
||||
$2, # subject
|
||||
$direct || $self->{'ridiculouslyEagerToHelp'});
|
||||
$direct);
|
||||
} elsif ($shortMessage =~ /^(?:(?:where|how)
|
||||
(?:\s+the\s+hell|\s+on\s+earth|\s+the\s+fuck)?
|
||||
\s+ can \s+ (?:i|one|s?he|we) \s+ (?:find|learn|read)
|
||||
|
@ -228,32 +227,30 @@ sub DoFactoidCheck {
|
|||
$self->GiveFactoid($event,
|
||||
undef, # is/are (optional)
|
||||
$1, # subject
|
||||
$direct || $self->{'ridiculouslyEagerToHelp'});
|
||||
} elsif ($shortMessage =~ /^(?:what|where|who)
|
||||
(?:\s+the\s+hell|\s+on\s+earth|\s+the\s+fuck)?
|
||||
\s+ (.+?) \s+ (is|are) [?\s]* $/osix) {
|
||||
$direct);
|
||||
} elsif ($shortMessage =~ /^(.+?) \s+ (is|are) \s+ (?:what|where|who) [?!\s]* $/osix) {
|
||||
$self->GiveFactoid($event,
|
||||
lc($2), # is/are (optional)
|
||||
$1, # subject
|
||||
$direct || $self->{'ridiculouslyEagerToHelp'});
|
||||
$direct);
|
||||
} elsif ($shortMessage =~ /^(?:what|where|who)
|
||||
(?:\s+the\s+hell|\s+on\s+earth|\s+the\s+fuck)? \s+
|
||||
(?:am\s+I|I\s+am) [?\s]* $/osix) {
|
||||
$self->GiveFactoid($event,
|
||||
'is', # am => is
|
||||
$event->{'from'}, # subject
|
||||
$direct || $self->{'ridiculouslyEagerToHelp'});
|
||||
$direct);
|
||||
} elsif ($shortMessage =~ /^(no\s*, (\s*\Q$event->{'nick'}\E\s*,)? \s+)? (?:remember\s*:\s+)? (.+?) \s+ (is|are) \s+ (also\s+)? (.*?[^?\s]) \s* $/six) {
|
||||
# the "remember:" prefix can be used to delimit the start of the actual content, if necessary.
|
||||
$self->SetFactoid($event,
|
||||
defined($1) &&
|
||||
($direct || $self->{'ridiculouslyEagerToHelp'} || defined($2)),
|
||||
($direct || defined($2)),
|
||||
# replace existing answer?
|
||||
$3, # subject
|
||||
lc($4), # is/are
|
||||
defined($5), # add to existing answer?
|
||||
$6, # object
|
||||
$direct || $self->{'ridiculouslyEagerToHelp'} || defined($2));
|
||||
$direct || defined($2));
|
||||
} 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,
|
||||
|
@ -262,18 +259,18 @@ sub DoFactoidCheck {
|
|||
'is', # I am = Foo is
|
||||
defined($2), # add to existing answer?
|
||||
$3, # object
|
||||
$direct || $self->{'ridiculouslyEagerToHelp'});
|
||||
$direct);
|
||||
} 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 || $self->{'ridiculouslyEagerToHelp'})
|
||||
$direct)
|
||||
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 || $self->{'ridiculouslyEagerToHelp'})
|
||||
$direct)
|
||||
if ($2 or ($direct == 2 and $self->{'eagerToHelp'}));
|
||||
} else {
|
||||
return 0;
|
||||
|
|
Загрузка…
Ссылка в новой задаче