Markov: try to fix unicode errors in irc bot
This commit is contained in:
parent
a9560b6fa2
commit
3856a1e95b
@ -139,15 +139,15 @@ class Markov(Module):
|
||||
topics = [x for x in addressed_re.match(what).group(1).split(' ') if len(x) >= 3]
|
||||
|
||||
self.lines_seen.append(('.self.said.', datetime.now()))
|
||||
return self.irc.reply(event, '{0:s}: {1:s}'.format(nick,
|
||||
' '.join(_generate_sentence(context, topics=topics))))
|
||||
return self.irc.reply(event, u"{0:s}: {1:s}".format(nick,
|
||||
u" ".join(_generate_sentence(context, topics=topics))))
|
||||
else:
|
||||
# i wasn't addressed directly, so just respond
|
||||
topics = [x for x in what.split(' ') if len(x) >= 3]
|
||||
self.lines_seen.append(('.self.said.', datetime.now()))
|
||||
|
||||
return self.irc.reply(event, '{0:s}'.format(' '.join(_generate_sentence(context,
|
||||
topics=topics))))
|
||||
return self.irc.reply(event, u"{0:s}".format(u" ".join(_generate_sentence(context,
|
||||
topics=topics))))
|
||||
|
||||
def markov_learn(self, event, nick, userhost, what, admin_unlocked):
|
||||
"""Learn one line, as provided to the command."""
|
||||
@ -190,10 +190,12 @@ class Markov(Module):
|
||||
topics = [x for x in line.split(' ') if len(x) >= 3]
|
||||
|
||||
self.lines_seen.append(('.self.said.', datetime.now()))
|
||||
return ' '.join(_generate_sentence(context, topics=topics, min_words=min_size, max_words=max_size))
|
||||
return u" ".join(_generate_sentence(context, topics=topics,
|
||||
min_words=min_size, max_words=max_size))
|
||||
else:
|
||||
self.lines_seen.append(('.self.said.', datetime.now()))
|
||||
return ' '.join(_generate_sentence(context, min_words=min_size, max_words=max_size))
|
||||
return u" ".join(_generate_sentence(context, min_words=min_size,
|
||||
max_words=max_size))
|
||||
|
||||
def thread_do(self):
|
||||
"""Do various things."""
|
||||
|
Loading…
Reference in New Issue
Block a user