0
Kick a Chat Member
One script reply has been approved by the moderators Verified
Created by saskiacimex 684 days ago Viewed 4318 times
0
Submitted by adam186 Deno
Verified 499 days ago
1
import { Telegram } from "npm:telegraf@4.11";
2

3
/**
4
 * @param until_date Unix time. If user is banned for more than
5
 * 366 days or less than 30 seconds from the current time they
6
 * are considered to be banned forever.
7
 *
8
 * @param revoke_messages If `true` then the banned user's messages
9
 * will be deleted from the chat.
10
 */
11
type Telegram = {
12
  token: string;
13
};
14
export async function main(
15
  auth: Telegram,
16
  chat_id: string,
17
  user_id: number,
18
  until_date?: number,
19
  revoke_messages?: boolean | undefined,
20
) {
21
  const client = new Telegram(auth.token);
22
  return await client.banChatMember(chat_id, user_id, until_date || undefined, {
23
    revoke_messages,
24
  });
25
}
26