[go: up one dir, main page]

Menu

#1 Bwentbot 2.4.5 !lart does not work

v2.4.x
open
Code (1)
9
2004-09-13
2004-09-13
Leprykaun
No

Just found a really stupid error in 2.4.5 in the !lart
function. I would have noticed it sooner but I still
run 2.4 (I don't need the op stuff).

The error:
When you use '!lart name', there is no name inserted
into the lart, and you may get an error from the bot in
terminal.

The bug:
That I used local variables inside the if/else clause,
and they got lost on the way to the search/replace call
to add the targets name into the random lart.

The fix:
In bwentbot.pl, find the 'sub lart_call' subfunction
and delete it. Add the folowing code in its place...

------start code below here ------
#############################################################################
# @larts is an array of random larts used in
conjuntion with lart_call which
# responds to !lart by larting the 'target' requested
#############################################################################
sub lart_call {
my @arglist = @_;
my $target = "";

if ( !@arglist ) {
return "0";
}
else {
my $lart = $larts[ rand scalar @larts ];
# trying to lart the bot? fuck off ;)
if ($arglist[0] eq $mynick) {
$target = $nick;
}
else {
$target = $arglist[0];
}

# replace 'WHO' with the targets name in the
random lart
$lart =~ s/WHO/$target/g;
return $lart;
}
}
--------- end code above here ------

OR, delete the 'my' variable before both occurances of
'$target' in the if/else clause, and add 'my $target =
"" ' at the top of the function.

Sorry again about this, wish someone had reported it to
me sooner.

-Leprykaun

Discussion

  • Leprykaun

    Leprykaun - 2004-09-13
    • priority: 5 --> 9
    • assigned_to: nobody --> leprykaun
     
  • Leprykaun

    Leprykaun - 2004-09-13
    • labels: --> Code
    • milestone: --> v2.4.x
     

Log in to post a comment.