Skip to content

Commit efed48d

Browse files
authored
Merge pull request #501 from mqcmd196/PR/google_chat_action_param
[google_chat_ros] check whether google_chat_button's parameters inclu…
2 parents ebbd0f6 + fc4aa0a commit efed48d

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

google_chat_ros/scripts/google_chat_ros_node.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,13 +222,11 @@ def event_cb(self, event, publish_topic=True):
222222
action = event.get('action')
223223
msg.action.action_method_name = action.get('actionMethodName')
224224
if action.get('parameters'):
225-
parameters = []
226225
for param in action.get('parameters'):
227226
action_parameter = ActionParameter()
228-
action_parameter.key = param.get('key')
229-
action_parameter.value = param.get('value')
230-
parameters.append(action_parameter)
231-
msg.action.parameters = parameters
227+
action_parameter.key = param.get("key") if param.get("key") else ""
228+
action_parameter.value = param.get("value") if param.get("value") else ""
229+
msg.action.parameters.append(action_parameter)
232230
if publish_topic:
233231
self._card_activity_pub.publish(msg)
234232
return msg

google_chat_ros/src/google_chat_ros/google_chat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def _pubsub_cb(self, message):
125125
except Exception as e:
126126
rospy.logerr("Failed to handle the request from Cloud PubSub.")
127127
rospy.logerr("It might be caused because of invalid type message from GCP")
128-
rospy.logerr("{}".str(e))
128+
rospy.logerr(e)
129129
finally:
130130
message.ack()
131131

0 commit comments

Comments
 (0)