def cmd_locate(self, data, client, cmd=None): input = self._adminPlugin.parseUserCmd(data) if input: # input[0] is the player id sclient = self._adminPlugin.findClientPrompt(input[0], client) if not sclient: # a player matchin the name was not found, a list of closest matches will be displayed # we can exit here and the user will retry with a more specific player return False else: client.message('^7Invalid data, try !help whereis') return False if sclient.isvar(self,'country'): country = sclient.var(self, 'country').value else: # lets find the country try: ret = geoip.geo_ip_lookup(sclient.ip) country = translate(u'%s (%s)' % (ret['city'],ret['country_name'])) sclient.setvar(self, 'country', country) except Exception, e: self.error(e) client.message('^7Unable to find client location.') return False
def cmd_locate(self, data, client, cmd=None): input = self._adminPlugin.parseUserCmd(data) if input: # input[0] is the player id sclient = self._adminPlugin.findClientPrompt(input[0], client) if not sclient: # a player matchin the name was not found, a list of closest matches will be displayed # we can exit here and the user will retry with a more specific player return False else: client.message('^7Invalid data, try !help whereis') return False if sclient.isvar(self, 'country'): country = sclient.var(self, 'country').value else: # lets find the country try: ret = geoip.geo_ip_lookup(sclient.ip) country = translate(u'%s (%s)' % (ret['city'], ret['country_name'])) sclient.setvar(self, 'country', country) except Exception, e: self.error(e) client.message('^7Unable to find client location.') return False
def get_client_location(self, client): if client.isvar(self,'localization'): return client.var(self, 'localization').value else: # lets find the country try: ret = geoip.geo_ip_lookup(client.ip) if ret: client.setvar(self, 'localization', ret) return ret except Exception, e: self.error(e) return False
def get_client_location(self, client): if client.isvar(self, 'localization'): return client.var(self, 'localization').value else: # lets find the country try: ret = geoip.geo_ip_lookup(client.ip) if ret: client.setvar(self, 'localization', ret) return ret except Exception, e: self.error(e) return False