From c139879670b3b9a0de96e0814e58179b2f297689 Mon Sep 17 00:00:00 2001 From: jesopo Date: Thu, 2 Apr 2020 18:38:04 +0100 Subject: [PATCH] add a matching Not() type - to invert other criteria --- ircrobots/matching.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ircrobots/matching.py b/ircrobots/matching.py index aabefce..52fed7c 100644 --- a/ircrobots/matching.py +++ b/ircrobots/matching.py @@ -47,3 +47,8 @@ class Literal(ResponseParam): self._value = value def match(self, arg: str) -> bool: return self._value == arg +class Not(ResponseParam): + def __init__(self, param: ResponseParam): + self._param = param + def match(self, arg: str) -> bool: + return not self._param.match(arg)