summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Baumann <derflob@derflob.de>2016-07-16 17:46:38 +1200
committerFlorian Baumann <derflob@derflob.de>2016-07-16 17:46:38 +1200
commitd76ae648acaec4e0d21ea0eebd4e5b580b6c0fb5 (patch)
tree9cc4ce0a164380f47f373cdb6c49795fd083b9fa
parentedc94c05923266b8f5988574a3d2cc20b0e24b21 (diff)
downloadxmpp-d76ae648acaec4e0d21ea0eebd4e5b580b6c0fb5.tar.gz
xmpp-d76ae648acaec4e0d21ea0eebd4e5b580b6c0fb5.tar.bz2
xmpp_name -> xmpp_cmd
-rw-r--r--__init__.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/__init__.py b/__init__.py
index 959b80c..da0557a 100644
--- a/__init__.py
+++ b/__init__.py
@@ -13,20 +13,16 @@ class xmpp_cmd():
self.name = name
self.desc = desc
self.hidden = hidden
-
def __call__(self, fn):
if (self.name):
fn.xmpp_cmd = self.name
else:
fn.xmpp_cmd = fn.__name__[len('_cmd_'):]
-
if (self.desc):
fn.desc = self.desc
else:
fn.desc = fn.__doc__
-
fn.hidden = self.hidden
-
return fn
class OctoXMPP(EventHandlerPlugin, SettingsPlugin):
@@ -353,14 +349,14 @@ class OctoXMPP(EventHandlerPlugin, SettingsPlugin):
if (len(cmd) == 0 or cmd[0] == 'all'):
lines.append("Available commands:")
for (attr, fn) in self.__dict__.items():
- if (attr.startswith('_cmd_') and hasattr(fn, 'xmpp_name') and not fn.hidden):
- lines.append("{} - {}".format(fn.xmpp_name, fn.desc))
+ if (attr.startswith('_cmd_') and hasattr(fn, 'xmpp_cmd') and not fn.hidden):
+ lines.append("{} - {}".format(fn.xmpp_cmd, fn.desc))
else:
fn = getattr(self, "_cmd_{}".format(cmd[0]), None)
- if (fn and hasattr(fn, 'xmpp_name')):
- lines.append("{} - {}".format(fn.xmpp_name, fn.desc))
+ if (fn and hasattr(fn, 'xmpp_cmd')):
+ lines.append("{} - {}".format(fn.xmpp_cmd, fn.desc))
else:
- lines.append("{} not an available command".format(cmd[0]))
+ lines.append("{} not an available command.".format(cmd[0]))
msg.reply(body="\n".join(lines)).send()