mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-11 12:42:34 +01:00
Added cyborg.
This commit is contained in:
parent
75ef7630a8
commit
f3b49e4e88
@ -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
|
||||
|
@ -202,6 +202,22 @@ class Http(callbacks.Privmsg):
|
||||
quote = ' // '.join(quote.splitlines())
|
||||
irc.reply(quote)
|
||||
|
||||
_cyborgRe = re.compile(r'<p class="mediumheader">(.*?)</p>', re.I)
|
||||
def cyborg(self, irc, msg, args):
|
||||
"""<name>
|
||||
|
||||
Returns a cyborg acronym for <name> from <http://www.cyborgname.com/>.
|
||||
"""
|
||||
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'(?:<b>)?([^<]+)')
|
||||
def acronym(self, irc, msg, args):
|
||||
|
Loading…
Reference in New Issue
Block a user