Always display plugin errors
And fix !megakick once more.
This commit is contained in:
10
hptoad.py
10
hptoad.py
@@ -147,6 +147,7 @@ class Hptoad:
|
|||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def handle_command(self, command, body, nick, from_id, is_admin):
|
def handle_command(self, command, body, nick, from_id, is_admin):
|
||||||
if command == "megakick": # Megakick.
|
if command == "megakick": # Megakick.
|
||||||
|
reply = None
|
||||||
victim = body
|
victim = body
|
||||||
if victim:
|
if victim:
|
||||||
is_bot_admin = self.is_muc_admin(self.muc, self.bot_nick)
|
is_bot_admin = self.is_muc_admin(self.muc, self.bot_nick)
|
||||||
@@ -163,6 +164,7 @@ class Hptoad:
|
|||||||
else:
|
else:
|
||||||
reply = "%s: WAT" % nick
|
reply = "%s: WAT" % nick
|
||||||
|
|
||||||
|
if reply:
|
||||||
self.client.send_message(mto=self.muc, mbody=reply,
|
self.client.send_message(mto=self.muc, mbody=reply,
|
||||||
mtype="groupchat")
|
mtype="groupchat")
|
||||||
|
|
||||||
@@ -299,10 +301,10 @@ class Hptoad:
|
|||||||
def on_plugin_got_result(self, future, nick="", from_id="", is_admin=False):
|
def on_plugin_got_result(self, future, nick="", from_id="", is_admin=False):
|
||||||
result = future.result()
|
result = future.result()
|
||||||
|
|
||||||
if not result or not result["handled"]:
|
if not result:
|
||||||
return
|
return
|
||||||
|
|
||||||
if result["reply"]:
|
if result["handled"] and result["reply"]:
|
||||||
self.client.send_message(mto=self.muc, mbody=result["reply"],
|
self.client.send_message(mto=self.muc, mbody=result["reply"],
|
||||||
mtype="groupchat")
|
mtype="groupchat")
|
||||||
|
|
||||||
@@ -312,10 +314,6 @@ class Hptoad:
|
|||||||
self.client.send_message(mto=from_id, mbody=result["error"],
|
self.client.send_message(mto=from_id, mbody=result["error"],
|
||||||
mtype="chat")
|
mtype="chat")
|
||||||
|
|
||||||
if nick:
|
|
||||||
self.client.send_message(mto=self.muc, mbody="%s: WAT" % nick,
|
|
||||||
mtype="groupchat")
|
|
||||||
|
|
||||||
def import_plugins(self):
|
def import_plugins(self):
|
||||||
plugins = {}
|
plugins = {}
|
||||||
_, _, filenames = next(os.walk("./plugins"), (None, None, []))
|
_, _, filenames = next(os.walk("./plugins"), (None, None, []))
|
||||||
|
|||||||
Reference in New Issue
Block a user