gramio 0.0.27 → 0.0.28
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/bot.d.ts +1 -0
- package/dist/bot.js +7 -0
- package/package.json +5 -5
package/dist/bot.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export declare class Bot<Errors extends ErrorDefinitions = {}, Derives extends D
|
|
|
20
20
|
private runHooks;
|
|
21
21
|
private runImmutableHooks;
|
|
22
22
|
private _callApi;
|
|
23
|
+
downloadFile(fileId: string): Promise<ArrayBuffer>;
|
|
23
24
|
/**
|
|
24
25
|
* Register custom class-error for type-safe catch in `onError` hook
|
|
25
26
|
*
|
package/dist/bot.js
CHANGED
|
@@ -163,6 +163,13 @@ let Bot = (() => {
|
|
|
163
163
|
});
|
|
164
164
|
return data.result;
|
|
165
165
|
}
|
|
166
|
+
async downloadFile(fileId) {
|
|
167
|
+
const file = await this.api.getFile({ file_id: fileId });
|
|
168
|
+
const url = `https://api.telegram.org/file/bot${this.options.token}/${file.file_path}`;
|
|
169
|
+
const res = await fetch(url);
|
|
170
|
+
const buffer = await res.arrayBuffer();
|
|
171
|
+
return buffer;
|
|
172
|
+
}
|
|
166
173
|
/**
|
|
167
174
|
* Register custom class-error for type-safe catch in `onError` hook
|
|
168
175
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gramio",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.28",
|
|
4
4
|
"description": "Powerful Telegram Bot API framework",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -25,19 +25,19 @@
|
|
|
25
25
|
"license": "ISC",
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@biomejs/biome": "1.6.4",
|
|
28
|
-
"@types/node": "^20.12.
|
|
29
|
-
"typescript": "^5.4.
|
|
28
|
+
"@types/node": "^20.12.7",
|
|
29
|
+
"typescript": "^5.4.5"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@gramio/callback-data": "^0.0.2",
|
|
33
33
|
"@gramio/contexts": "^0.0.9",
|
|
34
|
-
"@gramio/files": "^0.0.
|
|
34
|
+
"@gramio/files": "^0.0.5",
|
|
35
35
|
"@gramio/format": "^0.0.8",
|
|
36
36
|
"@gramio/keyboards": "^0.3.0",
|
|
37
37
|
"@gramio/types": "^7.2.1",
|
|
38
38
|
"inspectable": "^3.0.0",
|
|
39
39
|
"middleware-io": "^2.8.1",
|
|
40
|
-
"undici": "^6.
|
|
40
|
+
"undici": "^6.12.0"
|
|
41
41
|
},
|
|
42
42
|
"files": [
|
|
43
43
|
"dist"
|