diff --git a/hptoad.py b/hptoad.py index 5e51928..a839e79 100755 --- a/hptoad.py +++ b/hptoad.py @@ -147,6 +147,7 @@ class Hptoad: @asyncio.coroutine def handle_command(self, command, body, nick, from_id, is_admin): if command == "megakick": # Megakick. + reply = None victim = body if victim: is_bot_admin = self.is_muc_admin(self.muc, self.bot_nick) @@ -163,8 +164,9 @@ class Hptoad: else: reply = "%s: WAT" % nick - self.client.send_message(mto=self.muc, mbody=reply, - mtype="groupchat") + if reply: + self.client.send_message(mto=self.muc, mbody=reply, + mtype="groupchat") else: # Any plugin command. futures = [] @@ -299,10 +301,10 @@ class Hptoad: def on_plugin_got_result(self, future, nick="", from_id="", is_admin=False): result = future.result() - if not result or not result["handled"]: + if not result: return - if result["reply"]: + if result["handled"] and result["reply"]: self.client.send_message(mto=self.muc, mbody=result["reply"], mtype="groupchat") @@ -312,10 +314,6 @@ class Hptoad: self.client.send_message(mto=from_id, mbody=result["error"], mtype="chat") - if nick: - self.client.send_message(mto=self.muc, mbody="%s: WAT" % nick, - mtype="groupchat") - def import_plugins(self): plugins = {} _, _, filenames = next(os.walk("./plugins"), (None, None, []))