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 ip = stuff
else: else:
irc.reply("invalid nick or hostname/ip {0}".format(stuff)) irc.reply("invalid nick or hostname/ip {0}".format(stuff))
res = reader.city(ip) try:
if res: res = reader.city(ip)
irc.reply('%s, %s, %s' % (res.city.name, res.subdivisions.most_specific.name, res.country.name )) if res:
else: 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") irc.reply("No results found")
geo = wrap(geo, ['text']) geo = wrap(geo, ['text'])