mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +01:00
MessageParser: Add support for notices.
This commit is contained in:
parent
2a8b8e78a0
commit
7479849767
@ -57,6 +57,9 @@ conf.registerChannelValue(MessageParser, 'enable',
|
||||
registry.Boolean(True, _("""Determines whether the
|
||||
message parser is enabled. If enabled, will trigger on regexps
|
||||
added to the regexp db.""")))
|
||||
conf.registerChannelValue(MessageParser, 'enableForNotices',
|
||||
registry.Boolean(False, _("""Determines whether the message parser
|
||||
is enabled for NOTICE messages too.""")))
|
||||
conf.registerChannelValue(MessageParser, 'keepRankInfo',
|
||||
registry.Boolean(True, _("""Determines whether we keep updating the usage
|
||||
count for each regexp, for popularity ranking.""")))
|
||||
|
@ -146,13 +146,11 @@ class MessageParser(callbacks.Plugin, plugins.ChannelDBHandler):
|
||||
else:
|
||||
return True
|
||||
|
||||
def doPrivmsg(self, irc, msg):
|
||||
def do_privmsg_notice(self, irc, msg):
|
||||
channel = msg.args[0]
|
||||
if not irc.isChannel(channel):
|
||||
return
|
||||
if self.registryValue('enable', channel):
|
||||
if callbacks.addressed(irc.nick, msg): #message is direct command
|
||||
return
|
||||
actions = []
|
||||
results = []
|
||||
for channel in set(map(plugins.getChannel, (channel, 'global'))):
|
||||
@ -182,6 +180,14 @@ class MessageParser(callbacks.Plugin, plugins.ChannelDBHandler):
|
||||
for action in actions:
|
||||
self._runCommandFunction(irc, msg, action)
|
||||
|
||||
def doPrivmsg(self, irc, msg):
|
||||
if not callbacks.addressed(irc.nick, msg): #message is not direct command
|
||||
self.do_privmsg_notice(irc, msg)
|
||||
|
||||
def doNotice(self, irc, msg):
|
||||
if self.registryValue('enableForNotices', msg.args[0]):
|
||||
self.do_privmsg_notice(irc, msg)
|
||||
|
||||
@internationalizeDocstring
|
||||
def add(self, irc, msg, args, channel, regexp, action):
|
||||
"""[<channel>|global] <regexp> <action>
|
||||
|
Loading…
Reference in New Issue
Block a user