Nonetype for string config

This commit is contained in:
Pratyush Desai 2021-09-02 18:02:58 +05:30
parent 46596e0b33
commit 7a7bbe9b01
Signed by: pratyush
GPG Key ID: DBA5BB7505946FAD
2 changed files with 4 additions and 11 deletions

View File

@ -53,7 +53,7 @@ SnoParser = conf.registerPlugin('SnoParser')
# registry.Boolean(False, _("""Help for someConfigVariableName.""")))
conf.registerGlobalValue(SnoParser, 'targetChannel',
registry.String(None, ("""Sends reformatted snolines to the <channel>""")))
registry.String("", ("""Sends reformatted snolines to the <channel>""")))
conf.registerGlobalValue(SnoParser, 'AutoVhost',
registry.String('libcasa/user/', ("""Configure the vhost eg. libcasa/user/$account""")))

View File

@ -253,8 +253,9 @@ class SnoParser(callbacks.Plugin):
(target, text) = msg.args
if target == irc.nick:
# server notices CONNECT, KILL, XLINE, NICK, ACCOUNT
# server notices
text = ircutils.stripFormatting(text)
# CONNECT
if 'CONNECT' in text:
connregex = "^-CONNECT- Client connected \[(.+)\] \[u\:~(.+)\] \[h\:(.+)\] \[ip\:(.+)\] \[r\:(.+)\]$"
couple = re.match(connregex, text)
@ -272,9 +273,7 @@ class SnoParser(callbacks.Plugin):
whois = self.whois_run(sourceip=ip)
DictFromSnotice = {'notice': 'connect', 'nickname': nickname, 'username': username, 'host': host, 'ip': ip, 'realname': realname, 'ipCount': ip_seen, 'nickCount': nick_seen}
#repl = f"\x02\x1FNOTICE: {DictFromSnotice['notice']} \x0F\x11\x0303==>>\x0F \x02Nick:\x0F {DictFromSnotice['nickname']} \x02Username:\x0F {DictFromSnotice['username']} \x02Hostname:\x0F {DictFromSnotice['host']} \x02IP:\x0F {DictFromSnotice['ip']} \x02Realname:\x0F {DictFromSnotice['realname']} \x02IPcount:\x0F {DictFromSnotice['ipCount']} \x02NickCount:\x0F {DictFromSnotice['nickCount']}"
repl = f"\x02\x1F{DictFromSnotice['notice']} \x0F\x11\x0303==>>\x0F \x02Nick:\x0F {DictFromSnotice['nickname']} \x02Username:\x0F {DictFromSnotice['username']} \x02Hostname:\x0F {DictFromSnotice['host']} \x02IP:\x0F {DictFromSnotice['ip']} {whois} \x02Realname:\x0F {DictFromSnotice['realname']} \x02IPcount:\x0F {DictFromSnotice['ipCount']} \x02NickCount:\x0F {DictFromSnotice['nickCount']}"
self._sendSnotice(irc, msg, repl)
if 'XLINE' in text and 'temporary' in text:
xlineregex = "^-XLINE- (.+) \[(.+)\] added temporary \((.+)\) (K-Line|D-Line) for (.+)$"
@ -344,8 +343,8 @@ class SnoParser(callbacks.Plugin):
# Trigger HS SET
self._setvhost(irc, msg, account)
self._sendSnotice(irc, msg, repl)
if 'ACCOUNT' in text and 'registered account' in text and 'SAREGISTER' in text:
accregex = "^-ACCOUNT- Operator \[(.*)\] registered account \[(.*)\] with SAREGISTER$"
couple = re.match(accregex, text)
@ -353,7 +352,6 @@ class SnoParser(callbacks.Plugin):
account = couple.group(2)
DictFromSnotice = {'notice': 'sareg', 'oper': oper, 'account': account}
repl = f"\x02\x1FNOTICE: sareg -> [{account}] was registered by operator [{oper}]"
self._setvhost(irc, msg, account)
self._sendSnotice(irc, msg, repl)
@ -362,16 +360,11 @@ class SnoParser(callbacks.Plugin):
couple = re.match(operregex, text)
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)
if 'OPER' in text and 'Client deopered' in text:
operregex = "^-OPER- Client deopered \[(.*)\]"
couple = re.match(operregex, text)
account = couple.group(1)