UNPKG

t-comm

Version:

专业、稳定、纯粹的工具库

46 lines (43 loc) 1.2 kB
import { b as __awaiter, c as __generator } from '../tslib.es6-096fffdd.js'; import { fetchWeatherData } from './api.mjs'; import { parseWeatherData } from './parse.mjs'; import '../node/fs-util.mjs'; import 'fs'; import 'path'; import '../fs/fs.mjs'; import '../time/time.mjs'; /** * 获取深圳天气信息,可用于通过机器人发送到群聊 * @returns {object} 天气信息和是否有变化 * @example * * getWeatherRobotContent().then(resp => { * const { content, isSame } = resp * * console.log(content) * // ## 深圳当前正在生效的预警如下 * // ... * * console.log(isSame) * // false * }) */ function getWeatherRobotContent() { return __awaiter(this, void 0, void 0, function () { var data, _a, content, isSame; return __generator(this, function (_b) { switch (_b.label) { case 0: return [4 /*yield*/, fetchWeatherData()]; case 1: data = _b.sent(); _a = parseWeatherData(data), content = _a.content, isSame = _a.isSame; return [2 /*return*/, { content: content, isSame: isSame }]; } }); }); } export { getWeatherRobotContent };