From ddd4e1114399c043dd4b9db2fdec48e571bdf067 Mon Sep 17 00:00:00 2001 From: Thaeli Date: Thu, 22 Jun 2017 00:52:58 -0400 Subject: [PATCH] Compatibility fixes for Errbot 5.0.1 --- otp.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/otp.py b/otp.py index d817ae0..abb062a 100644 --- a/otp.py +++ b/otp.py @@ -37,11 +37,6 @@ def makeQRCodeMessage(data, mode): class OTP(BotPlugin): """ This implements One Time Passwords for Errbot. """ - def __init__(self, bot): - super().__init__(bot) - self.backlog = [] # backlog of commands awaiting for OTP. - self.lock = threading.Lock() # protects storage - self.bl_lock = threading.Lock() # protects backlog @contextlib.contextmanager def stored(self, key): @@ -55,6 +50,9 @@ def stored(self, key): def activate(self): super().activate() + self.backlog = [] # backlog of commands awaiting for OTP. + self.lock = threading.Lock() # protects storage + self.bl_lock = threading.Lock() # protects backlog if 'cmds' not in self: self['cmds'] = set() if 'secrets' not in self: @@ -109,7 +107,7 @@ def otp_reset(self, msg, args): def callback_message(self, msg): """Check the messages if it received an OTP confirming a command.""" - if msg.type == 'groupchat': + if msg.is_group: return try: otp = int(msg.body)