mata_bot

some cheeky bot for #unix_surrealism
git clone https://git.pastanoggin.com/mata_bot.git
Log | Files | Refs | README | LICENSE

commit 3f948ae7aa2915c2dcb6a69adf9c15ded9c31f86
parent 598064f27b382118202c70ac3dde81856ae5f6b2
Author: noodle <noodle@pastanoggin.com>
Date:   Wed, 18 Jun 2025 20:08:41 +0300

make matabot nick recognition more lenient

Diffstat:
Mmata_bot.pl | 9+++++----
Mmatabot.8 | 8++++----
2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/mata_bot.pl b/mata_bot.pl @@ -10,6 +10,7 @@ use POSIX qw(strftime); my $SHAREDIR = '/usr/local/share'; my $CHUNK_LENGTH = 1024; my $NICK = 'mata_bot'; +my $NICK_RE = qr/mata_?bo[ity]/i; my $USER = 'mata_bot_beta4'; my $REAL = 'death to technomage!!'; my $MOTHER = 'noodle'; @@ -153,7 +154,7 @@ sub respond_mention { my ($sock, $sender_nick, $message) = @_; if ($sender_nick eq $MOTHER) { msg($sock, "Yes, mother? ${MATA_HAPPY}"); - } elsif ($message =~ /^\W*${NICK}\W*$/) { + } elsif ($message =~ /^\b${NICK_RE}\b$/) { msg($sock, "${MATA_NORM} ?"); } else { msg($sock, "$quotes[int rand($quotes_num)] ${MATA_NORM}"); @@ -243,10 +244,10 @@ sub respond { } else { msg($sock, "No title found (GET ${url} ${MATA_DEAD}"); } - } elsif ($message =~ /^ *${NICK}[:, ] *([^\000\r\n ][^\000\r\n]*)$/ - or $message =~ /^ *([^\000\r\n ][^\000\r\n]*)[, ] *${NICK}\W*$/) { + } elsif ($message =~ /^ *${NICK_RE}[:, ] *([^\000\r\n ][^\000\r\n]*)$/ + or $message =~ /^ *([^\000\r\n ][^\000\r\n]*)[, ] *${NICK_RE}\W*$/) { respond_command($sock, $sender_nick, $1); - } elsif ($message =~ /\b${NICK}\b/) { + } elsif ($message =~ /\b${NICK_RE}\b/) { respond_mention($sock, $sender_nick, $message); } return 0; diff --git a/matabot.8 b/matabot.8 @@ -74,13 +74,13 @@ Ask him to roll ${number1} of ${number2}-sided dice. He's a dungeon master too!! .It mata_bot: *pray* Stay prayed up!! -.It mata_bot I LOVE U!!! +.It MATABOT I LOVE U!!! Love the boy. .It thank you mata_bot!! Thank your future master. -.It mata_bot: Who's the good boy?? (or boi, girl, bot, etc.). +.It mata_boi: Who's the good boy?? (or boi, girl, bot, etc.). Praise your future master. -.It ...mata_bot... +.It .../mata_?bo[ity]/i... Mention him! This boy talks back!? .It mata_bot, hru? Ask him how he's doin. @@ -88,7 +88,7 @@ Ask him how he's doin. Ask him what he's up to. .It mata_bot, good boy! (or boi, girl, bot, etc.). Praise your future master. -.It hi, mata_bot! +.It hi, mata_boy! Say hi to the boy .It mata_bot, What doth life? Ask him your burning questions...