<s> from datetime import datetime , timedelta <EOL> import re <EOL> from base import BaseMatcher <EOL> class BrbMatcher ( BaseMatcher ) : <EOL> name = '<STR_LIT>' <EOL> memory = { } <EOL> regex = r'<STR_LIT>' <EOL> def respond ( self , message , user = None ) : <EOL> if '<STR_LIT>' in message . lower ( ) : <EOL> matches = re . findall ( self . regex , message . lower ( ) ) <EOL> if matches : <EOL> now = datetime . now ( ) <EOL> due = now + timedelta ( minutes = int ( matches [ <NUM_LIT:0> ] ) ) <EOL> self . memory [ user ] = due <EOL> elif '<STR_LIT>' in message . lower ( ) : <EOL> if user in self . memory . keys ( ) : <EOL> due = self . memory [ user ] <EOL> now = datetime . now ( ) <EOL> if now > due : <EOL> message = user + "<STR_LIT>" + "<STR_LIT>" <EOL> self . speak ( message ) <EOL> self . memory . pop ( user ) <EOL> else : <EOL> pass </s>
