@tgify/tgify 0.1.5 → 1.0.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.
Files changed (48) hide show
  1. package/README.md +23 -17
  2. package/lib/button.js +20 -19
  3. package/lib/core/types/typegram.js +10 -10
  4. package/lib/index.js +3 -1
  5. package/lib/reactions.js +3 -1
  6. package/lib/telegraf.js +2 -253
  7. package/lib/telegram.js +7 -5
  8. package/lib/tgify.js +254 -0
  9. package/package.json +2 -2
  10. package/src/button.ts +48 -36
  11. package/src/composer.ts +13 -13
  12. package/src/context.ts +22 -22
  13. package/src/core/helpers/formatting.ts +2 -3
  14. package/src/core/types/typegram.ts +11 -11
  15. package/src/filters.ts +60 -60
  16. package/src/format.ts +4 -4
  17. package/src/future.ts +1 -1
  18. package/src/index.ts +1 -0
  19. package/src/markup.ts +5 -5
  20. package/src/reactions.ts +3 -1
  21. package/src/session.ts +2 -2
  22. package/src/telegraf.ts +1 -354
  23. package/src/telegram-types.ts +5 -5
  24. package/src/telegram.ts +12 -10
  25. package/src/tgify.ts +351 -0
  26. package/typings/button.d.ts +17 -17
  27. package/typings/button.d.ts.map +1 -1
  28. package/typings/context.d.ts +49 -49
  29. package/typings/context.d.ts.map +1 -1
  30. package/typings/core/helpers/formatting.d.ts +1 -1
  31. package/typings/core/helpers/formatting.d.ts.map +1 -1
  32. package/typings/core/types/typegram.d.ts +11 -11
  33. package/typings/core/types/typegram.d.ts.map +1 -1
  34. package/typings/filters.d.ts +1 -1
  35. package/typings/filters.d.ts.map +1 -1
  36. package/typings/format.d.ts +1 -1
  37. package/typings/format.d.ts.map +1 -1
  38. package/typings/index.d.ts +1 -0
  39. package/typings/index.d.ts.map +1 -1
  40. package/typings/markup.d.ts.map +1 -1
  41. package/typings/reactions.d.ts.map +1 -1
  42. package/typings/telegraf.d.ts +1 -114
  43. package/typings/telegraf.d.ts.map +1 -1
  44. package/typings/telegram-types.d.ts.map +1 -1
  45. package/typings/telegram.d.ts +31 -30
  46. package/typings/telegram.d.ts.map +1 -1
  47. package/typings/tgify.d.ts +118 -0
  48. package/typings/tgify.d.ts.map +1 -0
