telegram-bot-api-lightweight-client
Version:
Lightweight Telegram Bot API client. Exports only minimal Fetch call. Fully compatible with AWS LLRT.
19 lines • 586 B
JavaScript
let baseUrl = undefined;
export let client_fetch = async (path, args) => {
const response = await fetch(`${baseUrl}/${path}`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(args),
});
return (await response.json());
};
export const client_setClientToken = (token) => {
baseUrl = `https://api.telegram.org/bot${token}`;
};
export const client_setBaseUrl = (url) => {
baseUrl = url;
};
export const client_setFetch = (customFetch) => {
client_fetch = customFetch;
};
//# sourceMappingURL=core.js.map