From 5cada0c5d8df493a2418c89c38cd55b39e4d18f1 Mon Sep 17 00:00:00 2001 From: deuce <> Date: Fri, 27 Sep 2013 22:16:31 +0000 Subject: [PATCH] Notice when there's nothing to quote. --- exec/ircbots/dis/dis.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/exec/ircbots/dis/dis.js b/exec/ircbots/dis/dis.js index 1b0b544898..8c5ff80345 100644 --- a/exec/ircbots/dis/dis.js +++ b/exec/ircbots/dis/dis.js @@ -95,11 +95,15 @@ Bot_Commands["QUOTE"].command = function (target, onick, ouh, srv, lbl, cmd) { return true; var posts=get_posts_by(cmd.slice(1).join(' ')); - var m=null; - while(m==null) { - m=posts.substr(random(posts.length)).match(/[^\.][\.\!\?]\s+(.*?[^.][\.\!\?])[^.]/); + if(posts.search(/[^\.][\.\!\?]\s+(.*?[^.][\.\!\?])[^.]/)==-1) + srv.o(target, "Nothing quotable every posted by "+cmd.slice(1).join(' ')); + else { + var m=null; + while(m==null) { + m=posts.substr(random(posts.length)).match(/[^\.][\.\!\?]\s+(.*?[^.][\.\!\?])[^.]/); + } + srv.o(target, cmd.slice(1).join(' ')+': "'+m[1]+'"'); } - srv.o(target, cmd.slice(1).join(' ')+': "'+m[1]+'"'); } Bot_Commands["DIS"] = new Bot_Command(0, false, false); -- GitLab