New "shut up" command

This commit is contained in:
Neale Pickett 2007-11-15 08:33:15 -07:00
parent 82c3a7fb06
commit 9da0e88ea8
3 changed files with 22 additions and 1 deletions

6
README
View File

@ -84,6 +84,12 @@ answers with the factoid he gathered.
<dt>firebot, forget _x_ from _y_</dt>
<dd>forget a single entry (<em>x</em>) that is listed in _y_; _x_ can be a single word, it does not need to be the whole entry</dd>
<dt>firebot, shut up</td>
<dd>make the bot only respond to factoids when addressed specifically</dd>
<dt>firebot, be chatty</td>
<dd>make the bot respond to factoids even when not addressed</dd>
</dl>
In addition, the following tricks can be used within factiods:

View File

@ -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

View File

@ -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)