Pass on_member_update() to plugins.
authorCMDR furrycat <elite@furrycat.net>
Fri, 25 Nov 2016 15:04:19 +0000 (15:04 +0000)
committerCMDR furrycat <elite@furrycat.net>
Fri, 25 Nov 2016 15:04:19 +0000 (15:04 +0000)
app.py
plugins.py

diff --git a/app.py b/app.py
index 85220ac..1181e42 100644 (file)
--- a/app.py
+++ b/app.py
@@ -337,4 +337,9 @@ def on_message(message):
 def on_member_join(member):
   yield from plugins.on_member_join(member)
 
+@client.event
+@asyncio.coroutine
+def on_member_update(before, after):
+  yield from plugins.on_member_update(before, after)
+
 client.run(token)
index 91470df..e3930bb 100644 (file)
@@ -109,6 +109,12 @@ class Plugins(object):
       if self.has_method(name, 'on_member_join'):
         asyncio.async(self.call_coroutine(name, 'on_member_join', member))
 
+  @asyncio.coroutine
+  def on_member_update(self, before, after):
+    for name in self.plugins():
+      if self.has_method(name, 'on_member_update'):
+        asyncio.async(self.call_coroutine(name, 'on_member_update', before, after))
+
   # Plugin can return True to force skipping other handlers.
   @asyncio.coroutine
   def handle_command(self, message, command, raw):