UNPKG

relu-core

Version:
256 lines (251 loc) 11 kB
var botbuilder = require('../../modules/botbuilder'); module.exports.CompactWeatherSchema = function(session, title, UrlImage, temperature, grade, prevision) { var Card = new botbuilder.Message(session) .addAttachment({ "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", "contentType": "application/vnd.microsoft.card.adaptive", "content": { "type": "AdaptiveCard", "version": "1.0", "body": [{ "type": "Container", "items": [{ "type": "TextBlock", "text": title, "isSubtle": true }] }, { "type": "Container", "items": [{ "type": "ColumnSet", "columns": [{ "type": "Column", "size": "auto", "items": [{ "type": "Image", "url": UrlImage, "size": "small", "horizontalAlignment": "center" }] }, { "type": "Column", "size": "auto", "items": [{ "type": "ColumnSet", "columns": [{ "type": "Column", "size": "auto", "items": [{ "type": "TextBlock", "text": temperature, "size": "extraLarge" }] }, { "type": "Column", "size": "auto", "items": [{ "type": "TextBlock", "text": grade, "weight": "bolder" }, { "type": "TextBlock", "text": prevision, "isSubtle": true } ] } ] }] } ] }] } ] } }) return (Card); } module.exports.CalendarReminder = function(session, title, reminder, time) { var Card = new botbuilde.Message(session) .addAttachment({ "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", "contentType": "application/vnd.microsoft.card.adaptive", "content": { "type": "AdaptiveCard", "version": "1.0", "body": [{ "type": "TextBlock", "text": title, "size": "large", "weight": "bolder" }, { "type": "TextBlock", "text": reminder, "isSubtle": true }, { "type": "TextBlock", "text": time, "isSubtle": true, "separation": "none" }, { "type": "TextBlock", "text": "Postpones for:" }, { "type": "Input.ChoiceSet", "id": "snooze", "style": "compact", "choices": [{ "title": "5 minutes", "value": "5", "isSelected": true }, { "title": "15 minutes", "value": "15" }, { "title": "30 minutes", "value": "30" }, { "title": "1 hour", "value": "60" }, { "title": "3 hours", "value": "180" }, { "title": "1 day", "value": "1440" }, { "title": "Forever", "value": "forever" } ] } ], "actions": [{ "type": "Action.Submit", "title": "Postpone", "data": { "myProperty": "Postpone" } }, { "type": "Action.Submit", "title": "Dismiss", "data": { "myProperty": "Dismiss" } } ] } }) return (Card); } module.exports.EmailSender = function(session, AccountImage, name, title) { var Card = new botbuilder.Message(session) .addAttachment({ "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", "contentType": "application/vnd.microsoft.card.adaptive", "content": { "type": "AdaptiveCard", "version": "1.0", "body": [{ "type": "Container", "items": [{ "type": "ColumnSet", "columns": [{ "type": "Column", "size": "auto", "items": [{ "type": "Image", "url": AccountImage, "size": "small", "style": "person" }] }, { "type": "Column", "size": "stretch", "items": [{ "type": "TextBlock", "text": name, "wrap": true }, { "type": "TextBlock", "separation": "none", "text": "{{new Date().getDate()}} {{new Date().getHours()}}", "isSubtle": true, "wrap": true } ] } ] }] }, { "type": "Container", "items": [{ "type": "ColumnSet", "columns": [{ "type": "Column", "size": "auto", "items": [{ "type": "TextBlock", "text": "To:", "wrap": true }] }, { "type": "Column", "size": "auto", "items": [{ "type": "Input.Text", "placeholder": "Insert your email", "wrap": true, "style": "email" }] } ] }] }, { "type": "TextBlock", "text": title, "size": "medium" }, { "type": "Container", "items": [{ "type": "Input.Text", "placeholder": "Compose Email", "wrap": true }] } ], "actions": [{ "type": "Action.Http", "title": "Reply", "method": "GET", "url": "", //url "headers": { "content-type": "application/json" }, "body": "" //body }] } }) return (Card) }