1
0
Fork 0
mirror of https://github.com/muerwre/vk-tg-bot.git synced 2025-04-25 06:56:40 +07:00

added calendar service

This commit is contained in:
Fedor Katurov 2024-01-10 21:31:06 +07:00
parent 0b663fb96f
commit 6e34090f8f
31 changed files with 1359 additions and 200 deletions

View file

@ -6,6 +6,10 @@ import { validateConfig } from "./validate";
import { getCmdArg } from "../utils/args";
import { defaultConfig } from "./default";
import { merge } from "lodash";
import {
CalendarKeyFile,
calendarKeyValidator,
} from "../service/calendar/config";
const configPath = getCmdArg("config");
const data = fs.readFileSync(
@ -21,6 +25,18 @@ const config =
export default function prepareConfig() {
validateConfig(config);
if (config.calendar?.keyFile) {
try {
const key = JSON.parse(
fs.readFileSync(config.calendar?.keyFile).toString()
) as CalendarKeyFile;
calendarKeyValidator.validateSync(key);
config.calendarKey = key;
} catch (error) {
console.warn("tried to parse calendar key, got error", error);
}
}
config.telegram.templates = {
help: config.templates.help,
help_admin: config.templates.help_admin,