chz-telegram-bot 0.5.0 → 0.5.1

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.
@@ -5,6 +5,7 @@ import { ChatInfo } from '../chatInfo';
5
5
  import { TraceId } from '../../types/trace';
6
6
  import { ReplyInfo } from '../replyInfo';
7
7
  import { IReplyCapture } from '../../types/capture';
8
+ import { TelegramInlineKeyboardButton } from '../../types/externalAliases';
8
9
  export declare class TextMessage implements IReplyResponseWithContent<string> {
9
10
  readonly kind: "text";
10
11
  readonly createdAt: number;
@@ -16,6 +17,7 @@ export declare class TextMessage implements IReplyResponseWithContent<string> {
16
17
  readonly disableWebPreview: boolean;
17
18
  readonly shouldPin: boolean;
18
19
  readonly action: IAction;
20
+ readonly keyboard?: TelegramInlineKeyboardButton[][];
19
21
  constructor(text: string, chatInfo: ChatInfo, traceId: TraceId, action: IAction, replyInfo?: ReplyInfo, options?: TextMessageSendingOptions);
20
22
  }
21
23
  //# sourceMappingURL=textMessage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"textMessage.d.ts","sourceRoot":"","sources":["../../../dtos/responses/textMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAEH,yBAAyB,EAC5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,qBAAa,WAAY,YAAW,yBAAyB,CAAC,MAAM,CAAC;IACjE,QAAQ,CAAC,IAAI,SAAyB;IACtC,QAAQ,CAAC,SAAS,SAAc;IAChC,QAAQ,CAAC,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;IACzB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC;IACpC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE,4BAA4B,EAAE,EAAE,CAAC;gBAGjD,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,OAAO,EACf,SAAS,CAAC,EAAE,SAAS,EACrB,OAAO,CAAC,EAAE,yBAAyB;CAW1C"}
@@ -13,6 +13,7 @@ class TextMessage {
13
13
  disableWebPreview;
14
14
  shouldPin;
15
15
  action;
16
+ keyboard;
16
17
  constructor(text, chatInfo, traceId, action, replyInfo, options) {
17
18
  this.content = text;
18
19
  this.chatInfo = chatInfo;
@@ -21,6 +22,7 @@ class TextMessage {
21
22
  this.disableWebPreview = options?.disableWebPreview ?? false;
22
23
  this.shouldPin = options?.pin ?? false;
23
24
  this.action = action;
25
+ this.keyboard = options?.keyboard;
24
26
  }
25
27
  }
26
28
  exports.TextMessage = TextMessage;
@@ -18,5 +18,6 @@ export declare class TelegramApiService {
18
18
  flushResponses(): void;
19
19
  private pinIfShould;
20
20
  private processResponse;
21
+ private sendApiRequest;
21
22
  }
22
23
  //# sourceMappingURL=telegramApi.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"telegramApi.d.ts","sourceRoot":"","sources":["../../services/telegramApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAkB,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,iBAA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AAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAmB,MAAM,0BAA0B,CAAC;AAE9E,eAAO,MAAM,4BAA4B,uBAAuB,CAAC;AAEjE,qBAAa,kBAAkB;IAC3B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAiC;IACvD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAoB;IAC7C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiB;IACzC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAU;IACjC,OAAO,CAAC,QAAQ,CAAC,2BAA2B,CAKlC;IAEV,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAG7B,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,iBAAiB,EAC3B,OAAO,EAAE,cAAc,EACvB,MAAM,EAAE,OAAO,EACf,2BAA2B,EAAE,CACzB,OAAO,EAAE,aAAa,EACtB,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,KACf,IAAI;IASb,uBAAuB,CAAC,SAAS,EAAE,WAAW,EAAE;IAwDhD,cAAc;YAIA,WAAW;YAqBX,eAAe;YAiBf,cAAc;CA6F/B"}
@@ -66,10 +66,18 @@ class TelegramApiService {
66
66
  }
67
67
  }
68
68
  async processResponse(response, ignoreQuote = false) {
69
- let sentMessage = null;
69
+ const sentMessage = await this.sendApiRequest(response, ignoreQuote);
70
+ if (sentMessage && 'content' in response) {
71
+ await this.pinIfShould(response, sentMessage);
72
+ for (const capture of response.captures) {
73
+ this.captureRegistrationCallback(capture, sentMessage.message_id, response.chatInfo, response.traceId);
74
+ }
75
+ }
76
+ }
77
+ async sendApiRequest(response, ignoreQuote) {
70
78
  switch (response.kind) {
71
79
  case 'text':
72
- sentMessage = await this.telegram.sendMessage(response.chatInfo.id, response.content, {
80
+ return await this.telegram.sendMessage(response.chatInfo.id, response.content, {
73
81
  reply_parameters: response.replyInfo
74
82
  ? {
75
83
  message_id: response.replyInfo.id,
@@ -81,27 +89,29 @@ class TelegramApiService {
81
89
  parse_mode: 'MarkdownV2',
82
90
  link_preview_options: {
83
91
  is_disabled: response.disableWebPreview
84
- }
92
+ },
93
+ reply_markup: response.keyboard
94
+ ? {
95
+ inline_keyboard: response.keyboard
96
+ }
97
+ : undefined
85
98
  });
86
- break;
87
99
  case 'image':
88
- sentMessage = await this.telegram.sendPhoto(response.chatInfo.id, response.content,
100
+ return await this.telegram.sendPhoto(response.chatInfo.id, response.content,
89
101
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
90
102
  response.replyInfo?.id
91
103
  ? {
92
104
  reply_to_message_id: response.replyInfo.id // eslint-disable-next-line @typescript-eslint/no-explicit-any
93
105
  }
94
106
  : undefined);
95
- break;
96
107
  case 'video':
97
- sentMessage = await this.telegram.sendVideo(response.chatInfo.id, response.content,
108
+ return await this.telegram.sendVideo(response.chatInfo.id, response.content,
98
109
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
99
110
  response.replyInfo?.id
100
111
  ? {
101
112
  reply_to_message_id: response.replyInfo.id // eslint-disable-next-line @typescript-eslint/no-explicit-any
102
113
  }
103
114
  : undefined);
104
- break;
105
115
  case 'react':
106
116
  await this.telegram.setMessageReaction(response.chatInfo.id, response.messageId, [
107
117
  {
@@ -109,24 +119,18 @@ class TelegramApiService {
109
119
  emoji: response.emoji
110
120
  }
111
121
  ]);
112
- return;
122
+ return null;
113
123
  case 'unpin':
114
124
  await this.telegram.unpinChatMessage(response.chatInfo.id, response.messageId);
115
125
  await this.storage.updateStateFor(response.action, response.chatInfo.id, (state) => {
116
126
  state.pinnedMessages = state.pinnedMessages.filter((x) => x != response.messageId);
117
127
  });
118
- break;
128
+ return null;
119
129
  case 'inlineQuery':
120
130
  await this.telegram.answerInlineQuery(response.queryId, response.queryResults, { cache_time: 0 });
121
- break;
131
+ return null;
122
132
  case 'delay':
123
- break;
124
- }
125
- if ('content' in response && sentMessage) {
126
- await this.pinIfShould(response, sentMessage);
127
- for (const capture of response.captures) {
128
- this.captureRegistrationCallback(capture, sentMessage.message_id, response.chatInfo, response.traceId);
129
- }
133
+ return null;
130
134
  }
131
135
  }
132
136
  }
@@ -1,6 +1,5 @@
1
- import { User, Message, InlineQueryResult, TelegramEmoji as Emoji, UserFromGetMe } from 'telegraf/typings/core/types/typegram';
2
- import { Telegraf } from 'telegraf';
3
- import Telegram from 'telegraf/typings/telegram';
1
+ import { Telegram, Telegraf } from 'telegraf';
2
+ import { User, Message, InlineQueryResult, UserFromGetMe, TelegramEmoji as Emoji, InlineKeyboardButton } from 'telegraf/types';
4
3
  export type TelegramUser = User;
5
4
  export type TelegramMessage = Message;
6
5
  export type TelegramInlineQueryResult = InlineQueryResult;
@@ -8,4 +7,5 @@ export type TelegramEmoji = Emoji;
8
7
  export type TelegramApiClient = Telegram;
9
8
  export type BotInfo = UserFromGetMe;
10
9
  export type TelegramBot = Telegraf;
10
+ export type TelegramInlineKeyboardButton = InlineKeyboardButton;
11
11
  //# sourceMappingURL=externalAliases.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"externalAliases.d.ts","sourceRoot":"","sources":["../../types/externalAliases.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,IAAI,EACJ,OAAO,EACP,iBAAiB,EACjB,aAAa,IAAI,KAAK,EACtB,aAAa,EAChB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,QAAQ,MAAM,2BAA2B,CAAC;AAEjD,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC;AAChC,MAAM,MAAM,eAAe,GAAG,OAAO,CAAC;AACtC,MAAM,MAAM,yBAAyB,GAAG,iBAAiB,CAAC;AAC1D,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC;AAClC,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC;AACzC,MAAM,MAAM,OAAO,GAAG,aAAa,CAAC;AACpC,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC"}
1
+ {"version":3,"file":"externalAliases.d.ts","sourceRoot":"","sources":["../../types/externalAliases.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EACH,IAAI,EACJ,OAAO,EACP,iBAAiB,EACjB,aAAa,EACb,aAAa,IAAI,KAAK,EACtB,oBAAoB,EACvB,MAAM,gBAAgB,CAAC;AAExB,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC;AAChC,MAAM,MAAM,eAAe,GAAG,OAAO,CAAC;AACtC,MAAM,MAAM,yBAAyB,GAAG,iBAAiB,CAAC;AAC1D,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC;AAClC,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC;AACzC,MAAM,MAAM,OAAO,GAAG,aAAa,CAAC;AACpC,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC;AACnC,MAAM,MAAM,4BAA4B,GAAG,oBAAoB,CAAC"}
@@ -1,7 +1,9 @@
1
+ import { TelegramInlineKeyboardButton } from './externalAliases';
1
2
  export interface MessageSendingOptions {
2
3
  pin?: boolean;
3
4
  }
4
5
  export interface TextMessageSendingOptions extends MessageSendingOptions {
5
6
  disableWebPreview?: boolean;
7
+ keyboard?: TelegramInlineKeyboardButton[][];
6
8
  }
7
9
  //# sourceMappingURL=messageSendingOptions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"messageSendingOptions.d.ts","sourceRoot":"","sources":["../../types/messageSendingOptions.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,qBAAqB;IAClC,GAAG,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,yBAA0B,SAAQ,qBAAqB;IACpE,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC/B"}
1
+ {"version":3,"file":"messageSendingOptions.d.ts","sourceRoot":"","sources":["../../types/messageSendingOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAC;AAEjE,MAAM,WAAW,qBAAqB;IAClC,GAAG,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,yBAA0B,SAAQ,qBAAqB;IACpE,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,EAAE,4BAA4B,EAAE,EAAE,CAAC;CAC/C"}
@@ -8,6 +8,7 @@ import { ChatInfo } from '../chatInfo';
8
8
  import { TraceId } from '../../types/trace';
9
9
  import { ReplyInfo } from '../replyInfo';
10
10
  import { IReplyCapture } from '../../types/capture';
11
+ import { TelegramInlineKeyboardButton } from '../../types/externalAliases';
11
12
 
12
13
  export class TextMessage implements IReplyResponseWithContent<string> {
13
14
  readonly kind = BotResponseTypes.text;
@@ -21,6 +22,7 @@ export class TextMessage implements IReplyResponseWithContent<string> {
21
22
  readonly disableWebPreview: boolean;
22
23
  readonly shouldPin: boolean;
23
24
  readonly action: IAction;
25
+ readonly keyboard?: TelegramInlineKeyboardButton[][];
24
26
 
25
27
  constructor(
26
28
  text: string,
@@ -37,5 +39,6 @@ export class TextMessage implements IReplyResponseWithContent<string> {
37
39
  this.disableWebPreview = options?.disableWebPreview ?? false;
38
40
  this.shouldPin = options?.pin ?? false;
39
41
  this.action = action;
42
+ this.keyboard = options?.keyboard;
40
43
  }
41
44
  }
package/eslint.config.js CHANGED
@@ -16,6 +16,7 @@ export default tseslint.config(
16
16
  }
17
17
  },
18
18
  rules: {
19
+ '@typescript-eslint/switch-exhaustiveness-check': 'error',
19
20
  '@typescript-eslint/no-unused-vars': [
20
21
  'error',
21
22
  {
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "type": "git",
15
15
  "url": "https://github.com/AlexSolari/botFramework.git"
16
16
  },
17
- "version": "0.5.0",
17
+ "version": "0.5.1",
18
18
  "type": "module",
19
19
  "dependencies": {
20
20
  "async-sema": "^3.1.1",
@@ -126,11 +126,29 @@ export class TelegramApiService {
126
126
  }
127
127
 
128
128
  private async processResponse(response: BotResponse, ignoreQuote = false) {
129
- let sentMessage: TelegramMessage | null = null;
129
+ const sentMessage = await this.sendApiRequest(response, ignoreQuote);
130
130
 
131
+ if (sentMessage && 'content' in response) {
132
+ await this.pinIfShould(response, sentMessage);
133
+
134
+ for (const capture of response.captures) {
135
+ this.captureRegistrationCallback(
136
+ capture,
137
+ sentMessage.message_id,
138
+ response.chatInfo,
139
+ response.traceId
140
+ );
141
+ }
142
+ }
143
+ }
144
+
145
+ private async sendApiRequest(
146
+ response: BotResponse,
147
+ ignoreQuote: boolean
148
+ ): Promise<TelegramMessage | null> {
131
149
  switch (response.kind) {
132
150
  case 'text':
133
- sentMessage = await this.telegram.sendMessage(
151
+ return await this.telegram.sendMessage(
134
152
  response.chatInfo.id,
135
153
  response.content,
136
154
  {
@@ -145,12 +163,16 @@ export class TelegramApiService {
145
163
  parse_mode: 'MarkdownV2',
146
164
  link_preview_options: {
147
165
  is_disabled: response.disableWebPreview
148
- }
166
+ },
167
+ reply_markup: response.keyboard
168
+ ? {
169
+ inline_keyboard: response.keyboard
170
+ }
171
+ : undefined
149
172
  }
150
173
  );
151
- break;
152
174
  case 'image':
153
- sentMessage = await this.telegram.sendPhoto(
175
+ return await this.telegram.sendPhoto(
154
176
  response.chatInfo.id,
155
177
  response.content,
156
178
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
@@ -160,9 +182,8 @@ export class TelegramApiService {
160
182
  } as any)
161
183
  : undefined
162
184
  );
163
- break;
164
185
  case 'video':
165
- sentMessage = await this.telegram.sendVideo(
186
+ return await this.telegram.sendVideo(
166
187
  response.chatInfo.id,
167
188
  response.content,
168
189
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
@@ -172,7 +193,6 @@ export class TelegramApiService {
172
193
  } as any)
173
194
  : undefined
174
195
  );
175
- break;
176
196
  case 'react':
177
197
  await this.telegram.setMessageReaction(
178
198
  response.chatInfo.id,
@@ -185,7 +205,7 @@ export class TelegramApiService {
185
205
  ]
186
206
  );
187
207
 
188
- return;
208
+ return null;
189
209
  case 'unpin':
190
210
  await this.telegram.unpinChatMessage(
191
211
  response.chatInfo.id,
@@ -201,29 +221,18 @@ export class TelegramApiService {
201
221
  );
202
222
  }
203
223
  );
204
- break;
224
+
225
+ return null;
205
226
  case 'inlineQuery':
206
227
  await this.telegram.answerInlineQuery(
207
228
  response.queryId,
208
229
  response.queryResults,
209
230
  { cache_time: 0 }
210
231
  );
211
- break;
212
- case 'delay':
213
- break;
214
- }
215
232
 
216
- if ('content' in response && sentMessage) {
217
- await this.pinIfShould(response, sentMessage);
218
-
219
- for (const capture of response.captures) {
220
- this.captureRegistrationCallback(
221
- capture,
222
- sentMessage.message_id,
223
- response.chatInfo,
224
- response.traceId
225
- );
226
- }
233
+ return null;
234
+ case 'delay':
235
+ return null;
227
236
  }
228
237
  }
229
238
  }
@@ -1,12 +1,12 @@
1
+ import { Telegram, Telegraf } from 'telegraf';
1
2
  import {
2
3
  User,
3
4
  Message,
4
5
  InlineQueryResult,
6
+ UserFromGetMe,
5
7
  TelegramEmoji as Emoji,
6
- UserFromGetMe
7
- } from 'telegraf/typings/core/types/typegram';
8
- import { Telegraf } from 'telegraf';
9
- import Telegram from 'telegraf/typings/telegram';
8
+ InlineKeyboardButton
9
+ } from 'telegraf/types';
10
10
 
11
11
  export type TelegramUser = User;
12
12
  export type TelegramMessage = Message;
@@ -15,3 +15,4 @@ export type TelegramEmoji = Emoji;
15
15
  export type TelegramApiClient = Telegram;
16
16
  export type BotInfo = UserFromGetMe;
17
17
  export type TelegramBot = Telegraf;
18
+ export type TelegramInlineKeyboardButton = InlineKeyboardButton;
@@ -1,7 +1,10 @@
1
+ import { TelegramInlineKeyboardButton } from './externalAliases';
2
+
1
3
  export interface MessageSendingOptions {
2
4
  pin?: boolean;
3
5
  }
4
6
 
5
7
  export interface TextMessageSendingOptions extends MessageSendingOptions {
6
8
  disableWebPreview?: boolean;
9
+ keyboard?: TelegramInlineKeyboardButton[][];
7
10
  }