lib/bot/responder.rb in bot-0.0.37 vs lib/bot/responder.rb in bot-0.0.38
- old
+ new
@@ -66,9 +66,30 @@
}
photo_response['suggestedResponses'] = suggested_responses if suggested_responses
photo_response
end
+ def card_response(text, url, icon=nil)
+ card = {
+ 'type' => 'link',
+ 'to' => message['from'],
+ 'url' => url,
+ 'title' => "", # Displays over the image
+ 'text' => text, # Displays under the image
+ 'attribution' => {
+ 'name' => text # Displays in bottom line
+ },
+ 'chatId' => message['chatId']
+ }
+
+ card['picUrl'] = icon if icon
+ card['attribution']['iconUrl'] = icon if icon
+
+ [
+ card
+ ]
+ end
+
def video_response(video_id, suggested_responses=false)
video_response = {
'type' => 'video',
'to' => message['from'],
'videoId' => video_id,