Markov: when learning lines, don't include the part direct addressing

e.g. if i say 'dr_botzo: hello dude', he only learns 'hello dude'.
this is mainly being done because the bot's name being in the brain
so many times was getting kind of silly, especially in channels that
have lots of conversations with the bot
This commit is contained in:
Brian S. Stephan 2011-04-22 19:40:36 -05:00
parent 69243ce1e5
commit 5885983afd
1 changed files with 2 additions and 0 deletions

View File

@ -106,6 +106,8 @@ class Markov(Module):
"""Learn from IRC events."""
what = ''.join(event.arguments()[0])
my_nick = connection.get_nickname()
what = re.sub('^' + my_nick + '[:,]\s+', '', what)
# don't learn from commands
if self.trainre.search(what) or self.learnre.search(what) or self.replyre.search(what):