Markov: handle non-channel events properly

this includes having privmsgs correctly be attributed to the speaker,
rather than the bot
This commit is contained in:
Brian S. Stephan 2013-05-03 16:02:07 -05:00
parent 88e470183b
commit 25e41150af
1 changed files with 8 additions and 0 deletions

View File

@ -205,6 +205,10 @@ class Markov(Module):
"""Learn one line, as provided to the command."""
target = event.target()
if not irclib.is_channel(target):
target = nick
match = self.learnre.search(what)
if match:
line = match.group(1)
@ -217,6 +221,10 @@ class Markov(Module):
"""Generate a reply to one line, without learning it."""
target = event.target()
if not irclib.is_channel(target):
target = nick
match = self.replyre.search(what)
if match:
min_size = 15