regex-cleanup #19
12
config.py
12
config.py
@ -74,14 +74,14 @@ conf.registerGlobalValue(SnoParser, 'debug',
|
||||
###
|
||||
conf.registerGroup(SnoParser, 'redis')
|
||||
conf.registerGlobalValue(SnoParser.redis, 'db1',
|
||||
registry.Integer('1',
|
||||
registry.Integer(1,
|
||||
"""
|
||||
Redis: Database number for counting of NICKNAMES.
|
||||
"""
|
||||
, private=True
|
||||
))
|
||||
conf.registerGlobalValue(SnoParser.redis, 'db2',
|
||||
registry.Integer('2',
|
||||
registry.Integer(2,
|
||||
"""
|
||||
Redis: Database number for counting of IP ADDRESSES.
|
||||
"""
|
||||
@ -95,7 +95,7 @@ conf.registerGlobalValue(SnoParser.redis, 'host',
|
||||
, private=True
|
||||
))
|
||||
conf.registerGlobalValue(SnoParser.redis, 'port',
|
||||
registry.Integer('6379',
|
||||
registry.Integer(6379,
|
||||
"""
|
||||
Redis: Port.
|
||||
"""
|
||||
@ -115,7 +115,7 @@ conf.registerGlobalValue(SnoParser.redis, 'password',
|
||||
"""
|
||||
))
|
||||
conf.registerGlobalValue(SnoParser.redis, 'timeout',
|
||||
registry.Integer('5',
|
||||
registry.Integer(5,
|
||||
"""
|
||||
Redis: Socket Timeout. The developer does not know what to recommend here, but `5` seems to yield good results.
|
||||
"""
|
||||
@ -141,7 +141,7 @@ conf.registerGlobalValue(SnoParser.whois, 'sample',
|
||||
, private=True
|
||||
))
|
||||
conf.registerGlobalValue(SnoParser.whois, 'ttl',
|
||||
registry.Integer('3600',
|
||||
registry.Integer(3600,
|
||||
"""
|
||||
SnoParser: How long to cache WHOIS entries for.
|
||||
"""
|
||||
@ -149,7 +149,7 @@ conf.registerGlobalValue(SnoParser.whois, 'ttl',
|
||||
))
|
||||
conf.registerGroup(SnoParser.whois, 'redis')
|
||||
conf.registerGlobalValue(SnoParser.whois.redis, 'db',
|
||||
registry.Integer('0',
|
||||
registry.Integer(0,
|
||||
"""
|
||||
Redis: Database number for WHOIS query caching.
|
||||
"""
|
||||
|
18
plugin.py
18
plugin.py
@ -243,11 +243,10 @@ class SnoParser(callbacks.Plugin):
|
||||
ttl = self.redis_client_whois.ttl(ipaddress)
|
||||
count = self.redis_client_ips.get(ipaddress)
|
||||
decoded_count = count.decode('utf-8')
|
||||
|
||||
print('SnoParser manual query: ', data, ' ', ttl)
|
||||
irc.reply(f'{decoded_data} - Count: {decoded_count} - Remaining: {ttl}s')
|
||||
|
||||
ipquery = wrap(ipquery, ['anything'])
|
||||
ipquery = wrap(ipquery, ['ip'])
|
||||
|
||||
|
||||
def doNotice(self, irc, msg):
|
||||
@ -359,12 +358,15 @@ class SnoParser(callbacks.Plugin):
|
||||
self._sendSnotice(irc, msg, repl)
|
||||
|
||||
if 'OPER' in text and 'Client opered up' in text:
|
||||
|
||||
operregex = "^-OPER- Client opered up \[(.*)\]"
|
||||
operregex = "^-OPER- Client opered up \[(.*)\, \ (.*)\]$"
|
||||
couple = re.match(operregex, text)
|
||||
account = couple.group(1)
|
||||
DictFromSnotice = {'notice': 'oper'}
|
||||
repl = f"\x02\x1FNOTICE:\x0F [{account}] opered up."
|
||||
hostmask = couple.group(1)
|
||||
oper = couple.group(2)
|
||||
|
||||
print(couple)
|
||||
|
||||
DictFromSnotice = {'notice': 'opered', 'hostmask': hostmask, 'oper': oper}
|
||||
repl = f"\x02\x1FNOTICE:\x0F [{hostmask}] opered up as [{oper}]."
|
||||
|
||||
self._sendSnotice(irc, msg, repl)
|
||||
|
||||
@ -373,7 +375,7 @@ class SnoParser(callbacks.Plugin):
|
||||
operregex = "^-OPER- Client deopered \[(.*)\]"
|
||||
couple = re.match(operregex, text)
|
||||
account = couple.group(1)
|
||||
DictFromSnotice = {'notice': 'oper'}
|
||||
DictFromSnotice = {'notice': 'deopered', 'name': account}
|
||||
repl = f"\x02\x1FNOTICE:\x0F [{account}] opered down."
|
||||
|
||||
self._sendSnotice(irc, msg, repl)
|
||||
|
Loading…
Reference in New Issue
Block a user