在 Errbot 中匹配后停止处理消息
Stop processing message after match in Errbot
如何在匹配后停止处理消息?
例如这样的事情:
@re_botcmd(pattern=r"(.*)(damn|fuck|stupid)(.*)$", flags=re.IGNORECASE,matchall=True)
def be_nice(self, msg, match):
yield "Could you be more nice (((?"
stop_processing_msg(msg)
还有没有办法组织匹配,这样就可以按照特定的顺序进行?
对于此特定功能,我将使用命令过滤器:http://errbot.io/en/latest/errbot.html#errbot.cmdfilter
直接向用户发送消息,您有机会在这里阻止处理。
关于解释的顺序,我们还没有完整的解决方案,但是我们有:
配置文件中用于回调的配置参数 PLUGINS_CALLBACK_ORDER。
一个替代方案可能是一个流程,具体取决于您要执行的顺序:http://errbot.io/en/latest/user_guide/flow_development/advanced.html#making-a-step-execute-automatically
如何在匹配后停止处理消息? 例如这样的事情:
@re_botcmd(pattern=r"(.*)(damn|fuck|stupid)(.*)$", flags=re.IGNORECASE,matchall=True)
def be_nice(self, msg, match):
yield "Could you be more nice (((?"
stop_processing_msg(msg)
还有没有办法组织匹配,这样就可以按照特定的顺序进行?
对于此特定功能,我将使用命令过滤器:http://errbot.io/en/latest/errbot.html#errbot.cmdfilter
直接向用户发送消息,您有机会在这里阻止处理。
关于解释的顺序,我们还没有完整的解决方案,但是我们有:
配置文件中用于回调的配置参数 PLUGINS_CALLBACK_ORDER。
一个替代方案可能是一个流程,具体取决于您要执行的顺序:http://errbot.io/en/latest/user_guide/flow_development/advanced.html#making-a-step-execute-automatically