* Send a file to the Telegram chat.
(
chatId: number,
filePath: string,
caption?: string,
)
| 420 | * Send a file to the Telegram chat. |
| 421 | */ |
| 422 | private async sendFileSafe( |
| 423 | chatId: number, |
| 424 | filePath: string, |
| 425 | caption?: string, |
| 426 | ): Promise<void> { |
| 427 | if (!this.bot) return; |
| 428 | |
| 429 | try { |
| 430 | if (!fs.existsSync(filePath)) { |
| 431 | console.error(`[Telegram] File not found for sending: ${filePath}`); |
| 432 | return; |
| 433 | } |
| 434 | await this.bot.sendDocument(chatId, filePath, { |
| 435 | caption: caption || undefined, |
| 436 | }); |
| 437 | } catch (err) { |
| 438 | console.error("[Telegram] Failed to send file:", err); |
| 439 | } |
| 440 | } |
| 441 | } |
no outgoing calls
no test coverage detected