@xtsea/tgcore-ts 0.1.9 → 0.1.11
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/README.md +4 -2
- package/dist/index.cjs +38 -2
- package/dist/index.d.cts +13 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.js +36 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -34,9 +34,11 @@ npm install @xtsea/tgcore-ts
|
|
|
34
34
|
## Getting started
|
|
35
35
|
|
|
36
36
|
```ts
|
|
37
|
-
import {
|
|
37
|
+
import { tgcore } from "@xtsea/tgcore-ts"
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
// old version: 0.1.9 new Client({})
|
|
40
|
+
|
|
41
|
+
const tg = tgcore({ api_key: "fw_live_xxx" }) // version: 0.1.10
|
|
40
42
|
|
|
41
43
|
await tg.raw.sendMessage({
|
|
42
44
|
chat_id: -1001234567890,
|
package/dist/index.cjs
CHANGED
|
@@ -21,7 +21,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
Client: () => Client,
|
|
24
|
-
KeyboardBuilder: () => KeyboardBuilder
|
|
24
|
+
KeyboardBuilder: () => KeyboardBuilder,
|
|
25
|
+
tgcore: () => tgcore
|
|
25
26
|
});
|
|
26
27
|
module.exports = __toCommonJS(index_exports);
|
|
27
28
|
|
|
@@ -120,6 +121,31 @@ var SendMessageBuilder = class extends BaseCallBuilder {
|
|
|
120
121
|
}
|
|
121
122
|
};
|
|
122
123
|
|
|
124
|
+
// src/calls/sendPhoto.ts
|
|
125
|
+
var SendPhotoBuilder = class extends BaseCallBuilder {
|
|
126
|
+
chatId(id) {
|
|
127
|
+
return this.set("chat_id", id);
|
|
128
|
+
}
|
|
129
|
+
photo(url) {
|
|
130
|
+
return this.set("photo", url);
|
|
131
|
+
}
|
|
132
|
+
caption(caption) {
|
|
133
|
+
return this.set("caption", caption);
|
|
134
|
+
}
|
|
135
|
+
parseMode(mode) {
|
|
136
|
+
return this.set("parse_mode", mode);
|
|
137
|
+
}
|
|
138
|
+
disableNotification(value) {
|
|
139
|
+
return this.set("disable_notification", value);
|
|
140
|
+
}
|
|
141
|
+
protectContent(value) {
|
|
142
|
+
return this.set("protect_content", value);
|
|
143
|
+
}
|
|
144
|
+
replyMarkup(markup) {
|
|
145
|
+
return this.set("reply_markup", markup);
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
|
|
123
149
|
// src/calls/index.ts
|
|
124
150
|
var CallMethods = class {
|
|
125
151
|
constructor(http) {
|
|
@@ -131,9 +157,18 @@ var CallMethods = class {
|
|
|
131
157
|
"/api/v2/sendMessage"
|
|
132
158
|
);
|
|
133
159
|
}
|
|
160
|
+
sendPhoto() {
|
|
161
|
+
return new SendPhotoBuilder(
|
|
162
|
+
this.http,
|
|
163
|
+
"/api/v2/sendPhoto"
|
|
164
|
+
);
|
|
165
|
+
}
|
|
134
166
|
};
|
|
135
167
|
|
|
136
168
|
// src/client.ts
|
|
169
|
+
function tgcore(options) {
|
|
170
|
+
return new Client(options);
|
|
171
|
+
}
|
|
137
172
|
var Client = class {
|
|
138
173
|
constructor(opts) {
|
|
139
174
|
if (!opts?.api_key) {
|
|
@@ -234,5 +269,6 @@ var KeyboardBuilder = class _KeyboardBuilder {
|
|
|
234
269
|
// Annotate the CommonJS export names for ESM import in node:
|
|
235
270
|
0 && (module.exports = {
|
|
236
271
|
Client,
|
|
237
|
-
KeyboardBuilder
|
|
272
|
+
KeyboardBuilder,
|
|
273
|
+
tgcore
|
|
238
274
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -42,10 +42,21 @@ declare class SendMessageBuilder extends BaseCallBuilder {
|
|
|
42
42
|
linkPreviewOptions(options: any): this;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
declare class SendPhotoBuilder extends BaseCallBuilder {
|
|
46
|
+
chatId(id: string | number): this;
|
|
47
|
+
photo(url: string): this;
|
|
48
|
+
caption(caption: string): this;
|
|
49
|
+
parseMode(mode: "HTML" | "Markdown" | "MarkdownV2"): this;
|
|
50
|
+
disableNotification(value: boolean): this;
|
|
51
|
+
protectContent(value: boolean): this;
|
|
52
|
+
replyMarkup(markup: any): this;
|
|
53
|
+
}
|
|
54
|
+
|
|
45
55
|
declare class CallMethods {
|
|
46
56
|
private http;
|
|
47
57
|
constructor(http: any);
|
|
48
58
|
sendMessage(): SendMessageBuilder;
|
|
59
|
+
sendPhoto(): SendPhotoBuilder;
|
|
49
60
|
}
|
|
50
61
|
|
|
51
62
|
type ClientOptions = {
|
|
@@ -53,6 +64,7 @@ type ClientOptions = {
|
|
|
53
64
|
base_url?: string;
|
|
54
65
|
timeout_ms?: number;
|
|
55
66
|
};
|
|
67
|
+
declare function tgcore(options: ClientOptions): Client;
|
|
56
68
|
declare class Client {
|
|
57
69
|
private http;
|
|
58
70
|
raw: RawMethods;
|
|
@@ -110,4 +122,4 @@ declare class KeyboardBuilder {
|
|
|
110
122
|
build(): InlineKeyboardMarkup;
|
|
111
123
|
}
|
|
112
124
|
|
|
113
|
-
export { Client, type ClientOptions, type InlineKeyboardButton, type InlineKeyboardMarkup, KeyboardBuilder };
|
|
125
|
+
export { Client, type ClientOptions, type InlineKeyboardButton, type InlineKeyboardMarkup, KeyboardBuilder, tgcore };
|
package/dist/index.d.ts
CHANGED
|
@@ -42,10 +42,21 @@ declare class SendMessageBuilder extends BaseCallBuilder {
|
|
|
42
42
|
linkPreviewOptions(options: any): this;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
declare class SendPhotoBuilder extends BaseCallBuilder {
|
|
46
|
+
chatId(id: string | number): this;
|
|
47
|
+
photo(url: string): this;
|
|
48
|
+
caption(caption: string): this;
|
|
49
|
+
parseMode(mode: "HTML" | "Markdown" | "MarkdownV2"): this;
|
|
50
|
+
disableNotification(value: boolean): this;
|
|
51
|
+
protectContent(value: boolean): this;
|
|
52
|
+
replyMarkup(markup: any): this;
|
|
53
|
+
}
|
|
54
|
+
|
|
45
55
|
declare class CallMethods {
|
|
46
56
|
private http;
|
|
47
57
|
constructor(http: any);
|
|
48
58
|
sendMessage(): SendMessageBuilder;
|
|
59
|
+
sendPhoto(): SendPhotoBuilder;
|
|
49
60
|
}
|
|
50
61
|
|
|
51
62
|
type ClientOptions = {
|
|
@@ -53,6 +64,7 @@ type ClientOptions = {
|
|
|
53
64
|
base_url?: string;
|
|
54
65
|
timeout_ms?: number;
|
|
55
66
|
};
|
|
67
|
+
declare function tgcore(options: ClientOptions): Client;
|
|
56
68
|
declare class Client {
|
|
57
69
|
private http;
|
|
58
70
|
raw: RawMethods;
|
|
@@ -110,4 +122,4 @@ declare class KeyboardBuilder {
|
|
|
110
122
|
build(): InlineKeyboardMarkup;
|
|
111
123
|
}
|
|
112
124
|
|
|
113
|
-
export { Client, type ClientOptions, type InlineKeyboardButton, type InlineKeyboardMarkup, KeyboardBuilder };
|
|
125
|
+
export { Client, type ClientOptions, type InlineKeyboardButton, type InlineKeyboardMarkup, KeyboardBuilder, tgcore };
|
package/dist/index.js
CHANGED
|
@@ -93,6 +93,31 @@ var SendMessageBuilder = class extends BaseCallBuilder {
|
|
|
93
93
|
}
|
|
94
94
|
};
|
|
95
95
|
|
|
96
|
+
// src/calls/sendPhoto.ts
|
|
97
|
+
var SendPhotoBuilder = class extends BaseCallBuilder {
|
|
98
|
+
chatId(id) {
|
|
99
|
+
return this.set("chat_id", id);
|
|
100
|
+
}
|
|
101
|
+
photo(url) {
|
|
102
|
+
return this.set("photo", url);
|
|
103
|
+
}
|
|
104
|
+
caption(caption) {
|
|
105
|
+
return this.set("caption", caption);
|
|
106
|
+
}
|
|
107
|
+
parseMode(mode) {
|
|
108
|
+
return this.set("parse_mode", mode);
|
|
109
|
+
}
|
|
110
|
+
disableNotification(value) {
|
|
111
|
+
return this.set("disable_notification", value);
|
|
112
|
+
}
|
|
113
|
+
protectContent(value) {
|
|
114
|
+
return this.set("protect_content", value);
|
|
115
|
+
}
|
|
116
|
+
replyMarkup(markup) {
|
|
117
|
+
return this.set("reply_markup", markup);
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
|
|
96
121
|
// src/calls/index.ts
|
|
97
122
|
var CallMethods = class {
|
|
98
123
|
constructor(http) {
|
|
@@ -104,9 +129,18 @@ var CallMethods = class {
|
|
|
104
129
|
"/api/v2/sendMessage"
|
|
105
130
|
);
|
|
106
131
|
}
|
|
132
|
+
sendPhoto() {
|
|
133
|
+
return new SendPhotoBuilder(
|
|
134
|
+
this.http,
|
|
135
|
+
"/api/v2/sendPhoto"
|
|
136
|
+
);
|
|
137
|
+
}
|
|
107
138
|
};
|
|
108
139
|
|
|
109
140
|
// src/client.ts
|
|
141
|
+
function tgcore(options) {
|
|
142
|
+
return new Client(options);
|
|
143
|
+
}
|
|
110
144
|
var Client = class {
|
|
111
145
|
constructor(opts) {
|
|
112
146
|
if (!opts?.api_key) {
|
|
@@ -206,5 +240,6 @@ var KeyboardBuilder = class _KeyboardBuilder {
|
|
|
206
240
|
};
|
|
207
241
|
export {
|
|
208
242
|
Client,
|
|
209
|
-
KeyboardBuilder
|
|
243
|
+
KeyboardBuilder,
|
|
244
|
+
tgcore
|
|
210
245
|
};
|