Utility library for Telegram API, especially useful for testing But powerful enough to be used full featured telegram bot or integrations
Features
- Call API methods
- Validate data from webapp
- Testing functions
Create a bot instance and call API methods
Create a bot instance and call API methods
import tgtb from "@izzqz/tgtb"; // create a bot instance with a bot token const bot = tgtb("123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11"); // call a method const res = await bot.api.getMe(); // it does not throw an error when ok is false if (res.ok) { console.log(res.result); // { id: 123456, is_bot: true, first_name: 'John', username: 'john_bot' } } else { console.error(res.description); }