1 | import { Telegram } from "npm:telegraf@4.11"; |
2 | import { UpdateType } from "npm:telegraf@4.11/typings/telegram-types"; |
3 |
|
4 |
|
5 | * @param limit Number of elements in the returned list. |
6 | * Defaults to 100 and must be between 1-100. |
7 | * |
8 | * @param offset Identifier of the first update to be returned. |
9 | * |
10 | * @param allowed_updates The update types that should be received. |
11 | * Read more about types at |
12 | * https://core.telegram.org/bots/api#update |
13 | */ |
14 | type Telegram = { |
15 | token: string; |
16 | }; |
17 | export async function main( |
18 | auth: Telegram, |
19 | limit = 100, |
20 | offset = 0, |
21 | allowed_updates?: UpdateType[], |
22 | ) { |
23 | const client = new Telegram(auth.token); |
24 | return await client.getUpdates( |
25 | 0, |
26 | limit, |
27 | offset, |
28 | allowed_updates || undefined, |
29 | ); |
30 | } |
31 |
|