umbrello-bot/src/templates.js

56 lines
1.0 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

export const searchCityTemplate = (data) => (
`==========
*Id*: ${data.id}
*City*: ${data.name}
*Country*: ${data.country}`
);
export const welcomeTemplate = () => (
`*Welcome to umbrello-bot* ☂
An opensource telegram bot to know if you need to take the umbrella.
Made with ❤️ by @franjsco.
`
);
export const helpTemplate = () => (
`*umbrello-bot commands*:
/search {city name} - search city.
/set {city id} - set city id.
/get - get forecast.`
);
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;
};