From 96e861a6ece5d8f40328ac924d70836fd203049d Mon Sep 17 00:00:00 2001 From: Gordon Shumway <39967334+oddluck@users.noreply.github.com> Date: Fri, 15 Nov 2019 17:31:41 -0500 Subject: [PATCH] give 'no result' for local IPs --- Geo/plugin.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Geo/plugin.py b/Geo/plugin.py index 586ab4a..87d6148 100644 --- a/Geo/plugin.py +++ b/Geo/plugin.py @@ -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'])