From 0dda6c07653a609ff1f64096827d1d928b2b54c5 Mon Sep 17 00:00:00 2001 From: CMDR furrycat Date: Fri, 25 Nov 2016 15:04:19 +0000 Subject: [PATCH] Pass on_member_update() to plugins. --- app.py | 5 +++++ plugins.py | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/app.py b/app.py index 85220ac..1181e42 100644 --- 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) diff --git a/plugins.py b/plugins.py index 91470df..e3930bb 100644 --- a/plugins.py +++ b/plugins.py @@ -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): -- 2.7.4