@codebam/cf-workers-telegram-bot 7.22.0 → 7.24.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/README.md +6 -1
- package/dist/main.d.ts +1 -9
- package/dist/main.js +1 -2
- package/dist/telegram_api.d.ts +35 -5
- package/dist/telegram_api.js +33 -0
- package/dist/telegram_bot.d.ts +20 -0
- package/dist/telegram_bot.js +20 -0
- package/dist/telegram_execution_context.d.ts +34 -9
- package/dist/telegram_execution_context.js +31 -14
- package/dist/types.d.ts +1 -9
- package/dist/types.js +1 -2
- package/package.json +1 -1
- package/dist/types/Balance.d.ts +0 -6
- package/dist/types/Balance.js +0 -1
- package/dist/types/Bored.d.ts +0 -10
- package/dist/types/Bored.js +0 -1
- package/dist/types/DDGQueryResponse.d.ts +0 -12
- package/dist/types/DDGQueryResponse.js +0 -1
- package/dist/types/Joke.d.ts +0 -20
- package/dist/types/Joke.js +0 -1
- package/dist/types/Kanye.d.ts +0 -4
- package/dist/types/Kanye.js +0 -1
- package/dist/types/Kv.d.ts +0 -3
- package/dist/types/Kv.js +0 -1
- package/dist/types/SerializableData.d.ts +0 -2
- package/dist/types/SerializableData.js +0 -1
- package/dist/types/localhost.d.ts +0 -3
- package/dist/types/localhost.js +0 -1
package/README.md
CHANGED
|
@@ -5,7 +5,12 @@ CF Workers Telegram Bot
|
|
|
5
5
|
<br/>
|
|
6
6
|
</h3>
|
|
7
7
|
|
|
8
|
-
<
|
|
8
|
+
<h6 align="center">
|
|
9
|
+
<a href="https://codebam.github.io/cf-workers-telegram-bot/">Docs</a>
|
|
10
|
+
<a href="https://github.com/codebam/cf-workers-telegram-bot/wiki">Wiki</a>
|
|
11
|
+
</h6>
|
|
12
|
+
|
|
13
|
+
<p align="center">
|
|
9
14
|
<a href="https://github.com/codebam/cf-workers-telegram-bot/stargazers"> <img src="https://img.shields.io/github/stars/codebam/cf-workers-telegram-bot?style=for-the-badge&logo=starship&color=111111&logoColor=ffffff&labelColor=000000" alt="GitHub stars"/></a>
|
|
10
15
|
<a href="https://github.com/codebam/cf-workers-telegram-bot/issues">
|
|
11
16
|
<img src="https://img.shields.io/github/issues/codebam/cf-workers-telegram-bot?style=for-the-badge&logo=gitbook&color=111111&logoColor=ffffff&labelColor=000000" alt="GitHub issues"/></a>
|
package/dist/main.d.ts
CHANGED
|
@@ -3,12 +3,7 @@ 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 Kv from './types/Kv.js';
|
|
7
|
-
import localhost from './types/localhost.js';
|
|
8
6
|
import WebhookCommands from './types/WebhookCommands.js';
|
|
9
|
-
import Joke from './types/Joke.js';
|
|
10
|
-
import Bored from './types/Bored.js';
|
|
11
|
-
import Balance from './types/Balance.js';
|
|
12
7
|
import TelegramFrom from './types/TelegramFrom.js';
|
|
13
8
|
import TelegramChat from './types/TelegramChat.js';
|
|
14
9
|
import TelegramUser from './types/TelegramUser.js';
|
|
@@ -24,9 +19,6 @@ import TelegramInlineQueryType from './types/TelegramInlineQueryType.js';
|
|
|
24
19
|
import TelegramInlineQueryResult from './types/TelegramInlineQueryResult.js';
|
|
25
20
|
import TelegramInlineQueryResultPhoto from './types/TelegramInlineQueryResultPhoto.js';
|
|
26
21
|
import TelegramInlineQueryResultArticle from './types/TelegramInlineQueryResultArticle.js';
|
|
27
|
-
import DDGQueryResponse from './types/DDGQueryResponse.js';
|
|
28
22
|
import ChatPermissions from './types/ChatPermissions.js';
|
|
29
|
-
import Kanye from './types/Kanye.js';
|
|
30
|
-
import SerializableData from './types/SerializableData.js';
|
|
31
23
|
export default TelegramBot;
|
|
32
|
-
export { TelegramBot, TelegramExecutionContext, Webhook, TelegramApi, TelegramCommand,
|
|
24
|
+
export { TelegramBot, TelegramExecutionContext, Webhook, TelegramApi, TelegramCommand, WebhookCommands, TelegramFrom, TelegramChat, TelegramUser, TelegramMessageEntity, TelegramPhotoSize, TelegramMessage, TelegramInputMessageContent, TelegramInlineQuery, Update, TelegramUpdate, PartialTelegramUpdate, TelegramInlineQueryType, TelegramInlineQueryResult, TelegramInlineQueryResultPhoto, TelegramInlineQueryResultArticle, ChatPermissions, };
|
package/dist/main.js
CHANGED
|
@@ -2,7 +2,6 @@ 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 localhost from './types/localhost.js';
|
|
6
5
|
import WebhookCommands from './types/WebhookCommands.js';
|
|
7
6
|
import Update from './types/Update.js';
|
|
8
7
|
import TelegramUpdate from './types/TelegramUpdate.js';
|
|
@@ -10,4 +9,4 @@ import TelegramInlineQueryResult from './types/TelegramInlineQueryResult.js';
|
|
|
10
9
|
import TelegramInlineQueryResultPhoto from './types/TelegramInlineQueryResultPhoto.js';
|
|
11
10
|
import TelegramInlineQueryResultArticle from './types/TelegramInlineQueryResultArticle.js';
|
|
12
11
|
export default TelegramBot;
|
|
13
|
-
export { TelegramBot, TelegramExecutionContext, Webhook, TelegramApi,
|
|
12
|
+
export { TelegramBot, TelegramExecutionContext, Webhook, TelegramApi, WebhookCommands, Update, TelegramUpdate, TelegramInlineQueryResult, TelegramInlineQueryResultPhoto, TelegramInlineQueryResultArticle, };
|
package/dist/telegram_api.d.ts
CHANGED
|
@@ -1,30 +1,60 @@
|
|
|
1
1
|
/// <reference types="@cloudflare/workers-types" />
|
|
2
|
-
import SerializableData from './types/SerializableData.js';
|
|
3
2
|
import TelegramInlineQueryResultArticle from './types/TelegramInlineQueryResultArticle.js';
|
|
4
3
|
import TelegramInlineQueryResultPhoto from './types/TelegramInlineQueryResultPhoto.js';
|
|
5
4
|
import TelegramInlineQueryResultVideo from './types/TelegramInlineQueryResultVideo.js';
|
|
5
|
+
/** Class representing the Telegram API and all it's methods */
|
|
6
6
|
export default class TelegramApi {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Get the API URL for a given bot API and slug
|
|
9
|
+
* @param botApi - full URL to the telegram API without slug
|
|
10
|
+
* @param slug - slug to append to the API URL
|
|
11
|
+
* @param data - data to append to the request
|
|
12
|
+
*/
|
|
13
|
+
getApiUrl(botApi: string, slug: string, data: Record<string, number | string | boolean>): Request<unknown, CfProperties<unknown>>;
|
|
14
|
+
/**
|
|
15
|
+
* Get a file with a given file_id
|
|
16
|
+
* @param botApi - full URL to the telegram API without slug
|
|
17
|
+
* @param data - data to append to the request
|
|
18
|
+
* @param token - bot token
|
|
19
|
+
*/
|
|
20
|
+
getFile(botApi: string, data: Record<string, number | string | boolean>, token: string): Promise<Response>;
|
|
21
|
+
/**
|
|
22
|
+
* Send a message to a given botApi
|
|
23
|
+
* @param botApi - full URL to the telegram API without slug
|
|
24
|
+
* @param data - data to append to the request
|
|
25
|
+
*/
|
|
11
26
|
sendMessage(botApi: string, data: {
|
|
12
27
|
reply_to_message_id: number | string;
|
|
13
28
|
chat_id: number | string;
|
|
14
29
|
text: string;
|
|
15
30
|
parse_mode: string;
|
|
16
31
|
}): Promise<Response>;
|
|
32
|
+
/**
|
|
33
|
+
* Send a video message to a given botApi
|
|
34
|
+
* @param botApi - full URL to the telegram API without slug
|
|
35
|
+
* @param data - data to append to the request
|
|
36
|
+
*/
|
|
17
37
|
sendVideo(botApi: string, data: {
|
|
18
38
|
reply_to_message_id: number | string;
|
|
19
39
|
chat_id: number | string;
|
|
20
40
|
video: string;
|
|
21
41
|
}): Promise<Response>;
|
|
42
|
+
/**
|
|
43
|
+
* Send a photo message to a given botApi
|
|
44
|
+
* @param botApi - full URL to the telegram API without slug
|
|
45
|
+
* @param data - data to append to the request
|
|
46
|
+
*/
|
|
22
47
|
sendPhoto(botApi: string, data: {
|
|
23
48
|
reply_to_message_id: number | string;
|
|
24
49
|
chat_id: number | string;
|
|
25
50
|
photo: string;
|
|
26
51
|
caption: string;
|
|
27
52
|
}): Promise<Response>;
|
|
53
|
+
/**
|
|
54
|
+
* Send an inline response to a given botApi
|
|
55
|
+
* @param botApi - full URL to the telegram API without slug
|
|
56
|
+
* @param data - data to append to the request
|
|
57
|
+
*/
|
|
28
58
|
answerInline(botApi: string, data: {
|
|
29
59
|
inline_query_id: number | string;
|
|
30
60
|
results: TelegramInlineQueryResultArticle[] | TelegramInlineQueryResultPhoto[] | TelegramInlineQueryResultVideo[];
|
package/dist/telegram_api.js
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
+
/** Class representing the Telegram API and all it's methods */
|
|
1
2
|
export default class TelegramApi {
|
|
3
|
+
/**
|
|
4
|
+
* Get the API URL for a given bot API and slug
|
|
5
|
+
* @param botApi - full URL to the telegram API without slug
|
|
6
|
+
* @param slug - slug to append to the API URL
|
|
7
|
+
* @param data - data to append to the request
|
|
8
|
+
*/
|
|
2
9
|
getApiUrl(botApi, slug, data) {
|
|
3
10
|
const request = new URL(botApi + (slug.startsWith('/') || botApi.endsWith('/') ? '' : '/') + slug);
|
|
4
11
|
const params = new URLSearchParams();
|
|
@@ -7,6 +14,12 @@ export default class TelegramApi {
|
|
|
7
14
|
}
|
|
8
15
|
return new Request(`${request.toString()}?${params.toString()}`);
|
|
9
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Get a file with a given file_id
|
|
19
|
+
* @param botApi - full URL to the telegram API without slug
|
|
20
|
+
* @param data - data to append to the request
|
|
21
|
+
* @param token - bot token
|
|
22
|
+
*/
|
|
10
23
|
async getFile(botApi, data, token) {
|
|
11
24
|
const url = this.getApiUrl(botApi, 'getFile', data);
|
|
12
25
|
const response = await fetch(url);
|
|
@@ -21,18 +34,38 @@ export default class TelegramApi {
|
|
|
21
34
|
}
|
|
22
35
|
return await fetch(`https://api.telegram.org/file/bot${token}/${file_path}`);
|
|
23
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Send a message to a given botApi
|
|
39
|
+
* @param botApi - full URL to the telegram API without slug
|
|
40
|
+
* @param data - data to append to the request
|
|
41
|
+
*/
|
|
24
42
|
async sendMessage(botApi, data) {
|
|
25
43
|
const url = this.getApiUrl(botApi, 'sendMessage', data);
|
|
26
44
|
return await fetch(url);
|
|
27
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Send a video message to a given botApi
|
|
48
|
+
* @param botApi - full URL to the telegram API without slug
|
|
49
|
+
* @param data - data to append to the request
|
|
50
|
+
*/
|
|
28
51
|
async sendVideo(botApi, data) {
|
|
29
52
|
const url = this.getApiUrl(botApi, 'sendVideo', data);
|
|
30
53
|
return await fetch(url);
|
|
31
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Send a photo message to a given botApi
|
|
57
|
+
* @param botApi - full URL to the telegram API without slug
|
|
58
|
+
* @param data - data to append to the request
|
|
59
|
+
*/
|
|
32
60
|
async sendPhoto(botApi, data) {
|
|
33
61
|
const url = this.getApiUrl(botApi, 'sendPhoto', data);
|
|
34
62
|
return await fetch(url);
|
|
35
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Send an inline response to a given botApi
|
|
66
|
+
* @param botApi - full URL to the telegram API without slug
|
|
67
|
+
* @param data - data to append to the request
|
|
68
|
+
*/
|
|
36
69
|
async answerInline(botApi, data) {
|
|
37
70
|
const url = this.getApiUrl(botApi, 'answerInlineQuery', {
|
|
38
71
|
inline_query_id: data.inline_query_id,
|
package/dist/telegram_bot.d.ts
CHANGED
|
@@ -2,14 +2,34 @@
|
|
|
2
2
|
import TelegramUpdate from './types/TelegramUpdate.js';
|
|
3
3
|
import TelegramExecutionContext from './telegram_execution_context.js';
|
|
4
4
|
import Webhook from './webhook.js';
|
|
5
|
+
/** Class representing a telegram bot. */
|
|
5
6
|
export default class TelegramBot {
|
|
7
|
+
/** The telegram token */
|
|
6
8
|
token: string;
|
|
9
|
+
/** The telegram api URL */
|
|
7
10
|
api: URL;
|
|
11
|
+
/** The telegram webhook object */
|
|
8
12
|
webhook: Webhook;
|
|
13
|
+
/** The telegram update object */
|
|
9
14
|
update: TelegramUpdate;
|
|
15
|
+
/** The telegram commands record map */
|
|
10
16
|
commands: Record<string, (ctx: TelegramExecutionContext) => Promise<Response>>;
|
|
17
|
+
/** The current bot context */
|
|
11
18
|
currentContext: TelegramExecutionContext;
|
|
19
|
+
/**
|
|
20
|
+
* Create a bot
|
|
21
|
+
* @param token - the telegram secret token
|
|
22
|
+
*/
|
|
12
23
|
constructor(token: string);
|
|
24
|
+
/**
|
|
25
|
+
* Register a function on the bot
|
|
26
|
+
* @param event - the event or command name
|
|
27
|
+
* @param callback - the bot context
|
|
28
|
+
*/
|
|
13
29
|
on(event: string, callback: (ctx: TelegramExecutionContext) => Promise<Response>): this;
|
|
30
|
+
/**
|
|
31
|
+
* Handle a request on a given bot
|
|
32
|
+
* @param request - the request to handle
|
|
33
|
+
*/
|
|
14
34
|
handle(request: Request): Promise<Response>;
|
|
15
35
|
}
|
package/dist/telegram_bot.js
CHANGED
|
@@ -1,23 +1,43 @@
|
|
|
1
1
|
import TelegramUpdate from './types/TelegramUpdate.js';
|
|
2
2
|
import TelegramExecutionContext from './telegram_execution_context.js';
|
|
3
3
|
import Webhook from './webhook.js';
|
|
4
|
+
/** Class representing a telegram bot. */
|
|
4
5
|
export default class TelegramBot {
|
|
6
|
+
/** The telegram token */
|
|
5
7
|
token;
|
|
8
|
+
/** The telegram api URL */
|
|
6
9
|
api;
|
|
10
|
+
/** The telegram webhook object */
|
|
7
11
|
webhook = new Webhook('', new Request('http://127.0.0.1'));
|
|
12
|
+
/** The telegram update object */
|
|
8
13
|
update = new TelegramUpdate({});
|
|
14
|
+
/** The telegram commands record map */
|
|
9
15
|
commands = {};
|
|
16
|
+
/** The current bot context */
|
|
10
17
|
currentContext;
|
|
18
|
+
/**
|
|
19
|
+
* Create a bot
|
|
20
|
+
* @param token - the telegram secret token
|
|
21
|
+
*/
|
|
11
22
|
constructor(token) {
|
|
12
23
|
this.token = token;
|
|
13
24
|
this.api = new URL('https://api.telegram.org/bot' + token);
|
|
14
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Register a function on the bot
|
|
28
|
+
* @param event - the event or command name
|
|
29
|
+
* @param callback - the bot context
|
|
30
|
+
*/
|
|
15
31
|
on(event, callback) {
|
|
16
32
|
if (!['on', 'handle'].includes(event)) {
|
|
17
33
|
this.commands[event] = callback;
|
|
18
34
|
}
|
|
19
35
|
return this;
|
|
20
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Handle a request on a given bot
|
|
39
|
+
* @param request - the request to handle
|
|
40
|
+
*/
|
|
21
41
|
async handle(request) {
|
|
22
42
|
this.webhook = new Webhook(this.token, request);
|
|
23
43
|
const url = new URL(request.url);
|
|
@@ -1,21 +1,46 @@
|
|
|
1
1
|
/// <reference types="@cloudflare/workers-types" />
|
|
2
2
|
import TelegramApi from './telegram_api.js';
|
|
3
3
|
import TelegramBot from './telegram_bot.js';
|
|
4
|
-
import SerializableData from './types/SerializableData.js';
|
|
5
4
|
import TelegramUpdate from './types/TelegramUpdate.js';
|
|
5
|
+
/** Class representing the context of execution */
|
|
6
6
|
export default class TelegramExecutionContext {
|
|
7
|
+
/** an instance of the telegram bot */
|
|
7
8
|
bot: TelegramBot;
|
|
9
|
+
/** an instance of the telegram update */
|
|
8
10
|
update: TelegramUpdate;
|
|
11
|
+
/** string representing the type of update that was sent */
|
|
9
12
|
update_type: string;
|
|
13
|
+
/** reference to TelegramApi class */
|
|
10
14
|
api: TelegramApi;
|
|
11
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Create a telegram execution context
|
|
17
|
+
* @param bot - the telegram bot
|
|
18
|
+
* @param update - the telegram update
|
|
19
|
+
*/
|
|
12
20
|
constructor(bot: TelegramBot, update: TelegramUpdate);
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Reply to the last message with a video
|
|
23
|
+
* @param video - string to a video on the internet or a file_id on telegram
|
|
24
|
+
* @param options - any additional options to pass to sendVideo
|
|
25
|
+
*/
|
|
26
|
+
replyVideo(video: string, options?: Record<string, number | string | boolean>): Promise<Response | undefined>;
|
|
27
|
+
/**
|
|
28
|
+
* Get File from telegram file_id
|
|
29
|
+
* @param file_id - telegram file_id
|
|
30
|
+
*/
|
|
18
31
|
getFile(file_id: string): Promise<Response>;
|
|
19
|
-
|
|
20
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Reply to the last message with a photo
|
|
34
|
+
* @param photo - url or file_id to photo
|
|
35
|
+
* @param caption - photo caption
|
|
36
|
+
* @param options - any additional options to pass to sendPhoto
|
|
37
|
+
*/
|
|
38
|
+
replyPhoto(photo: string, caption?: string, options?: Record<string, number | string | boolean>): Promise<Response | undefined>;
|
|
39
|
+
/**
|
|
40
|
+
* Reply to the last message with text
|
|
41
|
+
* @param message - text to reply with
|
|
42
|
+
* @param parse_mode - one of HTML, MarkdownV2, Markdown, or an empty string for ascii
|
|
43
|
+
* @param options - any additional options to pass to sendMessage
|
|
44
|
+
*/
|
|
45
|
+
reply(message: string, parse_mode?: string, options?: Record<string, number | string | boolean>): Promise<Response | undefined>;
|
|
21
46
|
}
|
|
@@ -2,12 +2,21 @@ import TelegramApi from './telegram_api.js';
|
|
|
2
2
|
import TelegramInlineQueryResultArticle from './types/TelegramInlineQueryResultArticle.js';
|
|
3
3
|
import TelegramInlineQueryResultPhoto from './types/TelegramInlineQueryResultPhoto.js';
|
|
4
4
|
import TelegramInlineQueryResultVideo from './types/TelegramInlineQueryResultVideo.js';
|
|
5
|
+
/** Class representing the context of execution */
|
|
5
6
|
export default class TelegramExecutionContext {
|
|
7
|
+
/** an instance of the telegram bot */
|
|
6
8
|
bot;
|
|
9
|
+
/** an instance of the telegram update */
|
|
7
10
|
update;
|
|
11
|
+
/** string representing the type of update that was sent */
|
|
8
12
|
update_type = '';
|
|
13
|
+
/** reference to TelegramApi class */
|
|
9
14
|
api = new TelegramApi();
|
|
10
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Create a telegram execution context
|
|
17
|
+
* @param bot - the telegram bot
|
|
18
|
+
* @param update - the telegram update
|
|
19
|
+
*/
|
|
11
20
|
constructor(bot, update) {
|
|
12
21
|
this.bot = bot;
|
|
13
22
|
this.update = update;
|
|
@@ -24,19 +33,11 @@ export default class TelegramExecutionContext {
|
|
|
24
33
|
this.update_type = 'document';
|
|
25
34
|
}
|
|
26
35
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
setData(key, value) {
|
|
34
|
-
this.data[key] = value;
|
|
35
|
-
return this;
|
|
36
|
-
}
|
|
37
|
-
getData(key) {
|
|
38
|
-
return this.data[key];
|
|
39
|
-
}
|
|
36
|
+
/**
|
|
37
|
+
* Reply to the last message with a video
|
|
38
|
+
* @param video - string to a video on the internet or a file_id on telegram
|
|
39
|
+
* @param options - any additional options to pass to sendVideo
|
|
40
|
+
*/
|
|
40
41
|
async replyVideo(video, options = {}) {
|
|
41
42
|
switch (this.update_type) {
|
|
42
43
|
case 'message':
|
|
@@ -56,9 +57,19 @@ export default class TelegramExecutionContext {
|
|
|
56
57
|
break;
|
|
57
58
|
}
|
|
58
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Get File from telegram file_id
|
|
62
|
+
* @param file_id - telegram file_id
|
|
63
|
+
*/
|
|
59
64
|
async getFile(file_id) {
|
|
60
65
|
return await this.api.getFile(this.bot.api.toString(), { file_id }, this.bot.token);
|
|
61
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* Reply to the last message with a photo
|
|
69
|
+
* @param photo - url or file_id to photo
|
|
70
|
+
* @param caption - photo caption
|
|
71
|
+
* @param options - any additional options to pass to sendPhoto
|
|
72
|
+
*/
|
|
62
73
|
async replyPhoto(photo, caption = '', options = {}) {
|
|
63
74
|
switch (this.update_type) {
|
|
64
75
|
case 'photo':
|
|
@@ -86,6 +97,12 @@ export default class TelegramExecutionContext {
|
|
|
86
97
|
break;
|
|
87
98
|
}
|
|
88
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* Reply to the last message with text
|
|
102
|
+
* @param message - text to reply with
|
|
103
|
+
* @param parse_mode - one of HTML, MarkdownV2, Markdown, or an empty string for ascii
|
|
104
|
+
* @param options - any additional options to pass to sendMessage
|
|
105
|
+
*/
|
|
89
106
|
async reply(message, parse_mode = '', options = {}) {
|
|
90
107
|
switch (this.update_type) {
|
|
91
108
|
case 'message':
|
package/dist/types.d.ts
CHANGED
|
@@ -3,12 +3,7 @@ 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 Kv from './types/Kv.js';
|
|
7
|
-
import localhost from './types/localhost.js';
|
|
8
6
|
import WebhookCommands from './types/WebhookCommands.js';
|
|
9
|
-
import Joke from './types/Joke.js';
|
|
10
|
-
import Bored from './types/Bored.js';
|
|
11
|
-
import Balance from './types/Balance.js';
|
|
12
7
|
import TelegramFrom from './types/TelegramFrom.js';
|
|
13
8
|
import TelegramChat from './types/TelegramChat.js';
|
|
14
9
|
import TelegramUser from './types/TelegramUser.js';
|
|
@@ -24,9 +19,6 @@ import TelegramInlineQueryType from './types/TelegramInlineQueryType.js';
|
|
|
24
19
|
import TelegramInlineQueryResult from './types/TelegramInlineQueryResult.js';
|
|
25
20
|
import TelegramInlineQueryResultPhoto from './types/TelegramInlineQueryResultPhoto.js';
|
|
26
21
|
import TelegramInlineQueryResultArticle from './types/TelegramInlineQueryResultArticle.js';
|
|
27
|
-
import DDGQueryResponse from './types/DDGQueryResponse.js';
|
|
28
22
|
import ChatPermissions from './types/ChatPermissions.js';
|
|
29
|
-
import Kanye from './types/Kanye.js';
|
|
30
|
-
import SerializableData from './types/SerializableData.js';
|
|
31
23
|
export default TelegramBot;
|
|
32
|
-
export { TelegramBot, TelegramExecutionContext, Webhook, TelegramApi, TelegramCommand,
|
|
24
|
+
export { TelegramBot, TelegramExecutionContext, Webhook, TelegramApi, TelegramCommand, WebhookCommands, TelegramFrom, TelegramChat, TelegramUser, TelegramMessageEntity, TelegramPhotoSize, TelegramMessage, TelegramInputMessageContent, TelegramInlineQuery, Update, TelegramUpdate, PartialTelegramUpdate, TelegramInlineQueryType, TelegramInlineQueryResult, TelegramInlineQueryResultPhoto, TelegramInlineQueryResultArticle, ChatPermissions, };
|
package/dist/types.js
CHANGED
|
@@ -2,7 +2,6 @@ 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 localhost from './types/localhost.js';
|
|
6
5
|
import WebhookCommands from './types/WebhookCommands.js';
|
|
7
6
|
import Update from './types/Update.js';
|
|
8
7
|
import TelegramUpdate from './types/TelegramUpdate.js';
|
|
@@ -10,4 +9,4 @@ import TelegramInlineQueryResult from './types/TelegramInlineQueryResult.js';
|
|
|
10
9
|
import TelegramInlineQueryResultPhoto from './types/TelegramInlineQueryResultPhoto.js';
|
|
11
10
|
import TelegramInlineQueryResultArticle from './types/TelegramInlineQueryResultArticle.js';
|
|
12
11
|
export default TelegramBot;
|
|
13
|
-
export { TelegramBot, TelegramExecutionContext, Webhook, TelegramApi,
|
|
12
|
+
export { TelegramBot, TelegramExecutionContext, Webhook, TelegramApi, WebhookCommands, Update, TelegramUpdate, TelegramInlineQueryResult, TelegramInlineQueryResultPhoto, TelegramInlineQueryResultArticle, };
|
package/package.json
CHANGED
package/dist/types/Balance.d.ts
DELETED
package/dist/types/Balance.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/types/Bored.d.ts
DELETED
package/dist/types/Bored.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/types/Joke.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
interface Joke {
|
|
2
|
-
error: boolean;
|
|
3
|
-
category: string;
|
|
4
|
-
type: string;
|
|
5
|
-
setup?: string;
|
|
6
|
-
delivery?: string;
|
|
7
|
-
joke?: string;
|
|
8
|
-
flags: {
|
|
9
|
-
nsfw: boolean;
|
|
10
|
-
religious: boolean;
|
|
11
|
-
political: boolean;
|
|
12
|
-
racist: boolean;
|
|
13
|
-
sexist: boolean;
|
|
14
|
-
explicit: boolean;
|
|
15
|
-
};
|
|
16
|
-
id: number;
|
|
17
|
-
safe: boolean;
|
|
18
|
-
lang: string;
|
|
19
|
-
}
|
|
20
|
-
export default Joke;
|
package/dist/types/Joke.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/types/Kanye.d.ts
DELETED
package/dist/types/Kanye.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/types/Kv.d.ts
DELETED
package/dist/types/Kv.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/types/localhost.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default new URL('http://localhost');
|