package/src/tgify.ts ADDED
@@ -0,0 +1,351 @@
1
+ import * as crypto from 'crypto'
2
+ import * as http from 'http'
3
+ import * as https from 'https'
4
+ import * as tg from './core/types/typegram'
5
+ import * as tt from './telegram-types'
6
+ import { Composer } from './composer'
7
+ import { MaybePromise } from './core/helpers/util'
8
+ import ApiClient from './core/network/client'
9
+ import { compactOptions } from './core/helpers/compact'
10
+ import Context from './context'
11
+ import d from 'debug'
12
+ import generateCallback from './core/network/webhook'
13
+ import { Polling } from './core/network/polling'
14
+ import pTimeout from 'p-timeout'
15
+ import Telegram from './telegram'
16
+ import { TlsOptions } from 'tls'
17
+ import { URL } from 'url'
18
+ import safeCompare = require('safe-compare')
19
+ const debug = d('tgify:main')
20
+
21
+ const DEFAULT_OPTIONS: Tgify.Options<Context> = {
22
+ telegram: {},
23
+ handlerTimeout: 90_000, // 90s in ms
24
+ contextType: Context,
25
+ }
26
+
27
+ function always<T>(x: T) {
28
+ return () => x
29
+ }
30
+
31
+ const anoop = always(Promise.resolve())
32
+
33
+ export namespace Tgify {
34
+ export interface Options<TContext extends Context> {
35
+ contextType: new (
36
+ ...args: ConstructorParameters<typeof Context>
37
+ ) => TContext
38
+ handlerTimeout: number
39
+ telegram?: Partial<ApiClient.Options>
40
+ }
41
+
42
+ export interface LaunchOptions {
43
+ dropPendingUpdates?: boolean
44
+ /** List the types of updates you want your bot to receive */
45
+ allowedUpdates?: tt.UpdateType[]
46
+ /** Configuration options for when the bot is run via webhooks */
47
+ webhook?: {
48
+ /** Domain for webhook. */
49
+ domain: string
50
+
51
+ /** Local bot api is used */
52
+ local?: boolean
53
+
54
+ /**
55
+ * Webhook url path; will be automatically generated if not specified
56
+ * @deprecated Pass `path` instead
57
+ * */
58
+ hookPath?: string
59
+
60
+ /** Webhook url path; will be automatically generated if not specified */
61
+ path?: string
62
+
63
+ host?: string
64
+ port?: number
65
+
66
+ /** The fixed IP address which will be used to send webhook requests instead of the IP address resolved through DNS */
67
+ ipAddress?: string
68
+
69
+ /**
70
+ * Maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery, 1-100. Defaults to 40.
71
+ * Use lower values to limit the load on your bot's server, and higher values to increase your bot's throughput.
72
+ */
73
+ maxConnections?: number
74
+
75
+ /** TLS server options. Omit to use http. */
76
+ tlsOptions?: TlsOptions
77
+
78
+ /**
79
+ * A secret token to be sent in a header `“X-Telegram-Bot-Api-Secret-Token”` in every webhook request.
80
+ * 1-256 characters. Only characters `A-Z`, `a-z`, `0-9`, `_` and `-` are allowed.
81
+ * The header is useful to ensure that the request comes from a webhook set by you.
82
+ */
83
+ secretToken?: string
84
+
85
+ /**
86
+ * Upload your public key certificate so that the root certificate in use can be checked.
87
+ * See [self-signed guide](https://core.telegram.org/bots/self-signed) for details.
88
+ */
89
+ certificate?: tg.InputFile
90
+
91
+ cb?: http.RequestListener
92
+ }
93
+ }
94
+ }
95
+
96
+ const TOKEN_HEADER = 'x-telegram-bot-api-secret-token'
97
+
98
+ export class Tgify<C extends Context = Context> extends Composer<C> {
99
+ private readonly options: Tgify.Options<C>
100
+ private webhookServer?: http.Server | https.Server
101
+ private polling?: Polling
102
+ /** Set manually to avoid implicit `getMe` call in `launch` or `webhookCallback` */
103
+ public botInfo?: tg.UserFromGetMe
104
+ public telegram: Telegram
105
+ readonly context: Partial<C> = {}
106
+
107
+ /** Assign to this to customise the webhook filter middleware.
108
+ * `{ path, secretToken }` will be bound to this rather than the Tgify instance.
109
+ * Remember to assign a regular function and not an arrow function so it's bindable.
110
+ */
111
+ public webhookFilter = function (
112
+ // NOTE: this function is assigned to a variable instead of being a method to signify that it's assignable
113
+ // NOTE: the `this` binding is so custom impls don't need to double wrap
114
+ this: {
115
+ /** @deprecated Use path instead */
116
+ hookPath: string
117
+ path: string
118
+ secretToken?: string
119
+ },
120
+ req: http.IncomingMessage
121
+ ) {
122
+ const debug = d('telegraf:webhook')
123
+
124
+ if (req.method === 'POST') {
125
+ if (safeCompare(this.path, req.url as string)) {
126
+ // no need to check if secret_token was not set
127
+ if (!this.secretToken) return true
128
+ else {
129
+ const token = req.headers[TOKEN_HEADER] as string
130
+ if (safeCompare(this.secretToken, token)) return true
131
+ else debug('Secret token does not match:', token, this.secretToken)
132
+ }
133
+ } else debug('Path does not match:', req.url, this.path)
134
+ } else debug('Unexpected request method, not POST. Received:', req.method)
135
+
136
+ return false
137
+ }
138
+
139
+ private handleError = (err: unknown, ctx: C): MaybePromise<void> => {
140
+ // set exit code to emulate `warn-with-error-code` behavior of
141
+ // https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode
142
+ // to prevent a clean exit despite an error being thrown
143
+ process.exitCode = 1
144
+ console.error('Unhandled error while processing', ctx.update)
145
+ throw err
146
+ }
147
+
148
+ constructor(token: string, options?: Partial<Tgify.Options<C>>) {
149
+ super()
150
+ // @ts-expect-error Trust me, TS
151
+ this.options = {
152
+ ...DEFAULT_OPTIONS,
153
+ ...compactOptions(options),
154
+ }
155
+ this.telegram = new Telegram(token, this.options.telegram)
156
+ debug('Created a `Tgify` instance')
157
+ }
158
+
159
+ private get token() {
160
+ return this.telegram.token
161
+ }
162
+
163
+ /** @deprecated use `ctx.telegram.webhookReply` */
164
+ set webhookReply(webhookReply: boolean) {
165
+ this.telegram.webhookReply = webhookReply
166
+ }
167
+
168
+ /** @deprecated use `ctx.telegram.webhookReply` */
169
+ get webhookReply() {
170
+ return this.telegram.webhookReply
171
+ }
172
+
173
+ /**
174
+ * _Override_ error handling
175
+ */
176
+ catch(handler: (err: unknown, ctx: C) => MaybePromise<void>) {
177
+ this.handleError = handler
178
+ return this
179
+ }
180
+
181
+ /**
182
+ * You must call `bot.telegram.setWebhook` for this to work.
183
+ * You should probably use {@link Tgify.createWebhook} instead.
184
+ */
185
+ webhookCallback(path = '/', opts: { secretToken?: string } = {}) {
186
+ const { secretToken } = opts
187
+ return generateCallback(
188
+ this.webhookFilter.bind({ hookPath: path, path, secretToken }),
189
+ (update: tg.Update, res: http.ServerResponse) =>
190
+ this.handleUpdate(update, res)
191
+ )
192
+ }
193
+
194
+ private getDomainOpts(opts: { domain: string; local?: boolean; path?: string }) {
195
+ const protocol = opts.local ? 'http:' : 'https:';
196
+
197
+ const path = opts.path || `/telegraf/${this.secretPathComponent()}`;
198
+ const domain = new URL(`${protocol}//${opts.domain}`).host;
199
+ const url = `${protocol}//${domain}${path}`;
200
+
201
+ return { domain, path, url };
202
+ }
203
+
204
+ /**
205
+ * Specify a url to receive incoming updates via webhook.
206
+ * Returns an Express-style middleware you can pass to app.use()
207
+ */
208
+ async createWebhook(
209
+ opts: { domain: string; local?: boolean; path?: string } & tt.ExtraSetWebhook
210
+ ) {
211
+ const { domain, path, local, ...extra } = opts
212
+
213
+ const domainOpts = this.getDomainOpts({ local, domain, path })
214
+
215
+ await this.telegram.setWebhook(domainOpts.url, extra)
216
+ debug(`Webhook set to ${domainOpts.url}`)
217
+
218
+ return this.webhookCallback(domainOpts.path, {
219
+ secretToken: extra.secret_token,
220
+ })
221
+ }
222
+
223
+ private startPolling(allowedUpdates: tt.UpdateType[] = []) {
224
+ this.polling = new Polling(this.telegram, allowedUpdates)
225
+ return this.polling.loop(async (update) => {
226
+ await this.handleUpdate(update)
227
+ })
228
+ }
229
+
230
+ private startWebhook(
231
+ path: string,
232
+ tlsOptions?: TlsOptions,
233
+ port?: number,
234
+ host?: string,
235
+ cb?: http.RequestListener,
236
+ secretToken?: string
237
+ ) {
238
+ const webhookCb = this.webhookCallback(path, { secretToken })
239
+ const callback: http.RequestListener =
240
+ typeof cb === 'function'
241
+ ? (req, res) => webhookCb(req, res, () => cb(req, res))
242
+ : webhookCb
243
+ this.webhookServer =
244
+ tlsOptions != null
245
+ ? https.createServer(tlsOptions, callback)
246
+ : http.createServer(callback)
247
+ this.webhookServer.listen(port, host, () => {
248
+ debug('Webhook listening on port: %s', port)
249
+ })
250
+ return this
251
+ }
252
+
253
+ secretPathComponent() {
254
+ return crypto
255
+ .createHash('sha3-256')
256
+ .update(this.token)
257
+ .update(process.version) // salt
258
+ .digest('hex')
259
+ }
260
+
261
+ async launch(onLaunch?: () => void): Promise<void>
262
+ async launch(
263
+ config: Tgify.LaunchOptions,
264
+ onLaunch?: () => void
265
+ ): Promise<void>
266
+ /**
267
+ * @see https://github.com/telegraf/telegraf/discussions/1344#discussioncomment-335700
268
+ */
269
+ async launch(
270
+ config: Tgify.LaunchOptions | (() => void) = {},
271
+ /** @experimental */
272
+ onLaunch?: () => void
273
+ ) {
274
+ const [cfg, onMe] =
275
+ typeof config === 'function' ? [{}, config] : [config, onLaunch]
276
+ const drop_pending_updates = cfg.dropPendingUpdates
277
+ const allowed_updates = cfg.allowedUpdates
278
+ const webhook = cfg.webhook
279
+
280
+ debug('Connecting to Telegram')
281
+ this.botInfo ??= await this.telegram.getMe()
282
+ onMe?.()
283
+ debug(`Launching @${this.botInfo.username}`)
284
+
285
+ if (webhook === undefined) {
286
+ await this.telegram.deleteWebhook({ drop_pending_updates })
287
+ debug('Bot started with long polling')
288
+ await this.startPolling(allowed_updates)
289
+ return
290
+ }
291
+
292
+ const domainOpts = this.getDomainOpts({
293
+ local: webhook.local,
294
+ domain: webhook.domain,
295
+ path: webhook.path ?? webhook.hookPath,
296
+ })
297
+
298
+ const { tlsOptions, port, host, cb, secretToken } = webhook
299
+
300
+ this.startWebhook(domainOpts.path, tlsOptions, port, host, cb, secretToken)
301
+
302
+ await this.telegram.setWebhook(domainOpts.url, {
303
+ drop_pending_updates: drop_pending_updates,
304
+ allowed_updates: allowed_updates,
305
+ ip_address: webhook.ipAddress,
306
+ max_connections: webhook.maxConnections,
307
+ secret_token: webhook.secretToken,
308
+ certificate: webhook.certificate,
309
+ })
310
+
311
+ debug(`Bot started with webhook @ ${domainOpts.url}`)
312
+ }
313
+
314
+ stop(reason = 'unspecified') {
315
+ debug('Stopping bot... Reason:', reason)
316
+ // https://github.com/telegraf/telegraf/pull/1224#issuecomment-742693770
317
+ if (this.polling === undefined && this.webhookServer === undefined) {
318
+ throw new Error('Bot is not running!')
319
+ }
320
+ this.webhookServer?.close()
321
+ this.polling?.stop()
322
+ }
323
+
324
+ private botInfoCall?: Promise<tg.UserFromGetMe>
325
+ async handleUpdate(update: tg.Update, webhookResponse?: http.ServerResponse) {
326
+ this.botInfo ??=
327
+ (debug(
328
+ 'Update %d is waiting for `botInfo` to be initialized',
329
+ update.update_id
330
+ ),
331
+ await (this.botInfoCall ??= this.telegram.getMe()))
332
+ debug('Processing update', update.update_id)
333
+ const tg = new Telegram(this.token, this.telegram.options, webhookResponse)
334
+ const TelegrafContext = this.options.contextType
335
+ const ctx = new TelegrafContext(update, tg, this.botInfo)
336
+ Object.assign(ctx, this.context)
337
+ try {
338
+ await pTimeout(
339
+ Promise.resolve(this.middleware()(ctx, anoop)),
340
+ this.options.handlerTimeout
341
+ )
342
+ } catch (err) {
343
+ return await this.handleError(err, ctx)
344
+ } finally {
345
+ if (webhookResponse?.writableEnded === false) {
346
+ webhookResponse.end()
347
+ }
348
+ debug('Finished processing update', update.update_id)
349
+ }
350
+ }
351
+ }
@@ -1,36 +1,36 @@
1
- import { InlineKeyboardButton, KeyboardButton, KeyboardButtonRequestChat, KeyboardButtonRequestUsers } from './core/types/typegram';
1
+ import { KeyboardButton, InlineKeyboardButton, KeyboardButtonRequestChat, KeyboardButtonRequestUsers } from './core/types/typegram';
2
2
  type Hideable<B> = B & {
3
3
  hide: boolean;
4
4
  };
