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:
parent
0b663fb96f
commit
6e34090f8f
31 changed files with 1359 additions and 200 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue