diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-08-06 20:40:40 +0200 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-08-06 20:40:40 +0200 |
commit | 9a66dcadede5cadc00b4fde344f75a9bd78220d7 (patch) | |
tree | 3f9058aba3376c28dffcbb4d008a271d413f9597 | |
parent | 900623771ac00270992ab66f959ab679c09a5f1f (diff) |
markov plugin: don't echo a line a line that is just a substring of the input line
-rw-r--r-- | data/rbot/plugins/markov.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/data/rbot/plugins/markov.rb b/data/rbot/plugins/markov.rb index 3339eac0..9b83e53a 100644 --- a/data/rbot/plugins/markov.rb +++ b/data/rbot/plugins/markov.rb @@ -183,7 +183,9 @@ class MarkovPlugin < Plugin return unless word1 and word2 line = generate_string(word1, word2) return unless line - return if line == message + # we do nothing if the line we return is just an initial substring + # of the line we received + return if message.index(line) == 0 @bot.timer.add_once(delay) { m.reply line } |