List Chats ( telegram)
One script reply has been approved by the moderators Verified

Created by maximelambercier 296 days ago Viewed 65 times 0 Points

No comments yet

Login to be able to comment
Points: 0
deno
One script reply has been approved by the moderators
Ap­pro­ved
import * as wmill from "https://deno.land/x/windmill@v1.70.1/mod.ts"
import { Telegram } from "npm:telegraf@4.11"
import { UpdateType } from "npm:telegraf@4.11/typings/telegram-types";

/** 
 * @param limit Number of elements in the returned list. 
 * Defaults to 100 and must be between 1-100.
 * 
 * @param offset Identifier of the first update to be returned.
 * 
 * @param allowed_updates The update types that should be received.
 * Read more about types at 
 * https://core.telegram.org/bots/api#update
 */
export async function main(
  auth: wmill.Resource<"telegram">,
  limit = 100,
  offset = 0,
  allowed_updates?: UpdateType[]
) {
  const client = new Telegram(auth.token)
  return await client.getUpdates(
    0,
    limit,
    offset,
    allowed_updates || undefined
  )
}

Submitted by adam186 111 days ago

Edited 29 days ago

No comments yet

Login to be able to comment