Make commands be processed under received.message.* at PRIORITY_LOW, eat the
event when it's done, change karma.py to use PRIORITY_MONITOR
This commit is contained in:
parent
2a37e10533
commit
59912776c1
2 changed files with 8 additions and 6 deletions
|
@ -1,5 +1,5 @@
|
||||||
import re
|
import re
|
||||||
import Utils
|
import EventManager, Utils
|
||||||
|
|
||||||
STR_MORE = "%s (more...)" % Utils.FONT_RESET
|
STR_MORE = "%s (more...)" % Utils.FONT_RESET
|
||||||
STR_CONTINUED = "(...continued) "
|
STR_CONTINUED = "(...continued) "
|
||||||
|
@ -48,8 +48,10 @@ class Module(object):
|
||||||
def __init__(self, bot, events, exports):
|
def __init__(self, bot, events, exports):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
self.events = events
|
self.events = events
|
||||||
events.on("received.message.channel").hook(self.channel_message)
|
events.on("received.message.channel").hook(self.channel_message,
|
||||||
events.on("received.message.private").hook(self.private_message)
|
priority=EventManager.PRIORITY_LOW)
|
||||||
|
events.on("received.message.private").hook(self.private_message,
|
||||||
|
priority=EventManager.PRIORITY_LOW)
|
||||||
|
|
||||||
events.on("received.command.help").hook(self.help,
|
events.on("received.command.help").hook(self.help,
|
||||||
help="Show help for commands", usage="<command>")
|
help="Show help for commands", usage="<command>")
|
||||||
|
@ -153,7 +155,7 @@ class Module(object):
|
||||||
target.last_stdout = stdout
|
target.last_stdout = stdout
|
||||||
target.last_stderr = stderr
|
target.last_stderr = stderr
|
||||||
buffer.skip_next()
|
buffer.skip_next()
|
||||||
|
event.eat()
|
||||||
|
|
||||||
def channel_message(self, event):
|
def channel_message(self, event):
|
||||||
command_prefix = event["channel"].get_setting("command-prefix",
|
command_prefix = event["channel"].get_setting("command-prefix",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import re, time
|
import re, time
|
||||||
import Utils
|
import EventManager, Utils
|
||||||
|
|
||||||
REGEX_KARMA = re.compile("(.*)(\+{2,}|\-{2,})$")
|
REGEX_KARMA = re.compile("(.*)(\+{2,}|\-{2,})$")
|
||||||
KARMA_DELAY_SECONDS = 3
|
KARMA_DELAY_SECONDS = 3
|
||||||
|
@ -10,7 +10,7 @@ class Module(object):
|
||||||
self.events = events
|
self.events = events
|
||||||
events.on("new").on("user").hook(self.new_user)
|
events.on("new").on("user").hook(self.new_user)
|
||||||
events.on("received").on("message").on("channel").hook(
|
events.on("received").on("message").on("channel").hook(
|
||||||
self.channel_message)
|
self.channel_message, priority=EventManager.PRIORITY_MONITOR)
|
||||||
events.on("received").on("command").on("karma").hook(
|
events.on("received").on("command").on("karma").hook(
|
||||||
self.karma, help="Get your or someone else's karma",
|
self.karma, help="Get your or someone else's karma",
|
||||||
usage="[target]")
|
usage="[target]")
|
||||||
|
|
Loading…
Reference in a new issue