sub frank {
 my ($server, $msg, $nick, $address, $channel) = @_;
 $msg_count++;
 my @badnicks;
 my $asshole = asshat($msg, $server, $nick, $channel);
 $moderate{$nick} = $asshole - 4 + $moderate{$nick} * 0.40;
 if ($moderate{$nick} >= $asslevel) {
  $server->command('kick' . ' ' . $channel . ' ' . $nick . ' ' . "Be nice.");
  $moderate{$nick} = 0;
 }

 if ($blockfn) {
  if (-e $blockfn) {
   open(BN, '<', $blockfn)
    or die "Franklin: Sorry, you need a blocklist file. $!";
   @badnicks = <BN>;
   close BN;
  }
 }
 push(@chat, "The user: $nick said: $msg - in $channel ");
 if (scalar(@chat) >= $histlen) {
  shift(@chat);
 }
 chomp(@badnicks);
 for (@badnicks) {
  s/(.*)#.*$/$1/; ## for comments in the badnicks file
 }
 if (grep(/^$nick$/, @badnicks)) { ## fuck everyone inside this conditional
  Irssi::print "Franklin: $nick does not have privs to use this.";
 }
 else {
  my $wrote = 1;
  my $ln = $server->{nick};
  if ($msg =~ /^$ln[:|,] (.*)/i) { ## added /i for case insensitivity
   my $textcall = $1; ## $1 is the "dot star" inside the parenthesis
   $textcall =~ s/\'//gs;
   $textcall =~ s/\"//gs;
   Irssi::print "Franklin: $nick asked: $textcall";
   if (($textcall !~ m/^\s+$/) || ($textcall !~ m/^$/)) {
    $wrote = callapi($textcall, $server, $nick, $channel);
   }
   else { Irssi::print "Unknown error, response not sent to server"; }1
  }
  else {
   if (($chatterbox le 995) && ($chatterbox gt 0)) {
    if (int(rand(1000) - $chatterbox) eq 0) {
     $wrote = callapi($msg, $server, $nick, $channel, @chat);
    }
   }
   else {
    unless ($chatterbox eq 0) {
     Irssi::print "Chatterbox should be an int between 0 and 995, where 995 is very chatty.";
    }
   }
  }
 }
}