0

List Chats

by
Published Jun 6, 2022
Script telegram Verified

The script

Submitted by hugo989 Bun
Verified 6 days ago
1
import { Telegram as Telegraf } from "[email protected]";
2
import { UpdateType } from "[email protected]/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 Telegraf(auth.token);
24
  return await client.getUpdates(
25
    0,
26
    limit,
27
    offset,
28
    allowed_updates || undefined,
29
  );
30
}
31

Other submissions
  • Submitted by adam186 Deno
    Created 398 days ago
    1
    import { Telegram } from "npm:[email protected]";
    2
    import { UpdateType } from "npm:[email protected]/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