mata_bot

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

commit 63862862150b3cc203b30b489e5b1dfc9aa27647
parent ff52d78cdd15c4a3705b9e9bf42d0a469080c74a
Author: noodle <noodle@pastanoggin.com>
Date:   Sat, 14 Jun 2025 20:36:04 +0300

fix bot crashing on regex errors when the regex was passed from chat

we're ignoring the regex error lol (because it's from chat and they don't care
about errors)

Diffstat:
Mmata_bot.pl | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mata_bot.pl b/mata_bot.pl @@ -109,7 +109,8 @@ sub respond { # chat s/// my $toreplace = $1; my $replacement = $2; - if ($subbuffer{$sender_nick} =~ s/$toreplace/$replacement/) { + eval { $subbuffer{$sender_nick} =~ s/$toreplace/$replacement/ }; + if (not $@ and $subbuffer{$sender_nick}) { msg($sock, "${sender_nick} meant to say: $subbuffer{$sender_nick}"); return 1; }