Open mqcmd196 opened 8 months ago
nice. can you describe how to reproduce this error ? https://github.com/jsk-ros-pkg/jsk_3rdparty/tree/master/google_chat_ros#sending-an-interactive-button
Using the fetch1075's credential info and launch the node like
<include file="$(find google_chat_ros)/launch/google_chat.launch">
<arg name="use_yaml" value="false" />
<arg name="receiving_mode" value="pubsub" />
<arg name="project_id" value="fetch-***" />
<arg name="subscription_id" value="chat-sub" />
<arg name="google_cloud_credentials_json" value="/home/obinata/Downloads/fetch-***.json" />
<arg name="respawn" value="false" />
</include>
then run the euslisp code
(setq *chat-space* "hoge") ;; set your own google chat space name with Fetch1075
(load "package://google_chat_ros/scripts/google-chat.l")
(setq buttons (list (create-google-chat-button "hello1" "hello1") (create-google-chat-button "hello2" "hello2")))
(send-google-chat-buttons *chat-space* buttons)
You may see the button on Google Chat.
On another terminal,
rostopic echo /google_chat_ros/card_activity
then press the button on Google Chat UI and you might encounter the error.
I wasn't sure whether to fix python code or euslisp library
(defun create-google-chat-button
(button-name button-action-name
&key (button-action-key) (button-action-value))
(let ((button (instance google_chat_ros::Button :init))
(text-button-on-click (instance google_chat_ros::OnClick :init))
(action (instance google_chat_ros::FormAction :init))
(parameter (instance google_chat_ros::ActionParameter :init)))
(send button :text_button_name button-name)
(send action :action_method_name button-action-name)
(send parameter :key button-action-key)
(send parameter :value button-action-value)
(send action :parameters (list parameter))
(send text-button-on-click :action action)
(send button :text_button_on_click text-button-on-click)
button))
it sets parameter
's key
and value
even if button-action-key
and button-action-value
were not given. So the button's parameter.key
and parameter.value
are empty.
But in any case, the element can be empty, so I modified the python node to handle it anyway.
When
google_chat_ros
receives NoneType parameters with python dictionaries generated from json, python's.get
method returnsNone
and it cannot be serialized with string format and raisesThis PR fixes it