Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions otp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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:
Expand Down Expand Up @@ -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)
Expand Down