mirror of
https://github.com/muerwre/vk-tg-bot.git
synced 2025-04-24 22:46:41 +07:00
added calendar service
This commit is contained in:
parent
0b663fb96f
commit
6e34090f8f
31 changed files with 1359 additions and 200 deletions
27
src/service/calendar/setup.ts
Normal file
27
src/service/calendar/setup.ts
Normal file
|
@ -0,0 +1,27 @@
|
|||
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;
|
||||
}
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue