# telegraf-media-group

> Handle media groups (aka albums) easily with [telegraf](https://telegraf.js.org)!

Latest version **1.2.1** (published 2022-04-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install telegraf-media-group
pnpm add telegraf-media-group
yarn add telegraf-media-group
bun add telegraf-media-group
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.1 |
| Published | 2022-04-24 |
| First published | 2020-03-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | Loskir |
| Maintainers | loskir |

## Links

- npm: https://www.npmjs.com/package/telegraf-media-group
- Repository: https://github.com/Loskir/telegraf-media-group
- Homepage: https://github.com/Loskir/telegraf-media-group#readme
- Issues: https://github.com/Loskir/telegraf-media-group/issues
- npm.io page: https://npm.io/package/telegraf-media-group

## Recent versions

- 1.2.1 (latest) — 2022-04-24
- 1.2.0 — 2022-04-24
- 1.1.2 — 2020-07-24
- 1.1.1 — 2020-04-03
- 1.1.0 — 2020-04-03
- 1.0.1 — 2020-03-19
- 1.0.0 — 2020-03-19

## README

# telegraf-media-group

Handle media groups (aka albums) easily with [telegraf](https://telegraf.js.org)!

## Usage

### Telegraf v3
```js
const Telegraf = require('telegraf')
const mediaGroup = require('telegraf-media-group')

const bot = new Telegraf(process.env.BOT_TOKEN)

bot.use(mediaGroup())

bot.on('media_group', (ctx) => {
  // ctx.mediaGroup — an array of album messages (including the last one)
  for (const message of ctx.mediaGroup) {
    console.log(message)
  }
  return ctx.reply(`total: ${ctx.mediaGroup.length}`)
})
```

### Telegraf v4
```js
const { Telegraf } = require('telegraf')
const mediaGroup = require('telegraf-media-group')

const bot = new Telegraf(process.env.BOT_TOKEN)

bot.use(mediaGroup())

bot.on('media_group', (ctx) => {
  // ctx.mediaGroup — an array of album messages (including the last one)
  for (const message of ctx.mediaGroup) {
    console.log(message)
  }
  return ctx.reply(`total: ${ctx.mediaGroup.length}`)
})
```

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