Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
RLKRo committed Feb 22, 2024
1 parent 6d982e0 commit 6e74128
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 27 deletions.
16 changes: 7 additions & 9 deletions dff/script/core/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,16 +201,14 @@ class level variables to store message information.
# ui: Optional[Union[Keyboard, DataModel]] = None

def __init__(
self,
text: Optional[str] = None,
commands: Optional[List[Command]] = None,
attachments: Optional[Attachments] = None,
annotations: Optional[dict] = None,
misc: Optional[dict] = None,
self,
text: Optional[str] = None,
commands: Optional[List[Command]] = None,
attachments: Optional[Attachments] = None,
annotations: Optional[dict] = None,
misc: Optional[dict] = None,
):
super().__init__(
text=text, commands=commands, attachments=attachments, annotations=annotations, misc=misc
)
super().__init__(text=text, commands=commands, attachments=attachments, annotations=annotations, misc=misc)

def __eq__(self, other):
if isinstance(other, Message):
Expand Down
8 changes: 2 additions & 6 deletions tutorials/messengers/telegram/1_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,15 @@ class and [telebot](https://pytba.readthedocs.io/en/latest/index.html)
script = {
"greeting_flow": {
"start_node": {
TRANSITIONS: {
"greeting_node": cnd.exact_match(Message("/start"))
},
TRANSITIONS: {"greeting_node": cnd.exact_match(Message("/start"))},
},
"greeting_node": {
RESPONSE: Message("Hi"),
TRANSITIONS: {lbl.repeat(): cnd.true()},
},
"fallback_node": {
RESPONSE: Message("Please, repeat the request"),
TRANSITIONS: {
"greeting_node": cnd.exact_match(Message("/start"))
},
TRANSITIONS: {"greeting_node": cnd.exact_match(Message("/start"))},
},
}
}
Expand Down
8 changes: 2 additions & 6 deletions tutorials/script/core/1_basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,12 @@
"node2": {
RESPONSE: Message("Good. What do you want to talk about?"),
TRANSITIONS: {
"node3": cnd.exact_match(
Message("Let's talk about music.")
)
"node3": cnd.exact_match(Message("Let's talk about music."))
},
},
"node3": {
RESPONSE: Message("Sorry, I can not talk about music now."),
TRANSITIONS: {
"node4": cnd.exact_match(Message("Ok, goodbye."))
},
TRANSITIONS: {"node4": cnd.exact_match(Message("Ok, goodbye."))},
},
"node4": {
RESPONSE: Message("Bye"),
Expand Down
8 changes: 2 additions & 6 deletions tutorials/script/core/3_responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,12 @@ def fallback_trace_response(ctx: Context, _: Pipeline) -> Message:
"node2": {
RESPONSE: Message("Good. What do you want to talk about?"),
TRANSITIONS: {
"node3": cnd.exact_match(
Message("Let's talk about music.")
)
"node3": cnd.exact_match(Message("Let's talk about music."))
},
},
"node3": {
RESPONSE: cannot_talk_about_topic_response,
TRANSITIONS: {
"node4": cnd.exact_match(Message("Ok, goodbye."))
},
TRANSITIONS: {"node4": cnd.exact_match(Message("Ok, goodbye."))},
},
"node4": {
RESPONSE: upper_case_response(Message("bye")),
Expand Down

0 comments on commit 6e74128

Please sign in to comment.