jellyfin-discord-bot/index.ts

22 lines
717 B
TypeScript

import { ExtendedClient } from "./server/structures/client"
import { JellyfinHandler } from "./jellyfin/handler"
import { config } from "./server/configuration"
import { logger } from "./server/logger"
const requestId = 'startup'
export const jellyfinHandler = new JellyfinHandler(config)
export const client = new ExtendedClient(jellyfinHandler)
async function init() {
try {
const users = await jellyfinHandler.getCurrentUsers("", requestId)
logger.info(`Fetched ${users.map(x => x.name).join(', ')} from JF`, { requestId })
} catch (error) {
logger.error(`Error fetching existing users from Jellyfin`, { requestId })
}
logger.info(`Starting client`, { requestId })
client.start()
}
init()