def ison(jenni,input): """.ison <nick> """ dat=web.get_urllib_object("http://redflare.ofthings.net/reports",30) data=json.load(dat) try: nick =input.group(2).rstrip() except AttributeError: nick='' print nick, type(nick), str(nick), type(str(nick)) flag=0 for i in iter(data): tmp=data[i] if(tmp['playerNames']==[]): continue print tmp['description'] for temp in tmp['playerNames']: try: print "trying: ",nick," and ",temp['plain'] if str(nick).strip().lower() in str(temp['plain']).strip().lower(): jenni.say("Found "+nick+"( "+temp['plain']+" ) on server: "+tmp['description']) flag=1 except UnicodeEncodeError: print 'err' if flag==0: jenni.say("Nick not found")
def imdb(jenni, input): if not input.group(2): return word=input.group(2).rstrip() word=word.replace(" ", "+") uri="http://www.imdbapi.com/?t="+word try: u = web.get_urllib_object(uri, 30) except: jenni.say('IMDB is too slow at the moment :(') return 'err' data = json.load(u) #data is a Dict containing all the information we need u.close() if data['Response'] == 'False': if 'Error' in data: message = '[IMDB] %s' % data['Error'] else: jenni.debug('imdb', 'Got an error from the imdb api, search phrase was %s' % word, 'warning') jenni.debug('imdb', str(data), 'warning') message = '[IMDB] Got an error from the IMDB api' else: message = '[IMDB] Title: ' +data['Title']+ \ ' | Year: ' +data['Year']+ \ ' | Rating: ' +data['imdbRating']+ \ ' | Genre: ' +data['Genre']+ \ ' | Link: http://imdb.com/title/' + data['imdbID'] jenni.say(message)
def movie(jenni, trigger): """ Returns some information about a movie, like Title, Year, Rating, Genre and IMDB Link. """ if not trigger.group(2): return word=trigger.group(2).rstrip() word=word.replace(" ", "+") uri="http://www.imdbapi.com/?t="+word u = web.get_urllib_object(uri, 30) data = json.load(u) #data is a Dict containing all the information we need u.close() if data['Response'] == 'False': if 'Error' in data: message = '[MOVIE] %s' % data['Error'] else: jenni.debug('movie', 'Got an error from the imdb api, search phrase was %s' % word, 'warning') jenni.debug('movie', str(data), 'warning') message = '[MOVIE] Got an error from imdbapi' else: message = '[MOVIE] Title: ' +data['Title']+ \ ' | Year: ' +data['Year']+ \ ' | Rating: ' +data['imdbRating']+ \ ' | Genre: ' +data['Genre']+ \ ' | IMDB Link: http://imdb.com/title/' + data['imdbID'] jenni.say(message)
def geoip(jenni, trigger): """.geoip <ip_addr> - Geoip module""" if not trigger .group(2): return word=trigger.group(2).rstrip() uri='http://freegeoip.net/json/'+word u=web.get_urllib_object(uri,30) data=json.load(u) message = 'Country: '+ data['country_name'] + ' Region: '+data['region_name'] + ' City: ' + data['city'] + ' IP: ' + data['ip'] jenni.say(message)
def geoip(jenni,input): """geo ip the player form RE game""" # jenni.say('from geoip module'+str(input)) servlist=['RErelay','doommapsrv','doommodsrv','doomserver','doomrmodsrv','manishrw'] if input.nick in servlist: word=(re.split('\)',(re.split(r'\(',input))[1]))[0] uri='http://freegeoip.net/json/'+word u=web.get_urllib_object(uri,30) data=json.load(u) message = 'Country: '+ data['country_name'] + ' | Region: '+data['region_name'] + ' | City: ' + data['city'] + ' | IP: ' + data['ip'] jenni.say(message)
def servdoom(jenni,input): """.serv """ if( input.nick in jenni.config.admins): dat=web.get_urllib_object("http://redflare.ofthings.net/reports",30) data=json.load(dat) for i in iter(data): tmp=data[i] if tmp['clients']==0: continue if tmp['host']=='149.154.159.31': msg = tmp['description']+":: "+tmp['gameMode']+" "+tmp['mapName']+" " for j in tmp['mutators']: msg=msg+j+" " msg=msg+" | "+"Players: "+str(tmp['clients'])+" -> " for j in range(len(tmp['playerNames'])): msg=msg+tmp['playerNames'][j]['plain']+" , " jenni.say(msg+"|")
def serv(jenni,input): """.serv """ if input.admin: dat=web.get_urllib_object("http://redflare.ofthings.net/reports",30) data=json.load(dat) jenni.say('working') for i in iter(data): tmp=data[i] if(tmp['playerNames']==[]): continue msg = tmp['description']+":: Gamemode:"+tmp['gameMode']+" | "+\ "Map:"+tmp['mapName']+" | "+\ "Address:"+str(i)+" | "+\ "Mutators:" for j in tmp['mutators']: msg=msg+j+"; " msg=msg+" | "+"Players: "+str(tmp['clients'])+" -> " abc=tmp['playerNames'] for j in range(len(abc)): msg=msg+abc[j]['plain']+"; " jenni.say(msg+"|") jenni.say("done")