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

added per-group and per-channel templates

This commit is contained in:
Fedor Katurov 2021-05-20 17:33:42 +07:00
parent a3fcb429ce
commit 3f2e07b391
5 changed files with 28 additions and 5 deletions

View file

@ -1,5 +1,6 @@
import * as yup from "yup";
import { VkConfig, VkEvent } from "./types";
import { templateOptionalSchema } from "../../config/validate";
const vkChannelEventSchema = yup.string().oneOf(Object.values(VkEvent));
@ -12,6 +13,7 @@ const vkChannelSchema = yup
.required()
.matches(/^@/, ({ path }) => `${path} should start with "@"`),
events: yup.array().of(vkChannelEventSchema),
templates: templateOptionalSchema,
});
export const vkConfigSchema = yup
@ -30,6 +32,7 @@ export const vkConfigSchema = yup
secretKey: yup.string().required(),
apiKey: yup.string().required(),
channels: yup.array().of(vkChannelSchema),
templates: templateOptionalSchema,
})
),
});