5
- export declare function text(text: string, hide?: boolean): Hideable<KeyboardButton.CommonButton>;
6
- export declare function contactRequest(text: string, hide?: boolean): Hideable<KeyboardButton.RequestContactButton>;
7
- export declare function locationRequest(text: string, hide?: boolean): Hideable<KeyboardButton.RequestLocationButton>;
8
- export declare function pollRequest(text: string, type?: 'quiz' | 'regular', hide?: boolean): Hideable<KeyboardButton.RequestPollButton>;
5
+ export declare function text(text: string, hide?: boolean, extra?: Pick<KeyboardButton.Text, 'style' | 'icon_custom_emoji_id'>): Hideable<KeyboardButton.Text>;
6
+ export declare function contactRequest(text: string, hide?: boolean): Hideable<KeyboardButton.RequestContact>;
7
+ export declare function locationRequest(text: string, hide?: boolean): Hideable<KeyboardButton.RequestLocation>;
8
+ export declare function pollRequest(text: string, type?: 'quiz' | 'regular', hide?: boolean): Hideable<KeyboardButton.RequestPoll>;
9
9
  export declare function userRequest(text: string,
10
10
  /** Must fit in a signed 32 bit int */
11
- request_id: number, extra?: Omit<KeyboardButtonRequestUsers, 'request_id' | 'text'>, hide?: boolean): Hideable<KeyboardButton.RequestUsersButton>;
11
+ request_id: number, extra?: Omit<KeyboardButtonRequestUsers, 'request_id' | 'text'>, hide?: boolean): Hideable<KeyboardButton.RequestUsers>;
12
12
  export declare function botRequest(text: string,
13
13
  /** Must fit in a signed 32 bit int */
14
- request_id: number, extra?: Omit<KeyboardButtonRequestUsers, 'request_id' | 'user_is_bot' | 'text'>, hide?: boolean): Hideable<KeyboardButton.RequestUsersButton>;
14
+ request_id: number, extra?: Omit<KeyboardButtonRequestUsers, 'request_id' | 'user_is_bot' | 'text'>, hide?: boolean): Hideable<KeyboardButton.RequestUsers>;
15
15
  type KeyboardButtonRequestGroup = Omit<KeyboardButtonRequestChat, 'request_id' | 'chat_is_channel'>;
