@codebam/cf-workers-telegram-bot 7.25.0 → 7.27.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/main.d.ts +1 -3
- package/dist/main.js +1 -3
- package/dist/telegram_api.d.ts +12 -1
- package/dist/telegram_api.js +9 -0
- package/dist/telegram_bot.d.ts +0 -1
- package/dist/telegram_bot.js +4 -0
- package/dist/telegram_execution_context.d.ts +0 -1
- package/dist/telegram_execution_context.js +3 -0
- package/dist/types/TelegramCallbackQuery.d.ts +15 -0
- package/dist/types/TelegramCallbackQuery.js +1 -0
- package/dist/types/TelegramCommand.d.ts +0 -1
- package/dist/types/TelegramUpdate.d.ts +3 -2
- package/dist/types/TelegramUpdate.js +2 -4
- package/dist/types.d.ts +1 -3
- package/dist/types.js +1 -3
- package/dist/webhook.d.ts +0 -1
- package/package.json +11 -11
- package/dist/types/Update.d.ts +0 -3
- package/dist/types/Update.js +0 -2
- package/dist/types/WebhookCommands.d.ts +0 -4
- package/dist/types/WebhookCommands.js +0 -2
package/dist/main.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import TelegramExecutionContext from './telegram_execution_context.js';
|
|
|
3
3
|
import Webhook from './webhook.js';
|
|
4
4
|
import TelegramApi from './telegram_api.js';
|
|
5
5
|
import TelegramCommand from './types/TelegramCommand.js';
|
|
6
|
-
import WebhookCommands from './types/WebhookCommands.js';
|
|
7
6
|
import TelegramFrom from './types/TelegramFrom.js';
|
|
8
7
|
import TelegramChat from './types/TelegramChat.js';
|
|
9
8
|
import TelegramUser from './types/TelegramUser.js';
|
|
@@ -12,7 +11,6 @@ import TelegramPhotoSize from './types/TelegramPhotoSize.js';
|
|
|
12
11
|
import TelegramMessage from './types/TelegramMessage.js';
|
|
13
12
|
import TelegramInputMessageContent from './types/TelegramInputMessageContent.js';
|
|
14
13
|
import TelegramInlineQuery from './types/TelegramInlineQuery.js';
|
|
15
|
-
import Update from './types/Update.js';
|
|
16
14
|
import TelegramUpdate from './types/TelegramUpdate.js';
|
|
17
15
|
import PartialTelegramUpdate from './types/PartialTelegramUpdate.js';
|
|
18
16
|
import TelegramInlineQueryType from './types/TelegramInlineQueryType.js';
|
|
@@ -21,4 +19,4 @@ import TelegramInlineQueryResultPhoto from './types/TelegramInlineQueryResultPho
|
|
|
21
19
|
import TelegramInlineQueryResultArticle from './types/TelegramInlineQueryResultArticle.js';
|
|
22
20
|
import ChatPermissions from './types/ChatPermissions.js';
|
|
23
21
|
export default TelegramBot;
|
|
24
|
-
export { TelegramBot, TelegramExecutionContext, Webhook, TelegramApi, TelegramCommand,
|
|
22
|
+
export { TelegramBot, TelegramExecutionContext, Webhook, TelegramApi, TelegramCommand, TelegramFrom, TelegramChat, TelegramUser, TelegramMessageEntity, TelegramPhotoSize, TelegramMessage, TelegramInputMessageContent, TelegramInlineQuery, TelegramUpdate, PartialTelegramUpdate, TelegramInlineQueryType, TelegramInlineQueryResult, TelegramInlineQueryResultPhoto, TelegramInlineQueryResultArticle, ChatPermissions, };
|
package/dist/main.js
CHANGED
|
@@ -2,11 +2,9 @@ import TelegramBot from './telegram_bot.js';
|
|
|
2
2
|
import TelegramExecutionContext from './telegram_execution_context.js';
|
|
3
3
|
import Webhook from './webhook.js';
|
|
4
4
|
import TelegramApi from './telegram_api.js';
|
|
5
|
-
import WebhookCommands from './types/WebhookCommands.js';
|
|
6
|
-
import Update from './types/Update.js';
|
|
7
5
|
import TelegramUpdate from './types/TelegramUpdate.js';
|
|
8
6
|
import TelegramInlineQueryResult from './types/TelegramInlineQueryResult.js';
|
|
9
7
|
import TelegramInlineQueryResultPhoto from './types/TelegramInlineQueryResultPhoto.js';
|
|
10
8
|
import TelegramInlineQueryResultArticle from './types/TelegramInlineQueryResultArticle.js';
|
|
11
9
|
export default TelegramBot;
|
|
12
|
-
export { TelegramBot, TelegramExecutionContext, Webhook, TelegramApi,
|
|
10
|
+
export { TelegramBot, TelegramExecutionContext, Webhook, TelegramApi, TelegramUpdate, TelegramInlineQueryResult, TelegramInlineQueryResultPhoto, TelegramInlineQueryResultArticle, };
|
package/dist/telegram_api.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="@cloudflare/workers-types" />
|
|
2
1
|
import TelegramInlineQueryResultArticle from './types/TelegramInlineQueryResultArticle.js';
|
|
3
2
|
import TelegramInlineQueryResultPhoto from './types/TelegramInlineQueryResultPhoto.js';
|
|
4
3
|
import TelegramInlineQueryResultVideo from './types/TelegramInlineQueryResultVideo.js';
|
|
@@ -59,4 +58,16 @@ export default class TelegramApi {
|
|
|
59
58
|
inline_query_id: number | string;
|
|
60
59
|
results: TelegramInlineQueryResultArticle[] | TelegramInlineQueryResultPhoto[] | TelegramInlineQueryResultVideo[];
|
|
61
60
|
}): Promise<Response>;
|
|
61
|
+
/**
|
|
62
|
+
* Send an callback response to a given botApi
|
|
63
|
+
* @param botApi - full URL to the telegram API without slug
|
|
64
|
+
* @param data - data to append to the request
|
|
65
|
+
*/
|
|
66
|
+
answerCallback(botApi: string, data: {
|
|
67
|
+
callback_query_id: number | string;
|
|
68
|
+
text?: string;
|
|
69
|
+
show_alert?: boolean;
|
|
70
|
+
url?: string;
|
|
71
|
+
cache_time?: number;
|
|
72
|
+
}): Promise<Response>;
|
|
62
73
|
}
|
package/dist/telegram_api.js
CHANGED
|
@@ -73,4 +73,13 @@ export default class TelegramApi {
|
|
|
73
73
|
});
|
|
74
74
|
return await fetch(url);
|
|
75
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* Send an callback response to a given botApi
|
|
78
|
+
* @param botApi - full URL to the telegram API without slug
|
|
79
|
+
* @param data - data to append to the request
|
|
80
|
+
*/
|
|
81
|
+
async answerCallback(botApi, data) {
|
|
82
|
+
const url = this.getApiUrl(botApi, 'answerCallbackQuery', data);
|
|
83
|
+
return await fetch(url);
|
|
84
|
+
}
|
|
76
85
|
}
|
package/dist/telegram_bot.d.ts
CHANGED
package/dist/telegram_bot.js
CHANGED
|
@@ -32,6 +32,9 @@ export default class TelegramExecutionContext {
|
|
|
32
32
|
else if (this.update.message?.document) {
|
|
33
33
|
this.update_type = 'document';
|
|
34
34
|
}
|
|
35
|
+
else if (this.update.callback_query?.id) {
|
|
36
|
+
this.update_type = 'callback';
|
|
37
|
+
}
|
|
35
38
|
}
|
|
36
39
|
/**
|
|
37
40
|
* Reply to the last message with a video
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import TelegramFrom from './TelegramFrom.js';
|
|
2
|
+
import TelegramMessage from './TelegramMessage.js';
|
|
3
|
+
interface TelegramCallbackQuery {
|
|
4
|
+
chat_type: 'sender' | 'private' | 'group' | 'supergroup' | 'channel';
|
|
5
|
+
from: TelegramFrom;
|
|
6
|
+
id: number;
|
|
7
|
+
offset: string;
|
|
8
|
+
query: string;
|
|
9
|
+
message: TelegramMessage;
|
|
10
|
+
inline_message_id: string;
|
|
11
|
+
chat_instance: string;
|
|
12
|
+
data: string;
|
|
13
|
+
game_short_name: string;
|
|
14
|
+
}
|
|
15
|
+
export default TelegramCallbackQuery;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import TelegramInlineQuery from './TelegramInlineQuery.js';
|
|
2
2
|
import TelegramMessage from './TelegramMessage.js';
|
|
3
|
-
import Update from './Update.js';
|
|
4
3
|
import PartialTelegramUpdate from './PartialTelegramUpdate.js';
|
|
5
|
-
|
|
4
|
+
import TelegramCallbackQuery from './TelegramCallbackQuery.js';
|
|
5
|
+
export default class TelegramUpdate {
|
|
6
6
|
update_id: number;
|
|
7
7
|
message?: TelegramMessage;
|
|
8
8
|
edited_message?: TelegramMessage;
|
|
9
9
|
channel_post?: TelegramMessage;
|
|
10
10
|
edited_channel_post?: TelegramMessage;
|
|
11
11
|
inline_query?: TelegramInlineQuery;
|
|
12
|
+
callback_query?: TelegramCallbackQuery;
|
|
12
13
|
constructor(update: PartialTelegramUpdate);
|
|
13
14
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export default class TelegramUpdate extends Update {
|
|
1
|
+
export default class TelegramUpdate {
|
|
3
2
|
update_id;
|
|
4
3
|
message;
|
|
5
4
|
edited_message;
|
|
@@ -7,7 +6,7 @@ export default class TelegramUpdate extends Update {
|
|
|
7
6
|
edited_channel_post;
|
|
8
7
|
inline_query;
|
|
9
8
|
// chosen_inline_result?: TelegramChosenInlineResult;
|
|
10
|
-
|
|
9
|
+
callback_query;
|
|
11
10
|
// shipping_query?: TelegramShippingQuery;
|
|
12
11
|
// pre_checkout_query?: TelegramPreCheckoutQuery;
|
|
13
12
|
// poll?: TelegramPoll;
|
|
@@ -16,7 +15,6 @@ export default class TelegramUpdate extends Update {
|
|
|
16
15
|
// chat_member?: TelegramChatMemberUpdated;
|
|
17
16
|
// chat_join_request: TelegramChatJoinRequest;
|
|
18
17
|
constructor(update) {
|
|
19
|
-
super();
|
|
20
18
|
this.update_id = update.update_id ?? 0;
|
|
21
19
|
this.message = update.message;
|
|
22
20
|
this.edited_message = update.edited_message;
|
package/dist/types.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import TelegramExecutionContext from './telegram_execution_context.js';
|
|
|
3
3
|
import Webhook from './webhook.js';
|
|
4
4
|
import TelegramApi from './telegram_api.js';
|
|
5
5
|
import TelegramCommand from './types/TelegramCommand.js';
|
|
6
|
-
import WebhookCommands from './types/WebhookCommands.js';
|
|
7
6
|
import TelegramFrom from './types/TelegramFrom.js';
|
|
8
7
|
import TelegramChat from './types/TelegramChat.js';
|
|
9
8
|
import TelegramUser from './types/TelegramUser.js';
|
|
@@ -12,7 +11,6 @@ import TelegramPhotoSize from './types/TelegramPhotoSize.js';
|
|
|
12
11
|
import TelegramMessage from './types/TelegramMessage.js';
|
|
13
12
|
import TelegramInputMessageContent from './types/TelegramInputMessageContent.js';
|
|
14
13
|
import TelegramInlineQuery from './types/TelegramInlineQuery.js';
|
|
15
|
-
import Update from './types/Update.js';
|
|
16
14
|
import TelegramUpdate from './types/TelegramUpdate.js';
|
|
17
15
|
import PartialTelegramUpdate from './types/PartialTelegramUpdate.js';
|
|
18
16
|
import TelegramInlineQueryType from './types/TelegramInlineQueryType.js';
|
|
@@ -21,4 +19,4 @@ import TelegramInlineQueryResultPhoto from './types/TelegramInlineQueryResultPho
|
|
|
21
19
|
import TelegramInlineQueryResultArticle from './types/TelegramInlineQueryResultArticle.js';
|
|
22
20
|
import ChatPermissions from './types/ChatPermissions.js';
|
|
23
21
|
export default TelegramBot;
|
|
24
|
-
export { TelegramBot, TelegramExecutionContext, Webhook, TelegramApi, TelegramCommand,
|
|
22
|
+
export { TelegramBot, TelegramExecutionContext, Webhook, TelegramApi, TelegramCommand, TelegramFrom, TelegramChat, TelegramUser, TelegramMessageEntity, TelegramPhotoSize, TelegramMessage, TelegramInputMessageContent, TelegramInlineQuery, TelegramUpdate, PartialTelegramUpdate, TelegramInlineQueryType, TelegramInlineQueryResult, TelegramInlineQueryResultPhoto, TelegramInlineQueryResultArticle, ChatPermissions, };
|
package/dist/types.js
CHANGED
|
@@ -2,11 +2,9 @@ import TelegramBot from './telegram_bot.js';
|
|
|
2
2
|
import TelegramExecutionContext from './telegram_execution_context.js';
|
|
3
3
|
import Webhook from './webhook.js';
|
|
4
4
|
import TelegramApi from './telegram_api.js';
|
|
5
|
-
import WebhookCommands from './types/WebhookCommands.js';
|
|
6
|
-
import Update from './types/Update.js';
|
|
7
5
|
import TelegramUpdate from './types/TelegramUpdate.js';
|
|
8
6
|
import TelegramInlineQueryResult from './types/TelegramInlineQueryResult.js';
|
|
9
7
|
import TelegramInlineQueryResultPhoto from './types/TelegramInlineQueryResultPhoto.js';
|
|
10
8
|
import TelegramInlineQueryResultArticle from './types/TelegramInlineQueryResultArticle.js';
|
|
11
9
|
export default TelegramBot;
|
|
12
|
-
export { TelegramBot, TelegramExecutionContext, Webhook, TelegramApi,
|
|
10
|
+
export { TelegramBot, TelegramExecutionContext, Webhook, TelegramApi, TelegramUpdate, TelegramInlineQueryResult, TelegramInlineQueryResultPhoto, TelegramInlineQueryResultArticle, };
|
package/dist/webhook.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codebam/cf-workers-telegram-bot",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.27.0",
|
|
4
4
|
"description": "serverless telegram bot on cf workers",
|
|
5
5
|
"main": "./dist/main.js",
|
|
6
6
|
"module": "./dist/main.js",
|
|
@@ -31,16 +31,16 @@
|
|
|
31
31
|
"url": "https://github.com/codebam/cf-workers-telegram-bot.git"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@cloudflare/workers-types": "^4.
|
|
35
|
-
"@eslint/js": "^9.
|
|
36
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
37
|
-
"@typescript-eslint/parser": "^
|
|
38
|
-
"eslint": "^
|
|
34
|
+
"@cloudflare/workers-types": "^4.20241112.0",
|
|
35
|
+
"@eslint/js": "^9.14.0",
|
|
36
|
+
"@typescript-eslint/eslint-plugin": "^8.14.0",
|
|
37
|
+
"@typescript-eslint/parser": "^8.14.0",
|
|
38
|
+
"eslint": "^9.14.0",
|
|
39
39
|
"eslint-config-prettier": "^9.1.0",
|
|
40
|
-
"globals": "^15.
|
|
41
|
-
"prettier": "^3.3.
|
|
42
|
-
"typescript": "^5.
|
|
43
|
-
"typescript-eslint": "^
|
|
44
|
-
"vitest": "^1.
|
|
40
|
+
"globals": "^15.12.0",
|
|
41
|
+
"prettier": "^3.3.3",
|
|
42
|
+
"typescript": "^5.6.3",
|
|
43
|
+
"typescript-eslint": "^8.14.0",
|
|
44
|
+
"vitest": "^2.1.5"
|
|
45
45
|
}
|
|
46
46
|
}
|
package/dist/types/Update.d.ts
DELETED
package/dist/types/Update.js
DELETED