This commit is contained in:
neersighted 2012-02-28 21:58:38 -08:00
parent 715f926846
commit 79b4f15b45
3 changed files with 17 additions and 11 deletions

View file

@ -1,5 +1,6 @@
from util import pywhois, hook from util import pywhois, hook
@hook.command @hook.command
def whois(inp, say=None): def whois(inp, say=None):
".whois <domain> -- Look up ownership infomation for <domain>" ".whois <domain> -- Look up ownership infomation for <domain>"
@ -13,28 +14,29 @@ def whois(inp, say=None):
try: try:
domain_name = w.domain_name[0] domain_name = w.domain_name[0]
except IndexError, e: except IndexError, e:
domain_name="none." domain_name = "None"
try: try:
expiration_date = w.expiration_date[0] expiration_date = w.expiration_date[0]
except IndexError, e: except IndexError, e:
expiration_date="none." expiration_date = "None"
try: try:
creation_date = w.creation_date[0] creation_date = w.creation_date[0]
except IndexError, e: except IndexError, e:
creation_date="none." creation_date = "None"
try: try:
registrant_email = w.emails[0] registrant_email = w.emails[0]
except: except:
registrant_email="none." registrant_email = "None"
try: try:
administrative_email = w.emails[1] administrative_email = w.emails[1]
except: except:
administrative_email="none." administrative_email = "None"
say('Domain recognised! %s was registered on \x02%s\x02 and will expire on \x02%s\x02' % (domain_name, creation_date, expiration_date))
say('Registrant email: %s Administrative email: %s' % (registrant_email, administrative_email))
say("Domain recognised! %s was registered on \x02%s\x02 and will "\
"expire on \x02%s\x02" % (domain_name, creation_date, expiration_date))
say("Registrant email: %s "\
"Administrative email: %s" % (registrant_email, administrative_email))

View file

@ -2,6 +2,7 @@ import re
from util import hook, http, misc from util import hook, http, misc
from BeautifulSoup import BeautifulSoup from BeautifulSoup import BeautifulSoup
@hook.command(autohelp=False) @hook.command(autohelp=False)
def word(inp, say=False, nick=False): def word(inp, say=False, nick=False):
".word -- Gets the word of the day." ".word -- Gets the word of the day."
@ -15,4 +16,5 @@ def word(inp, say=False, nick=False):
#definitions = re.findall(r'<span class="ssens"><strong>:</strong>' #definitions = re.findall(r'<span class="ssens"><strong>:</strong>'
# r' *([^<]+)</span>', content) # r' *([^<]+)</span>', content)
say("(%s) The word of the day is: \x02%s\x02 (%s)" % (nick, word, function)) say("(%s) The word of the day is:"\
" \x02%s\x02 (%s)" % (nick, word, function))

View file

@ -50,11 +50,12 @@ def get_video_description(vid_id):
return out return out
def GetInHMS(seconds): def GetInHMS(seconds):
hours = seconds / 3600 hours = seconds / 3600
seconds -= 3600*hours seconds -= 3600 * hours
minutes = seconds / 60 minutes = seconds / 60
seconds -= 60*minutes seconds -= 60 * minutes
if hours == 0: if hours == 0:
return "%02d:%02d" % (minutes, seconds) return "%02d:%02d" % (minutes, seconds)
return "%02d:%02d:%02d" % (hours, minutes, seconds) return "%02d:%02d:%02d" % (hours, minutes, seconds)
@ -64,6 +65,7 @@ def GetInHMS(seconds):
def youtube_url(match): def youtube_url(match):
return get_video_description(match.group(1)) return get_video_description(match.group(1))
@hook.command('yt') @hook.command('yt')
@hook.command('y') @hook.command('y')
@hook.command @hook.command