"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.deprecate = exports.fmtCaption = exports.env = void 0; exports.env = process.env; function fmtCaption(extra) { const caption = extra === null || extra === void 0 ? void 0 : extra.caption; if (!caption || typeof caption === 'string') return extra; const { text, entities } = caption; return { ...extra, caption: text, ...(entities && { caption_entities: entities, parse_mode: undefined, }), }; } exports.fmtCaption = fmtCaption; function deprecate(method, ignorable, use, see) { // don't use deprecate() yet // wait for a couple minor releases of telegraf so the news reaches more people return; const ignorer = `IGNORE_DEPRECATED_${ignorable}`; if (exports.env[ignorer]) return; const stack = { stack: '' }; Error.captureStackTrace(stack); const line = (stack.stack.split('\n')[3] || '').trim(); const useOther = use ? `; use ${use} instead` : ''; const pad = ' '.repeat('[WARN]'.length); console.warn(`[WARN] ${method} is deprecated${useOther}`); if (line) console.warn(pad, line); if (see) console.warn(pad, `SEE ${see}`); } exports.deprecate = deprecate;