def autoban(inp, name, host):
inp.user = 'OP Alert'
if any(word in name.lower() for word in PROFANITY):
kick_user(inp, name, lex.autoban.kick.name)
ban_user(inp, host, 10)
ban_user(inp, name, 900)
return lex.autoban.name(user=name)
banlist = BANS.get(inp.channel)
if not banlist:
return
# find if the user is in the banlist
bans = [
b for b in banlist if name.lower() in b.names or
any(pat(host) for pat in b.hosts)]
for ban in bans:
try:
# check if the ban has expired
if arrow.get(ban.status, ['M/D/YYYY', 'YYYY-MM-DD']) < arrow.now():
continue
except arrow.parser.ParserError:
# if we can't parse the time, it's perma
pass
kick_user(inp, name, lex.autoban.kick.banlist(reason=ban.reason))
ban_user(inp, host, 900)
return lex.autoban.banlist(user=name, truename=ban.names[0])
评论列表
文章目录