@effect-ak/tg-bot-api
v1.0.0
Published
TypeScript types for Telegram Bot Api and Telegram Mini Apps
Downloads
407
Maintainers
Readme
Highlights:
- Complete and Up-to-Date Telegram Bot API: The entire API is generated from the official documentation using a code generator, ensuring this client remains in sync and supports every method and type provided by the Telegram Bot API.
- Types for Webapps Types that describe
Telegram.WebApp. Created by code generator as well. - ChatBot runner: Focus on the logic of your chat bot
- Type Mapping: Types from the documentation are converted to TypeScript types:
Integer→numberTrue→booleanString or Number→string | number- Enumerated types, such as
"Type of the chat can be either “private”, “group”, “supergroup” or “channel”", are converted to a standard union of literal types"private" | "group" | "supergroup" | "channel" - And more...
Webapps typings
Telegram provides a big html page that describes Telegram.WebApp
import type { WebApp } from "@effect-ak/tg-bot-client/webapp"
interface Telegram {
WebApp: TgWebApp
}
declare const Telegram: Telegram
const saveData = () => {
Telegram.WebApp.CloudStorage.setItem("key1", "some data", (error) => {
if (error == null) {
console.log("Saved!")
}
})
}