16
16
  export declare function groupRequest(text: string,
17
17
  /** Must fit in a signed 32 bit int */
18
- request_id: number, extra?: KeyboardButtonRequestGroup, hide?: boolean): Hideable<KeyboardButton.RequestChatButton>;
18
+ request_id: number, extra?: KeyboardButtonRequestGroup, hide?: boolean): Hideable<KeyboardButton.RequestChat>;
19
19
  type KeyboardButtonRequestChannel = Omit<KeyboardButtonRequestChat, 'request_id' | 'chat_is_channel' | 'chat_is_forum'>;
20
20
  export declare function channelRequest(text: string,
21
21
  /** Must fit in a signed 32 bit int */
22
- request_id: number, extra?: KeyboardButtonRequestChannel, hide?: boolean): Hideable<KeyboardButton.RequestChatButton>;
23
- export declare function url(text: string, url: string, hide?: boolean): Hideable<InlineKeyboardButton.UrlButton>;
24
- export declare function callback(text: string, data: string, hide?: boolean): Hideable<InlineKeyboardButton.CallbackButton>;
25
- export declare function switchToChat(text: string, value: string, hide?: boolean): Hideable<InlineKeyboardButton.SwitchInlineButton>;
26
- export declare function switchToCurrentChat(text: string, value: string, hide?: boolean): Hideable<InlineKeyboardButton.SwitchInlineCurrentChatButton>;
27
- export declare function game(text: string, hide?: boolean): Hideable<InlineKeyboardButton.GameButton>;
28
- export declare function pay(text: string, hide?: boolean): Hideable<InlineKeyboardButton.PayButton>;
22
+ request_id: number, extra?: KeyboardButtonRequestChannel, hide?: boolean): Hideable<KeyboardButton.RequestChat>;
23
+ export declare function url(text: string, url: string, hide?: boolean, extra?: Pick<InlineKeyboardButton.Url, 'style' | 'icon_custom_emoji_id'>): Hideable<InlineKeyboardButton.Url>;
24
+ export declare function callback(text: string, data: string, hide?: boolean, extra?: Pick<InlineKeyboardButton.Callback, 'style' | 'icon_custom_emoji_id'>): Hideable<InlineKeyboardButton.Callback>;
25
+ export declare function switchToChat(text: string, value: string, hide?: boolean, extra?: Pick<InlineKeyboardButton.SwitchInline, 'style' | 'icon_custom_emoji_id'>): Hideable<InlineKeyboardButton.SwitchInline>;
26
+ export declare function switchToCurrentChat(text: string, value: string, hide?: boolean, extra?: Pick<InlineKeyboardButton.SwitchInlineCurrentChat, 'style' | 'icon_custom_emoji_id'>): Hideable<InlineKeyboardButton.SwitchInlineCurrentChat>;
27
+ export declare function game(text: string, hide?: boolean, extra?: Pick<InlineKeyboardButton.Game, 'style' | 'icon_custom_emoji_id'>): Hideable<InlineKeyboardButton.Game>;
28
+ export declare function pay(text: string, hide?: boolean, extra?: Pick<InlineKeyboardButton.Pay, 'style' | 'icon_custom_emoji_id'>): Hideable<InlineKeyboardButton.Pay>;
29
29
  export declare function login(text: string, url: string, opts?: {
30
30
  forward_text?: string;
31
31
  bot_username?: string;
32
32
  request_write_access?: boolean;
33
- }, hide?: boolean): Hideable<InlineKeyboardButton.LoginButton>;
34
- export declare function webApp(text: string, url: string, hide?: boolean): Hideable<InlineKeyboardButton.WebAppButton>;
33
+ }, hide?: boolean, extra?: Pick<InlineKeyboardButton.Login, 'style' | 'icon_custom_emoji_id'>): Hideable<InlineKeyboardButton.Login>;
34
+ export declare function webApp(text: string, url: string, hide?: boolean, extra?: Pick<InlineKeyboardButton.WebApp, 'style' | 'icon_custom_emoji_id'>): Hideable<InlineKeyboardButton.WebApp>;
35
35
  export {};
36
36
  //# sourceMappingURL=button.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../src/button.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,yBAAyB,EACzB,0BAA0B,EAC3B,MAAM,uBAAuB,CAAA;AAE9B,KAAK,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAA;AAExC,wBAAgB,IAAI,CAClB,IAAI,EAAE,MAAM,EACZ,IAAI,UAAQ,GACX,QAAQ,CAAC,cAAc,CAAC,YAAY,CAAC,CAEvC;AAED,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,IAAI,UAAQ,GACX,QAAQ,CAAC,cAAc,CAAC,oBAAoB,CAAC,CAE/C;AAED,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,IAAI,UAAQ,GACX,QAAQ,CAAC,cAAc,CAAC,qBAAqB,CAAC,CAEhD;AAED,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,EACzB,IAAI,UAAQ,GACX,QAAQ,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAE5C;AAED,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM;AACZ,sCAAsC;AACtC,UAAU,EAAE,MAAM,EAClB,KAAK,CAAC,EAAE,IAAI,CAAC,0BAA0B,EAAE,YAAY,GAAG,MAAM,CAAC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