From 2b8f0d284384eab64cacbec6ae373bcc0c7d24ad Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Mon, 14 Mar 2011 13:14:56 -0500 Subject: [PATCH 1/4] Markov: don't crash when learning a sentence that's only whitespace --- modules/Markov.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/Markov.py b/modules/Markov.py index f7c0667..0a681b0 100644 --- a/modules/Markov.py +++ b/modules/Markov.py @@ -187,6 +187,9 @@ class Markov(Module): k2 = self.start2 words = line.split() + if len(words) <= 0: + return line + self.starts.append(words[0]) try: From 5913a95165621cfb19417bc643942d30da8b4539 Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Thu, 17 Mar 2011 17:24:11 -0500 Subject: [PATCH 2/4] Markov: append a stop if we have nothing to append from a chain somehow a chain led us down a path where there are no values for the keys in the chain. if that happens, just abort. i'm not quite sure how this could happen --- modules/Markov.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/Markov.py b/modules/Markov.py index 0a681b0..22ac1cc 100644 --- a/modules/Markov.py +++ b/modules/Markov.py @@ -284,6 +284,8 @@ class Markov(Module): else: if len(gen_words) < min_size and len(filter(lambda a: a != self.stop, key_hits)) > 0: gen_words.append(random.choice(filter(lambda a: a != self.stop, key_hits))) + elif len(key_hits) <= 0: + gen_words.append(self.stop) else: gen_words.append(random.choice(key_hits)) From 9a4f8b019a1e0d3f8a4f0034fcf9c2bb94d3807d Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Mon, 21 Mar 2011 18:23:59 -0500 Subject: [PATCH 3/4] Twitter: move timer reregistration up to the top of the timer routine twitter will occasionally fail hard, when it was doing so this check for updates wasn't reregistering, making the bot stop checking eventually --- modules/Twitter.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/Twitter.py b/modules/Twitter.py index cc4919c..32576e4 100644 --- a/modules/Twitter.py +++ b/modules/Twitter.py @@ -236,6 +236,9 @@ class Twitter(Module): def _check_self_timeline(self): """Check my timeline, and if there are entries, print them to the channel.""" + # re-register this check + Timer(300, self._check_self_timeline, ()).start() + if self.authed: # get the id of the last check we made since_id = self._get_last_since_id() @@ -263,9 +266,6 @@ class Twitter(Module): # set since_id self._set_last_since_id(new_since_id) - # re-register this check - Timer(300, self._check_self_timeline, ()).start() - def _return_tweet_or_retweet_text(self, tweet, print_source=False): """ Return a string of the author and text body of a status, From 768fd1c0720112aa1174e31d6f60ff01b66b87cd Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Sat, 2 Apr 2011 23:23:36 -0500 Subject: [PATCH 4/4] BUGS: document !alias list wrong destination bug --- BUGS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/BUGS b/BUGS index 1ba8265..6c68e82 100644 --- a/BUGS +++ b/BUGS @@ -9,3 +9,7 @@ dr.botzo --- BUGS * get_db() in Module is not thread-aware, threads other than the main bot thread cannot call it (see Twitter.py) ProgrammingError: SQLite objects created in a thread can only be used in that same thread.The object was created in thread id 1 and this is thread id 2 + * various stuff (or at least !alias list) doesn't get privmsg handling right, and + ends up sending the reply to the bot itself (as that is the target of the incoming + privmsg, same as in a channel, but the bot is supposed to overwrite the nick case + with the sender's)