tgtb(bot_token: string,config?: TgtbConfig,): Client
Creates a new TgtbClient instance
call API methods
call API methods
import tgtb, { TgtbConfig } from "@izzqz/tgtb"; const options: TgtbConfig = { fetch_fn: globalThis.fetch, base_url: "https://api.telegram.org/bot", use_test_mode: false }; const bot_token = "123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11"; const bot = tgtb(bot_token, options); bot; // TgtbClient // call a method const res = await bot.api.sendMessage({ chat_id: 123456, text: "Hello, world!" }); res; // ApiResponse<SendMessage>
optional
config: TgtbConfig
- tgtb options
A new TgtbClient instance