def kickss(inp, input=None, bot=None): repchan = input.conn.conf["reportchan"] nickf = munge.munge(0, input, bot, 0, "") json.dump(bot.config, open('config', 'w'), sort_keys=True, indent=1) if input.nick==input.conn.nick and not perm.isowner(input) and not perm.isbot(input): input.conn.conf['channels'].remove(input.inp) input.conn.send("PRIVMSG "+repchan+" :I have been kicked in "+input.chan+" by "+nickf)
def urlparser(match, say = None, input=None, bot=None): inpo = input.params.replace(input.chan+" :","") url = match.group().encode('utf-8') regexs = re.compile(r"(.+?)(\'|\"|\(|\)|\{|\}|\]|\[|\<|\>)") matchs = regexs.search(url) if matchs: url = matchs.group(0).replace(matchs.group(0)[-1:],"") url = urlnorm.normalize(url) url2 = urltest(url,match) if (not input.conn.conf['autotitle']==False) and (not (perm.isignored(input) or perm.isbot(input))) and not (inpo.startswith(",t") or inpo.startswith(",title") or inpo.startswith(",shor")) and not ("@" in url): #print "[debug] URL found" if url.startswith("www."): url = "http://"+url for x in ignored_urls: if x in url: return title = parse(url) title = multiwordReplace(title, wordDic) try: realurl = http.get_url(url) except Exception, msg: return("(Link) %s" % msg) api_user = bot.config.get("api_keys", {}).get("bitly_user", None) api_key = bot.config.get("api_keys", {}).get("bitly_api", None) if api_key is None: return "error: no api key set" realurl = isgd(realurl) if realurl == url: return("(Link) %s" % title) else: return("(Link) %s <=> %s" % (realurl, title))
def sieve_suite(bot, input, func, kind, args): inuserhost = input.user+'@'+input.host if perm.isignored(input) and not (perm.isvoiced(input)): if not (input.paraml[0].startswith("\x01ACTION ")): return None else: return input if perm.isbot(input): if not (input.paraml[0].startswith("\x01ACTION ")): return None else: return input if (input.chan in input.conn.conf["ignore"]) and not (perm.isvoiced(input)): if not (input.paraml[0].startswith("\x01ACTION ")): return None else: return input ignored = input.conn.conf['ignore'] if kind == "command": if "^" in input.paraml[1]: input.inp = input.inp.replace("^",bot.chanseen[input.conn.name][input.chan][0]) input.paraml[1] = input.paraml[1].replace("^",bot.chanseen[input.conn.name][input.chan][0]) if input.trigger in bot.config["disabled_commands"]: return None connitem = input.conn for xconn in bot.conns: if connitem==bot.conns[xconn]: server=bot.conns[xconn].name if input.nick in bot.cooldown[str(server)]: bot.cooldown[str(server)][input.nick]+=1 return None if input.paraml[0].startswith("\x01PING "): input.conn.send("NOTICE "+input.nick+" :"+input.inp[1]) fn = re.match(r'^plugins.(.+).py$', func._filename) disabled = bot.config.get('disabled_plugins', []) if fn and fn.group(1).lower() in disabled: return None acl = bot.config.get('acls', {}).get(func.__name__) if acl: if 'deny-except' in acl: allowed_channels = map(unicode.lower, acl['deny-except']) if input.chan.lower() not in allowed_channels: return None if 'allow-except' in acl: denied_channels = map(unicode.lower, acl['allow-except']) if input.chan.lower() in denied_channels: return None #the extended permissions were moved here. if args.get('adminonly', False): if not perm.isadmin(input): return None if args.get('superadminonly', False): if not perm.issuperadmin(input): return None if args.get('owneronly', False): if not perm.isowner(input): return None #extended permissions end here. return input
def joins(paraml, conn=None, input=None, bot=None): repchan = input.conn.conf["reportchan"] if not perm.isowner(input) and not perm.isignored(input) and not perm.isbot(input) and input.nick==conn.nick: input.conn.send("PRIVMSG "+repchan+" :I have joined "+paraml[-1])
def invite(paraml, conn=None, input=None, bot=None): repchan = input.conn.conf["reportchan"] nickf = munge.munge(0, input, bot, 0, "") if not perm.isowner(input) and not perm.isignored(input) and not perm.isbot(input): input.conn.send("PRIVMSG "+repchan+" :I have been invited to "+paraml[-1]+" by "+nickf)