* 初始化 - 获取机器人信息
()
| 92 | * 初始化 - 获取机器人信息 |
| 93 | */ |
| 94 | async initialize(): Promise<void> { |
| 95 | try { |
| 96 | const botInfo = await this.client.getBotInfo(); |
| 97 | this.botOpenId = botInfo.botOpenId; |
| 98 | this.client.setBotOpenId(botInfo.botOpenId); |
| 99 | logger.info(`Bot initialized: ${botInfo.botName} (${botInfo.botOpenId})`); |
| 100 | } catch (error) { |
| 101 | const errorMsg = error instanceof Error ? error.message : String(error); |
| 102 | logger.error(`Failed to initialize Feishu bot: ${errorMsg}`); |
| 103 | throw new Error( |
| 104 | `飞书机器人初始化失败。请检查 .env 文件中的 FEISHU_APP_ID 和 FEISHU_APP_SECRET 是否正确。\n` + |
| 105 | `错误详情: ${errorMsg}` |
| 106 | ); |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | /** |
| 111 | * 设置事件处理器 |
no test coverage detected