Skip to content

Instantly share code, notes, and snippets.

@cat5inthecradle
Created May 29, 2015 04:37
Show Gist options
  • Select an option

  • Save cat5inthecradle/4418ea4bde3890c5677b to your computer and use it in GitHub Desktop.

Select an option

Save cat5inthecradle/4418ea4bde3890c5677b to your computer and use it in GitHub Desktop.
Jabberbot BOFH Excuse
# download the bofh excuse list from http://pages.cs.wisc.edu/~ballard/bofh/excuses
# save the list to ./bofh/bofh.txt with each excuse on a new line
@botcmd
def why(self, mess, arg):
try:
excuses = open('bofh/bofh.txt')
self.send_simple_reply(mess, random.choice(excuses.readlines()).rstrip('\r\n'))
except Exception, e:
self.send_simple_reply(mess, "Sorry I can't think of a good excuse, or bofh/bofh.txt is missing.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment