aboutsummaryrefslogtreecommitdiff
path: root/EventManager.py
diff options
context:
space:
mode:
authorGravatar jesopo2018-07-15 23:53:59 +0100
committerGravatar jesopo2018-07-15 23:53:59 +0100
commit8307a1121a3b124ad1a6f1df45006dff226e7294 (patch)
treed5ab00ae1fed72ee6873caccf53cac76bbae3eb6 /EventManager.py
parentMade part/quit print_activity functions more uniform (diff)
signature
move priority constants to root of EventManager namespace
Diffstat (limited to 'EventManager.py')
-rw-r--r--EventManager.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/EventManager.py b/EventManager.py
index a5b7bd37..e46d682b 100644
--- a/EventManager.py
+++ b/EventManager.py
@@ -1,5 +1,10 @@
import traceback
+PRIORITY_URGENT = 0
+PRIORITY_HIGH = 1
+PRIORITY_MEDIUM = 2
+PRIORITY_LOW = 3
+
class Event(object):
def __init__(self, bot, name, **kwargs):
self.bot = bot
@@ -16,11 +21,6 @@ class Event(object):
self.eaten = True
class EventCallback(object):
- PRIORITY_URGENT = 0
- PRIORITY_HIGH = 1
- PRIORITY_MEDIUM = 2
- PRIORITY_LOW = 3
-
def __init__(self, function, bot, priority, **kwargs):
self.function = function
self.bot = bot
@@ -52,8 +52,7 @@ class EventHook(object):
self._call_notify = None
self._stored_events = []
- def hook(self, function, priority=EventCallback.PRIORITY_LOW,
- replay=False, **kwargs):
+ def hook(self, function, priority=PRIORITY_LOW, replay=False, **kwargs):
callback = EventCallback(function, self.bot, priority, **kwargs)
if self._hook_notify:
self._hook_notify(self, callback)