@effect-ak/tg-bot-client 0.0.7 → 0.1.0
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/cjs/client/_client.js +2 -2
- package/dist/cjs/client/const.js +2 -1
- package/dist/cjs/index.js +0 -22
- package/dist/dts/client/_client.d.ts +3 -3
- package/dist/dts/client/const.d.ts +1 -0
- package/dist/dts/index.d.ts +0 -2
- package/dist/dts/specification/api.d.ts +784 -2774
- package/dist/dts/specification/types.d.ts +1382 -3542
- package/dist/esm/client/_client.js +1 -1
- package/dist/esm/client/const.js +1 -0
- package/dist/esm/index.js +2 -2
- package/package.json +7 -4
- package/readme.md +12 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { makeExecute } from "./execute-request.js";
|
|
2
2
|
import { makeDownloadFile } from "./download-file.js";
|
|
3
|
-
|
|
3
|
+
import { defaultBaseUrl } from "./const.js";
|
|
4
4
|
export const makeTgBotClient = (inputConfig) => {
|
|
5
5
|
const config = {
|
|
6
6
|
...inputConfig,
|
package/dist/esm/client/const.js
CHANGED
package/dist/esm/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effect-ak/tg-bot-client",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Aleksandr Kondaurov",
|
|
@@ -32,17 +32,20 @@
|
|
|
32
32
|
"@types/node": "^22.10.1",
|
|
33
33
|
"effect": "^3.11.4",
|
|
34
34
|
"node-html-parser": "^6.1.13",
|
|
35
|
+
"openapi-types": "^12.1.3",
|
|
35
36
|
"ts-morph": "^24.0.0",
|
|
36
37
|
"tsc-alias": "^1.8.10",
|
|
37
38
|
"type-fest": "^4.30.0",
|
|
38
39
|
"typescript": "^5.7.2",
|
|
39
40
|
"vite-tsconfig-paths": "^5.1.4",
|
|
40
|
-
"vitest": "^2.1.8"
|
|
41
|
+
"vitest": "^2.1.8",
|
|
42
|
+
"@redocly/cli": "^1.26.0"
|
|
41
43
|
},
|
|
42
44
|
"scripts": {
|
|
43
|
-
"gen": "bun run codegen/main",
|
|
45
|
+
"gen": "bun run ./codegen/main",
|
|
44
46
|
"build": "pnpm build-esm && pnpm build-cjs",
|
|
45
47
|
"build-esm": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
|
|
46
|
-
"build-cjs": "babel dist/esm --out-dir dist/cjs"
|
|
48
|
+
"build-cjs": "babel dist/esm --out-dir dist/cjs",
|
|
49
|
+
"gen-html": "redocly build-docs --output ../effect-ak.github.io/telegram-bot-api/index.html"
|
|
47
50
|
}
|
|
48
51
|
}
|
package/readme.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|

|
|
2
2
|
|
|
3
|
+
[OpenApi Specification](https://effect-ak.github.io/telegram-bot-api/)
|
|
4
|
+
|
|
3
5
|
### What is it?
|
|
4
6
|
|
|
5
7
|
This is a client for interacting with the Telegram Bot API.
|
|
@@ -10,8 +12,15 @@ They only provide documentation in the form of a massive HTML page, which is ver
|
|
|
10
12
|
## Features:
|
|
11
13
|
- **Pure TypeScript Client**: This is a clean client written in TypeScript with no abstractions.
|
|
12
14
|
- **Complete**: The entire API is generated from the official documentation [https://core.telegram.org/bots/api](https://core.telegram.org/bots/api) using a [code generator](./codegen/main.ts).
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
+
- ~~**Inline Documentation**: No need to read lengthy official documentation. All types and comments are available in JS DOC, allowing you to develop your bot without leaving your IDE.~~
|
|
16
|
+
- Codegenerator produces TypeScript code and OpenApi specification now! Documentation was removed from TypeScript interfaces in order to keep npm package smaller.
|
|
17
|
+
|
|
18
|
+
- **Type Mapping**: Types from the documentation are converted to TypeScript types:
|
|
19
|
+
- `Integer` becomes `number`
|
|
20
|
+
- `True` becomes `boolean`
|
|
21
|
+
- `String or Number` becomes `string | number`
|
|
22
|
+
- Enumerated types, such as `Type of the chat, can be either “private”, “group”, “supergroup” or “channel”` becomes a standard union of literal types `"private"| "group" | "supergroup" | "channel"`
|
|
23
|
+
- And so on
|
|
15
24
|
- **Readable Method Names**: Method names, such as `SetChatAdministratorCustomTitleInput`, are converted to snake_case for easier code readability, e.g., `set_chat_administrator_custom_title`.
|
|
16
25
|
|
|
17
26
|
### Usage example
|
|
@@ -44,7 +53,7 @@ if you want, you can use unsafe alternative, `unsafeExecute`, which gives you th
|
|
|
44
53
|
#### 1. Sending a Message with an Effect
|
|
45
54
|
|
|
46
55
|
```typescript
|
|
47
|
-
import { MESSAGE_EFFECTS } from "effect-ak/tg-bot-client"
|
|
56
|
+
import { MESSAGE_EFFECTS } from "@effect-ak/tg-bot-client"
|
|
48
57
|
|
|
49
58
|
await client.execute("send_message", {
|
|
50
59
|
chat_id: "???", // replace ??? with the chat number
|