]> git.aero2k.de Git - urlbot-v3.git/commitdiff
nicer representation for actions
authorThorsten S <mail@aero2k.de>
Wed, 1 May 2019 09:14:41 +0000 (11:14 +0200)
committerThorsten S <mail@aero2k.de>
Wed, 1 May 2019 09:14:41 +0000 (11:14 +0200)
distbot/common/action.py

index 7ea70fd1b7906e773c6ae4a64d6823ce70415055..c754c0ab3e45da1b5021a91b5a656c83b6d083c4 100644 (file)
@@ -34,6 +34,14 @@ class Action:
 
         self.command = kwargs.get('command')
 
+    def __repr__(self):
+        properties = [
+            "%s='%s'" % (key, str(self.__getattribute__(key))) for key in
+            ["msg", "priv_msg", "presence", "sender", "recipient", "event", "stop_event", "time", "mutex", "command"] if
+            self.__getattribute__(key) is not None
+        ]
+        return "<Action %s/>" % " ".join(properties)
+
     @property
     def serializable(self):
         return self.__dict__