@puregram/markup
Advanced tools
Comparing version 1.3.2 to 1.3.3
@@ -232,22 +232,24 @@ "use strict"; | ||
exports.formatDedent = formatDedent; | ||
function processEntity(entity) { | ||
for (const [key, value] of [['text', 'entities'], ['caption', 'caption_entities'], ['quote', 'quote_entities']]) { | ||
if (key in entity && entity[key] instanceof format_1.Formatted) { | ||
const fmt = entity[key]; | ||
entity[key] = fmt.format(); | ||
entity[value] = fmt.entities; | ||
} | ||
} | ||
} | ||
// TODO: refactor | ||
function processParams(path, params) { | ||
for (const [key, value] of [['text', 'entities'], ['caption', 'caption_entities']]) { | ||
if (path === 'sendMediaGroup') { | ||
for (const entity of params.media) { | ||
if (key in entity && entity[key] instanceof format_1.Formatted) { | ||
const fmt = entity[key]; | ||
entity[key] = fmt.format(); | ||
entity[value] = fmt.entities; | ||
} | ||
} | ||
if (path === 'sendMediaGroup') { | ||
for (const entity of params.media) { | ||
processEntity(entity); | ||
} | ||
else { | ||
if (key in params && params[key] instanceof format_1.Formatted) { | ||
const fmt = params[key]; | ||
params[key] = fmt.format(); | ||
params[value] = fmt.entities; | ||
} | ||
} | ||
} | ||
else { | ||
processEntity(params); | ||
} | ||
if ('reply_parameters' in params && 'quote' in params.reply_parameters) { | ||
processEntity(params.reply_parameters); | ||
} | ||
if (path === 'answerInlineQuery') { | ||
@@ -254,0 +256,0 @@ const iqp = params; |
{ | ||
"name": "@puregram/markup", | ||
"version": "1.3.2", | ||
"version": "1.3.3", | ||
"description": "simple yet powerful markup system for puregram", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
472
19963