@effect-ak/tg-bot-api 0.9.2 → 0.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effect-ak/tg-bot-api",
3
- "version": "0.9.2",
3
+ "version": "0.9.3",
4
4
  "type": "module",
5
5
  "description": "TypeScript types for Telegram Bot Api and Telegram Mini Apps",
6
6
  "license": "MIT",
@@ -13,6 +13,10 @@
13
13
  "name": "Aleksandr Kondaurov",
14
14
  "email": "kondaurov.dev@gmail.com"
15
15
  },
16
+ "scripts": {
17
+ "build": "tsup",
18
+ "typecheck": "tsc"
19
+ },
16
20
  "repository": {
17
21
  "type": "git",
18
22
  "url": "https://github.com/effect-ak/tg-bot-client",
@@ -37,8 +41,5 @@
37
41
  "dist/*.js",
38
42
  "dist/*.cjs",
39
43
  "dist/*.d.ts"
40
- ],
41
- "scripts": {
42
- "build": "tsup"
43
- }
44
- }
44
+ ]
45
+ }
package/readme.md ADDED
@@ -0,0 +1,37 @@
1
+ ![Telegram Bot API](https://img.shields.io/badge/BotApi-9.2-blue?link=)
2
+ ![Telegram WebApp](https://img.shields.io/badge/Telegram.WebApp-9.1-blue?link=)
3
+ [![OpenAPI](https://img.shields.io/badge/OpenAPI-3.1-blue.svg)](https://effect-ak.github.io/telegram-bot-api/)
4
+
5
+ ## Highlights:
6
+
7
+ - **Complete and Up-to-Date Telegram Bot API**: The entire API is generated from [the official documentation](https://core.telegram.org/bots/api) using a [code generator](./codegen/main.ts), ensuring this client remains in sync and supports every method and type provided by the **Telegram Bot API**.
8
+ - **[Types for Webapps](#webapps-typings)** Types that describe `Telegram.WebApp`. Created by [code generator](./codegen/main.ts) as well.
9
+ - **[ChatBot runner](#chatbot-runner)**: Focus on the logic of your chat bot
10
+ - **Type Mapping**: Types from the documentation are converted to TypeScript types:
11
+ - `Integer` → `number`
12
+ - `True` → `boolean`
13
+ - `String or Number` → `string | number`
14
+ - 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"`
15
+ - And more...
16
+
17
+ ## Webapps typings
18
+
19
+ Telegram provides a big [html](https://core.telegram.org/bots/webapps) page that describes `Telegram.WebApp`
20
+
21
+ ```typescript
22
+ import type { WebApp } from "@effect-ak/tg-bot-client/webapp"
23
+
24
+ interface Telegram {
25
+ WebApp: TgWebApp
26
+ }
27
+
28
+ declare const Telegram: Telegram
29
+
30
+ const saveData = () => {
31
+ Telegram.WebApp.CloudStorage.setItem("key1", "some data", (error) => {
32
+ if (error == null) {
33
+ console.log("Saved!")
34
+ }
35
+ })
36
+ }
37
+ ```