수정완료
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import TelegramBot from "node-telegram-bot-api";
|
||||
import fs from "fs";
|
||||
|
||||
process.env.NTBA_FIX_350 = "1";
|
||||
|
||||
export interface TelegramUser {
|
||||
site: string;
|
||||
chatId: number;
|
||||
@@ -108,7 +110,10 @@ export class TelegramService {
|
||||
|
||||
constructor(token: string, enablePolling: boolean = false) {
|
||||
this.token = token;
|
||||
this.bot = new TelegramBot(token, { polling: enablePolling });
|
||||
this.bot = new TelegramBot(token, {
|
||||
polling: enablePolling,
|
||||
filepath: false,
|
||||
});
|
||||
|
||||
if (enablePolling) {
|
||||
this.setupListeners();
|
||||
@@ -149,16 +154,15 @@ export class TelegramService {
|
||||
caption?: string
|
||||
): Promise<void> {
|
||||
try {
|
||||
const buffer = Buffer.from(await Bun.file(fileName).arrayBuffer());
|
||||
|
||||
await this.bot.sendDocument(
|
||||
chatId,
|
||||
fs.createReadStream(fileName),
|
||||
{
|
||||
caption: caption || "",
|
||||
},
|
||||
buffer,
|
||||
{ caption: caption || "" },
|
||||
{
|
||||
filename: fileName.split("/").pop(),
|
||||
contentType:
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
contentType: "application/octet-stream",
|
||||
}
|
||||
);
|
||||
console.log(`✅ 문서 전송 성공 - chatId: ${chatId}, file: ${fileName}`);
|
||||
|
||||
Reference in New Issue
Block a user