Explorar o código

Add cache to command object

Kirk Trombley %!s(int64=4) %!d(string=hai) anos
pai
achega
1ffeae3dfa
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      lib/rollbot/types.py

+ 4 - 0
lib/rollbot/types.py

@@ -47,6 +47,10 @@ class Command:
     name: str
     args: str
 
+    def __post_init__(self):
+        # cache is used by injectors to store results and avoid recomputation
+        self.cache = {}
+
     @staticmethod
     def from_text(text: str) -> Optional[Command]:
         cleaned = text.lstrip()