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:
parent
1b6a586003
commit
116273cbab
2 changed files with 4 additions and 2 deletions
|
@ -48,7 +48,7 @@ export class Template<
|
||||||
* Themes the template with values
|
* Themes the template with values
|
||||||
*/
|
*/
|
||||||
public theme = (values: V) => {
|
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");
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -109,7 +109,9 @@ export class PostNewHandler extends VkEventHandler<Fields, Values> {
|
||||||
.slice(0, this.template.fields.images_limit) as string[];
|
.slice(0, this.template.fields.images_limit) as string[];
|
||||||
|
|
||||||
const hasThumb =
|
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 (hasThumb) {
|
||||||
if (this.template.fields.images_limit! <= 1) {
|
if (this.template.fields.images_limit! <= 1) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue