| 1 |
from __future__ import absolute_import |
| 2 |
|
| 3 |
from errbot import BotFlow, FlowRoot, botflow |
| 4 |
|
| 5 |
|
| 6 |
class FlowDefinitions(BotFlow): |
| 7 |
"""A plugin to test the flows |
| 8 |
see flowtest.png for the structure. |
| 9 |
""" |
| 10 |
|
| 11 |
@botflow |
| 12 |
def w1(self, flow: FlowRoot): |
| 13 |
"documentation of W1" |
| 14 |
a_node = flow.connect("a") # no autotrigger |
| 15 |
b_node = a_node.connect("b") |
| 16 |
c_node = a_node.connect("c") # crosses the autotrigger of w2 |
| 17 |
d_node = c_node.connect("d") |
| 18 |
|
| 19 |
assert a_node.hints |
| 20 |
assert b_node.hints |
| 21 |
assert c_node.hints |
| 22 |
assert d_node.hints |
| 23 |
|
| 24 |
@botflow |
| 25 |
def w2(self, flow: FlowRoot): |
| 26 |
"""documentation of W2""" |
| 27 |
c_node = flow.connect("c", auto_trigger=True) |
| 28 |
b_node = c_node.connect("b") |
| 29 |
e_node = flow.connect( |
| 30 |
"e", auto_trigger=True |
| 31 |
) # 2 autotriggers for the same workflow |
| 32 |
d_node = e_node.connect("d") |
| 33 |
|
| 34 |
@botflow |
| 35 |
def w3(self, flow: FlowRoot): |
| 36 |
"""documentation of W3""" |
| 37 |
c_node = flow.connect("a", room_flow=True) |
| 38 |
b_node = c_node.connect("b") |
| 39 |
|
| 40 |
@botflow |
| 41 |
def w4(self, flow: FlowRoot): |
| 42 |
"""documentation of W4""" |
| 43 |
a_node = flow.connect("a") |
| 44 |
b_node = a_node.connect("b") |
| 45 |
c_node = b_node.connect("c") |
| 46 |
c_node.connect("d") |
| 47 |
|
| 48 |
# set some hinting. |
| 49 |
flow.hints = False |
| 50 |
a_node.hints = False |
| 51 |
b_node.hints = True |
| 52 |
c_node.hint = False |