Skip to content
This repository has been archived by the owner on Aug 22, 2019. It is now read-only.

Commit

Permalink
Merge pull request #1289 from smn-snkl/patch-2
Browse files Browse the repository at this point in the history
Update channel.py
  • Loading branch information
akelad committed Nov 9, 2018
2 parents 41f44f8 + 6b8f100 commit 8bb05aa
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions rasa_core/channels/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ def register(input_channels, # type: List[InputChannel]
def button_to_string(button, idx=0):
"""Create a string representation of a button."""
return "{idx}: {title} ({val})".format(
idx=idx + 1, title=button['title'], val=button['payload'])
idx=idx + 1,
title=button.get('title', ''),
val=button.get('payload', ''))


class InputChannel(object):
Expand Down Expand Up @@ -178,7 +180,8 @@ def send_custom_message(self, recipient_id, elements):

for element in elements:
element_msg = "{title} : {subtitle}".format(
title=element['title'], subtitle=element['subtitle'])
title=element.get('title', ''),
subtitle=element.get('subtitle', ''))
self.send_text_with_buttons(
recipient_id, element_msg, element['buttons'])

Expand Down

0 comments on commit 8bb05aa

Please sign in to comment.