commit
This commit is contained in:
parent
be4fd23bcf
commit
0bd53741af
728 changed files with 86573 additions and 0 deletions
38
node_modules/telegraf/lib/util.js
generated
vendored
Normal file
38
node_modules/telegraf/lib/util.js
generated
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
"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;
|
Loading…
Add table
Add a link
Reference in a new issue