1
0
Fork 0
mirror of https://github.com/muerwre/vk-tg-bot.git synced 2025-04-24 22:46:41 +07:00

fixed template handling

This commit is contained in:
Fedor Katurov 2021-05-26 11:05:23 +07:00
parent 1b6a586003
commit 116273cbab
2 changed files with 4 additions and 2 deletions

View file

@ -48,7 +48,7 @@ export class Template<
* Themes the template with values
*/
public theme = (values: V) => {
return hb.compile(this.template)(values).replace(/\n+/g, "\n\n");
return hb.compile(this.template)(values).replace(/\n+/gim, "\n\n");
};
/**

View file

@ -109,7 +109,9 @@ export class PostNewHandler extends VkEventHandler<Fields, Values> {
.slice(0, this.template.fields.images_limit) as string[];
const hasThumb =
this.template.fields.image && this.template.fields.images_limit;
!!this.template.fields.image &&
!!this.template.fields.images_limit &&
thumbs.length > 0;
if (hasThumb) {
if (this.template.fields.images_limit! <= 1) {