From 70f7b82bc33a606517404d3e6d762412941bd454 Mon Sep 17 00:00:00 2001 From: mutantmonkey Date: Mon, 14 May 2012 16:44:38 -0400 Subject: [PATCH] add what the commit module --- modules/commit.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 modules/commit.py diff --git a/modules/commit.py b/modules/commit.py new file mode 100644 index 0000000..e2ce0d2 --- /dev/null +++ b/modules/commit.py @@ -0,0 +1,22 @@ +#!/usr/bin/python3 +""" +commit.py - what the commit +author: mutantmonkey +""" + +from urllib.error import HTTPError +import web + +def commit(phenny, input): + """.commit - Get a What the Commit commit message.""" + + try: + msg = web.get("http://whatthecommit.com/index.txt") + except (HTTPError, IOError, ValueError): + phenny.reply("THE INTERNET IS FUCKING BROKEN. Please try again later.") + return + phenny.reply(msg) +commit.commands = ['commit'] + +if __name__ == '__main__': + print(__doc__.strip())