give 'no result' for local IPs

This commit is contained in:
Gordon Shumway 2019-11-15 17:31:41 -05:00 committed by GitHub
parent 66e5fecd6a
commit 96e861a6ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -66,10 +66,13 @@ class Geo(callbacks.Plugin):
ip = stuff
else:
irc.reply("invalid nick or hostname/ip {0}".format(stuff))
res = reader.city(ip)
if res:
irc.reply('%s, %s, %s' % (res.city.name, res.subdivisions.most_specific.name, res.country.name ))
else:
try:
res = reader.city(ip)
if res:
irc.reply('%s, %s, %s' % (res.city.name, res.subdivisions.most_specific.name, res.country.name ))
else:
irc.reply("No results found")
except:
irc.reply("No results found")
geo = wrap(geo, ['text'])