jellyfin-discord-bot/index.ts

26 lines
1.2 KiB
TypeScript
Raw Normal View History

2023-04-15 22:06:35 +02:00
import { ExtendedClient } from "./server/structures/client"
import { config } from "./server/configuration"
import { logger } from "./server/logger"
2023-05-04 23:38:11 +02:00
import { JellyfinHandler } from "./server/jellyfin/handler"
import { attachedImages } from "./server/assets/attachments"
const requestId = 'startup'
2023-04-15 22:06:35 +02:00
2023-06-24 20:56:58 +02:00
export const jellyfinHandler = new JellyfinHandler({ jellyfinToken: config.bot.workaround_token, jellyfinUrl: config.bot.jellyfin_url, movieCollectionId: config.bot.jf_collection_id, collectionUser: config.bot.jf_user })
export const yavinJellyfinHandler = new JellyfinHandler({ jellyfinToken: config.bot.yavin_jellyfin_token, jellyfinUrl: config.bot.yavin_jellyfin_url, movieCollectionId: config.bot.yavin_collection_id, collectionUser: config.bot.yavin_jellyfin_collection_user })
export const client = new ExtendedClient(jellyfinHandler)
export const attachmentImages = attachedImages
async function init() {
2023-06-24 21:05:43 +02:00
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()
2023-04-15 22:06:35 +02:00
}
init()