From f3b49e4e88ae9ef1ea84ca1617ea263c613d07f4 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Fri, 23 Jan 2004 16:41:01 +0000 Subject: [PATCH] Added cyborg. --- ChangeLog | 3 +++ plugins/Http.py | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/ChangeLog b/ChangeLog index d64f85cbb..b8ec08fef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ + * Added Http.cyborg, a fun little command for getting cyborg + abbreviations for names. + * Added Sourceforge.totalbugs and Sourceforge.totalrfes * Removed Admin.setprefixchar, since it's unneeded with the new diff --git a/plugins/Http.py b/plugins/Http.py index 9aafd48a9..f44f329ae 100644 --- a/plugins/Http.py +++ b/plugins/Http.py @@ -202,6 +202,22 @@ class Http(callbacks.Privmsg): quote = ' // '.join(quote.splitlines()) irc.reply(quote) + _cyborgRe = re.compile(r'

(.*?)

', re.I) + def cyborg(self, irc, msg, args): + """ + + Returns a cyborg acronym for from . + """ + name = privmsgs.getArgs(args) + name = urllib.quote(name) + url = 'http://www.cyborgname.com/cyborger.cgi?acronym=%s' % name + html = webutils.getUrl(url) + m = self._cyborgRe.search(html) + if m: + irc.reply(m.group(1)) + else: + irc.errorPossibleBug('No cyborg name returned.') + _acronymre = re.compile(r'valign="middle" width="7\d%" bgcolor="[^"]+">' r'(?:)?([^<]+)') def acronym(self, irc, msg, args):