UNPKG

tgram.js

Version:

Lightweight modern library for telegram bot. use Node.js

17 lines (15 loc) 591 B
import telegramFetch from "../utility/telegram-fetch.js"; import FormData from "form-data"; import { convertToWebp } from "../utility/converter.js"; export async function sendSticker(token, chatId, stickUrl, filename = "sticker.webp") { const sharps = await convertToWebp(stickUrl) const form = new FormData() form.append("chat_id", chatId) form.append("sticker", sharps, { filename, mimetype: "image/webp" }) return await telegramFetch.post(`https://api.telegram.org/bot${token}/sendSticker`, form, { headers: form.getHeaders() }) }