-
-
Save attakei/0f6b3d2cdab52b6c63faa1f9f02e1c42 to your computer and use it in GitHub Desktop.
Kiyoshi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Core] | |
Name = Kiyoshi flows. | |
Module = kiyoshi_flows.py | |
[Documentation] | |
Description = Kiyoshi! | |
[Python] | |
Version = 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Core] | |
name = kiyoshi | |
module = kiyoshi | |
[Documentation] | |
description = Kiyoshi | |
[Python] | |
version = 3 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from errbot import BotPlugin, botcmd, arg_botcmd, webhook, botmatch | |
class Kiyoshi(BotPlugin): | |
""" | |
Kiyoshi | |
""" | |
@botmatch(r'^ズン$') | |
def zun(self, msg, match): | |
msg.ctx['zun'] = 1 | |
@botmatch(r'^ズン$', flow_only=True) | |
def zun_re(self, msg, match): | |
msg.ctx['zun'] += 1 | |
@botmatch(r'^ズンドコ$', flow_only=True) | |
def kiyoshi(self, msg, match): | |
if msg.ctx['zun'] == 3: | |
return 'きよし!' | |
if msg.ctx['zun'] < 3: | |
return '足りない!' | |
if msg.ctx['zun'] > 3: | |
return '遅い!' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from errbot import botflow, FlowRoot, BotFlow, FLOW_END | |
class KiyoshiFlows(BotFlow): | |
""" Conversation flows for Errbot""" | |
@botflow | |
def kiyoshi(self, flow: FlowRoot): | |
""" Docs for the flow example comes here """ | |
zun = flow.connect('zun', auto_trigger=True) | |
zun_re = zun.connect('zun_re') | |
zun_re = zun_re.connect(zun_re) | |
kiyoshi = zun_re.connect('kiyoshi') | |
kiyoshi.connect(FLOW_END) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment