# telegrambo-send-file

> Telegrambo method for sending local files

Latest version **0.1.1** (published 2023-11-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install telegrambo-send-file
pnpm add telegrambo-send-file
yarn add telegrambo-send-file
bun add telegrambo-send-file
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2023-11-08 |
| First published | 2023-11-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 766.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | headmad |
| Maintainers | headmad |
| Keywords | telegrambo, extension |

## Links

- npm: https://www.npmjs.com/package/telegrambo-send-file
- Repository: https://github.com/headmad/telegrambo-send-file
- Homepage: https://github.com/headmad/telegrambo-send-file#readme
- Issues: https://github.com/headmad/telegrambo-send-file/issues
- npm.io page: https://npm.io/package/telegrambo-send-file

## Dependencies (1)

- [form-data](https://npm.io/package/form-data.md) ^4.0.0

## Recent versions

- 0.1.1 (latest) — 2023-11-08
- 0.1.0 — 2023-11-08

## README

# Telegrambo Send File

Extension for sending local files as [inputFile](https://core.telegram.org/bots/api#inputfile) using using multipart/form-data. It cam be sended as document, photo, video, audio, voice, video-note, animation, sticker or media group.

<br>

## Installation

<br>You can install Telegrambo Send File using npm:

```
npm install telegrambo-send-file
```
<br>

## Usage
<br>

```js
// 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.

<br>Example of sending photo:

```js
bot.sendFile({
  chat_id: process.env.CHAT_ID,
  photo: './test.jpg'
});
```

<br>Or sending file as document:

```js
bot.sendFile({
  chat_id: process.env.CHAT_ID,
  document: './test.jpg'
});
```

<br>Or media group:

```js
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'
    }
  ]
});
```

---
_Source: https://npm.io/package/telegrambo-send-file · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
