1
0
mirror of https://github.com/franjsco/umbrello-bot synced 2025-06-05 21:49:11 +02:00

Add templates

This commit is contained in:
Francesco Esposito
2019-08-22 17:26:58 +02:00
parent b55b46671f
commit 0518b6b331

43
src/templates.js Normal file
View File

@ -0,0 +1,43 @@
export const searchCityTemplate = (data) => (
`==========
*Id*: ${data.id}
*City*: ${data.name}
*Country*: ${data.country}`
);
export const welcomeTemplate = (name) => (
`Welcome *${name}*`
);
export const errorTemplate = () => (
"*Ops*, there's a problem. Check the log."
);
export const setLocationTemplate = (location) => (
`Location setted: ${location}`
);
export const weatherTemplate = () => (
'Hey, today take the umbrella ☂️'
);
export const weatherDetailsTemplate = (data) => {
let msg = `*Information:*
City: ${data.city}\n\n`;
msg += '*Details*:';
data.list.forEach((e) => {
msg += `
🕓 ${new Date(e.date).toLocaleTimeString()}
${e.rain_flag === 'Y' ? 'Yes' : 'No'}
🌡️ ${e.temperature}
----`;
});
return msg;
};