初始化模版工程
This commit is contained in:
34
instrumentation.ts
Normal file
34
instrumentation.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
export async function register() {
|
||||
if (process.env.NEXT_RUNTIME === 'nodejs') {
|
||||
const { ConfigManager } = await import('./remote-control/config/manager')
|
||||
const configManager = ConfigManager.getInstance()
|
||||
await configManager.load()
|
||||
|
||||
const config = configManager.get()
|
||||
|
||||
if (config.discord.enabled) {
|
||||
const { startBot } = await import('./remote-control/bots/discord')
|
||||
await startBot(config.discord.botToken).catch(console.error)
|
||||
}
|
||||
|
||||
if (config.dingtalk.enabled) {
|
||||
const { startBot } = await import('./remote-control/bots/dingtalk')
|
||||
await startBot(config.dingtalk.clientId, config.dingtalk.clientSecret).catch(console.error)
|
||||
}
|
||||
|
||||
if (config.lark.enabled) {
|
||||
const { startBot } = await import('./remote-control/bots/lark')
|
||||
await startBot(config.lark.appId, config.lark.appSecret).catch(console.error)
|
||||
}
|
||||
|
||||
if (config.telegram.enabled) {
|
||||
const { startBot } = await import('./remote-control/bots/telegram')
|
||||
await startBot(config.telegram.botToken).catch(console.error)
|
||||
}
|
||||
|
||||
if (config.slack.enabled) {
|
||||
const { startBot } = await import('./remote-control/bots/slack')
|
||||
await startBot(config.slack.botToken, config.slack.appToken).catch(console.error)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user