mata_bot

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

commit 509cddf0ac6b76eacaefe3a31c7006a337443a20
parent ba7e7f3f13cddd9880bb688e0ce081d2ecbb281c
Author: boredpasta <boredpasta@tutanota.com>
Date:   Fri, 21 Mar 2025 00:58:10 +0200

add 8ball

Diffstat:
Aball | 30++++++++++++++++++++++++++++++
Mmata_bot.pl | 8+++++++-
2 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/ball b/ball @@ -0,0 +1,30 @@ +Dead-on! +Correct! +That's right! +Yes, of course! +Absolutely! +Affirmative! +Positive! +Hell yeah! +true; +1 (yes) +That's wrong! +Bogus! +Of course not! +Absolutely not! +Nu-uh! +Hell nah! +Negative! +It can't be! +false; +0 (no) +No clue. +IDK LOL. +Beats me. +I have know idea. +Who knows?! +It's a mystery... +Only Spirit of The Machine knows. +Dunno. +NULL (idk) +undef (idk) diff --git a/mata_bot.pl b/mata_bot.pl @@ -30,6 +30,12 @@ chomp(my @quotes = <$quotes_file>); my $quotes_num = $.; close $quotes_file or die "$quotes_file: $!"; +# read in the 8ball file +open (my $ball_file, "<", "ball") or die "couldn't open ball: $!"; +chomp(my @ball = <$ball_file>); +my $ball_num = $.; +close $ball_file or die "$ball_file: $!"; + sub randint { my($min, $max) = @_; return $min if $min == $max; @@ -66,7 +72,7 @@ sub respond_command { } elsif ($content =~ /\?$/) { # we got a question unless ($sender_nick eq $MOTHER) { - msg($sock, "lol idk ${MATA_CUTE}"); + msg($sock, "$ball[int rand($ball_num)] ${MATA_CUTE}"); } } else { # we got anything else