UNPKG

telegram-bot-api-wrapper

Version:

A simple wrapper for the Telegram Bot API. Just provide your bot token and start using it.

16 lines 485 B
export default async function fetchWrapper<T>( url: string, body?: object, ): Promise<T> { const response = await fetch(url, { method: "POST", headers: { "Content-Type": "application/json", }, body: body ? JSON.stringify(body) : undefined, }); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } return response.json(); }