def matcher(func): """Add decorated function to skills list for Rasa NLU matching.""" func = add_skill_attributes(func) func.matchers.append( {"rasanlu_intent": intent} ) return func
def matcher(func): """Add decorated function to skills list for Dialogflow matching.""" func = add_skill_attributes(func) func.matchers.append( {"dialogflow_intent": intent} ) return func
def matcher(func): """Add decorated function to skills list for luisai matching.""" func = add_skill_attributes(func) func.matchers.append( {"luisai_intent": intent} ) return func
def matcher(func): """Add decorated function to skills list for always matching.""" func = add_skill_attributes(func) func.matchers.append( {"always": True} ) return func
def matcher(func): """Add decorated function to skills list for webhook matching.""" func = add_skill_attributes(func) func.matchers.append( {"webhook": webhook} ) return func
def matcher(func): """Add decorated function to skills list for crontab matching.""" func = add_skill_attributes(func) func.matchers.append( {"crontab": crontab, "timezone": timezone} ) return func
def constraint_decorator(func): """Add user constraint to skill.""" def constraint_callback(message, users=users): """Check if the user is correct.""" return message.user in users func = add_skill_attributes(func) func.constraints.append(constraint_callback) return func
def constraint_decorator(func): """Add room constraint to skill.""" def constraint_callback(message, rooms=rooms): """Check if the room is correct.""" return message.target in rooms func = add_skill_attributes(func) func.constraints.append(constraint_callback) return func
def matcher(func): """Add decorated function to skills list for catch-all matching.""" func = add_skill_attributes(func) func.matchers.append({ "catchall": True, "messages_only": messages_only }) return func
def constraint_decorator(func): """Add connectors constraint to skill.""" def constraint_callback(message, connectors=connectors): """Check if the connectors is correct.""" return message.connector and (message.connector.name in connectors) func = add_skill_attributes(func) func.constraints.append(constraint_callback) return func
def constraint_decorator(func): """Add connectors constraint to skill.""" def constraint_callback(message, connectors=connectors): """Check if the connectors is correct.""" print(message.connector.name) print(connectors) return message.connector.name in connectors func = add_skill_attributes(func) func.constraints.append(constraint_callback) return func
def matcher(func): """Add decorated function to skills list for regex matching.""" func = add_skill_attributes(func) func.matchers.append( {"regex": { "expression": regex, "case_sensitive": case_sensitive, "score_factor": score_factor or REGEX_SCORE_FACTOR, }} ) return func
def matcher(func): """Add decorated function to skills list for regex matching.""" func = add_skill_attributes(func) func.matchers.append( {"regex": { "expression": regex, "case_sensitive": case_sensitive, "matching_condition": matching_condition, "score_factor": score_factor or REGEX_SCORE_FACTOR, }} ) return func
def matcher(func): """Add decorated function to skills list for parse matching.""" func = add_skill_attributes(func) func.matchers.append({ "parse_format": { "expression": format_str, "case_sensitive": case_sensitive, "matching_condition": matching_condition, "score_factor": score_factor or REGEX_PARSE_SCORE_FACTOR, } }) return func
def constraint_decorator(func): """Add room constraint to skill.""" def constraint_callback(message, rooms=rooms): """Check if the room is correct.""" if hasattr(message.connector, "lookup_target"): rooms = list(map(message.connector.lookup_target, rooms)) return message.target in rooms func = add_skill_attributes(func) if invert: constraint_callback = invert_wrapper(constraint_callback) func.constraints.append(constraint_callback) return func
def matcher(func): """Add decorated function to list for event matching.""" func = add_skill_attributes(func) func.matchers.append({"event_type": dict(type=event_type, **kwargs)}) return func
def matcher(func): """Add decorated function to list for event matching.""" func = add_skill_attributes(func) func.matchers.append({"event_type": {"type": event_type}}) return func