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
|
registry.Boolean(True, _("""Determines whether the
|
||||||
message parser is enabled. If enabled, will trigger on regexps
|
message parser is enabled. If enabled, will trigger on regexps
|
||||||
added to the regexp db.""")))
|
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',
|
conf.registerChannelValue(MessageParser, 'keepRankInfo',
|
||||||
registry.Boolean(True, _("""Determines whether we keep updating the usage
|
registry.Boolean(True, _("""Determines whether we keep updating the usage
|
||||||
count for each regexp, for popularity ranking.""")))
|
count for each regexp, for popularity ranking.""")))
|
||||||
|
@ -146,13 +146,11 @@ class MessageParser(callbacks.Plugin, plugins.ChannelDBHandler):
|
|||||||
else:
|
else:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def doPrivmsg(self, irc, msg):
|
def do_privmsg_notice(self, irc, msg):
|
||||||
channel = msg.args[0]
|
channel = msg.args[0]
|
||||||
if not irc.isChannel(channel):
|
if not irc.isChannel(channel):
|
||||||
return
|
return
|
||||||
if self.registryValue('enable', channel):
|
if self.registryValue('enable', channel):
|
||||||
if callbacks.addressed(irc.nick, msg): #message is direct command
|
|
||||||
return
|
|
||||||
actions = []
|
actions = []
|
||||||
results = []
|
results = []
|
||||||
for channel in set(map(plugins.getChannel, (channel, 'global'))):
|
for channel in set(map(plugins.getChannel, (channel, 'global'))):
|
||||||
@ -182,6 +180,14 @@ class MessageParser(callbacks.Plugin, plugins.ChannelDBHandler):
|
|||||||
for action in actions:
|
for action in actions:
|
||||||
self._runCommandFunction(irc, msg, action)
|
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
|
@internationalizeDocstring
|
||||||
def add(self, irc, msg, args, channel, regexp, action):
|
def add(self, irc, msg, args, channel, regexp, action):
|
||||||
"""[<channel>|global] <regexp> <action>
|
"""[<channel>|global] <regexp> <action>
|
||||||
|
Loading…
Reference in New Issue
Block a user