1
0
Fork 0
mirror of https://github.com/muerwre/vk-tg-bot.git synced 2025-04-24 22:46:41 +07:00
vk-tg-bot/src/service/calendar/setup.ts
2024-01-11 18:52:07 +07:00

27 lines
552 B
TypeScript

import { CalendarConfig, CalendarKeyFile } from "./config";
import { CalendarService } from "../calendar";
export const setupCalendar = async (
logger: (...vals: any) => void,
config?: Partial<CalendarConfig>,
keyConfig?: CalendarKeyFile
) => {
if (!keyConfig) {
return null;
}
try {
const service = new CalendarService(
keyConfig,
config?.timezone ?? "",
logger
);
await service.authenticate();
return service;
} catch (error) {
logger("can't init calendar", error);
return null;
}
};