Skip to content

Instantly share code, notes, and snippets.

@attakei
Last active December 10, 2017 16:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save attakei/0f6b3d2cdab52b6c63faa1f9f02e1c42 to your computer and use it in GitHub Desktop.
Save attakei/0f6b3d2cdab52b6c63faa1f9f02e1c42 to your computer and use it in GitHub Desktop.
Kiyoshi
[Core]
Name = Kiyoshi flows.
Module = kiyoshi_flows.py
[Documentation]
Description = Kiyoshi!
[Python]
Version = 3
[Core]
name = kiyoshi
module = kiyoshi
[Documentation]
description = Kiyoshi
[Python]
version = 3
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 '遅い!'
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