diff --git a/NetUtils.py b/NetUtils.py index 248a05c3..6b45c3ca 100644 --- a/NetUtils.py +++ b/NetUtils.py @@ -150,8 +150,8 @@ class JSONtoTextParser(metaclass=HandlerMeta): return "".join(self.handle_node(section) for section in input_object) def handle_node(self, node: JSONMessagePart): - type = node.get("type", None) - handler = self.handlers.get(type, self.handlers["text"]) + node_type = node.get("type", None) + handler = self.handlers.get(node_type, self.handlers["text"]) return handler(node) def _handle_color(self, node: JSONMessagePart): diff --git a/Options.py b/Options.py index 27f97b80..871b4d66 100644 --- a/Options.py +++ b/Options.py @@ -150,7 +150,9 @@ class Choice(Option): return cls.from_text(str(data)) def __eq__(self, other): - if isinstance(other, str): + if isinstance(other, self.__class__): + return other.value == self.value + elif isinstance(other, str): assert other in self.options return other == self.current_key elif isinstance(other, int): @@ -162,7 +164,9 @@ class Choice(Option): raise TypeError(f"Can't compare {self.__class__.__name__} with {other.__class__.__name__}") def __ne__(self, other): - if isinstance(other, str): + if isinstance(other, self.__class__): + return other.value != self.value + elif isinstance(other, str): assert other in self.options return other != self.current_key elif isinstance(other, int):