yagop / node-telegram-bot-api

Telegram Bot API for NodeJS
MIT License
8.31k stars 1.51k forks source link

sendMediaGroup deprecated Buffers and content-type #838

Open Barno opened 3 years ago

Barno commented 3 years ago

I have read:

I am using the latest version of the library.

Expected Behavior

I'm using sendMediaGroup with buffers.

 const fileOpts = {
        file: "Buffer",
        filename: 'image.jpeg',
        contentType: 'image/jpeg',
    };

    await bot.sendMediaGroup(id_channel, [{
            type: "photo",
            caption: `text`,
            media:
            objParam.img_before
        },
        {
            type: "photo",
            filename: 'image2.jpeg',
            contentType: 'image/jpeg',
            media:
            objParam.img_after
        }], fileOpts);

I'm able to send a message on telegram but I get this warning: Wed, 25 Nov 2020 18:50:08 GMT node-telegram-bot-api deprecated Buffers will have their filenames default to "filename" instead of "data". See https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#sending-files for more information on how sending files has been improved and on how to disable this deprecation message altogether. at

Wed, 25 Nov 2020 18:50:08 GMT node-telegram-bot-api deprecated In the future, content-type of files you send will default to "application/octet-stream". See https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#sending-files for more information on how sending files has been improved and on how to disable this deprecation message altogether. at

andreachezzi commented 1 year ago

@Barno Put these two lines in the very beginning of your js script file, they will prevent those warnings to show up.

process.env.NTBA_FIX_319 = 1;
process.env.NTBA_FIX_350 = 0;