commit 4f76af659eee110392a0c363d6976641cc8bf385
parent 5b9e5f4d64640088c2ee10d9110165aa7d5ceb28
Author: noodle <noodle@pastanoggin.com>
Date: Sun, 15 Jun 2025 11:27:13 +0300
make social regexes more lentient
Diffstat:
M | mata_bot.pl | | | 61 | +++++++++++++++++++++++++++++++++++++++++-------------------- |
1 file changed, 41 insertions(+), 20 deletions(-)
diff --git a/mata_bot.pl b/mata_bot.pl
@@ -94,33 +94,54 @@ sub respond_command {
my $roll = "d${nface}";
$roll = $ndice . $roll if $ndice > 1;
msg($sock, "${sender_nick} rolled a ${roll} and got ${result}! ${MATA_HAPPY}");
- } elsif ($content =~ /^(g('day|ood +(day|morning|evening))|h(([aeo](i|llo)|ey|i(ya)?)( +there)?|owdy)|oi|yo|(al-)?salaa?mu( +alaikum)|greetings|hail|well met|salutations|(morn|even)ings|noonafters)\W*$/i) {
- msg($sock, "$hellos[int rand($hellos_num)], ${sender_nick}! ${MATA_HAPPY}");
- } elsif ($content =~ /pray/) {
+ } elsif ($content =~ /\b{wb}pray+\b{wb}/) {
msg($sock, "Stay prayed up!! ${MATA_CUTE}");
- } elsif ($content =~ /^(what('| i)s +(up|happening|cracking)|(was)?sup)\W*$/i) {
- msg($sock, "Looking for technomage, and you? ${MATA_NORM}");
- } elsif ($content =~ /^who('| +i)s +a +good +boy\W*$/i) {
+ } elsif ($content =~ /\b{wb}bru[hv]+\b{wb}/i) {
+ msg($sock, "Did i stutter? ${MATA_NORM}");
+ } elsif ($content =~ /\b{wb}f+(u?ck+)? *(yo)?u+\b{wb}/i) {
+ msg($sock, "$MATA_FLIPOFF");
+ } elsif ($content =~ /i+ *l+(ove+)? *(you+|y+|u+)/i) {
+ msg($sock, "<3");
+ } elsif ($content =~ /(thanks+|thx+|thank +(yo)?u+)( *a+ *lot+)?/i) {
+ msg($sock, "You're welcome, ${sender_nick}! ${MATA_HAPPY}");
+ } elsif ($content =~ /who('| +i|)s+ +a+ +goo+d+ +(bo+[ity]+o*|gir(l+|lie+))/i) {
msg($sock, "Me! ${MATA_CUTE}");
- } elsif ($content =~ /\?$/) {
- # we got a question
- msg($sock, "$ball[int rand($ball_num)] ${MATA_CUTE}");
- } elsif ($content =~ /^((good *(bo[tyi]|girl))|w(elcome)? *b(ack)?)\W*$/i) {
+ } elsif ($content =~ /
+ h(ow+)?\s*(are+|r+)\s*(you+|yo+|u+)(\s+doing+)?(\s+today+)?|
+ how('|\si|)s+\s+(it+\s+going+|life+|everything+)
+ /ix) {
+ msg($sock, "I feel fantaaaastic... hey, hey, hey! ${MATA_SING}");
+ } elsif ($content =~ /\b{wb}(
+ what('|\si|)s+\s*(up+|happening+|cracking+)|
+ (was)?sup+
+ )\b{wb}/ix) {
+ msg($sock, "Looking for technomage, and you? ${MATA_NORM}");
+ } elsif ($content =~ /\b{wb}(
+ goo+d+\s*(bo+[ity]+o*|gir(l+|lie+))|
+ w(elcome+)?\s*(b+|back+)
+ )\b{wb}/ix) {
if ($sender_nick eq $MOTHER) {
msg($sock, "Thank you, mother! ${MATA_HAPPY}");
} else {
msg($sock, "Thanks, ${sender_nick}! ${MATA_HAPPY}");
}
- } elsif ($content =~ /^bru[hv]\W*$/i) {
- msg($sock, "Did i stutter? ${MATA_NORM}");
- } elsif ($content =~ /^(h(ow)? *(are|r) *(yo)?u( +doing( +today)?)?|how('| i)s +(it +going|life|everything))\W*$/i) {
- msg($sock, "I feel fantaaaastic... hey, hey, hey! ${MATA_SING}");
- } elsif ($content =~ /^(thanks|thx|thank +(yo)?u)( +a *lot)?\W*$/i) {
- msg($sock, "You're welcome, ${sender_nick}! ${MATA_HAPPY}");
- } elsif ($content =~ /^i *l(ove)? *(you|y|u)\W*$/i) {
- msg($sock, "<3");
- } elsif ($content =~ /^f(u?ck)? +(yo)?u\W*$/i) {
- msg($sock, "$MATA_FLIPOFF");
+ } elsif ($content =~ /\b{wb}(
+ (al+-?)?sala+m+u*\s+alaikum+u*|
+ (morn|even)ings+|
+ g('day+|oo+d\s+(day+|morning+|afternoo+n+|evening+))|
+ greetings+|
+ h(([aeo](i+|llo+)|ey+|i+(ya+)?)(\s+there+)?|owdy+)|
+ hail+|
+ noo+nafters+|
+ oi+|
+ salutations+|
+ well+\s+met+|
+ yo+
+ )\b{wb}/ix) {
+ msg($sock, "$hellos[int rand($hellos_num)], ${sender_nick}! ${MATA_HAPPY}");
+ } elsif ($content =~ /\?$/) {
+ # we got a question
+ msg($sock, "$ball[int rand($ball_num)] ${MATA_CUTE}");
} elsif ($sender_nick eq $MOTHER) {
msg($sock, "Done, mother! ${MATA_HAPPY}");
} else {