tgram.js
Version:
Lightweight modern library for telegram bot. use Node.js
18 lines (17 loc) • 510 B
JavaScript
import telegramFetch from "../utility/telegram-fetch.js";
export async function getUpdates(token, offset = 5) {
// API URL
const API_URL = `https://api.telegram.org/bot${token}/getUpdates`
try {
// Requests To API Client.
const res = await telegramFetch.get(API_URL, {
params: {
offset,
timeout: 90
}
})
return res.data.result || []
} catch (errorRequests) {
throw new Error(errorRequests)
}
}