0.1.1 • Published 2 years ago

telegrambo-send-file v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Telegrambo Send File

Extension for sending local files as inputFile using using multipart/form-data. It cam be sended as document, photo, video, audio, voice, video-note, animation, sticker or media group.

Installation

You can install Telegrambo Send File using npm:

npm install telegrambo-send-file

Usage

// bot.js

import telegrambo from 'telegrambo';
import sendFile  from 'telegrambo-send-file';

const bot = telegrambo(process.env.YOU_BOT_TOKEN);

// Initialize new method for bot
bot.sendFile = sendFile(process.env.YOU_BOT_TOKEN);

Returns:

  • function: A new method that get argument:
    • payload (object, required) - Payload one of methods, where bot send local file.

Example of sending photo:

bot.sendFile({
  chat_id: process.env.CHAT_ID,
  photo: './test.jpg'
});

Or sending file as document:

bot.sendFile({
  chat_id: process.env.CHAT_ID,
  document: './test.jpg'
});

Or media group:

bot.sendFile({
  chat_id: process.env.CHAT_ID,
  media: [
    {
      type: 'photo'
      photo: './test1.jpg'
    },
    {
      type: 'photo',
      photo: 'CAACaGqaaXKdaaidUMvlVKR8Hr2mQMTgJFYTMjE62L2OaalObaacH4nKuSrNuFTOBDuaMwQ'
    },
    {
      type: 'photo',
      photo: 'https://my-site.com/photo.jpg'
    }
  ]
});
0.1.1

2 years ago

0.1.0

2 years ago