From 9da0e88ea88185dfd7d3bfd894efa043c98b637b Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Thu, 15 Nov 2007 08:33:15 -0700 Subject: [PATCH] New "shut up" command --- README | 6 ++++++ gallium.py | 2 +- infobot.py | 15 +++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/README b/README index 72971b2..65d0b1c 100644 --- a/README +++ b/README @@ -84,6 +84,12 @@ answers with the factoid he gathered.
firebot, forget _x_ from _y_
forget a single entry (x) that is listed in _y_; _x_ can be a single word, it does not need to be the whole entry
+
firebot, shut up +
make the bot only respond to factoids when addressed specifically
+ +
firebot, be chatty +
make the bot respond to factoids even when not addressed
+ In addition, the following tricks can be used within factiods: diff --git a/gallium.py b/gallium.py index ca711ed..a8341af 100755 --- a/gallium.py +++ b/gallium.py @@ -117,7 +117,7 @@ if __name__ == '__main__': fink = Gallium(('irc.oftc.net', 6667), ['fink'], "Do you like my hat?", - ["#fast-food", "#orion"], + ["#fast-food"], dbname='fink.cdb') fink.debug = debug diff --git a/infobot.py b/infobot.py index d072418..b261eb3 100644 --- a/infobot.py +++ b/infobot.py @@ -50,6 +50,8 @@ class InfoBot(BindingsBot): msg_cat['locked'] = ('Sorry, %(sender)s, %(key)s is locked.',) msg_cat['tell'] = ('%(sender)s wants you to know: %(string)s',) msg_cat['synced'] = ('Synchronized in %(time)f seconds.',) + msg_cat['quiet'] = ("Fine, %(sender)s, I'll shut up.",) + msg_cat['chatty'] = ("Thanks, %(sender)s, I've been chomping at the bit.",) def do_sync(self, sender, forum, addl, match): @@ -280,6 +282,19 @@ class InfoBot(BindingsBot): val = match.group('val') return self.do_store(sender, forum, key, val, me=True, no=True, also=True) + def chatty_on(self, sender, forum, addl, match): + self.chatty = True + forum.msg(self.gettext('chatty', sender=sender.name())) + bindings.append((re.compile(r"^\008[,: ]+ be chatty", re.IGNORECASE), + chatty_on)) + + def chatty_off(self, sender, forum, addl, match): + self.chatty = False + forum.msg(self.gettext('quiet', sender=sender.name())) + bindings.append((re.compile(r"^\008[,: ]+ shut up", re.IGNORECASE), + chatty_off)) + + # Pull in BindingsBot things bindings.extend(BindingsBot.bindings)