Subject: | Bot-BasicBot-0.7 mess->{address} treatment bug |
Date: | Mon, 22 Oct 2007 23:12:27 +0100 (BST) |
To: | bug-Bot-BasicBot [...] rt.cpan.org |
From: | Jon Whitlock <jon.whitlock [...] yahoo.co.uk> |
Hello Tom,
I've been much enjoying Bot-BasicBot-0.7, many thanks.
I have had 2 issues with it, one am pretty sure is a
bug.
On lines 1169 - 1185 (quoted) there's a bunch of code
that IMO breaks expected usage.
# okay, work out if we're addressed or not
$mess->{body} = $body;
unless ( $mess->{channel} eq "msg" ) {
my $nick = $self->nick;
if ( $mess->{body} =~
s/^(\Q$nick\E)\s*[:,-]?\s*//i ) {
$mess->{address} = $1;
}
foreach $nick ( $self->alt_nicks ) {
last if $mess->{address};
if ( $mess->{body} =~
s/^(\Q$nick\E)\s*[:,-]?\s*//i ) {
$mess->{address} = $1;
}
}
}
I have a bot that talks back when addressed (in the
same channel). Certain key words are parsed after the
botname (as calls to action). Without prompting most
users do
Show quoted text
> botname search for blah
> botname translate hello nice day into french
1) The code up there seemingly translates this into a
private message -- which it isn't.
2) The bot replies in the channel regardless IIRC,
even though that code seems to want to change that?
3) Overriding this in my said() handler back to a
normal channel message (delete msg->{address}, reset
msg->{channel} is ignored... so I'm boned.
In a private chat (i.e. when 'channel' => 'msg',) the
bot works as expected as that unless block isn't
executed.
I guess it's for the "nick: blah blah" functionality
on replies (which i do not use, but I can certainly
see it's useful and needs to be retained).
The kicker is;
Show quoted text> hi botname, search for blah
works but
Show quoted text> botname, search for blah
does not.
... obv due to the caret in the regexp.
Commenting out the unless() loop works for me, so I'll
live, but I was wondering what the intention was
there, and if it's a genuine bug?
OK second thing :)
Can't see how to set, or retrieve, the current channel
topic.
"topic( $mess ) --Called when the topic of the channel
changes" certainly works for me.
I can see the topic in the underlying POE object but
can't figure how to get at it ... "channel_data" is
promising, but undocumented ... any pointers?
Thanks again for the module, am having much fun
delighting/tormenting my colleagues with it (depending
on whether their nicks are in @love or @hate ;)
jon
Show quoted text ___________________________________________________________
Yahoo! Answers - Got a question? Someone out there knows the answer. Try it
now.
http://uk.answers.yahoo.com/