Skip to main content

Media cache plugin for GramIO. This plugin caches the sent file_id's and prevents files from being uploaded again. Currently, sendMediaGroup is not cached.

Works with
This package works with Bun
It is unknown whether this package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
It is unknown whether this package works with Browsers
JSR Score
100%
Published
a week ago (0.0.3)

@gramio/media-cache

npm JSR JSR Score

Media cache plugin for GramIO.

This plugin caches the sent file_id's and prevents files from being uploaded again.

Currently, sendMediaGroup is not cached.

Usage

import { Bot } from "gramio";
import { mediaCache } from "@gramio/media-cache";

const bot = new Bot(process.env.token!)
    .extend(mediaCache())
    .command("start", async (context) => {
        return context.sendDocument(
            MediaUpload.url(
                "https://raw.githubusercontent.com/gramiojs/types/main/README.md"
            )
        );
    })
    .onStart(console.log);

bot.start();
Built and signed on
GitHub Actions
View transparency log

Add Package

deno add @gramio/media-cache

Import symbol

import * as mod from "@gramio/media-cache";

Add Package

npx jsr add @gramio/media-cache

Import symbol

import * as mod from "@gramio/media-cache";

Add Package

yarn dlx jsr add @gramio/media-cache

Import symbol

import * as mod from "@gramio/media-cache";

Add Package

pnpm dlx jsr add @gramio/media-cache

Import symbol

import * as mod from "@gramio/media-cache";

Add Package

bunx jsr add @gramio/media-cache

Import symbol

import * as mod from "@gramio/media-cache";