Renamed location.py > geoip.py, tweaked code

This commit is contained in:
Luke Rogers 2011-11-21 20:14:21 +13:00
parent 147398f8bc
commit 70c0b844e2

View file

@ -20,11 +20,10 @@ def timezone(ip):
return int(time) return int(time)
@hook.command @hook.command
def locations(inp, say = None, me = None, bot = None): @hook.command("location")
".location <ip> - Performs a GeoIP check on the ip given." def geoip(inp, say = None, bot = None):
".geoip <ip> - Performs a location check on the ip given."
api = bot.config['api_keys']['geoip'] api = bot.config['api_keys']['geoip']
if api == "":
return "No API key"
give = find_location(inp, api) give = find_location(inp, api)
if give["country"] not in [""," ","-"," - "]: if give["country"] not in [""," ","-"," - "]:
if give["state"] == give["city"]: if give["state"] == give["city"]:
@ -36,3 +35,4 @@ def locations(inp, say = None, me = None, bot = None):
else: else:
say("Either that wasn't an IP or I cannot locate it in my database. :(") say("Either that wasn't an IP or I cannot locate it in my database. :(")
return return