Edits history of script submission #22570 for ' List Chats (telegram)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    import { Telegram as Telegraf } from "[email protected]";
    import { UpdateType } from "[email protected]/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
     */
    type Telegram = {
      token: string;
    };
    export async function main(
      auth: Telegram,
      limit = 100,
      offset = 0,
      allowed_updates?: UpdateType[],
    ) {
      const client = new Telegraf(auth.token);
      return await client.getUpdates(
        0,
        limit,
        offset,
        allowed_updates || undefined,
      );
    }
    

    Submitted by hugo989 6 days ago