def command(ircbot, source, nick, mask, args): """Takes a space-separated list of websites and returns their shortened goo.gl form / Usage: %PREFIX%BOLDgoogl%RESET http://foo.com http://bar.com""" if not args: ircbot.msg(nick, command.__doc__, notice=True) # return the docstring to the user if there are no arguments return result = [] headers = {'Content-Type' : 'application/json'} for site in args: try: result.append(googl.googl(site, ircbot.config.googleapikey)) except Exception, e: print e
return queryInfo = query.info() queryRules = query.rules() ruleString = u"" for rule in sorted(queryRules.iterkeys()): ruleString += u"%s %s\n" % (rule, queryRules[rule]) ruleString = ruleString.rstrip(u"\n") # strip trailing newline # pastebin stuff pasteResponse = "Couldn't paste cvars" pasteData = None try: pasteData = pasteee.Paste(ruleString, desc="%s - cvars" % (queryInfo[u"hostname"]), key=ircbot.config.pastebinapikey)["link"] except pasteee.PasteError, e: pasteResponse = e if pasteData: pasteResponse = googl.googl(pasteData, ircbot.config.googleapikey) tags, passworded, OS = None, None, None if u"tag" in queryInfo: tags = "Tags: %s" % (queryInfo[u"tag"]) if queryInfo[u"passworded"]: passworded = "Passworded" if queryInfo[u"os"] == u"w": OS = "Windows" queryPlayersDict = sorted(query.player(), key=itemgetter(u"kills"), reverse=True)[0:3:1] or None # get the top 3 players by kills queryPlayersList = [] if queryPlayersDict: for player in queryPlayersDict: queryPlayersList.append("%s:%s" % (player[u"name"], str(player[u"kills"]))) queryPlayersList = ", ".join(queryPlayersList)